From 9c8833d0bab37bfe14ccdd9358a59b089da7f89a Mon Sep 17 00:00:00 2001 From: scaleway-bot Date: Mon, 27 Jul 2026 14:12:28 +0000 Subject: [PATCH] feat: update generated APIs --- .../scaleway_async/account/v2/__init__.py | 23 - .../scaleway_async/account/v2/api.py | 261 -- .../scaleway_async/account/v2/marshalling.py | 108 - .../scaleway_async/account/v2/types.py | 153 - .../autoscaling/v1alpha2/api.py | 29 +- .../billing/v2alpha1/__init__.py | 43 - .../scaleway_async/billing/v2alpha1/api.py | 265 -- .../billing/v2alpha1/marshalling.py | 287 -- .../scaleway_async/billing/v2alpha1/types.py | 363 --- .../cockpit/v1beta1/__init__.py | 111 - .../scaleway_async/cockpit/v1beta1/api.py | 1150 ------- .../scaleway_async/cockpit/v1beta1/content.py | 16 - .../cockpit/v1beta1/marshalling.py | 815 ----- .../scaleway_async/cockpit/v1beta1/types.py | 961 ------ .../scaleway_async/document_db/__init__.py | 2 - .../document_db/v1beta1/__init__.py | 263 -- .../scaleway_async/document_db/v1beta1/api.py | 2846 ----------------- .../document_db/v1beta1/content.py | 55 - .../document_db/v1beta1/marshalling.py | 1949 ----------- .../document_db/v1beta1/types.py | 2275 ------------- .../edge_services/v1alpha1/__init__.py | 173 - .../edge_services/v1alpha1/api.py | 1827 ----------- .../edge_services/v1alpha1/content.py | 21 - .../edge_services/v1alpha1/marshalling.py | 1334 -------- .../edge_services/v1alpha1/types.py | 1302 -------- .../inference/v1beta1/__init__.py | 89 - .../scaleway_async/inference/v1beta1/api.py | 988 ------ .../inference/v1beta1/content.py | 16 - .../inference/v1beta1/marshalling.py | 797 ----- .../scaleway_async/inference/v1beta1/types.py | 828 ----- .../instance/v2alpha1/__init__.py | 8 +- .../scaleway_async/instance/v2alpha1/api.py | 598 ++-- .../instance/v2alpha1/marshalling.py | 501 +-- .../scaleway_async/instance/v2alpha1/types.py | 1779 ++++++++++- .../scaleway_async/ipfs/__init__.py | 2 - .../scaleway_async/ipfs/v1alpha1/__init__.py | 83 - .../scaleway_async/ipfs/v1alpha1/api.py | 1070 ------- .../scaleway_async/ipfs/v1alpha1/content.py | 23 - .../ipfs/v1alpha1/marshalling.py | 492 --- .../scaleway_async/ipfs/v1alpha1/types.py | 632 ---- .../secret/v1alpha1/__init__.py | 93 - .../scaleway_async/secret/v1alpha1/api.py | 1430 --------- .../secret/v1alpha1/marshalling.py | 586 ---- .../scaleway_async/secret/v1alpha1/types.py | 1007 ------ .../scaleway_async/vpc/v1/__init__.py | 23 - scaleway-async/scaleway_async/vpc/v1/api.py | 304 -- .../scaleway_async/vpc/v1/marshalling.py | 124 - scaleway-async/scaleway_async/vpc/v1/types.py | 215 -- .../scaleway_async/vpcgw/v1/__init__.py | 147 - scaleway-async/scaleway_async/vpcgw/v1/api.py | 2158 ------------- .../scaleway_async/vpcgw/v1/content.py | 25 - .../scaleway_async/vpcgw/v1/marshalling.py | 1322 -------- .../scaleway_async/vpcgw/v1/types.py | 1776 ---------- .../webhosting/v1alpha1/__init__.py | 101 - .../scaleway_async/webhosting/v1alpha1/api.py | 954 ------ .../webhosting/v1alpha1/content.py | 16 - .../webhosting/v1alpha1/marshalling.py | 712 ----- .../webhosting/v1alpha1/types.py | 943 ------ scaleway/scaleway/account/v2/__init__.py | 23 - scaleway/scaleway/account/v2/api.py | 261 -- scaleway/scaleway/account/v2/marshalling.py | 108 - scaleway/scaleway/account/v2/types.py | 153 - scaleway/scaleway/autoscaling/v1alpha2/api.py | 29 +- .../scaleway/billing/v2alpha1/__init__.py | 43 - scaleway/scaleway/billing/v2alpha1/api.py | 265 -- .../scaleway/billing/v2alpha1/marshalling.py | 287 -- scaleway/scaleway/billing/v2alpha1/types.py | 363 --- scaleway/scaleway/cockpit/v1beta1/__init__.py | 111 - scaleway/scaleway/cockpit/v1beta1/api.py | 1150 ------- scaleway/scaleway/cockpit/v1beta1/content.py | 16 - .../scaleway/cockpit/v1beta1/marshalling.py | 815 ----- scaleway/scaleway/cockpit/v1beta1/types.py | 961 ------ scaleway/scaleway/document_db/__init__.py | 2 - .../scaleway/document_db/v1beta1/__init__.py | 263 -- scaleway/scaleway/document_db/v1beta1/api.py | 2838 ---------------- .../scaleway/document_db/v1beta1/content.py | 55 - .../document_db/v1beta1/marshalling.py | 1949 ----------- .../scaleway/document_db/v1beta1/types.py | 2275 ------------- .../edge_services/v1alpha1/__init__.py | 173 - .../scaleway/edge_services/v1alpha1/api.py | 1823 ----------- .../edge_services/v1alpha1/content.py | 21 - .../edge_services/v1alpha1/marshalling.py | 1334 -------- .../scaleway/edge_services/v1alpha1/types.py | 1302 -------- .../scaleway/inference/v1beta1/__init__.py | 89 - scaleway/scaleway/inference/v1beta1/api.py | 986 ------ .../scaleway/inference/v1beta1/content.py | 16 - .../scaleway/inference/v1beta1/marshalling.py | 797 ----- scaleway/scaleway/inference/v1beta1/types.py | 828 ----- .../scaleway/instance/v2alpha1/__init__.py | 8 +- scaleway/scaleway/instance/v2alpha1/api.py | 598 ++-- .../scaleway/instance/v2alpha1/marshalling.py | 501 +-- scaleway/scaleway/instance/v2alpha1/types.py | 1779 ++++++++++- scaleway/scaleway/ipfs/__init__.py | 2 - scaleway/scaleway/ipfs/v1alpha1/__init__.py | 83 - scaleway/scaleway/ipfs/v1alpha1/api.py | 1070 ------- scaleway/scaleway/ipfs/v1alpha1/content.py | 23 - .../scaleway/ipfs/v1alpha1/marshalling.py | 492 --- scaleway/scaleway/ipfs/v1alpha1/types.py | 632 ---- scaleway/scaleway/secret/v1alpha1/__init__.py | 93 - scaleway/scaleway/secret/v1alpha1/api.py | 1430 --------- .../scaleway/secret/v1alpha1/marshalling.py | 586 ---- scaleway/scaleway/secret/v1alpha1/types.py | 1007 ------ scaleway/scaleway/vpc/v1/__init__.py | 23 - scaleway/scaleway/vpc/v1/api.py | 304 -- scaleway/scaleway/vpc/v1/marshalling.py | 124 - scaleway/scaleway/vpc/v1/types.py | 215 -- scaleway/scaleway/vpcgw/v1/__init__.py | 147 - scaleway/scaleway/vpcgw/v1/api.py | 2156 ------------- scaleway/scaleway/vpcgw/v1/content.py | 25 - scaleway/scaleway/vpcgw/v1/marshalling.py | 1322 -------- scaleway/scaleway/vpcgw/v1/types.py | 1776 ---------- .../scaleway/webhosting/v1alpha1/__init__.py | 101 - scaleway/scaleway/webhosting/v1alpha1/api.py | 954 ------ .../scaleway/webhosting/v1alpha1/content.py | 16 - .../webhosting/v1alpha1/marshalling.py | 712 ----- .../scaleway/webhosting/v1alpha1/types.py | 943 ------ 116 files changed, 4538 insertions(+), 68394 deletions(-) delete mode 100644 scaleway-async/scaleway_async/account/v2/__init__.py delete mode 100644 scaleway-async/scaleway_async/account/v2/api.py delete mode 100644 scaleway-async/scaleway_async/account/v2/marshalling.py delete mode 100644 scaleway-async/scaleway_async/account/v2/types.py delete mode 100644 scaleway-async/scaleway_async/billing/v2alpha1/__init__.py delete mode 100644 scaleway-async/scaleway_async/billing/v2alpha1/api.py delete mode 100644 scaleway-async/scaleway_async/billing/v2alpha1/marshalling.py delete mode 100644 scaleway-async/scaleway_async/billing/v2alpha1/types.py delete mode 100644 scaleway-async/scaleway_async/cockpit/v1beta1/__init__.py delete mode 100644 scaleway-async/scaleway_async/cockpit/v1beta1/api.py delete mode 100644 scaleway-async/scaleway_async/cockpit/v1beta1/content.py delete mode 100644 scaleway-async/scaleway_async/cockpit/v1beta1/marshalling.py delete mode 100644 scaleway-async/scaleway_async/cockpit/v1beta1/types.py delete mode 100644 scaleway-async/scaleway_async/document_db/__init__.py delete mode 100644 scaleway-async/scaleway_async/document_db/v1beta1/__init__.py delete mode 100644 scaleway-async/scaleway_async/document_db/v1beta1/api.py delete mode 100644 scaleway-async/scaleway_async/document_db/v1beta1/content.py delete mode 100644 scaleway-async/scaleway_async/document_db/v1beta1/marshalling.py delete mode 100644 scaleway-async/scaleway_async/document_db/v1beta1/types.py delete mode 100644 scaleway-async/scaleway_async/edge_services/v1alpha1/__init__.py delete mode 100644 scaleway-async/scaleway_async/edge_services/v1alpha1/api.py delete mode 100644 scaleway-async/scaleway_async/edge_services/v1alpha1/content.py delete mode 100644 scaleway-async/scaleway_async/edge_services/v1alpha1/marshalling.py delete mode 100644 scaleway-async/scaleway_async/edge_services/v1alpha1/types.py delete mode 100644 scaleway-async/scaleway_async/inference/v1beta1/__init__.py delete mode 100644 scaleway-async/scaleway_async/inference/v1beta1/api.py delete mode 100644 scaleway-async/scaleway_async/inference/v1beta1/content.py delete mode 100644 scaleway-async/scaleway_async/inference/v1beta1/marshalling.py delete mode 100644 scaleway-async/scaleway_async/inference/v1beta1/types.py delete mode 100644 scaleway-async/scaleway_async/ipfs/__init__.py delete mode 100644 scaleway-async/scaleway_async/ipfs/v1alpha1/__init__.py delete mode 100644 scaleway-async/scaleway_async/ipfs/v1alpha1/api.py delete mode 100644 scaleway-async/scaleway_async/ipfs/v1alpha1/content.py delete mode 100644 scaleway-async/scaleway_async/ipfs/v1alpha1/marshalling.py delete mode 100644 scaleway-async/scaleway_async/ipfs/v1alpha1/types.py delete mode 100644 scaleway-async/scaleway_async/secret/v1alpha1/__init__.py delete mode 100644 scaleway-async/scaleway_async/secret/v1alpha1/api.py delete mode 100644 scaleway-async/scaleway_async/secret/v1alpha1/marshalling.py delete mode 100644 scaleway-async/scaleway_async/secret/v1alpha1/types.py delete mode 100644 scaleway-async/scaleway_async/vpc/v1/__init__.py delete mode 100644 scaleway-async/scaleway_async/vpc/v1/api.py delete mode 100644 scaleway-async/scaleway_async/vpc/v1/marshalling.py delete mode 100644 scaleway-async/scaleway_async/vpc/v1/types.py delete mode 100644 scaleway-async/scaleway_async/vpcgw/v1/__init__.py delete mode 100644 scaleway-async/scaleway_async/vpcgw/v1/api.py delete mode 100644 scaleway-async/scaleway_async/vpcgw/v1/content.py delete mode 100644 scaleway-async/scaleway_async/vpcgw/v1/marshalling.py delete mode 100644 scaleway-async/scaleway_async/vpcgw/v1/types.py delete mode 100644 scaleway-async/scaleway_async/webhosting/v1alpha1/__init__.py delete mode 100644 scaleway-async/scaleway_async/webhosting/v1alpha1/api.py delete mode 100644 scaleway-async/scaleway_async/webhosting/v1alpha1/content.py delete mode 100644 scaleway-async/scaleway_async/webhosting/v1alpha1/marshalling.py delete mode 100644 scaleway-async/scaleway_async/webhosting/v1alpha1/types.py delete mode 100644 scaleway/scaleway/account/v2/__init__.py delete mode 100644 scaleway/scaleway/account/v2/api.py delete mode 100644 scaleway/scaleway/account/v2/marshalling.py delete mode 100644 scaleway/scaleway/account/v2/types.py delete mode 100644 scaleway/scaleway/billing/v2alpha1/__init__.py delete mode 100644 scaleway/scaleway/billing/v2alpha1/api.py delete mode 100644 scaleway/scaleway/billing/v2alpha1/marshalling.py delete mode 100644 scaleway/scaleway/billing/v2alpha1/types.py delete mode 100644 scaleway/scaleway/cockpit/v1beta1/__init__.py delete mode 100644 scaleway/scaleway/cockpit/v1beta1/api.py delete mode 100644 scaleway/scaleway/cockpit/v1beta1/content.py delete mode 100644 scaleway/scaleway/cockpit/v1beta1/marshalling.py delete mode 100644 scaleway/scaleway/cockpit/v1beta1/types.py delete mode 100644 scaleway/scaleway/document_db/__init__.py delete mode 100644 scaleway/scaleway/document_db/v1beta1/__init__.py delete mode 100644 scaleway/scaleway/document_db/v1beta1/api.py delete mode 100644 scaleway/scaleway/document_db/v1beta1/content.py delete mode 100644 scaleway/scaleway/document_db/v1beta1/marshalling.py delete mode 100644 scaleway/scaleway/document_db/v1beta1/types.py delete mode 100644 scaleway/scaleway/edge_services/v1alpha1/__init__.py delete mode 100644 scaleway/scaleway/edge_services/v1alpha1/api.py delete mode 100644 scaleway/scaleway/edge_services/v1alpha1/content.py delete mode 100644 scaleway/scaleway/edge_services/v1alpha1/marshalling.py delete mode 100644 scaleway/scaleway/edge_services/v1alpha1/types.py delete mode 100644 scaleway/scaleway/inference/v1beta1/__init__.py delete mode 100644 scaleway/scaleway/inference/v1beta1/api.py delete mode 100644 scaleway/scaleway/inference/v1beta1/content.py delete mode 100644 scaleway/scaleway/inference/v1beta1/marshalling.py delete mode 100644 scaleway/scaleway/inference/v1beta1/types.py delete mode 100644 scaleway/scaleway/ipfs/__init__.py delete mode 100644 scaleway/scaleway/ipfs/v1alpha1/__init__.py delete mode 100644 scaleway/scaleway/ipfs/v1alpha1/api.py delete mode 100644 scaleway/scaleway/ipfs/v1alpha1/content.py delete mode 100644 scaleway/scaleway/ipfs/v1alpha1/marshalling.py delete mode 100644 scaleway/scaleway/ipfs/v1alpha1/types.py delete mode 100644 scaleway/scaleway/secret/v1alpha1/__init__.py delete mode 100644 scaleway/scaleway/secret/v1alpha1/api.py delete mode 100644 scaleway/scaleway/secret/v1alpha1/marshalling.py delete mode 100644 scaleway/scaleway/secret/v1alpha1/types.py delete mode 100644 scaleway/scaleway/vpc/v1/__init__.py delete mode 100644 scaleway/scaleway/vpc/v1/api.py delete mode 100644 scaleway/scaleway/vpc/v1/marshalling.py delete mode 100644 scaleway/scaleway/vpc/v1/types.py delete mode 100644 scaleway/scaleway/vpcgw/v1/__init__.py delete mode 100644 scaleway/scaleway/vpcgw/v1/api.py delete mode 100644 scaleway/scaleway/vpcgw/v1/content.py delete mode 100644 scaleway/scaleway/vpcgw/v1/marshalling.py delete mode 100644 scaleway/scaleway/vpcgw/v1/types.py delete mode 100644 scaleway/scaleway/webhosting/v1alpha1/__init__.py delete mode 100644 scaleway/scaleway/webhosting/v1alpha1/api.py delete mode 100644 scaleway/scaleway/webhosting/v1alpha1/content.py delete mode 100644 scaleway/scaleway/webhosting/v1alpha1/marshalling.py delete mode 100644 scaleway/scaleway/webhosting/v1alpha1/types.py diff --git a/scaleway-async/scaleway_async/account/v2/__init__.py b/scaleway-async/scaleway_async/account/v2/__init__.py deleted file mode 100644 index 455e1bca4..000000000 --- a/scaleway-async/scaleway_async/account/v2/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# This file was automatically generated. DO NOT EDIT. -# If you have any remark or suggestion do not hesitate to open an issue. -from .types import ListProjectsRequestOrderBy -from .types import Project -from .types import CreateProjectRequest -from .types import DeleteProjectRequest -from .types import GetProjectRequest -from .types import ListProjectsRequest -from .types import ListProjectsResponse -from .types import UpdateProjectRequest -from .api import AccountV2API - -__all__ = [ - "ListProjectsRequestOrderBy", - "Project", - "CreateProjectRequest", - "DeleteProjectRequest", - "GetProjectRequest", - "ListProjectsRequest", - "ListProjectsResponse", - "UpdateProjectRequest", - "AccountV2API", -] diff --git a/scaleway-async/scaleway_async/account/v2/api.py b/scaleway-async/scaleway_async/account/v2/api.py deleted file mode 100644 index 2c912cd4d..000000000 --- a/scaleway-async/scaleway_async/account/v2/api.py +++ /dev/null @@ -1,261 +0,0 @@ -# This file was automatically generated. DO NOT EDIT. -# If you have any remark or suggestion do not hesitate to open an issue. - -from typing import List, Optional - -from scaleway_core.api import API -from scaleway_core.utils import ( - random_name, - validate_path_param, - fetch_all_pages_async, -) -from .types import ( - ListProjectsRequestOrderBy, - CreateProjectRequest, - ListProjectsResponse, - Project, - UpdateProjectRequest, -) -from .marshalling import ( - unmarshal_Project, - unmarshal_ListProjectsResponse, - marshal_CreateProjectRequest, - marshal_UpdateProjectRequest, -) - - -class AccountV2API(API): - """ - This API allows you to manage your Scaleway Projects. - """ - - async def create_project( - self, - *, - name: Optional[str] = None, - organization_id: Optional[str] = None, - description: Optional[str] = None, - ) -> Project: - """ - Create a new Project for an Organization. - Deprecated in favor of Account API v3. - Generate a new Project for an Organization, specifying its configuration including name and description. - :param name: Name of the Project. - :param organization_id: Organization ID of the Project. - :param description: Description of the Project. - :return: :class:`Project ` - :deprecated - - Usage: - :: - - result = await api.create_project() - """ - - res = self._request( - "POST", - "/account/v2/projects", - body=marshal_CreateProjectRequest( - CreateProjectRequest( - name=name or random_name(prefix="proj"), - organization_id=organization_id, - description=description, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_Project(res.json()) - - async def list_projects( - self, - *, - organization_id: Optional[str] = None, - name: Optional[str] = None, - page: Optional[int] = None, - page_size: Optional[int] = None, - order_by: Optional[ListProjectsRequestOrderBy] = None, - project_ids: Optional[List[str]] = None, - ) -> ListProjectsResponse: - """ - List all Projects of an Organization. - Deprecated in favor of Account API v3. - List all Projects of an Organization. The response will include the total number of Projects as well as their associated Organizations, names and IDs. Other information include the creation and update date of the Project. - :param organization_id: Organization ID of the Project. - :param name: Name of the Project. - :param page: Page number for the returned Projects. - :param page_size: Maximum number of Project per page. - :param order_by: Sort order of the returned Projects. - :param project_ids: Project IDs to filter for. The results will be limited to any Projects with an ID in this array. - :return: :class:`ListProjectsResponse ` - :deprecated - - Usage: - :: - - result = await api.list_projects() - """ - - res = self._request( - "GET", - "/account/v2/projects", - params={ - "name": name, - "order_by": order_by, - "organization_id": organization_id - or self.client.default_organization_id, - "page": page, - "page_size": page_size or self.client.default_page_size, - "project_ids": project_ids, - }, - ) - - self._throw_on_error(res) - return unmarshal_ListProjectsResponse(res.json()) - - async def list_projects_all( - self, - *, - organization_id: Optional[str] = None, - name: Optional[str] = None, - page: Optional[int] = None, - page_size: Optional[int] = None, - order_by: Optional[ListProjectsRequestOrderBy] = None, - project_ids: Optional[List[str]] = None, - ) -> List[Project]: - """ - List all Projects of an Organization. - Deprecated in favor of Account API v3. - List all Projects of an Organization. The response will include the total number of Projects as well as their associated Organizations, names and IDs. Other information include the creation and update date of the Project. - :param organization_id: Organization ID of the Project. - :param name: Name of the Project. - :param page: Page number for the returned Projects. - :param page_size: Maximum number of Project per page. - :param order_by: Sort order of the returned Projects. - :param project_ids: Project IDs to filter for. The results will be limited to any Projects with an ID in this array. - :return: :class:`List[Project] ` - :deprecated - - Usage: - :: - - result = await api.list_projects_all() - """ - - return await fetch_all_pages_async( - type=ListProjectsResponse, - key="projects", - fetcher=self.list_projects, - args={ - "organization_id": organization_id, - "name": name, - "page": page, - "page_size": page_size, - "order_by": order_by, - "project_ids": project_ids, - }, - ) - - async def get_project( - self, - *, - project_id: Optional[str] = None, - ) -> Project: - """ - Get an existing Project. - Deprecated in favor of Account API v3. - Retrieve information about an existing Project, specified by its Project ID. Its full details, including ID, name and description, are returned in the response object. - :param project_id: Project ID of the Project. - :return: :class:`Project ` - :deprecated - - Usage: - :: - - result = await api.get_project() - """ - - param_project_id = validate_path_param( - "project_id", project_id or self.client.default_project_id - ) - - res = self._request( - "GET", - f"/account/v2/projects/{param_project_id}", - ) - - self._throw_on_error(res) - return unmarshal_Project(res.json()) - - async def delete_project( - self, - *, - project_id: Optional[str] = None, - ) -> None: - """ - Delete an existing Project. - Deprecated in favor of Account API v3. - Delete an existing Project, specified by its Project ID. The Project needs to be empty (meaning there are no resources left in it) to be deleted effectively. Note that deleting a Project is permanent, and cannot be undone. - :param project_id: Project ID of the Project. - :deprecated - - Usage: - :: - - result = await api.delete_project() - """ - - param_project_id = validate_path_param( - "project_id", project_id or self.client.default_project_id - ) - - res = self._request( - "DELETE", - f"/account/v2/projects/{param_project_id}", - ) - - self._throw_on_error(res) - - async def update_project( - self, - *, - project_id: Optional[str] = None, - name: Optional[str] = None, - description: Optional[str] = None, - ) -> Project: - """ - Update Project. - Deprecated in favor of Account API v3. - Update the parameters of an existing Project, specified by its Project ID. These parameters include the name and description. - :param project_id: Project ID of the Project. - :param name: Name of the Project. - :param description: Description of the Project. - :return: :class:`Project ` - :deprecated - - Usage: - :: - - result = await api.update_project() - """ - - param_project_id = validate_path_param( - "project_id", project_id or self.client.default_project_id - ) - - res = self._request( - "PATCH", - f"/account/v2/projects/{param_project_id}", - body=marshal_UpdateProjectRequest( - UpdateProjectRequest( - project_id=project_id, - name=name, - description=description, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_Project(res.json()) diff --git a/scaleway-async/scaleway_async/account/v2/marshalling.py b/scaleway-async/scaleway_async/account/v2/marshalling.py deleted file mode 100644 index c577c2d2d..000000000 --- a/scaleway-async/scaleway_async/account/v2/marshalling.py +++ /dev/null @@ -1,108 +0,0 @@ -# This file was automatically generated. DO NOT EDIT. -# If you have any remark or suggestion do not hesitate to open an issue. - -from typing import Any, Dict -from dateutil import parser - -from scaleway_core.profile import ProfileDefaults -from .types import ( - Project, - ListProjectsResponse, - CreateProjectRequest, - UpdateProjectRequest, -) - - -def unmarshal_Project(data: Any) -> Project: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'Project' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("id", None) - if field is not None: - args["id"] = field - - field = data.get("name", None) - if field is not None: - args["name"] = field - - field = data.get("organization_id", None) - if field is not None: - args["organization_id"] = field - - field = data.get("description", None) - if field is not None: - args["description"] = field - - field = data.get("created_at", None) - if field is not None: - args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["created_at"] = None - - field = data.get("updated_at", None) - if field is not None: - args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["updated_at"] = None - - return Project(**args) - - -def unmarshal_ListProjectsResponse(data: Any) -> ListProjectsResponse: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'ListProjectsResponse' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("total_count", None) - if field is not None: - args["total_count"] = field - - field = data.get("projects", None) - if field is not None: - args["projects"] = ( - [unmarshal_Project(v) for v in field] if field is not None else None - ) - - return ListProjectsResponse(**args) - - -def marshal_CreateProjectRequest( - request: CreateProjectRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - if request.name is not None: - output["name"] = request.name - - if request.organization_id is not None: - output["organization_id"] = ( - request.organization_id or defaults.default_organization_id - ) - - if request.description is not None: - output["description"] = request.description - - return output - - -def marshal_UpdateProjectRequest( - request: UpdateProjectRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - if request.name is not None: - output["name"] = request.name - - if request.description is not None: - output["description"] = request.description - - return output diff --git a/scaleway-async/scaleway_async/account/v2/types.py b/scaleway-async/scaleway_async/account/v2/types.py deleted file mode 100644 index bf789c6e1..000000000 --- a/scaleway-async/scaleway_async/account/v2/types.py +++ /dev/null @@ -1,153 +0,0 @@ -# This file was automatically generated. DO NOT EDIT. -# If you have any remark or suggestion do not hesitate to open an issue. -from __future__ import annotations - -from dataclasses import dataclass -from datetime import datetime -from enum import Enum -from typing import List, Optional - -from scaleway_core.utils import ( - StrEnumMeta, -) - - -class ListProjectsRequestOrderBy(str, Enum, metaclass=StrEnumMeta): - CREATED_AT_ASC = "created_at_asc" - CREATED_AT_DESC = "created_at_desc" - NAME_ASC = "name_asc" - NAME_DESC = "name_desc" - - def __str__(self) -> str: - return str(self.value) - - -@dataclass -class Project: - id: str - """ - ID of the Project. - """ - - name: str - """ - Name of the Project. - """ - - organization_id: str - """ - Organization ID of the Project. - """ - - description: str - """ - Description of the Project. - """ - - created_at: Optional[datetime] - """ - Creation date of the Project. - """ - - updated_at: Optional[datetime] - """ - Update date of the Project. - """ - - -@dataclass -class CreateProjectRequest: - name: Optional[str] - """ - Name of the Project. - """ - - organization_id: Optional[str] - """ - Organization ID of the Project. - """ - - description: Optional[str] - """ - Description of the Project. - """ - - -@dataclass -class DeleteProjectRequest: - project_id: Optional[str] - """ - Project ID of the Project. - """ - - -@dataclass -class GetProjectRequest: - project_id: Optional[str] - """ - Project ID of the Project. - """ - - -@dataclass -class ListProjectsRequest: - organization_id: Optional[str] - """ - Organization ID of the Project. - """ - - name: Optional[str] - """ - Name of the Project. - """ - - page: Optional[int] - """ - Page number for the returned Projects. - """ - - page_size: Optional[int] - """ - Maximum number of Project per page. - """ - - order_by: Optional[ListProjectsRequestOrderBy] - """ - Sort order of the returned Projects. - """ - - project_ids: Optional[List[str]] - """ - Project IDs to filter for. The results will be limited to any Projects with an ID in this array. - """ - - -@dataclass -class ListProjectsResponse: - total_count: int - """ - Total number of Projects. - """ - - projects: List[Project] - """ - Paginated returned Projects. - """ - - -@dataclass -class UpdateProjectRequest: - project_id: Optional[str] - """ - Project ID of the Project. - """ - - name: Optional[str] - """ - Name of the Project. - """ - - description: Optional[str] - """ - Description of the Project. - """ diff --git a/scaleway-async/scaleway_async/autoscaling/v1alpha2/api.py b/scaleway-async/scaleway_async/autoscaling/v1alpha2/api.py index 0ab4656df..4dcdd7ec8 100644 --- a/scaleway-async/scaleway_async/autoscaling/v1alpha2/api.py +++ b/scaleway-async/scaleway_async/autoscaling/v1alpha2/api.py @@ -42,9 +42,7 @@ class AutoscalingV1Alpha2API(API): - """ - Instances Autoscaling Groups management API. - """ + """ """ async def list_groups( self, @@ -101,7 +99,8 @@ async def get_group( ) -> Group: """ Get an autoscaling group. - Get details of a specified autoscaling group including its configuration, current size, and status. + Get details of a specified autoscaling group including its + configuration, current size, and status. :param group_id: ID of the group to get. :param zone: Zone to target. If none is passed will use default zone from the config. :return: :class:`Group ` @@ -134,7 +133,8 @@ async def wait_for_group( ) -> Group: """ Get an autoscaling group. - Get details of a specified autoscaling group including its configuration, current size, and status. + Get details of a specified autoscaling group including its + configuration, current size, and status. :param group_id: ID of the group to get. :param zone: Zone to target. If none is passed will use default zone from the config. :return: :class:`Group ` @@ -177,7 +177,9 @@ async def create_group( ) -> Group: """ Create an autoscaling group. - Create a new autoscaling group with the specified configuration including template, scaling policy, and optional load balancer settings. + Create a new autoscaling group with the specified configuration + including template, scaling policy, and optional load balancer + settings. :param name: Name of the autoscaling group. :param template_id: Template ID for instances in this group. :param zone: Zone to target. If none is passed will use default zone from the config. @@ -233,7 +235,8 @@ async def update_group( ) -> Group: """ Update an autoscaling group. - Update the configuration of a specified autoscaling group including name, tags, template, scaling policy, and load balancer settings. + Update the configuration of a specified autoscaling group including + name, tags, template, scaling policy, and load balancer settings. :param group_id: ID of the group to update. :param zone: Zone to target. If none is passed will use default zone from the config. :param name: New name for the group. @@ -282,7 +285,8 @@ async def delete_group( ) -> Group: """ Delete an autoscaling group. - Delete a specified autoscaling group and all its associated resources. + Delete a specified autoscaling group and all its associated + resources. :param group_id: ID of the group to delete. :param zone: Zone to target. If none is passed will use default zone from the config. :return: :class:`Group ` @@ -317,8 +321,9 @@ async def list_logs( end_time: Optional[datetime] = None, ) -> ListLogsResponse: """ - List group logs. - List logs for a specified autoscaling group to view scaling events and activities. + List autoscaling group logs. + List logs for a specified autoscaling group to view scaling events + and activities. :param group_id: :param zone: Zone to target. If none is passed will use default zone from the config. :param page_token: @@ -361,7 +366,7 @@ async def list_servers( page_size: Optional[int] = None, ) -> ListServersResponse: """ - List group servers. + List autoscaling group servers. List all Instances belonging to a specified autoscaling group. :param group_id: :param zone: Zone to target. If none is passed will use default zone from the config. @@ -402,7 +407,7 @@ async def list_alerts( project_id: Optional[str] = None, ) -> ListAlertsResponse: """ - List group alerts. + List autoscaling group alerts. List active and historical alerts for a specified autoscaling group. :param zone: Zone to target. If none is passed will use default zone from the config. :param group_id: diff --git a/scaleway-async/scaleway_async/billing/v2alpha1/__init__.py b/scaleway-async/scaleway_async/billing/v2alpha1/__init__.py deleted file mode 100644 index 3fae51bcc..000000000 --- a/scaleway-async/scaleway_async/billing/v2alpha1/__init__.py +++ /dev/null @@ -1,43 +0,0 @@ -# This file was automatically generated. DO NOT EDIT. -# If you have any remark or suggestion do not hesitate to open an issue. -from .types import DiscountDiscountMode -from .types import DiscountFilterType -from .types import DownloadInvoiceRequestFileType -from .types import InvoiceType -from .types import ListDiscountsRequestOrderBy -from .types import ListInvoicesRequestOrderBy -from .types import DiscountCoupon -from .types import DiscountFilter -from .types import GetConsumptionResponseConsumption -from .types import Discount -from .types import Invoice -from .types import DownloadInvoiceRequest -from .types import GetConsumptionRequest -from .types import GetConsumptionResponse -from .types import ListDiscountsRequest -from .types import ListDiscountsResponse -from .types import ListInvoicesRequest -from .types import ListInvoicesResponse -from .api import BillingV2Alpha1API - -__all__ = [ - "DiscountDiscountMode", - "DiscountFilterType", - "DownloadInvoiceRequestFileType", - "InvoiceType", - "ListDiscountsRequestOrderBy", - "ListInvoicesRequestOrderBy", - "DiscountCoupon", - "DiscountFilter", - "GetConsumptionResponseConsumption", - "Discount", - "Invoice", - "DownloadInvoiceRequest", - "GetConsumptionRequest", - "GetConsumptionResponse", - "ListDiscountsRequest", - "ListDiscountsResponse", - "ListInvoicesRequest", - "ListInvoicesResponse", - "BillingV2Alpha1API", -] diff --git a/scaleway-async/scaleway_async/billing/v2alpha1/api.py b/scaleway-async/scaleway_async/billing/v2alpha1/api.py deleted file mode 100644 index 3c1139242..000000000 --- a/scaleway-async/scaleway_async/billing/v2alpha1/api.py +++ /dev/null @@ -1,265 +0,0 @@ -# This file was automatically generated. DO NOT EDIT. -# If you have any remark or suggestion do not hesitate to open an issue. - -from datetime import datetime -from typing import List, Optional - -from scaleway_core.api import API -from scaleway_core.bridge import ( - ScwFile, - unmarshal_ScwFile, -) -from scaleway_core.utils import ( - validate_path_param, - fetch_all_pages_async, -) -from .types import ( - DownloadInvoiceRequestFileType, - InvoiceType, - ListDiscountsRequestOrderBy, - ListInvoicesRequestOrderBy, - Discount, - GetConsumptionResponse, - Invoice, - ListDiscountsResponse, - ListInvoicesResponse, -) -from .marshalling import ( - unmarshal_GetConsumptionResponse, - unmarshal_ListDiscountsResponse, - unmarshal_ListInvoicesResponse, -) - - -class BillingV2Alpha1API(API): - """ - This API allows you to manage and query your Scaleway billing and consumption. - """ - - async def get_consumption( - self, - *, - organization_id: Optional[str] = None, - ) -> GetConsumptionResponse: - """ - Get current month's consumption. - The consumption reflects the amount of money you have spent for the products you have used. - The consumption value is monetary and is not computed in real time. - :param organization_id: Filter by organization ID. - :return: :class:`GetConsumptionResponse ` - - Usage: - :: - - result = await api.get_consumption() - """ - - res = self._request( - "GET", - "/billing/v2alpha1/consumption", - params={ - "organization_id": organization_id - or self.client.default_organization_id, - }, - ) - - self._throw_on_error(res) - return unmarshal_GetConsumptionResponse(res.json()) - - async def list_invoices( - self, - *, - organization_id: Optional[str] = None, - started_after: Optional[datetime] = None, - started_before: Optional[datetime] = None, - invoice_type: Optional[InvoiceType] = None, - page: Optional[int] = None, - page_size: Optional[int] = None, - order_by: Optional[ListInvoicesRequestOrderBy] = None, - ) -> ListInvoicesResponse: - """ - List invoices. - List all your invoices, filtering by `start_date` and `invoice_type`. Each invoice has its own ID. - :param organization_id: Organization ID to filter for, only invoices from this Organization will be returned. - :param started_after: Invoice's `start_date` is greater or equal to `started_after`. - :param started_before: Invoice's `start_date` precedes `started_before`. - :param invoice_type: Invoice type. It can either be `periodic` or `purchase`. - :param page: Positive integer to choose the page to return. - :param page_size: Positive integer lower or equal to 100 to select the number of items to return. - :param order_by: How invoices are ordered in the response. - :return: :class:`ListInvoicesResponse ` - - Usage: - :: - - result = await api.list_invoices() - """ - - res = self._request( - "GET", - "/billing/v2alpha1/invoices", - params={ - "invoice_type": invoice_type, - "order_by": order_by, - "organization_id": organization_id - or self.client.default_organization_id, - "page": page, - "page_size": page_size or self.client.default_page_size, - "started_after": started_after, - "started_before": started_before, - }, - ) - - self._throw_on_error(res) - return unmarshal_ListInvoicesResponse(res.json()) - - async def list_invoices_all( - self, - *, - organization_id: Optional[str] = None, - started_after: Optional[datetime] = None, - started_before: Optional[datetime] = None, - invoice_type: Optional[InvoiceType] = None, - page: Optional[int] = None, - page_size: Optional[int] = None, - order_by: Optional[ListInvoicesRequestOrderBy] = None, - ) -> List[Invoice]: - """ - List invoices. - List all your invoices, filtering by `start_date` and `invoice_type`. Each invoice has its own ID. - :param organization_id: Organization ID to filter for, only invoices from this Organization will be returned. - :param started_after: Invoice's `start_date` is greater or equal to `started_after`. - :param started_before: Invoice's `start_date` precedes `started_before`. - :param invoice_type: Invoice type. It can either be `periodic` or `purchase`. - :param page: Positive integer to choose the page to return. - :param page_size: Positive integer lower or equal to 100 to select the number of items to return. - :param order_by: How invoices are ordered in the response. - :return: :class:`List[Invoice] ` - - Usage: - :: - - result = await api.list_invoices_all() - """ - - return await fetch_all_pages_async( - type=ListInvoicesResponse, - key="invoices", - fetcher=self.list_invoices, - args={ - "organization_id": organization_id, - "started_after": started_after, - "started_before": started_before, - "invoice_type": invoice_type, - "page": page, - "page_size": page_size, - "order_by": order_by, - }, - ) - - async def download_invoice( - self, - *, - invoice_id: str, - file_type: Optional[DownloadInvoiceRequestFileType] = None, - ) -> ScwFile: - """ - Download an invoice. - Download a specific invoice, specified by its ID. - :param invoice_id: Invoice ID. - :param file_type: Wanted file type. - :return: :class:`ScwFile ` - - Usage: - :: - - result = await api.download_invoice( - invoice_id="example", - ) - """ - - param_invoice_id = validate_path_param("invoice_id", invoice_id) - - res = self._request( - "GET", - f"/billing/v2alpha1/invoices/{param_invoice_id}/download", - params={ - "file_type": file_type, - }, - ) - - self._throw_on_error(res) - return unmarshal_ScwFile(res.json()) - - async def list_discounts( - self, - *, - order_by: Optional[ListDiscountsRequestOrderBy] = None, - page: Optional[int] = None, - page_size: Optional[int] = None, - organization_id: Optional[str] = None, - ) -> ListDiscountsResponse: - """ - List all user's discounts. - List all discounts for an organization and usable categories/products/offers/references/regions/zones where the discount can be applied. - :param order_by: Order discounts in the response by their description. - :param page: Positive integer to choose the page to return. - :param page_size: Positive integer lower or equal to 100 to select the number of items to return. - :param organization_id: ID of the organization. - :return: :class:`ListDiscountsResponse ` - - Usage: - :: - - result = await api.list_discounts() - """ - - res = self._request( - "GET", - "/billing/v2alpha1/discounts", - params={ - "order_by": order_by, - "organization_id": organization_id - or self.client.default_organization_id, - "page": page, - "page_size": page_size or self.client.default_page_size, - }, - ) - - self._throw_on_error(res) - return unmarshal_ListDiscountsResponse(res.json()) - - async def list_discounts_all( - self, - *, - order_by: Optional[ListDiscountsRequestOrderBy] = None, - page: Optional[int] = None, - page_size: Optional[int] = None, - organization_id: Optional[str] = None, - ) -> List[Discount]: - """ - List all user's discounts. - List all discounts for an organization and usable categories/products/offers/references/regions/zones where the discount can be applied. - :param order_by: Order discounts in the response by their description. - :param page: Positive integer to choose the page to return. - :param page_size: Positive integer lower or equal to 100 to select the number of items to return. - :param organization_id: ID of the organization. - :return: :class:`List[Discount] ` - - Usage: - :: - - result = await api.list_discounts_all() - """ - - return await fetch_all_pages_async( - type=ListDiscountsResponse, - key="discounts", - fetcher=self.list_discounts, - args={ - "order_by": order_by, - "page": page, - "page_size": page_size, - "organization_id": organization_id, - }, - ) diff --git a/scaleway-async/scaleway_async/billing/v2alpha1/marshalling.py b/scaleway-async/scaleway_async/billing/v2alpha1/marshalling.py deleted file mode 100644 index 58682a3f8..000000000 --- a/scaleway-async/scaleway_async/billing/v2alpha1/marshalling.py +++ /dev/null @@ -1,287 +0,0 @@ -# This file was automatically generated. DO NOT EDIT. -# If you have any remark or suggestion do not hesitate to open an issue. - -from typing import Any, Dict -from dateutil import parser - -from scaleway_core.bridge import ( - unmarshal_Money, -) -from .types import ( - GetConsumptionResponseConsumption, - GetConsumptionResponse, - DiscountCoupon, - DiscountFilter, - Discount, - ListDiscountsResponse, - Invoice, - ListInvoicesResponse, -) - - -def unmarshal_GetConsumptionResponseConsumption( - data: Any, -) -> GetConsumptionResponseConsumption: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'GetConsumptionResponseConsumption' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("description", None) - if field is not None: - args["description"] = field - - field = data.get("project_id", None) - if field is not None: - args["project_id"] = field - - field = data.get("category", None) - if field is not None: - args["category"] = field - - field = data.get("operation_path", None) - if field is not None: - args["operation_path"] = field - - field = data.get("value", None) - if field is not None: - args["value"] = unmarshal_Money(field) - else: - args["value"] = None - - return GetConsumptionResponseConsumption(**args) - - -def unmarshal_GetConsumptionResponse(data: Any) -> GetConsumptionResponse: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'GetConsumptionResponse' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("consumptions", None) - if field is not None: - args["consumptions"] = ( - [unmarshal_GetConsumptionResponseConsumption(v) for v in field] - if field is not None - else None - ) - - field = data.get("updated_at", None) - if field is not None: - args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["updated_at"] = None - - return GetConsumptionResponse(**args) - - -def unmarshal_DiscountCoupon(data: Any) -> DiscountCoupon: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'DiscountCoupon' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("description", None) - if field is not None: - args["description"] = field - else: - args["description"] = None - - return DiscountCoupon(**args) - - -def unmarshal_DiscountFilter(data: Any) -> DiscountFilter: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'DiscountFilter' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("type", None) - if field is not None: - args["type_"] = field - - field = data.get("value", None) - if field is not None: - args["value"] = field - - field = data.get("exclude", None) - if field is not None: - args["exclude"] = field - - return DiscountFilter(**args) - - -def unmarshal_Discount(data: Any) -> Discount: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'Discount' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("id", None) - if field is not None: - args["id"] = field - - field = data.get("organization_id", None) - if field is not None: - args["organization_id"] = field - - field = data.get("description", None) - if field is not None: - args["description"] = field - - field = data.get("value", None) - if field is not None: - args["value"] = field - - field = data.get("value_used", None) - if field is not None: - args["value_used"] = field - - field = data.get("value_remaining", None) - if field is not None: - args["value_remaining"] = field - - field = data.get("mode", None) - if field is not None: - args["mode"] = field - - field = data.get("filters", None) - if field is not None: - args["filters"] = ( - [unmarshal_DiscountFilter(v) for v in field] if field is not None else None - ) - - field = data.get("creation_date", None) - if field is not None: - args["creation_date"] = ( - parser.isoparse(field) if isinstance(field, str) else field - ) - else: - args["creation_date"] = None - - field = data.get("start_date", None) - if field is not None: - args["start_date"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["start_date"] = None - - field = data.get("stop_date", None) - if field is not None: - args["stop_date"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["stop_date"] = None - - field = data.get("coupon", None) - if field is not None: - args["coupon"] = unmarshal_DiscountCoupon(field) - else: - args["coupon"] = None - - return Discount(**args) - - -def unmarshal_ListDiscountsResponse(data: Any) -> ListDiscountsResponse: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'ListDiscountsResponse' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("total_count", None) - if field is not None: - args["total_count"] = field - - field = data.get("discounts", None) - if field is not None: - args["discounts"] = ( - [unmarshal_Discount(v) for v in field] if field is not None else None - ) - - return ListDiscountsResponse(**args) - - -def unmarshal_Invoice(data: Any) -> Invoice: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'Invoice' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("id", None) - if field is not None: - args["id"] = field - - field = data.get("invoice_type", None) - if field is not None: - args["invoice_type"] = field - - field = data.get("number", None) - if field is not None: - args["number"] = field - - field = data.get("start_date", None) - if field is not None: - args["start_date"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["start_date"] = None - - field = data.get("issued_date", None) - if field is not None: - args["issued_date"] = ( - parser.isoparse(field) if isinstance(field, str) else field - ) - else: - args["issued_date"] = None - - field = data.get("due_date", None) - if field is not None: - args["due_date"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["due_date"] = None - - field = data.get("total_untaxed", None) - if field is not None: - args["total_untaxed"] = unmarshal_Money(field) - else: - args["total_untaxed"] = None - - field = data.get("total_taxed", None) - if field is not None: - args["total_taxed"] = unmarshal_Money(field) - else: - args["total_taxed"] = None - - return Invoice(**args) - - -def unmarshal_ListInvoicesResponse(data: Any) -> ListInvoicesResponse: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'ListInvoicesResponse' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("total_count", None) - if field is not None: - args["total_count"] = field - - field = data.get("invoices", None) - if field is not None: - args["invoices"] = ( - [unmarshal_Invoice(v) for v in field] if field is not None else None - ) - - return ListInvoicesResponse(**args) diff --git a/scaleway-async/scaleway_async/billing/v2alpha1/types.py b/scaleway-async/scaleway_async/billing/v2alpha1/types.py deleted file mode 100644 index e4458efc3..000000000 --- a/scaleway-async/scaleway_async/billing/v2alpha1/types.py +++ /dev/null @@ -1,363 +0,0 @@ -# This file was automatically generated. DO NOT EDIT. -# If you have any remark or suggestion do not hesitate to open an issue. -from __future__ import annotations - -from dataclasses import dataclass -from datetime import datetime -from enum import Enum -from typing import List, Optional - -from scaleway_core.bridge import ( - Money, -) -from scaleway_core.utils import ( - StrEnumMeta, -) - - -class DiscountDiscountMode(str, Enum, metaclass=StrEnumMeta): - UNKNOWN_DISCOUNT_MODE = "unknown_discount_mode" - DISCOUNT_MODE_RATE = "discount_mode_rate" - DISCOUNT_MODE_VALUE = "discount_mode_value" - DISCOUNT_MODE_SPLITTABLE = "discount_mode_splittable" - - def __str__(self) -> str: - return str(self.value) - - -class DiscountFilterType(str, Enum, metaclass=StrEnumMeta): - UNKNOWN_TYPE = "unknown_type" - PRODUCT_CATEGORY = "product_category" - PRODUCT = "product" - PRODUCT_OFFER = "product_offer" - PRODUCT_REFERENCE = "product_reference" - REGION = "region" - ZONE = "zone" - - def __str__(self) -> str: - return str(self.value) - - -class DownloadInvoiceRequestFileType(str, Enum, metaclass=StrEnumMeta): - PDF = "pdf" - - def __str__(self) -> str: - return str(self.value) - - -class InvoiceType(str, Enum, metaclass=StrEnumMeta): - UNKNOWN_TYPE = "unknown_type" - PERIODIC = "periodic" - PURCHASE = "purchase" - - def __str__(self) -> str: - return str(self.value) - - -class ListDiscountsRequestOrderBy(str, Enum, metaclass=StrEnumMeta): - CREATION_DATE_DESC = "creation_date_desc" - CREATION_DATE_ASC = "creation_date_asc" - - def __str__(self) -> str: - return str(self.value) - - -class ListInvoicesRequestOrderBy(str, Enum, metaclass=StrEnumMeta): - INVOICE_NUMBER_DESC = "invoice_number_desc" - INVOICE_NUMBER_ASC = "invoice_number_asc" - START_DATE_DESC = "start_date_desc" - START_DATE_ASC = "start_date_asc" - ISSUED_DATE_DESC = "issued_date_desc" - ISSUED_DATE_ASC = "issued_date_asc" - DUE_DATE_DESC = "due_date_desc" - DUE_DATE_ASC = "due_date_asc" - TOTAL_UNTAXED_DESC = "total_untaxed_desc" - TOTAL_UNTAXED_ASC = "total_untaxed_asc" - TOTAL_TAXED_DESC = "total_taxed_desc" - TOTAL_TAXED_ASC = "total_taxed_asc" - INVOICE_TYPE_DESC = "invoice_type_desc" - INVOICE_TYPE_ASC = "invoice_type_asc" - - def __str__(self) -> str: - return str(self.value) - - -@dataclass -class DiscountCoupon: - description: Optional[str] - """ - The description of the coupon. - """ - - -@dataclass -class DiscountFilter: - type_: DiscountFilterType - """ - Type of the filter. - """ - - value: str - """ - Value of filter, it can be a product/range/region/zone value. - """ - - exclude: bool - """ - Boolean to describe if filter is an excluding filter. - """ - - -@dataclass -class GetConsumptionResponseConsumption: - description: str - """ - Description of the consumption. - """ - - project_id: str - """ - Project ID of the consumption. - """ - - category: str - """ - Category of the consumption. - """ - - operation_path: str - """ - Unique identifier of the product. - """ - - value: Optional[Money] - """ - Monetary value of the consumption. - """ - - -@dataclass -class Discount: - id: str - """ - The ID of the discount. - """ - - organization_id: str - """ - The organization ID of the discount. - """ - - description: str - """ - The description of the discount. - """ - - value: float - """ - The initial value of the discount. - """ - - value_used: float - """ - The value indicating how much of the discount has been used. - """ - - value_remaining: float - """ - The remaining value of the discount. - """ - - mode: DiscountDiscountMode - """ - The mode of the discount. - """ - - filters: List[DiscountFilter] - """ - List of products/ranges/regions/zones to limit the usability of discounts. - """ - - creation_date: Optional[datetime] - """ - The creation date of the discount. - """ - - start_date: Optional[datetime] - """ - The start date of the discount. - """ - - stop_date: Optional[datetime] - """ - The stop date of the discount. - """ - - coupon: Optional[DiscountCoupon] - """ - The description of the coupon. - """ - - -@dataclass -class Invoice: - id: str - """ - Invoice ID. - """ - - invoice_type: InvoiceType - """ - Type of invoice. - """ - - number: int - """ - Invoice number. - """ - - start_date: Optional[datetime] - """ - Start date of the billing period. - """ - - issued_date: Optional[datetime] - """ - Date when the invoice was sent to the customer. - """ - - due_date: Optional[datetime] - """ - Payment time limit, set according to the Organization's payment conditions. - """ - - total_untaxed: Optional[Money] - """ - Total amount, untaxed. - """ - - total_taxed: Optional[Money] - """ - Total amount, taxed. - """ - - -@dataclass -class DownloadInvoiceRequest: - invoice_id: str - """ - Invoice ID. - """ - - file_type: Optional[DownloadInvoiceRequestFileType] - """ - Wanted file type. - """ - - -@dataclass -class GetConsumptionRequest: - organization_id: Optional[str] - """ - Filter by organization ID. - """ - - -@dataclass -class GetConsumptionResponse: - consumptions: List[GetConsumptionResponseConsumption] - """ - Detailed consumption list. - """ - - updated_at: Optional[datetime] - """ - Last consumption update date. - """ - - -@dataclass -class ListDiscountsRequest: - order_by: Optional[ListDiscountsRequestOrderBy] - """ - Order discounts in the response by their description. - """ - - page: Optional[int] - """ - Positive integer to choose the page to return. - """ - - page_size: Optional[int] - """ - Positive integer lower or equal to 100 to select the number of items to return. - """ - - organization_id: Optional[str] - """ - ID of the organization. - """ - - -@dataclass -class ListDiscountsResponse: - total_count: int - """ - Total number of discounts. - """ - - discounts: List[Discount] - """ - Paginated returned discounts. - """ - - -@dataclass -class ListInvoicesRequest: - organization_id: Optional[str] - """ - Organization ID to filter for, only invoices from this Organization will be returned. - """ - - started_after: Optional[datetime] - """ - Invoice's `start_date` is greater or equal to `started_after`. - """ - - started_before: Optional[datetime] - """ - Invoice's `start_date` precedes `started_before`. - """ - - invoice_type: Optional[InvoiceType] - """ - Invoice type. It can either be `periodic` or `purchase`. - """ - - page: Optional[int] - """ - Positive integer to choose the page to return. - """ - - page_size: Optional[int] - """ - Positive integer lower or equal to 100 to select the number of items to return. - """ - - order_by: Optional[ListInvoicesRequestOrderBy] - """ - How invoices are ordered in the response. - """ - - -@dataclass -class ListInvoicesResponse: - total_count: int - """ - Total number of invoices. - """ - - invoices: List[Invoice] - """ - Paginated returned invoices. - """ diff --git a/scaleway-async/scaleway_async/cockpit/v1beta1/__init__.py b/scaleway-async/scaleway_async/cockpit/v1beta1/__init__.py deleted file mode 100644 index 99aac8c91..000000000 --- a/scaleway-async/scaleway_async/cockpit/v1beta1/__init__.py +++ /dev/null @@ -1,111 +0,0 @@ -# This file was automatically generated. DO NOT EDIT. -# If you have any remark or suggestion do not hesitate to open an issue. -from .types import CockpitStatus -from .content import COCKPIT_TRANSIENT_STATUSES -from .types import DatasourceType -from .types import GrafanaUserRole -from .types import ListDatasourcesRequestOrderBy -from .types import ListGrafanaUsersRequestOrderBy -from .types import ListPlansRequestOrderBy -from .types import ListTokensRequestOrderBy -from .types import PlanName -from .types import ContactPointEmail -from .types import TokenScopes -from .types import CockpitEndpoints -from .types import Plan -from .types import ContactPoint -from .types import Datasource -from .types import GrafanaProductDashboard -from .types import GrafanaUser -from .types import Token -from .types import ActivateCockpitRequest -from .types import Cockpit -from .types import CockpitMetrics -from .types import CreateContactPointRequest -from .types import CreateDatasourceRequest -from .types import CreateGrafanaUserRequest -from .types import CreateTokenRequest -from .types import DeactivateCockpitRequest -from .types import DeleteContactPointRequest -from .types import DeleteDatasourceRequest -from .types import DeleteGrafanaUserRequest -from .types import DeleteTokenRequest -from .types import DisableManagedAlertsRequest -from .types import EnableManagedAlertsRequest -from .types import GetCockpitMetricsRequest -from .types import GetCockpitRequest -from .types import GetGrafanaProductDashboardRequest -from .types import GetTokenRequest -from .types import ListContactPointsRequest -from .types import ListContactPointsResponse -from .types import ListDatasourcesRequest -from .types import ListDatasourcesResponse -from .types import ListGrafanaProductDashboardsRequest -from .types import ListGrafanaProductDashboardsResponse -from .types import ListGrafanaUsersRequest -from .types import ListGrafanaUsersResponse -from .types import ListPlansRequest -from .types import ListPlansResponse -from .types import ListTokensRequest -from .types import ListTokensResponse -from .types import ResetGrafanaUserPasswordRequest -from .types import SelectPlanRequest -from .types import SelectPlanResponse -from .types import TriggerTestAlertRequest -from .api import CockpitV1Beta1API - -__all__ = [ - "CockpitStatus", - "COCKPIT_TRANSIENT_STATUSES", - "DatasourceType", - "GrafanaUserRole", - "ListDatasourcesRequestOrderBy", - "ListGrafanaUsersRequestOrderBy", - "ListPlansRequestOrderBy", - "ListTokensRequestOrderBy", - "PlanName", - "ContactPointEmail", - "TokenScopes", - "CockpitEndpoints", - "Plan", - "ContactPoint", - "Datasource", - "GrafanaProductDashboard", - "GrafanaUser", - "Token", - "ActivateCockpitRequest", - "Cockpit", - "CockpitMetrics", - "CreateContactPointRequest", - "CreateDatasourceRequest", - "CreateGrafanaUserRequest", - "CreateTokenRequest", - "DeactivateCockpitRequest", - "DeleteContactPointRequest", - "DeleteDatasourceRequest", - "DeleteGrafanaUserRequest", - "DeleteTokenRequest", - "DisableManagedAlertsRequest", - "EnableManagedAlertsRequest", - "GetCockpitMetricsRequest", - "GetCockpitRequest", - "GetGrafanaProductDashboardRequest", - "GetTokenRequest", - "ListContactPointsRequest", - "ListContactPointsResponse", - "ListDatasourcesRequest", - "ListDatasourcesResponse", - "ListGrafanaProductDashboardsRequest", - "ListGrafanaProductDashboardsResponse", - "ListGrafanaUsersRequest", - "ListGrafanaUsersResponse", - "ListPlansRequest", - "ListPlansResponse", - "ListTokensRequest", - "ListTokensResponse", - "ResetGrafanaUserPasswordRequest", - "SelectPlanRequest", - "SelectPlanResponse", - "TriggerTestAlertRequest", - "CockpitV1Beta1API", -] diff --git a/scaleway-async/scaleway_async/cockpit/v1beta1/api.py b/scaleway-async/scaleway_async/cockpit/v1beta1/api.py deleted file mode 100644 index 920c84d5e..000000000 --- a/scaleway-async/scaleway_async/cockpit/v1beta1/api.py +++ /dev/null @@ -1,1150 +0,0 @@ -# This file was automatically generated. DO NOT EDIT. -# If you have any remark or suggestion do not hesitate to open an issue. - -from datetime import datetime -from typing import Awaitable, List, Optional, Union - -from scaleway_core.api import API -from scaleway_core.utils import ( - WaitForOptions, - random_name, - validate_path_param, - fetch_all_pages_async, - wait_for_resource_async, -) -from .types import ( - DatasourceType, - GrafanaUserRole, - ListDatasourcesRequestOrderBy, - ListGrafanaUsersRequestOrderBy, - ListPlansRequestOrderBy, - ListTokensRequestOrderBy, - ActivateCockpitRequest, - Cockpit, - CockpitMetrics, - ContactPoint, - CreateContactPointRequest, - CreateDatasourceRequest, - CreateGrafanaUserRequest, - CreateTokenRequest, - Datasource, - DeactivateCockpitRequest, - DeleteContactPointRequest, - DeleteGrafanaUserRequest, - DisableManagedAlertsRequest, - EnableManagedAlertsRequest, - GrafanaProductDashboard, - GrafanaUser, - ListContactPointsResponse, - ListDatasourcesResponse, - ListGrafanaProductDashboardsResponse, - ListGrafanaUsersResponse, - ListPlansResponse, - ListTokensResponse, - Plan, - ResetGrafanaUserPasswordRequest, - SelectPlanRequest, - SelectPlanResponse, - Token, - TokenScopes, - TriggerTestAlertRequest, -) -from .content import ( - COCKPIT_TRANSIENT_STATUSES, -) -from .marshalling import ( - unmarshal_ContactPoint, - unmarshal_Datasource, - unmarshal_GrafanaProductDashboard, - unmarshal_GrafanaUser, - unmarshal_Token, - unmarshal_Cockpit, - unmarshal_CockpitMetrics, - unmarshal_ListContactPointsResponse, - unmarshal_ListDatasourcesResponse, - unmarshal_ListGrafanaProductDashboardsResponse, - unmarshal_ListGrafanaUsersResponse, - unmarshal_ListPlansResponse, - unmarshal_ListTokensResponse, - unmarshal_SelectPlanResponse, - marshal_ActivateCockpitRequest, - marshal_CreateContactPointRequest, - marshal_CreateDatasourceRequest, - marshal_CreateGrafanaUserRequest, - marshal_CreateTokenRequest, - marshal_DeactivateCockpitRequest, - marshal_DeleteContactPointRequest, - marshal_DeleteGrafanaUserRequest, - marshal_DisableManagedAlertsRequest, - marshal_EnableManagedAlertsRequest, - marshal_ResetGrafanaUserPasswordRequest, - marshal_SelectPlanRequest, - marshal_TriggerTestAlertRequest, -) - - -class CockpitV1Beta1API(API): - """ - This API allows you to manage your Scaleway Cockpit, for storing and visualizing metrics and logs. - """ - - async def activate_cockpit( - self, - *, - project_id: Optional[str] = None, - ) -> Cockpit: - """ - Activate the Cockpit of a given Project specified by the Project ID. - :param project_id: ID of the Project the Cockpit belongs to. - :return: :class:`Cockpit ` - - Usage: - :: - - result = await api.activate_cockpit() - """ - - res = self._request( - "POST", - "/cockpit/v1beta1/activate", - body=marshal_ActivateCockpitRequest( - ActivateCockpitRequest( - project_id=project_id, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_Cockpit(res.json()) - - async def get_cockpit( - self, - *, - project_id: Optional[str] = None, - ) -> Cockpit: - """ - Retrieve the Cockpit of a given Project specified by the Project ID. - :param project_id: ID of the Project the Cockpit belongs to. - :return: :class:`Cockpit ` - - Usage: - :: - - result = await api.get_cockpit() - """ - - res = self._request( - "GET", - "/cockpit/v1beta1/cockpit", - params={ - "project_id": project_id or self.client.default_project_id, - }, - ) - - self._throw_on_error(res) - return unmarshal_Cockpit(res.json()) - - async def wait_for_cockpit( - self, - *, - project_id: Optional[str] = None, - options: Optional[WaitForOptions[Cockpit, Union[bool, Awaitable[bool]]]] = None, - ) -> Cockpit: - """ - Retrieve the Cockpit of a given Project specified by the Project ID. - :param project_id: ID of the Project the Cockpit belongs to. - :return: :class:`Cockpit ` - - Usage: - :: - - result = await api.get_cockpit() - """ - - if not options: - options = WaitForOptions() - - if not options.stop: - options.stop = lambda res: res.status not in COCKPIT_TRANSIENT_STATUSES - - return await wait_for_resource_async( - fetcher=self.get_cockpit, - options=options, - args={ - "project_id": project_id, - }, - ) - - async def get_cockpit_metrics( - self, - *, - project_id: Optional[str] = None, - start_date: Optional[datetime] = None, - end_date: Optional[datetime] = None, - metric_name: Optional[str] = None, - ) -> CockpitMetrics: - """ - Retrieve metrics from your Cockpit specified by the ID of the Project the Cockpit belongs to. - :param project_id: ID of the Project the Cockpit belongs to. - :param start_date: Desired time range's start date for the metrics. - :param end_date: Desired time range's end date for the metrics. - :param metric_name: Name of the metric requested. - :return: :class:`CockpitMetrics ` - - Usage: - :: - - result = await api.get_cockpit_metrics() - """ - - res = self._request( - "GET", - "/cockpit/v1beta1/cockpit/metrics", - params={ - "end_date": end_date, - "metric_name": metric_name, - "project_id": project_id or self.client.default_project_id, - "start_date": start_date, - }, - ) - - self._throw_on_error(res) - return unmarshal_CockpitMetrics(res.json()) - - async def deactivate_cockpit( - self, - *, - project_id: Optional[str] = None, - ) -> Cockpit: - """ - Deactivate the Cockpit of a given Project specified by the Project ID. - :param project_id: ID of the Project the Cockpit belongs to. - :return: :class:`Cockpit ` - - Usage: - :: - - result = await api.deactivate_cockpit() - """ - - res = self._request( - "POST", - "/cockpit/v1beta1/deactivate", - body=marshal_DeactivateCockpitRequest( - DeactivateCockpitRequest( - project_id=project_id, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_Cockpit(res.json()) - - async def create_datasource( - self, - *, - name: str, - is_default: bool, - project_id: Optional[str] = None, - type_: Optional[DatasourceType] = None, - ) -> Datasource: - """ - Create a data source for a given Project specified by the Project ID and the data source type. - :param name: Data source name. - :param is_default: Specifies that the returned output is the default data source per type. - :param project_id: ID of the Project the Cockpit belongs to. - :param type_: Data source type. - :return: :class:`Datasource ` - - Usage: - :: - - result = await api.create_datasource( - name="example", - is_default=False, - ) - """ - - res = self._request( - "POST", - "/cockpit/v1beta1/datasources", - body=marshal_CreateDatasourceRequest( - CreateDatasourceRequest( - name=name, - is_default=is_default, - project_id=project_id, - type_=type_, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_Datasource(res.json()) - - async def delete_datasource( - self, - *, - datasource_id: str, - ) -> None: - """ - Delete a given data source specified by the data source ID. - :param datasource_id: ID of the data source. - - Usage: - :: - - result = await api.delete_datasource( - datasource_id="example", - ) - """ - - param_datasource_id = validate_path_param("datasource_id", datasource_id) - - res = self._request( - "DELETE", - f"/cockpit/v1beta1/datasources/{param_datasource_id}", - ) - - self._throw_on_error(res) - - async def list_datasources( - self, - *, - page: Optional[int] = None, - page_size: Optional[int] = None, - order_by: Optional[ListDatasourcesRequestOrderBy] = None, - project_id: Optional[str] = None, - types: Optional[List[DatasourceType]] = None, - is_managed_by_scaleway: Optional[bool] = None, - ) -> ListDatasourcesResponse: - """ - Get a list of data sources for the specified Project ID. - :param page: Page number. - :param page_size: Page size. - :param order_by: How the response is ordered. - :param project_id: ID of the Project. - :param types: Filter by datasource types. - :param is_managed_by_scaleway: Filter by managed datasources. - :return: :class:`ListDatasourcesResponse ` - - Usage: - :: - - result = await api.list_datasources() - """ - - res = self._request( - "GET", - "/cockpit/v1beta1/datasources", - params={ - "is_managed_by_scaleway": is_managed_by_scaleway, - "order_by": order_by, - "page": page, - "page_size": page_size or self.client.default_page_size, - "project_id": project_id or self.client.default_project_id, - "types": types, - }, - ) - - self._throw_on_error(res) - return unmarshal_ListDatasourcesResponse(res.json()) - - async def list_datasources_all( - self, - *, - page: Optional[int] = None, - page_size: Optional[int] = None, - order_by: Optional[ListDatasourcesRequestOrderBy] = None, - project_id: Optional[str] = None, - types: Optional[List[DatasourceType]] = None, - is_managed_by_scaleway: Optional[bool] = None, - ) -> List[Datasource]: - """ - Get a list of data sources for the specified Project ID. - :param page: Page number. - :param page_size: Page size. - :param order_by: How the response is ordered. - :param project_id: ID of the Project. - :param types: Filter by datasource types. - :param is_managed_by_scaleway: Filter by managed datasources. - :return: :class:`List[Datasource] ` - - Usage: - :: - - result = await api.list_datasources_all() - """ - - return await fetch_all_pages_async( - type=ListDatasourcesResponse, - key="datasources", - fetcher=self.list_datasources, - args={ - "page": page, - "page_size": page_size, - "order_by": order_by, - "project_id": project_id, - "types": types, - "is_managed_by_scaleway": is_managed_by_scaleway, - }, - ) - - async def create_token( - self, - *, - project_id: Optional[str] = None, - name: Optional[str] = None, - scopes: Optional[TokenScopes] = None, - ) -> Token: - """ - Create a token in a given Project specified by the Project ID. - :param project_id: ID of the Project. - :param name: Name of the token. - :param scopes: Token's permissions. - :return: :class:`Token ` - - Usage: - :: - - result = await api.create_token() - """ - - res = self._request( - "POST", - "/cockpit/v1beta1/tokens", - body=marshal_CreateTokenRequest( - CreateTokenRequest( - project_id=project_id, - name=name or random_name(prefix="token"), - scopes=scopes, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_Token(res.json()) - - async def list_tokens( - self, - *, - page: Optional[int] = None, - page_size: Optional[int] = None, - order_by: Optional[ListTokensRequestOrderBy] = None, - project_id: Optional[str] = None, - ) -> ListTokensResponse: - """ - Get a list of tokens in a given Project specified by the Project ID. - :param page: Page number. - :param page_size: Page size. - :param order_by: How the response is ordered. - :param project_id: ID of the Project. - :return: :class:`ListTokensResponse ` - - Usage: - :: - - result = await api.list_tokens() - """ - - res = self._request( - "GET", - "/cockpit/v1beta1/tokens", - params={ - "order_by": order_by, - "page": page, - "page_size": page_size or self.client.default_page_size, - "project_id": project_id or self.client.default_project_id, - }, - ) - - self._throw_on_error(res) - return unmarshal_ListTokensResponse(res.json()) - - async def list_tokens_all( - self, - *, - page: Optional[int] = None, - page_size: Optional[int] = None, - order_by: Optional[ListTokensRequestOrderBy] = None, - project_id: Optional[str] = None, - ) -> List[Token]: - """ - Get a list of tokens in a given Project specified by the Project ID. - :param page: Page number. - :param page_size: Page size. - :param order_by: How the response is ordered. - :param project_id: ID of the Project. - :return: :class:`List[Token] ` - - Usage: - :: - - result = await api.list_tokens_all() - """ - - return await fetch_all_pages_async( - type=ListTokensResponse, - key="tokens", - fetcher=self.list_tokens, - args={ - "page": page, - "page_size": page_size, - "order_by": order_by, - "project_id": project_id, - }, - ) - - async def get_token( - self, - *, - token_id: str, - ) -> Token: - """ - Retrieve a given token specified by the token ID. - :param token_id: ID of the token. - :return: :class:`Token ` - - Usage: - :: - - result = await api.get_token( - token_id="example", - ) - """ - - param_token_id = validate_path_param("token_id", token_id) - - res = self._request( - "GET", - f"/cockpit/v1beta1/tokens/{param_token_id}", - ) - - self._throw_on_error(res) - return unmarshal_Token(res.json()) - - async def delete_token( - self, - *, - token_id: str, - ) -> None: - """ - Delete a given token specified by the token ID. - :param token_id: ID of the token. - - Usage: - :: - - result = await api.delete_token( - token_id="example", - ) - """ - - param_token_id = validate_path_param("token_id", token_id) - - res = self._request( - "DELETE", - f"/cockpit/v1beta1/tokens/{param_token_id}", - ) - - self._throw_on_error(res) - - async def create_contact_point( - self, - *, - project_id: Optional[str] = None, - contact_point: Optional[ContactPoint] = None, - ) -> ContactPoint: - """ - Create a contact point associated with the default receiver, to receive alerts. - :param project_id: ID of the Project in which to create the contact point. - :param contact_point: Contact point to create. - :return: :class:`ContactPoint ` - - Usage: - :: - - result = await api.create_contact_point() - """ - - res = self._request( - "POST", - "/cockpit/v1beta1/contact-points", - body=marshal_CreateContactPointRequest( - CreateContactPointRequest( - project_id=project_id, - contact_point=contact_point, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_ContactPoint(res.json()) - - async def list_contact_points( - self, - *, - page: Optional[int] = None, - page_size: Optional[int] = None, - project_id: Optional[str] = None, - ) -> ListContactPointsResponse: - """ - Get a list of contact points created for a given Cockpit, specified by the ID of the Project the Cockpit belongs to. - :param page: Page number. - :param page_size: Page size. - :param project_id: ID of the Project from which to list the contact points. - :return: :class:`ListContactPointsResponse ` - - Usage: - :: - - result = await api.list_contact_points() - """ - - res = self._request( - "GET", - "/cockpit/v1beta1/contact-points", - params={ - "page": page, - "page_size": page_size or self.client.default_page_size, - "project_id": project_id or self.client.default_project_id, - }, - ) - - self._throw_on_error(res) - return unmarshal_ListContactPointsResponse(res.json()) - - async def list_contact_points_all( - self, - *, - page: Optional[int] = None, - page_size: Optional[int] = None, - project_id: Optional[str] = None, - ) -> List[ContactPoint]: - """ - Get a list of contact points created for a given Cockpit, specified by the ID of the Project the Cockpit belongs to. - :param page: Page number. - :param page_size: Page size. - :param project_id: ID of the Project from which to list the contact points. - :return: :class:`List[ContactPoint] ` - - Usage: - :: - - result = await api.list_contact_points_all() - """ - - return await fetch_all_pages_async( - type=ListContactPointsResponse, - key="contact_points", - fetcher=self.list_contact_points, - args={ - "page": page, - "page_size": page_size, - "project_id": project_id, - }, - ) - - async def delete_contact_point( - self, - *, - project_id: Optional[str] = None, - contact_point: Optional[ContactPoint] = None, - ) -> None: - """ - Delete a contact point associated with the default receiver. - :param project_id: ID of the Project. - :param contact_point: Contact point to delete. - - Usage: - :: - - result = await api.delete_contact_point() - """ - - res = self._request( - "POST", - "/cockpit/v1beta1/delete-contact-point", - body=marshal_DeleteContactPointRequest( - DeleteContactPointRequest( - project_id=project_id, - contact_point=contact_point, - ), - self.client, - ), - ) - - self._throw_on_error(res) - - async def enable_managed_alerts( - self, - *, - project_id: Optional[str] = None, - ) -> None: - """ - Enable the sending of managed alerts for a given Cockpit, specified by the ID of the Project the Cockpit belongs to. - :param project_id: ID of the Project. - - Usage: - :: - - result = await api.enable_managed_alerts() - """ - - res = self._request( - "POST", - "/cockpit/v1beta1/enable-managed-alerts", - body=marshal_EnableManagedAlertsRequest( - EnableManagedAlertsRequest( - project_id=project_id, - ), - self.client, - ), - ) - - self._throw_on_error(res) - - async def disable_managed_alerts( - self, - *, - project_id: Optional[str] = None, - ) -> None: - """ - Disable the sending of managed alerts for a given Cockpit, specified by the ID of the Project the Cockpit belongs to. - :param project_id: ID of the Project. - - Usage: - :: - - result = await api.disable_managed_alerts() - """ - - res = self._request( - "POST", - "/cockpit/v1beta1/disable-managed-alerts", - body=marshal_DisableManagedAlertsRequest( - DisableManagedAlertsRequest( - project_id=project_id, - ), - self.client, - ), - ) - - self._throw_on_error(res) - - async def trigger_test_alert( - self, - *, - project_id: Optional[str] = None, - ) -> None: - """ - Send a test alert to make sure your contact points get notified when an actual alert is triggered. - :param project_id: - - Usage: - :: - - result = await api.trigger_test_alert() - """ - - res = self._request( - "POST", - "/cockpit/v1beta1/trigger-test-alert", - body=marshal_TriggerTestAlertRequest( - TriggerTestAlertRequest( - project_id=project_id, - ), - self.client, - ), - ) - - self._throw_on_error(res) - - async def create_grafana_user( - self, - *, - login: str, - project_id: Optional[str] = None, - role: Optional[GrafanaUserRole] = None, - ) -> GrafanaUser: - """ - Create a Grafana user for your Cockpit's Grafana. Make sure you save the automatically-generated password and the Grafana user ID. - :param login: Username of the Grafana user. - :param project_id: ID of the Project. - :param role: Role assigned to the Grafana user. - :return: :class:`GrafanaUser ` - - Usage: - :: - - result = await api.create_grafana_user( - login="example", - ) - """ - - res = self._request( - "POST", - "/cockpit/v1beta1/grafana-users", - body=marshal_CreateGrafanaUserRequest( - CreateGrafanaUserRequest( - login=login, - project_id=project_id, - role=role, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_GrafanaUser(res.json()) - - async def list_grafana_users( - self, - *, - page: Optional[int] = None, - page_size: Optional[int] = None, - order_by: Optional[ListGrafanaUsersRequestOrderBy] = None, - project_id: Optional[str] = None, - ) -> ListGrafanaUsersResponse: - """ - Get a list of all Grafana users created in your Cockpit's Grafana. - :param page: Page number. - :param page_size: Page size. - :param order_by: - :param project_id: ID of the Project. - :return: :class:`ListGrafanaUsersResponse ` - - Usage: - :: - - result = await api.list_grafana_users() - """ - - res = self._request( - "GET", - "/cockpit/v1beta1/grafana-users", - params={ - "order_by": order_by, - "page": page, - "page_size": page_size or self.client.default_page_size, - "project_id": project_id or self.client.default_project_id, - }, - ) - - self._throw_on_error(res) - return unmarshal_ListGrafanaUsersResponse(res.json()) - - async def list_grafana_users_all( - self, - *, - page: Optional[int] = None, - page_size: Optional[int] = None, - order_by: Optional[ListGrafanaUsersRequestOrderBy] = None, - project_id: Optional[str] = None, - ) -> List[GrafanaUser]: - """ - Get a list of all Grafana users created in your Cockpit's Grafana. - :param page: Page number. - :param page_size: Page size. - :param order_by: - :param project_id: ID of the Project. - :return: :class:`List[GrafanaUser] ` - - Usage: - :: - - result = await api.list_grafana_users_all() - """ - - return await fetch_all_pages_async( - type=ListGrafanaUsersResponse, - key="grafana_users", - fetcher=self.list_grafana_users, - args={ - "page": page, - "page_size": page_size, - "order_by": order_by, - "project_id": project_id, - }, - ) - - async def delete_grafana_user( - self, - *, - project_id: Optional[str] = None, - grafana_user_id: int, - ) -> None: - """ - Delete a Grafana user from your Cockpit's Grafana, specified by the ID of the Project the Cockpit belongs to, and the ID of the Grafana user. - :param project_id: ID of the Project. - :param grafana_user_id: ID of the Grafana user. - - Usage: - :: - - result = await api.delete_grafana_user( - grafana_user_id=1, - ) - """ - - param_grafana_user_id = validate_path_param("grafana_user_id", grafana_user_id) - - res = self._request( - "POST", - f"/cockpit/v1beta1/grafana-users/{param_grafana_user_id}/delete", - body=marshal_DeleteGrafanaUserRequest( - DeleteGrafanaUserRequest( - project_id=project_id, - grafana_user_id=grafana_user_id, - ), - self.client, - ), - ) - - self._throw_on_error(res) - - async def reset_grafana_user_password( - self, - *, - project_id: Optional[str] = None, - grafana_user_id: int, - ) -> GrafanaUser: - """ - Reset the password of a Grafana user, specified by the ID of the Project the Cockpit belongs to, and the ID of the Grafana user. - :param project_id: ID of the Project. - :param grafana_user_id: ID of the Grafana user. - :return: :class:`GrafanaUser ` - - Usage: - :: - - result = await api.reset_grafana_user_password( - grafana_user_id=1, - ) - """ - - param_grafana_user_id = validate_path_param("grafana_user_id", grafana_user_id) - - res = self._request( - "POST", - f"/cockpit/v1beta1/grafana-users/{param_grafana_user_id}/reset-password", - body=marshal_ResetGrafanaUserPasswordRequest( - ResetGrafanaUserPasswordRequest( - project_id=project_id, - grafana_user_id=grafana_user_id, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_GrafanaUser(res.json()) - - async def list_plans( - self, - *, - page: Optional[int] = None, - page_size: Optional[int] = None, - order_by: Optional[ListPlansRequestOrderBy] = None, - ) -> ListPlansResponse: - """ - Get a list of all pricing plans available. - :param page: Page number. - :param page_size: Page size. - :param order_by: - :return: :class:`ListPlansResponse ` - - Usage: - :: - - result = await api.list_plans() - """ - - res = self._request( - "GET", - "/cockpit/v1beta1/plans", - params={ - "order_by": order_by, - "page": page, - "page_size": page_size or self.client.default_page_size, - }, - ) - - self._throw_on_error(res) - return unmarshal_ListPlansResponse(res.json()) - - async def list_plans_all( - self, - *, - page: Optional[int] = None, - page_size: Optional[int] = None, - order_by: Optional[ListPlansRequestOrderBy] = None, - ) -> List[Plan]: - """ - Get a list of all pricing plans available. - :param page: Page number. - :param page_size: Page size. - :param order_by: - :return: :class:`List[Plan] ` - - Usage: - :: - - result = await api.list_plans_all() - """ - - return await fetch_all_pages_async( - type=ListPlansResponse, - key="plans", - fetcher=self.list_plans, - args={ - "page": page, - "page_size": page_size, - "order_by": order_by, - }, - ) - - async def select_plan( - self, - *, - plan_id: str, - project_id: Optional[str] = None, - ) -> SelectPlanResponse: - """ - Select your chosen pricing plan for your Cockpit, specifying the Cockpit's Project ID and the pricing plan's ID in the request. - :param plan_id: ID of the pricing plan. - :param project_id: ID of the Project. - :return: :class:`SelectPlanResponse ` - - Usage: - :: - - result = await api.select_plan( - plan_id="example", - ) - """ - - res = self._request( - "POST", - "/cockpit/v1beta1/select-plan", - body=marshal_SelectPlanRequest( - SelectPlanRequest( - plan_id=plan_id, - project_id=project_id, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_SelectPlanResponse(res.json()) - - async def list_grafana_product_dashboards( - self, - *, - project_id: Optional[str] = None, - page: Optional[int] = None, - page_size: Optional[int] = None, - tags: Optional[List[str]] = None, - ) -> ListGrafanaProductDashboardsResponse: - """ - List product dashboards. - Get a list of available product dashboards. - :param project_id: ID of the Project. - :param page: Page number. - :param page_size: Page size. - :param tags: Tags to filter the dashboards. - :return: :class:`ListGrafanaProductDashboardsResponse ` - - Usage: - :: - - result = await api.list_grafana_product_dashboards() - """ - - res = self._request( - "GET", - "/cockpit/v1beta1/grafana-product-dashboards", - params={ - "page": page, - "page_size": page_size or self.client.default_page_size, - "project_id": project_id or self.client.default_project_id, - "tags": tags, - }, - ) - - self._throw_on_error(res) - return unmarshal_ListGrafanaProductDashboardsResponse(res.json()) - - async def list_grafana_product_dashboards_all( - self, - *, - project_id: Optional[str] = None, - page: Optional[int] = None, - page_size: Optional[int] = None, - tags: Optional[List[str]] = None, - ) -> List[GrafanaProductDashboard]: - """ - List product dashboards. - Get a list of available product dashboards. - :param project_id: ID of the Project. - :param page: Page number. - :param page_size: Page size. - :param tags: Tags to filter the dashboards. - :return: :class:`List[GrafanaProductDashboard] ` - - Usage: - :: - - result = await api.list_grafana_product_dashboards_all() - """ - - return await fetch_all_pages_async( - type=ListGrafanaProductDashboardsResponse, - key="dashboards", - fetcher=self.list_grafana_product_dashboards, - args={ - "project_id": project_id, - "page": page, - "page_size": page_size, - "tags": tags, - }, - ) - - async def get_grafana_product_dashboard( - self, - *, - project_id: Optional[str] = None, - dashboard_name: str, - ) -> GrafanaProductDashboard: - """ - Get a product dashboard. - Get a product dashboard specified by the dashboard ID. - :param project_id: ID of the Project. - :param dashboard_name: Name of the dashboard. - :return: :class:`GrafanaProductDashboard ` - - Usage: - :: - - result = await api.get_grafana_product_dashboard( - dashboard_name="example", - ) - """ - - param_dashboard_name = validate_path_param("dashboard_name", dashboard_name) - - res = self._request( - "GET", - f"/cockpit/v1beta1/grafana-product-dashboards/{param_dashboard_name}", - params={ - "project_id": project_id or self.client.default_project_id, - }, - ) - - self._throw_on_error(res) - return unmarshal_GrafanaProductDashboard(res.json()) diff --git a/scaleway-async/scaleway_async/cockpit/v1beta1/content.py b/scaleway-async/scaleway_async/cockpit/v1beta1/content.py deleted file mode 100644 index 742950215..000000000 --- a/scaleway-async/scaleway_async/cockpit/v1beta1/content.py +++ /dev/null @@ -1,16 +0,0 @@ -# This file was automatically generated. DO NOT EDIT. -# If you have any remark or suggestion do not hesitate to open an issue. -from typing import List - -from .types import ( - CockpitStatus, -) - -COCKPIT_TRANSIENT_STATUSES: List[CockpitStatus] = [ - CockpitStatus.CREATING, - CockpitStatus.DELETING, - CockpitStatus.UPDATING, -] -""" -Lists transient statutes of the enum :class:`CockpitStatus `. -""" diff --git a/scaleway-async/scaleway_async/cockpit/v1beta1/marshalling.py b/scaleway-async/scaleway_async/cockpit/v1beta1/marshalling.py deleted file mode 100644 index 916db34ef..000000000 --- a/scaleway-async/scaleway_async/cockpit/v1beta1/marshalling.py +++ /dev/null @@ -1,815 +0,0 @@ -# This file was automatically generated. DO NOT EDIT. -# If you have any remark or suggestion do not hesitate to open an issue. - -from typing import Any, Dict -from dateutil import parser - -from scaleway_core.profile import ProfileDefaults -from scaleway_core.bridge import ( - unmarshal_TimeSeries, -) -from scaleway_core.utils import ( - OneOfPossibility, - resolve_one_of, -) -from .types import ( - ContactPointEmail, - ContactPoint, - Datasource, - GrafanaProductDashboard, - GrafanaUser, - TokenScopes, - Token, - CockpitEndpoints, - Plan, - Cockpit, - CockpitMetrics, - ListContactPointsResponse, - ListDatasourcesResponse, - ListGrafanaProductDashboardsResponse, - ListGrafanaUsersResponse, - ListPlansResponse, - ListTokensResponse, - SelectPlanResponse, - ActivateCockpitRequest, - CreateContactPointRequest, - CreateDatasourceRequest, - CreateGrafanaUserRequest, - CreateTokenRequest, - DeactivateCockpitRequest, - DeleteContactPointRequest, - DeleteGrafanaUserRequest, - DisableManagedAlertsRequest, - EnableManagedAlertsRequest, - ResetGrafanaUserPasswordRequest, - SelectPlanRequest, - TriggerTestAlertRequest, -) - - -def unmarshal_ContactPointEmail(data: Any) -> ContactPointEmail: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'ContactPointEmail' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("to", None) - if field is not None: - args["to"] = field - - return ContactPointEmail(**args) - - -def unmarshal_ContactPoint(data: Any) -> ContactPoint: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'ContactPoint' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("email", None) - if field is not None: - args["email"] = unmarshal_ContactPointEmail(field) - else: - args["email"] = None - - return ContactPoint(**args) - - -def unmarshal_Datasource(data: Any) -> Datasource: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'Datasource' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("id", None) - if field is not None: - args["id"] = field - - field = data.get("project_id", None) - if field is not None: - args["project_id"] = field - - field = data.get("name", None) - if field is not None: - args["name"] = field - - field = data.get("url", None) - if field is not None: - args["url"] = field - - field = data.get("type", None) - if field is not None: - args["type_"] = field - - field = data.get("is_managed_by_scaleway", None) - if field is not None: - args["is_managed_by_scaleway"] = field - - return Datasource(**args) - - -def unmarshal_GrafanaProductDashboard(data: Any) -> GrafanaProductDashboard: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'GrafanaProductDashboard' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("dashboard_name", None) - if field is not None: - args["dashboard_name"] = field - - field = data.get("title", None) - if field is not None: - args["title"] = field - - field = data.get("url", None) - if field is not None: - args["url"] = field - - field = data.get("tags", None) - if field is not None: - args["tags"] = field - - field = data.get("variables", None) - if field is not None: - args["variables"] = field - - return GrafanaProductDashboard(**args) - - -def unmarshal_GrafanaUser(data: Any) -> GrafanaUser: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'GrafanaUser' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("id", None) - if field is not None: - args["id"] = field - - field = data.get("login", None) - if field is not None: - args["login"] = field - - field = data.get("role", None) - if field is not None: - args["role"] = field - - field = data.get("password", None) - if field is not None: - args["password"] = field - else: - args["password"] = None - - return GrafanaUser(**args) - - -def unmarshal_TokenScopes(data: Any) -> TokenScopes: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'TokenScopes' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("query_metrics", None) - if field is not None: - args["query_metrics"] = field - - field = data.get("write_metrics", None) - if field is not None: - args["write_metrics"] = field - - field = data.get("setup_metrics_rules", None) - if field is not None: - args["setup_metrics_rules"] = field - - field = data.get("query_logs", None) - if field is not None: - args["query_logs"] = field - - field = data.get("write_logs", None) - if field is not None: - args["write_logs"] = field - - field = data.get("setup_logs_rules", None) - if field is not None: - args["setup_logs_rules"] = field - - field = data.get("setup_alerts", None) - if field is not None: - args["setup_alerts"] = field - - field = data.get("query_traces", None) - if field is not None: - args["query_traces"] = field - - field = data.get("write_traces", None) - if field is not None: - args["write_traces"] = field - - return TokenScopes(**args) - - -def unmarshal_Token(data: Any) -> Token: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'Token' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("id", None) - if field is not None: - args["id"] = field - - field = data.get("project_id", None) - if field is not None: - args["project_id"] = field - - field = data.get("name", None) - if field is not None: - args["name"] = field - - field = data.get("created_at", None) - if field is not None: - args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["created_at"] = None - - field = data.get("updated_at", None) - if field is not None: - args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["updated_at"] = None - - field = data.get("scopes", None) - if field is not None: - args["scopes"] = unmarshal_TokenScopes(field) - else: - args["scopes"] = None - - field = data.get("secret_key", None) - if field is not None: - args["secret_key"] = field - else: - args["secret_key"] = None - - return Token(**args) - - -def unmarshal_CockpitEndpoints(data: Any) -> CockpitEndpoints: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'CockpitEndpoints' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("metrics_url", None) - if field is not None: - args["metrics_url"] = field - - field = data.get("logs_url", None) - if field is not None: - args["logs_url"] = field - - field = data.get("traces_url", None) - if field is not None: - args["traces_url"] = field - - field = data.get("alertmanager_url", None) - if field is not None: - args["alertmanager_url"] = field - - field = data.get("grafana_url", None) - if field is not None: - args["grafana_url"] = field - - return CockpitEndpoints(**args) - - -def unmarshal_Plan(data: Any) -> Plan: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'Plan' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("id", None) - if field is not None: - args["id"] = field - - field = data.get("name", None) - if field is not None: - args["name"] = field - - field = data.get("sample_ingestion_price", None) - if field is not None: - args["sample_ingestion_price"] = field - - field = data.get("logs_ingestion_price", None) - if field is not None: - args["logs_ingestion_price"] = field - - field = data.get("traces_ingestion_price", None) - if field is not None: - args["traces_ingestion_price"] = field - - field = data.get("retention_price", None) - if field is not None: - args["retention_price"] = field - - field = data.get("retention_metrics_interval", None) - if field is not None: - args["retention_metrics_interval"] = field - else: - args["retention_metrics_interval"] = None - - field = data.get("retention_logs_interval", None) - if field is not None: - args["retention_logs_interval"] = field - else: - args["retention_logs_interval"] = None - - field = data.get("retention_traces_interval", None) - if field is not None: - args["retention_traces_interval"] = field - else: - args["retention_traces_interval"] = None - - return Plan(**args) - - -def unmarshal_Cockpit(data: Any) -> Cockpit: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'Cockpit' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("project_id", None) - if field is not None: - args["project_id"] = field - - field = data.get("status", None) - if field is not None: - args["status"] = field - - field = data.get("managed_alerts_enabled", None) - if field is not None: - args["managed_alerts_enabled"] = field - - field = data.get("created_at", None) - if field is not None: - args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["created_at"] = None - - field = data.get("updated_at", None) - if field is not None: - args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["updated_at"] = None - - field = data.get("endpoints", None) - if field is not None: - args["endpoints"] = unmarshal_CockpitEndpoints(field) - else: - args["endpoints"] = None - - field = data.get("plan", None) - if field is not None: - args["plan"] = unmarshal_Plan(field) - else: - args["plan"] = None - - return Cockpit(**args) - - -def unmarshal_CockpitMetrics(data: Any) -> CockpitMetrics: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'CockpitMetrics' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("timeseries", None) - if field is not None: - args["timeseries"] = ( - [unmarshal_TimeSeries(v) for v in field] if field is not None else None - ) - - return CockpitMetrics(**args) - - -def unmarshal_ListContactPointsResponse(data: Any) -> ListContactPointsResponse: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'ListContactPointsResponse' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("total_count", None) - if field is not None: - args["total_count"] = field - - field = data.get("contact_points", None) - if field is not None: - args["contact_points"] = ( - [unmarshal_ContactPoint(v) for v in field] if field is not None else None - ) - - field = data.get("has_additional_receivers", None) - if field is not None: - args["has_additional_receivers"] = field - - field = data.get("has_additional_contact_points", None) - if field is not None: - args["has_additional_contact_points"] = field - - return ListContactPointsResponse(**args) - - -def unmarshal_ListDatasourcesResponse(data: Any) -> ListDatasourcesResponse: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'ListDatasourcesResponse' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("total_count", None) - if field is not None: - args["total_count"] = field - - field = data.get("datasources", None) - if field is not None: - args["datasources"] = ( - [unmarshal_Datasource(v) for v in field] if field is not None else None - ) - - return ListDatasourcesResponse(**args) - - -def unmarshal_ListGrafanaProductDashboardsResponse( - data: Any, -) -> ListGrafanaProductDashboardsResponse: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'ListGrafanaProductDashboardsResponse' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("total_count", None) - if field is not None: - args["total_count"] = field - - field = data.get("dashboards", None) - if field is not None: - args["dashboards"] = ( - [unmarshal_GrafanaProductDashboard(v) for v in field] - if field is not None - else None - ) - - return ListGrafanaProductDashboardsResponse(**args) - - -def unmarshal_ListGrafanaUsersResponse(data: Any) -> ListGrafanaUsersResponse: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'ListGrafanaUsersResponse' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("total_count", None) - if field is not None: - args["total_count"] = field - - field = data.get("grafana_users", None) - if field is not None: - args["grafana_users"] = ( - [unmarshal_GrafanaUser(v) for v in field] if field is not None else None - ) - - return ListGrafanaUsersResponse(**args) - - -def unmarshal_ListPlansResponse(data: Any) -> ListPlansResponse: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'ListPlansResponse' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("total_count", None) - if field is not None: - args["total_count"] = field - - field = data.get("plans", None) - if field is not None: - args["plans"] = ( - [unmarshal_Plan(v) for v in field] if field is not None else None - ) - - return ListPlansResponse(**args) - - -def unmarshal_ListTokensResponse(data: Any) -> ListTokensResponse: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'ListTokensResponse' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("total_count", None) - if field is not None: - args["total_count"] = field - - field = data.get("tokens", None) - if field is not None: - args["tokens"] = ( - [unmarshal_Token(v) for v in field] if field is not None else None - ) - - return ListTokensResponse(**args) - - -def unmarshal_SelectPlanResponse(data: Any) -> SelectPlanResponse: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'SelectPlanResponse' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - return SelectPlanResponse(**args) - - -def marshal_ActivateCockpitRequest( - request: ActivateCockpitRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id - - return output - - -def marshal_ContactPointEmail( - request: ContactPointEmail, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - if request.to is not None: - output["to"] = request.to - - return output - - -def marshal_ContactPoint( - request: ContactPoint, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - output.update( - resolve_one_of( - [ - OneOfPossibility("email", request.email), - ] - ), - ) - - return output - - -def marshal_CreateContactPointRequest( - request: CreateContactPointRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id - - if request.contact_point is not None: - output["contact_point"] = marshal_ContactPoint(request.contact_point, defaults) - - return output - - -def marshal_CreateDatasourceRequest( - request: CreateDatasourceRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - if request.name is not None: - output["name"] = request.name - - if request.is_default is not None: - output["is_default"] = request.is_default - - if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id - - if request.type_ is not None: - output["type"] = str(request.type_) - - return output - - -def marshal_CreateGrafanaUserRequest( - request: CreateGrafanaUserRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - if request.login is not None: - output["login"] = request.login - - if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id - - if request.role is not None: - output["role"] = str(request.role) - - return output - - -def marshal_TokenScopes( - request: TokenScopes, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - if request.query_metrics is not None: - output["query_metrics"] = request.query_metrics - - if request.write_metrics is not None: - output["write_metrics"] = request.write_metrics - - if request.setup_metrics_rules is not None: - output["setup_metrics_rules"] = request.setup_metrics_rules - - if request.query_logs is not None: - output["query_logs"] = request.query_logs - - if request.write_logs is not None: - output["write_logs"] = request.write_logs - - if request.setup_logs_rules is not None: - output["setup_logs_rules"] = request.setup_logs_rules - - if request.setup_alerts is not None: - output["setup_alerts"] = request.setup_alerts - - if request.query_traces is not None: - output["query_traces"] = request.query_traces - - if request.write_traces is not None: - output["write_traces"] = request.write_traces - - return output - - -def marshal_CreateTokenRequest( - request: CreateTokenRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id - - if request.name is not None: - output["name"] = request.name - - if request.scopes is not None: - output["scopes"] = marshal_TokenScopes(request.scopes, defaults) - - return output - - -def marshal_DeactivateCockpitRequest( - request: DeactivateCockpitRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id - - return output - - -def marshal_DeleteContactPointRequest( - request: DeleteContactPointRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id - - if request.contact_point is not None: - output["contact_point"] = marshal_ContactPoint(request.contact_point, defaults) - - return output - - -def marshal_DeleteGrafanaUserRequest( - request: DeleteGrafanaUserRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id - - return output - - -def marshal_DisableManagedAlertsRequest( - request: DisableManagedAlertsRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id - - return output - - -def marshal_EnableManagedAlertsRequest( - request: EnableManagedAlertsRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id - - return output - - -def marshal_ResetGrafanaUserPasswordRequest( - request: ResetGrafanaUserPasswordRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id - - return output - - -def marshal_SelectPlanRequest( - request: SelectPlanRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - if request.plan_id is not None: - output["plan_id"] = request.plan_id - - if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id - - return output - - -def marshal_TriggerTestAlertRequest( - request: TriggerTestAlertRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id - - return output diff --git a/scaleway-async/scaleway_async/cockpit/v1beta1/types.py b/scaleway-async/scaleway_async/cockpit/v1beta1/types.py deleted file mode 100644 index 74329a938..000000000 --- a/scaleway-async/scaleway_async/cockpit/v1beta1/types.py +++ /dev/null @@ -1,961 +0,0 @@ -# This file was automatically generated. DO NOT EDIT. -# If you have any remark or suggestion do not hesitate to open an issue. -from __future__ import annotations - -from dataclasses import dataclass -from datetime import datetime -from enum import Enum -from typing import List, Optional - -from scaleway_core.bridge import ( - TimeSeries, -) -from scaleway_core.utils import ( - StrEnumMeta, -) - - -class CockpitStatus(str, Enum, metaclass=StrEnumMeta): - UNKNOWN_STATUS = "unknown_status" - CREATING = "creating" - READY = "ready" - DELETING = "deleting" - UPDATING = "updating" - ERROR = "error" - - def __str__(self) -> str: - return str(self.value) - - -class DatasourceType(str, Enum, metaclass=StrEnumMeta): - UNKNOWN_DATASOURCE_TYPE = "unknown_datasource_type" - METRICS = "metrics" - LOGS = "logs" - TRACES = "traces" - ALERTS = "alerts" - - def __str__(self) -> str: - return str(self.value) - - -class GrafanaUserRole(str, Enum, metaclass=StrEnumMeta): - UNKNOWN_ROLE = "unknown_role" - EDITOR = "editor" - VIEWER = "viewer" - - def __str__(self) -> str: - return str(self.value) - - -class ListDatasourcesRequestOrderBy(str, Enum, metaclass=StrEnumMeta): - CREATED_AT_ASC = "created_at_asc" - CREATED_AT_DESC = "created_at_desc" - NAME_ASC = "name_asc" - NAME_DESC = "name_desc" - - def __str__(self) -> str: - return str(self.value) - - -class ListGrafanaUsersRequestOrderBy(str, Enum, metaclass=StrEnumMeta): - LOGIN_ASC = "login_asc" - LOGIN_DESC = "login_desc" - - def __str__(self) -> str: - return str(self.value) - - -class ListPlansRequestOrderBy(str, Enum, metaclass=StrEnumMeta): - NAME_ASC = "name_asc" - NAME_DESC = "name_desc" - - def __str__(self) -> str: - return str(self.value) - - -class ListTokensRequestOrderBy(str, Enum, metaclass=StrEnumMeta): - CREATED_AT_ASC = "created_at_asc" - CREATED_AT_DESC = "created_at_desc" - NAME_ASC = "name_asc" - NAME_DESC = "name_desc" - - def __str__(self) -> str: - return str(self.value) - - -class PlanName(str, Enum, metaclass=StrEnumMeta): - UNKNOWN_NAME = "unknown_name" - FREE = "free" - PREMIUM = "premium" - CUSTOM = "custom" - - def __str__(self) -> str: - return str(self.value) - - -@dataclass -class ContactPointEmail: - to: str - - -@dataclass -class TokenScopes: - query_metrics: bool - """ - Permission to fetch metrics. - """ - - write_metrics: bool - """ - Permission to write metrics. - """ - - setup_metrics_rules: bool - """ - Permission to setup metrics rules. - """ - - query_logs: bool - """ - Permission to fetch logs. - """ - - write_logs: bool - """ - Permission to write logs. - """ - - setup_logs_rules: bool - """ - Permission to set up logs rules. - """ - - setup_alerts: bool - """ - Permission to set up alerts. - """ - - query_traces: bool - """ - Permission to fetch traces. - """ - - write_traces: bool - """ - Permission to write traces. - """ - - -@dataclass -class CockpitEndpoints: - metrics_url: str - """ - URL for metrics. - """ - - logs_url: str - """ - URL for logs. - """ - - traces_url: str - """ - URL for traces. - """ - - alertmanager_url: str - """ - URL for the alert manager. - """ - - grafana_url: str - """ - URL for the Grafana dashboard. - """ - - -@dataclass -class Plan: - """ - Pricing plan. - """ - - id: str - """ - ID of a given pricing plan. - """ - - name: PlanName - """ - Name of a given pricing plan. - """ - - sample_ingestion_price: int - """ - Ingestion price in cents for 1 million samples. - """ - - logs_ingestion_price: int - """ - Ingestion price in cents for 1 GB of logs. - """ - - traces_ingestion_price: int - """ - Ingestion price in cents for 1 GB of traces. - """ - - retention_price: int - """ - Retention price in euros per month. - """ - - retention_metrics_interval: Optional[str] - """ - Interval of time during which Scaleway's Cockpit keeps your metrics. - """ - - retention_logs_interval: Optional[str] - """ - Interval of time during which Scaleway's Cockpit keeps your logs. - """ - - retention_traces_interval: Optional[str] - """ - Interval of time during which Scaleway's Cockpit keeps your traces. - """ - - -@dataclass -class ContactPoint: - """ - Contact point. - """ - - email: Optional[ContactPointEmail] - - -@dataclass -class Datasource: - """ - Data source. - """ - - id: str - """ - ID of the data source. - """ - - project_id: str - """ - ID of the Project the Cockpit belongs to. - """ - - name: str - """ - Data source name. - """ - - url: str - """ - Data source URL. - """ - - type_: DatasourceType - """ - Data source type. - """ - - is_managed_by_scaleway: bool - """ - Specifies that the data source receives data from Scaleway products and is managed by Scaleway. - """ - - -@dataclass -class GrafanaProductDashboard: - """ - Grafana dashboard. - """ - - dashboard_name: str - """ - Name of the dashboard. - """ - - title: str - """ - Title of the dashboard. - """ - - url: str - """ - URL of the dashboard. - """ - - tags: List[str] - """ - Tags of the dashboard. - """ - - variables: List[str] - """ - Variables of the dashboard. - """ - - -@dataclass -class GrafanaUser: - """ - Grafana user. - """ - - id: int - """ - ID of the Grafana user. - """ - - login: str - """ - Username of the Grafana user. - """ - - role: GrafanaUserRole - """ - Role assigned to the Grafana user. - """ - - password: Optional[str] - """ - The Grafana user's password. - """ - - -@dataclass -class Token: - id: str - """ - ID of the token. - """ - - project_id: str - """ - ID of the Project. - """ - - name: str - """ - Name of the token. - """ - - created_at: Optional[datetime] - """ - Date and time of the token's creation. - """ - - updated_at: Optional[datetime] - """ - Date and time of the token's last update. - """ - - scopes: Optional[TokenScopes] - """ - Token's permissions. - """ - - secret_key: Optional[str] - """ - Token's secret key. - """ - - -@dataclass -class ActivateCockpitRequest: - project_id: Optional[str] - """ - ID of the Project the Cockpit belongs to. - """ - - -@dataclass -class Cockpit: - """ - Cockpit. - """ - - project_id: str - """ - ID of the Project the Cockpit belongs to. - """ - - status: CockpitStatus - """ - Status of the Cockpit. - """ - - managed_alerts_enabled: bool - """ - Specifies whether managed alerts are enabled or disabled. - """ - - created_at: Optional[datetime] - """ - Date and time of the Cockpit's creation. - """ - - updated_at: Optional[datetime] - """ - Date and time of the Cockpit's last update. - """ - - endpoints: Optional[CockpitEndpoints] - """ - Endpoints of the Cockpit. - """ - - plan: Optional[Plan] - """ - Pricing plan information. - """ - - -@dataclass -class CockpitMetrics: - """ - Metrics for a given Cockpit. - """ - - timeseries: List[TimeSeries] - """ - Time series array. - """ - - -@dataclass -class CreateContactPointRequest: - """ - Request to create a contact point. - """ - - project_id: Optional[str] - """ - ID of the Project in which to create the contact point. - """ - - contact_point: Optional[ContactPoint] - """ - Contact point to create. - """ - - -@dataclass -class CreateDatasourceRequest: - """ - Request to create a data source. - """ - - name: str - """ - Data source name. - """ - - is_default: bool - """ - Specifies that the returned output is the default data source per type. - """ - - project_id: Optional[str] - """ - ID of the Project the Cockpit belongs to. - """ - - type_: Optional[DatasourceType] - """ - Data source type. - """ - - -@dataclass -class CreateGrafanaUserRequest: - """ - Request to create a Grafana user. - """ - - login: str - """ - Username of the Grafana user. - """ - - project_id: Optional[str] - """ - ID of the Project. - """ - - role: Optional[GrafanaUserRole] - """ - Role assigned to the Grafana user. - """ - - -@dataclass -class CreateTokenRequest: - project_id: Optional[str] - """ - ID of the Project. - """ - - name: Optional[str] - """ - Name of the token. - """ - - scopes: Optional[TokenScopes] - """ - Token's permissions. - """ - - -@dataclass -class DeactivateCockpitRequest: - project_id: Optional[str] - """ - ID of the Project the Cockpit belongs to. - """ - - -@dataclass -class DeleteContactPointRequest: - """ - Request to delete a contact point. - """ - - project_id: Optional[str] - """ - ID of the Project. - """ - - contact_point: Optional[ContactPoint] - """ - Contact point to delete. - """ - - -@dataclass -class DeleteDatasourceRequest: - """ - Request to delete a data source. - """ - - datasource_id: str - """ - ID of the data source. - """ - - -@dataclass -class DeleteGrafanaUserRequest: - """ - Request to delete a Grafana user. - """ - - project_id: Optional[str] - """ - ID of the Project. - """ - - grafana_user_id: int - """ - ID of the Grafana user. - """ - - -@dataclass -class DeleteTokenRequest: - token_id: str - """ - ID of the token. - """ - - -@dataclass -class DisableManagedAlertsRequest: - """ - Request to disable the sending of managed alerts. - """ - - project_id: Optional[str] - """ - ID of the Project. - """ - - -@dataclass -class EnableManagedAlertsRequest: - """ - Request to enable the sending of managed alerts. - """ - - project_id: Optional[str] - """ - ID of the Project. - """ - - -@dataclass -class GetCockpitMetricsRequest: - """ - Request to get a given Cockpit's metrics. - """ - - project_id: Optional[str] - """ - ID of the Project the Cockpit belongs to. - """ - - start_date: Optional[datetime] - """ - Desired time range's start date for the metrics. - """ - - end_date: Optional[datetime] - """ - Desired time range's end date for the metrics. - """ - - metric_name: Optional[str] - """ - Name of the metric requested. - """ - - -@dataclass -class GetCockpitRequest: - project_id: Optional[str] - """ - ID of the Project the Cockpit belongs to. - """ - - -@dataclass -class GetGrafanaProductDashboardRequest: - """ - Request to get a dashboard. - """ - - project_id: Optional[str] - """ - ID of the Project. - """ - - dashboard_name: str - """ - Name of the dashboard. - """ - - -@dataclass -class GetTokenRequest: - token_id: str - """ - ID of the token. - """ - - -@dataclass -class ListContactPointsRequest: - """ - Request to list all contact points. - """ - - page: Optional[int] - """ - Page number. - """ - - page_size: Optional[int] - """ - Page size. - """ - - project_id: Optional[str] - """ - ID of the Project from which to list the contact points. - """ - - -@dataclass -class ListContactPointsResponse: - """ - Response returned when listing contact points. - """ - - total_count: int - """ - Count of all contact points created. - """ - - contact_points: List[ContactPoint] - """ - Array of contact points. - """ - - has_additional_receivers: bool - """ - Specifies whether the contact point has other receivers than the default receiver. - """ - - has_additional_contact_points: bool - """ - Specifies whether there are unmanaged contact points. - """ - - -@dataclass -class ListDatasourcesRequest: - page: Optional[int] - """ - Page number. - """ - - page_size: Optional[int] - """ - Page size. - """ - - order_by: Optional[ListDatasourcesRequestOrderBy] - """ - How the response is ordered. - """ - - project_id: Optional[str] - """ - ID of the Project. - """ - - types: Optional[List[DatasourceType]] - """ - Filter by datasource types. - """ - - is_managed_by_scaleway: Optional[bool] - """ - Filter by managed datasources. - """ - - -@dataclass -class ListDatasourcesResponse: - total_count: int - """ - Count of all datasources corresponding to the request. - """ - - datasources: List[Datasource] - """ - List of the datasources within the pagination. - """ - - -@dataclass -class ListGrafanaProductDashboardsRequest: - """ - Request to get a list of dashboards. - """ - - project_id: Optional[str] - """ - ID of the Project. - """ - - page: Optional[int] - """ - Page number. - """ - - page_size: Optional[int] - """ - Page size. - """ - - tags: Optional[List[str]] - """ - Tags to filter the dashboards. - """ - - -@dataclass -class ListGrafanaProductDashboardsResponse: - """ - Response returned when getting a list of dashboards. - """ - - total_count: int - """ - Count of grafana dasboards. - """ - - dashboards: List[GrafanaProductDashboard] - """ - Information on grafana dashboards. - """ - - -@dataclass -class ListGrafanaUsersRequest: - """ - Request to list all Grafana users. - """ - - page: Optional[int] - """ - Page number. - """ - - page_size: Optional[int] - """ - Page size. - """ - - order_by: Optional[ListGrafanaUsersRequestOrderBy] - - project_id: Optional[str] - """ - ID of the Project. - """ - - -@dataclass -class ListGrafanaUsersResponse: - """ - Response returned when listing Grafana users. - """ - - total_count: int - """ - Count of all Grafana users. - """ - - grafana_users: List[GrafanaUser] - """ - Information on all Grafana users. - """ - - -@dataclass -class ListPlansRequest: - """ - Request to list all pricing plans. - """ - - page: Optional[int] - """ - Page number. - """ - - page_size: Optional[int] - """ - Page size. - """ - - order_by: Optional[ListPlansRequestOrderBy] - - -@dataclass -class ListPlansResponse: - """ - Response returned when listing all pricing plans. - """ - - total_count: int - """ - Count of all pricing plans. - """ - - plans: List[Plan] - """ - Information on plans. - """ - - -@dataclass -class ListTokensRequest: - page: Optional[int] - """ - Page number. - """ - - page_size: Optional[int] - """ - Page size. - """ - - order_by: Optional[ListTokensRequestOrderBy] - """ - How the response is ordered. - """ - - project_id: Optional[str] - """ - ID of the Project. - """ - - -@dataclass -class ListTokensResponse: - total_count: int - """ - Count of all tokens created. - """ - - tokens: List[Token] - """ - List of all tokens created. - """ - - -@dataclass -class ResetGrafanaUserPasswordRequest: - """ - Request to reset a Grafana user's password. - """ - - project_id: Optional[str] - """ - ID of the Project. - """ - - grafana_user_id: int - """ - ID of the Grafana user. - """ - - -@dataclass -class SelectPlanRequest: - """ - Request to select a specific pricing plan. - """ - - plan_id: str - """ - ID of the pricing plan. - """ - - project_id: Optional[str] - """ - ID of the Project. - """ - - -@dataclass -class SelectPlanResponse: - """ - Response returned when selecting a pricing plan. - """ - - pass - - -@dataclass -class TriggerTestAlertRequest: - project_id: Optional[str] diff --git a/scaleway-async/scaleway_async/document_db/__init__.py b/scaleway-async/scaleway_async/document_db/__init__.py deleted file mode 100644 index 8b74a5ed7..000000000 --- a/scaleway-async/scaleway_async/document_db/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -# This file was automatically generated. DO NOT EDIT. -# If you have any remark or suggestion do not hesitate to open an issue. diff --git a/scaleway-async/scaleway_async/document_db/v1beta1/__init__.py b/scaleway-async/scaleway_async/document_db/v1beta1/__init__.py deleted file mode 100644 index ad0e61c0a..000000000 --- a/scaleway-async/scaleway_async/document_db/v1beta1/__init__.py +++ /dev/null @@ -1,263 +0,0 @@ -# This file was automatically generated. DO NOT EDIT. -# If you have any remark or suggestion do not hesitate to open an issue. -from .types import ACLRuleAction -from .types import ACLRuleDirection -from .types import ACLRuleProtocol -from .types import EngineSettingPropertyType -from .types import InstanceLogStatus -from .content import INSTANCE_LOG_TRANSIENT_STATUSES -from .types import InstanceStatus -from .content import INSTANCE_TRANSIENT_STATUSES -from .types import ListDatabasesRequestOrderBy -from .types import ListInstanceLogsRequestOrderBy -from .types import ListInstancesRequestOrderBy -from .types import ListPrivilegesRequestOrderBy -from .types import ListSnapshotsRequestOrderBy -from .types import ListUsersRequestOrderBy -from .types import MaintenanceStatus -from .content import MAINTENANCE_TRANSIENT_STATUSES -from .types import NodeTypeGeneration -from .types import NodeTypeStock -from .types import Permission -from .types import ReadReplicaStatus -from .content import READ_REPLICA_TRANSIENT_STATUSES -from .types import SnapshotStatus -from .content import SNAPSHOT_TRANSIENT_STATUSES -from .types import StorageClass -from .types import VolumeType -from .types import EndpointDirectAccessDetails -from .types import EndpointLoadBalancerDetails -from .types import EndpointPrivateNetworkDetails -from .types import EndpointSpecPrivateNetworkIpamConfig -from .types import ReadReplicaEndpointSpecPrivateNetworkIpamConfig -from .types import EngineSetting -from .types import Endpoint -from .types import EndpointSpecLoadBalancer -from .types import EndpointSpecPrivateNetwork -from .types import ReadReplicaEndpointSpecDirectAccess -from .types import ReadReplicaEndpointSpecPrivateNetwork -from .types import EngineVersion -from .types import BackupSchedule -from .types import InstanceSetting -from .types import LogsPolicy -from .types import Maintenance -from .types import ReadReplica -from .types import UpgradableVersion -from .types import Volume -from .types import NodeTypeVolumeConstraintSizes -from .types import NodeTypeVolumeType -from .types import SnapshotVolumeType -from .types import ACLRuleRequest -from .types import ACLRule -from .types import EndpointSpec -from .types import ReadReplicaEndpointSpec -from .types import DatabaseEngine -from .types import Database -from .types import ListInstanceLogsDetailsResponseInstanceLogDetail -from .types import InstanceLog -from .types import Instance -from .types import NodeType -from .types import Privilege -from .types import Snapshot -from .types import User -from .types import UpgradeInstanceRequestMajorUpgradeWorkflow -from .types import AddInstanceACLRulesRequest -from .types import AddInstanceACLRulesResponse -from .types import AddInstanceSettingsRequest -from .types import AddInstanceSettingsResponse -from .types import ApplyInstanceMaintenanceRequest -from .types import CloneInstanceRequest -from .types import CreateDatabaseRequest -from .types import CreateEndpointRequest -from .types import CreateInstanceFromSnapshotRequest -from .types import CreateInstanceRequest -from .types import CreateReadReplicaEndpointRequest -from .types import CreateReadReplicaRequest -from .types import CreateSnapshotRequest -from .types import CreateUserRequest -from .types import DeleteDatabaseRequest -from .types import DeleteEndpointRequest -from .types import DeleteInstanceACLRulesRequest -from .types import DeleteInstanceACLRulesResponse -from .types import DeleteInstanceRequest -from .types import DeleteInstanceSettingsRequest -from .types import DeleteInstanceSettingsResponse -from .types import DeleteReadReplicaRequest -from .types import DeleteSnapshotRequest -from .types import DeleteUserRequest -from .types import GetEndpointRequest -from .types import GetInstanceCertificateRequest -from .types import GetInstanceLogRequest -from .types import GetInstanceMetricsRequest -from .types import GetInstanceRequest -from .types import GetReadReplicaRequest -from .types import GetSnapshotRequest -from .types import InstanceMetrics -from .types import ListDatabaseEnginesRequest -from .types import ListDatabaseEnginesResponse -from .types import ListDatabasesRequest -from .types import ListDatabasesResponse -from .types import ListInstanceACLRulesRequest -from .types import ListInstanceACLRulesResponse -from .types import ListInstanceLogsDetailsRequest -from .types import ListInstanceLogsDetailsResponse -from .types import ListInstanceLogsRequest -from .types import ListInstanceLogsResponse -from .types import ListInstancesRequest -from .types import ListInstancesResponse -from .types import ListNodeTypesRequest -from .types import ListNodeTypesResponse -from .types import ListPrivilegesRequest -from .types import ListPrivilegesResponse -from .types import ListSnapshotsRequest -from .types import ListSnapshotsResponse -from .types import ListUsersRequest -from .types import ListUsersResponse -from .types import MigrateEndpointRequest -from .types import PromoteReadReplicaRequest -from .types import PurgeInstanceLogsRequest -from .types import RenewInstanceCertificateRequest -from .types import ResetReadReplicaRequest -from .types import RestartInstanceRequest -from .types import SetInstanceACLRulesRequest -from .types import SetInstanceACLRulesResponse -from .types import SetInstanceSettingsRequest -from .types import SetInstanceSettingsResponse -from .types import SetPrivilegeRequest -from .types import UpdateInstanceRequest -from .types import UpdateSnapshotRequest -from .types import UpdateUserRequest -from .types import UpgradeInstanceRequest -from .api import DocumentDbV1Beta1API - -__all__ = [ - "ACLRuleAction", - "ACLRuleDirection", - "ACLRuleProtocol", - "EngineSettingPropertyType", - "InstanceLogStatus", - "INSTANCE_LOG_TRANSIENT_STATUSES", - "InstanceStatus", - "INSTANCE_TRANSIENT_STATUSES", - "ListDatabasesRequestOrderBy", - "ListInstanceLogsRequestOrderBy", - "ListInstancesRequestOrderBy", - "ListPrivilegesRequestOrderBy", - "ListSnapshotsRequestOrderBy", - "ListUsersRequestOrderBy", - "MaintenanceStatus", - "MAINTENANCE_TRANSIENT_STATUSES", - "NodeTypeGeneration", - "NodeTypeStock", - "Permission", - "ReadReplicaStatus", - "READ_REPLICA_TRANSIENT_STATUSES", - "SnapshotStatus", - "SNAPSHOT_TRANSIENT_STATUSES", - "StorageClass", - "VolumeType", - "EndpointDirectAccessDetails", - "EndpointLoadBalancerDetails", - "EndpointPrivateNetworkDetails", - "EndpointSpecPrivateNetworkIpamConfig", - "ReadReplicaEndpointSpecPrivateNetworkIpamConfig", - "EngineSetting", - "Endpoint", - "EndpointSpecLoadBalancer", - "EndpointSpecPrivateNetwork", - "ReadReplicaEndpointSpecDirectAccess", - "ReadReplicaEndpointSpecPrivateNetwork", - "EngineVersion", - "BackupSchedule", - "InstanceSetting", - "LogsPolicy", - "Maintenance", - "ReadReplica", - "UpgradableVersion", - "Volume", - "NodeTypeVolumeConstraintSizes", - "NodeTypeVolumeType", - "SnapshotVolumeType", - "ACLRuleRequest", - "ACLRule", - "EndpointSpec", - "ReadReplicaEndpointSpec", - "DatabaseEngine", - "Database", - "ListInstanceLogsDetailsResponseInstanceLogDetail", - "InstanceLog", - "Instance", - "NodeType", - "Privilege", - "Snapshot", - "User", - "UpgradeInstanceRequestMajorUpgradeWorkflow", - "AddInstanceACLRulesRequest", - "AddInstanceACLRulesResponse", - "AddInstanceSettingsRequest", - "AddInstanceSettingsResponse", - "ApplyInstanceMaintenanceRequest", - "CloneInstanceRequest", - "CreateDatabaseRequest", - "CreateEndpointRequest", - "CreateInstanceFromSnapshotRequest", - "CreateInstanceRequest", - "CreateReadReplicaEndpointRequest", - "CreateReadReplicaRequest", - "CreateSnapshotRequest", - "CreateUserRequest", - "DeleteDatabaseRequest", - "DeleteEndpointRequest", - "DeleteInstanceACLRulesRequest", - "DeleteInstanceACLRulesResponse", - "DeleteInstanceRequest", - "DeleteInstanceSettingsRequest", - "DeleteInstanceSettingsResponse", - "DeleteReadReplicaRequest", - "DeleteSnapshotRequest", - "DeleteUserRequest", - "GetEndpointRequest", - "GetInstanceCertificateRequest", - "GetInstanceLogRequest", - "GetInstanceMetricsRequest", - "GetInstanceRequest", - "GetReadReplicaRequest", - "GetSnapshotRequest", - "InstanceMetrics", - "ListDatabaseEnginesRequest", - "ListDatabaseEnginesResponse", - "ListDatabasesRequest", - "ListDatabasesResponse", - "ListInstanceACLRulesRequest", - "ListInstanceACLRulesResponse", - "ListInstanceLogsDetailsRequest", - "ListInstanceLogsDetailsResponse", - "ListInstanceLogsRequest", - "ListInstanceLogsResponse", - "ListInstancesRequest", - "ListInstancesResponse", - "ListNodeTypesRequest", - "ListNodeTypesResponse", - "ListPrivilegesRequest", - "ListPrivilegesResponse", - "ListSnapshotsRequest", - "ListSnapshotsResponse", - "ListUsersRequest", - "ListUsersResponse", - "MigrateEndpointRequest", - "PromoteReadReplicaRequest", - "PurgeInstanceLogsRequest", - "RenewInstanceCertificateRequest", - "ResetReadReplicaRequest", - "RestartInstanceRequest", - "SetInstanceACLRulesRequest", - "SetInstanceACLRulesResponse", - "SetInstanceSettingsRequest", - "SetInstanceSettingsResponse", - "SetPrivilegeRequest", - "UpdateInstanceRequest", - "UpdateSnapshotRequest", - "UpdateUserRequest", - "UpgradeInstanceRequest", - "DocumentDbV1Beta1API", -] diff --git a/scaleway-async/scaleway_async/document_db/v1beta1/api.py b/scaleway-async/scaleway_async/document_db/v1beta1/api.py deleted file mode 100644 index 408a77643..000000000 --- a/scaleway-async/scaleway_async/document_db/v1beta1/api.py +++ /dev/null @@ -1,2846 +0,0 @@ -# This file was automatically generated. DO NOT EDIT. -# If you have any remark or suggestion do not hesitate to open an issue. - -from datetime import datetime -from typing import Awaitable, List, Optional, Union - -from scaleway_core.api import API -from scaleway_core.bridge import ( - Region, - ScwFile, - unmarshal_ScwFile, -) -from scaleway_core.utils import ( - WaitForOptions, - random_name, - validate_path_param, - fetch_all_pages_async, - wait_for_resource_async, -) -from .types import ( - ListDatabasesRequestOrderBy, - ListInstanceLogsRequestOrderBy, - ListInstancesRequestOrderBy, - ListPrivilegesRequestOrderBy, - ListSnapshotsRequestOrderBy, - ListUsersRequestOrderBy, - Permission, - VolumeType, - ACLRule, - ACLRuleRequest, - AddInstanceACLRulesRequest, - AddInstanceACLRulesResponse, - AddInstanceSettingsRequest, - AddInstanceSettingsResponse, - CloneInstanceRequest, - CreateDatabaseRequest, - CreateEndpointRequest, - CreateInstanceFromSnapshotRequest, - CreateInstanceRequest, - CreateReadReplicaEndpointRequest, - CreateReadReplicaRequest, - CreateSnapshotRequest, - CreateUserRequest, - Database, - DatabaseEngine, - DeleteInstanceACLRulesRequest, - DeleteInstanceACLRulesResponse, - DeleteInstanceSettingsRequest, - DeleteInstanceSettingsResponse, - Endpoint, - EndpointSpec, - Instance, - InstanceLog, - InstanceMetrics, - InstanceSetting, - ListDatabaseEnginesResponse, - ListDatabasesResponse, - ListInstanceACLRulesResponse, - ListInstanceLogsDetailsResponse, - ListInstanceLogsResponse, - ListInstancesResponse, - ListNodeTypesResponse, - ListPrivilegesResponse, - ListSnapshotsResponse, - ListUsersResponse, - LogsPolicy, - Maintenance, - MigrateEndpointRequest, - NodeType, - Privilege, - PurgeInstanceLogsRequest, - ReadReplica, - ReadReplicaEndpointSpec, - SetInstanceACLRulesRequest, - SetInstanceACLRulesResponse, - SetInstanceSettingsRequest, - SetInstanceSettingsResponse, - SetPrivilegeRequest, - Snapshot, - UpdateInstanceRequest, - UpdateSnapshotRequest, - UpdateUserRequest, - UpgradeInstanceRequest, - UpgradeInstanceRequestMajorUpgradeWorkflow, - User, -) -from .content import ( - INSTANCE_LOG_TRANSIENT_STATUSES, - INSTANCE_TRANSIENT_STATUSES, - READ_REPLICA_TRANSIENT_STATUSES, - SNAPSHOT_TRANSIENT_STATUSES, -) -from .marshalling import ( - unmarshal_Endpoint, - unmarshal_Maintenance, - unmarshal_ReadReplica, - unmarshal_Database, - unmarshal_InstanceLog, - unmarshal_Instance, - unmarshal_Privilege, - unmarshal_Snapshot, - unmarshal_User, - unmarshal_AddInstanceACLRulesResponse, - unmarshal_AddInstanceSettingsResponse, - unmarshal_DeleteInstanceACLRulesResponse, - unmarshal_DeleteInstanceSettingsResponse, - unmarshal_InstanceMetrics, - unmarshal_ListDatabaseEnginesResponse, - unmarshal_ListDatabasesResponse, - unmarshal_ListInstanceACLRulesResponse, - unmarshal_ListInstanceLogsDetailsResponse, - unmarshal_ListInstanceLogsResponse, - unmarshal_ListInstancesResponse, - unmarshal_ListNodeTypesResponse, - unmarshal_ListPrivilegesResponse, - unmarshal_ListSnapshotsResponse, - unmarshal_ListUsersResponse, - unmarshal_SetInstanceACLRulesResponse, - unmarshal_SetInstanceSettingsResponse, - marshal_AddInstanceACLRulesRequest, - marshal_AddInstanceSettingsRequest, - marshal_CloneInstanceRequest, - marshal_CreateDatabaseRequest, - marshal_CreateEndpointRequest, - marshal_CreateInstanceFromSnapshotRequest, - marshal_CreateInstanceRequest, - marshal_CreateReadReplicaEndpointRequest, - marshal_CreateReadReplicaRequest, - marshal_CreateSnapshotRequest, - marshal_CreateUserRequest, - marshal_DeleteInstanceACLRulesRequest, - marshal_DeleteInstanceSettingsRequest, - marshal_MigrateEndpointRequest, - marshal_PurgeInstanceLogsRequest, - marshal_SetInstanceACLRulesRequest, - marshal_SetInstanceSettingsRequest, - marshal_SetPrivilegeRequest, - marshal_UpdateInstanceRequest, - marshal_UpdateSnapshotRequest, - marshal_UpdateUserRequest, - marshal_UpgradeInstanceRequest, -) - - -class DocumentDbV1Beta1API(API): - """ - This API allows you to manage your Document Databases. - """ - - async def list_database_engines( - self, - *, - region: Optional[Region] = None, - name: Optional[str] = None, - version: Optional[str] = None, - page: Optional[int] = None, - page_size: Optional[int] = None, - ) -> ListDatabaseEnginesResponse: - """ - List available database engines. - List the FerretDB database engines available at Scaleway. - :param region: Region to target. If none is passed will use default region from the config. - :param name: Name of the database engine. - :param version: Version of the database engine. - :param page: - :param page_size: - :return: :class:`ListDatabaseEnginesResponse ` - - Usage: - :: - - result = await api.list_database_engines() - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - - res = self._request( - "GET", - f"/document-db/v1beta1/regions/{param_region}/database-engines", - params={ - "name": name, - "page": page, - "page_size": page_size or self.client.default_page_size, - "version": version, - }, - ) - - self._throw_on_error(res) - return unmarshal_ListDatabaseEnginesResponse(res.json()) - - async def list_database_engines_all( - self, - *, - region: Optional[Region] = None, - name: Optional[str] = None, - version: Optional[str] = None, - page: Optional[int] = None, - page_size: Optional[int] = None, - ) -> List[DatabaseEngine]: - """ - List available database engines. - List the FerretDB database engines available at Scaleway. - :param region: Region to target. If none is passed will use default region from the config. - :param name: Name of the database engine. - :param version: Version of the database engine. - :param page: - :param page_size: - :return: :class:`List[DatabaseEngine] ` - - Usage: - :: - - result = await api.list_database_engines_all() - """ - - return await fetch_all_pages_async( - type=ListDatabaseEnginesResponse, - key="engines", - fetcher=self.list_database_engines, - args={ - "region": region, - "name": name, - "version": version, - "page": page, - "page_size": page_size, - }, - ) - - async def list_node_types( - self, - *, - include_disabled_types: bool, - region: Optional[Region] = None, - page: Optional[int] = None, - page_size: Optional[int] = None, - ) -> ListNodeTypesResponse: - """ - List available node types. - List all available node types. By default, the node types returned in the list are ordered by creation date in ascending order, though this can be modified via the `order_by` field. - :param include_disabled_types: Defines whether or not to include disabled types. - :param region: Region to target. If none is passed will use default region from the config. - :param page: - :param page_size: - :return: :class:`ListNodeTypesResponse ` - - Usage: - :: - - result = await api.list_node_types( - include_disabled_types=False, - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - - res = self._request( - "GET", - f"/document-db/v1beta1/regions/{param_region}/node-types", - params={ - "include_disabled_types": include_disabled_types, - "page": page, - "page_size": page_size or self.client.default_page_size, - }, - ) - - self._throw_on_error(res) - return unmarshal_ListNodeTypesResponse(res.json()) - - async def list_node_types_all( - self, - *, - include_disabled_types: bool, - region: Optional[Region] = None, - page: Optional[int] = None, - page_size: Optional[int] = None, - ) -> List[NodeType]: - """ - List available node types. - List all available node types. By default, the node types returned in the list are ordered by creation date in ascending order, though this can be modified via the `order_by` field. - :param include_disabled_types: Defines whether or not to include disabled types. - :param region: Region to target. If none is passed will use default region from the config. - :param page: - :param page_size: - :return: :class:`List[NodeType] ` - - Usage: - :: - - result = await api.list_node_types_all( - include_disabled_types=False, - ) - """ - - return await fetch_all_pages_async( - type=ListNodeTypesResponse, - key="node_types", - fetcher=self.list_node_types, - args={ - "include_disabled_types": include_disabled_types, - "region": region, - "page": page, - "page_size": page_size, - }, - ) - - async def upgrade_instance( - self, - *, - instance_id: str, - region: Optional[Region] = None, - node_type: Optional[str] = None, - enable_ha: Optional[bool] = None, - volume_size: Optional[int] = None, - volume_type: Optional[VolumeType] = None, - upgradable_version_id: Optional[str] = None, - major_upgrade_workflow: Optional[ - UpgradeInstanceRequestMajorUpgradeWorkflow - ] = None, - ) -> Instance: - """ - Upgrade a Database Instance. - Upgrade your current Database Instance specifications like node type, high availability, volume, or the database engine version. Note that upon upgrade the `enable_ha` parameter can only be set to `true`. - :param instance_id: UUID of the Database Instance you want to upgrade. - :param region: Region to target. If none is passed will use default region from the config. - :param node_type: Node type of the Database Instance you want to upgrade to. - One-Of ('upgrade_target'): at most one of 'node_type', 'enable_ha', 'volume_size', 'volume_type', 'upgradable_version_id', 'major_upgrade_workflow' could be set. - :param enable_ha: Defines whether or not High Availability should be enabled on the Database Instance. - One-Of ('upgrade_target'): at most one of 'node_type', 'enable_ha', 'volume_size', 'volume_type', 'upgradable_version_id', 'major_upgrade_workflow' could be set. - :param volume_size: Increase your Block volume size. - One-Of ('upgrade_target'): at most one of 'node_type', 'enable_ha', 'volume_size', 'volume_type', 'upgradable_version_id', 'major_upgrade_workflow' could be set. - :param volume_type: Change your Database Instance storage type. - One-Of ('upgrade_target'): at most one of 'node_type', 'enable_ha', 'volume_size', 'volume_type', 'upgradable_version_id', 'major_upgrade_workflow' could be set. - :param upgradable_version_id: This will create a new Database Instance with same specifications as the current one and perform a Database Engine upgrade. - One-Of ('upgrade_target'): at most one of 'node_type', 'enable_ha', 'volume_size', 'volume_type', 'upgradable_version_id', 'major_upgrade_workflow' could be set. - :param major_upgrade_workflow: Upgrade your database engine to a new major version including instance endpoints. - One-Of ('upgrade_target'): at most one of 'node_type', 'enable_ha', 'volume_size', 'volume_type', 'upgradable_version_id', 'major_upgrade_workflow' could be set. - :return: :class:`Instance ` - - Usage: - :: - - result = await api.upgrade_instance( - instance_id="example", - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_instance_id = validate_path_param("instance_id", instance_id) - - res = self._request( - "POST", - f"/document-db/v1beta1/regions/{param_region}/instances/{param_instance_id}/upgrade", - body=marshal_UpgradeInstanceRequest( - UpgradeInstanceRequest( - instance_id=instance_id, - region=region, - node_type=node_type, - enable_ha=enable_ha, - volume_size=volume_size, - volume_type=volume_type, - upgradable_version_id=upgradable_version_id, - major_upgrade_workflow=major_upgrade_workflow, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_Instance(res.json()) - - async def list_instances( - self, - *, - region: Optional[Region] = None, - tags: Optional[List[str]] = None, - name: Optional[str] = None, - order_by: Optional[ListInstancesRequestOrderBy] = None, - organization_id: Optional[str] = None, - project_id: Optional[str] = None, - page: Optional[int] = None, - page_size: Optional[int] = None, - ) -> ListInstancesResponse: - """ - List Database Instances. - List all Database Instances in the specified region, for a given Scaleway Organization or Scaleway Project. By default, the Database Instances returned in the list are ordered by creation date in ascending order, though this can be modified via the order_by field. You can define additional parameters for your query, such as `tags` and `name`. For the `name` parameter, the value you include will be checked against the whole name string to see if it includes the string you put in the parameter. - :param region: Region to target. If none is passed will use default region from the config. - :param tags: List Database Instances that have a given tag. - :param name: Lists Database Instances that match a name pattern. - :param order_by: Criteria to use when ordering Database Instance listings. - :param organization_id: Please use project_id instead. - :param project_id: Project ID to list the Database Instance of. - :param page: - :param page_size: - :return: :class:`ListInstancesResponse ` - - Usage: - :: - - result = await api.list_instances() - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - - res = self._request( - "GET", - f"/document-db/v1beta1/regions/{param_region}/instances", - params={ - "name": name, - "order_by": order_by, - "organization_id": organization_id - or self.client.default_organization_id, - "page": page, - "page_size": page_size or self.client.default_page_size, - "project_id": project_id or self.client.default_project_id, - "tags": tags, - }, - ) - - self._throw_on_error(res) - return unmarshal_ListInstancesResponse(res.json()) - - async def list_instances_all( - self, - *, - region: Optional[Region] = None, - tags: Optional[List[str]] = None, - name: Optional[str] = None, - order_by: Optional[ListInstancesRequestOrderBy] = None, - organization_id: Optional[str] = None, - project_id: Optional[str] = None, - page: Optional[int] = None, - page_size: Optional[int] = None, - ) -> List[Instance]: - """ - List Database Instances. - List all Database Instances in the specified region, for a given Scaleway Organization or Scaleway Project. By default, the Database Instances returned in the list are ordered by creation date in ascending order, though this can be modified via the order_by field. You can define additional parameters for your query, such as `tags` and `name`. For the `name` parameter, the value you include will be checked against the whole name string to see if it includes the string you put in the parameter. - :param region: Region to target. If none is passed will use default region from the config. - :param tags: List Database Instances that have a given tag. - :param name: Lists Database Instances that match a name pattern. - :param order_by: Criteria to use when ordering Database Instance listings. - :param organization_id: Please use project_id instead. - :param project_id: Project ID to list the Database Instance of. - :param page: - :param page_size: - :return: :class:`List[Instance] ` - - Usage: - :: - - result = await api.list_instances_all() - """ - - return await fetch_all_pages_async( - type=ListInstancesResponse, - key="instances", - fetcher=self.list_instances, - args={ - "region": region, - "tags": tags, - "name": name, - "order_by": order_by, - "organization_id": organization_id, - "project_id": project_id, - "page": page, - "page_size": page_size, - }, - ) - - async def get_instance( - self, - *, - instance_id: str, - region: Optional[Region] = None, - ) -> Instance: - """ - Get a Database Instance. - Retrieve information about a given Database Instance, specified by the `region` and `instance_id` parameters. Its full details, including name, status, IP address and port, are returned in the response object. - :param instance_id: UUID of the Database Instance. - :param region: Region to target. If none is passed will use default region from the config. - :return: :class:`Instance ` - - Usage: - :: - - result = await api.get_instance( - instance_id="example", - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_instance_id = validate_path_param("instance_id", instance_id) - - res = self._request( - "GET", - f"/document-db/v1beta1/regions/{param_region}/instances/{param_instance_id}", - ) - - self._throw_on_error(res) - return unmarshal_Instance(res.json()) - - async def wait_for_instance( - self, - *, - instance_id: str, - region: Optional[Region] = None, - options: Optional[ - WaitForOptions[Instance, Union[bool, Awaitable[bool]]] - ] = None, - ) -> Instance: - """ - Get a Database Instance. - Retrieve information about a given Database Instance, specified by the `region` and `instance_id` parameters. Its full details, including name, status, IP address and port, are returned in the response object. - :param instance_id: UUID of the Database Instance. - :param region: Region to target. If none is passed will use default region from the config. - :return: :class:`Instance ` - - Usage: - :: - - result = await api.get_instance( - instance_id="example", - ) - """ - - if not options: - options = WaitForOptions() - - if not options.stop: - options.stop = lambda res: res.status not in INSTANCE_TRANSIENT_STATUSES - - return await wait_for_resource_async( - fetcher=self.get_instance, - options=options, - args={ - "instance_id": instance_id, - "region": region, - }, - ) - - async def create_instance( - self, - *, - engine: str, - user_name: str, - password: str, - node_type: str, - region: Optional[Region] = None, - organization_id: Optional[str] = None, - project_id: Optional[str] = None, - name: Optional[str] = None, - is_ha_cluster: bool, - disable_backup: bool, - volume_size: int, - backup_same_region: bool, - tags: Optional[List[str]] = None, - init_settings: Optional[List[InstanceSetting]] = None, - volume_type: Optional[VolumeType] = None, - init_endpoints: Optional[List[EndpointSpec]] = None, - ) -> Instance: - """ - Create a Database Instance. - Create a new Database Instance. You must set the `engine`, `user_name`, `password` and `node_type` parameters. Optionally, you can specify the volume type and size. - :param engine: Database engine of the Database Instance. - :param user_name: Username created when the Database Instance is created. - :param password: Password of the user. - :param node_type: Type of node to use for the Database Instance. - :param region: Region to target. If none is passed will use default region from the config. - :param organization_id: Please use project_id instead. - One-Of ('project_identifier'): at most one of 'organization_id', 'project_id' could be set. - :param project_id: The Project ID on which the Database Instance will be created. - One-Of ('project_identifier'): at most one of 'organization_id', 'project_id' could be set. - :param name: Name of the Database Instance. - :param is_ha_cluster: Defines whether or not High-Availability is enabled. - :param disable_backup: Defines whether or not backups are disabled. - :param volume_size: Volume size when volume_type is not lssd. - :param backup_same_region: Defines whether to or not to store logical backups in the same region as the Database Instance. - :param tags: Tags to apply to the Database Instance. - :param init_settings: List of engine settings to be set upon Database Instance initialization. - :param volume_type: Type of volume where data is stored (lssd, bssd, ...). - :param init_endpoints: One or multiple EndpointSpec used to expose your Database Instance. A load_balancer public endpoint is systematically created. - :return: :class:`Instance ` - - Usage: - :: - - result = await api.create_instance( - engine="example", - user_name="example", - password="example", - node_type="example", - is_ha_cluster=False, - disable_backup=False, - volume_size=1, - backup_same_region=False, - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - - res = self._request( - "POST", - f"/document-db/v1beta1/regions/{param_region}/instances", - body=marshal_CreateInstanceRequest( - CreateInstanceRequest( - engine=engine, - user_name=user_name, - password=password, - node_type=node_type, - region=region, - name=name or random_name(prefix="ins"), - is_ha_cluster=is_ha_cluster, - disable_backup=disable_backup, - volume_size=volume_size, - backup_same_region=backup_same_region, - tags=tags, - init_settings=init_settings, - volume_type=volume_type, - init_endpoints=init_endpoints, - organization_id=organization_id, - project_id=project_id, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_Instance(res.json()) - - async def update_instance( - self, - *, - instance_id: str, - region: Optional[Region] = None, - backup_schedule_frequency: Optional[int] = None, - backup_schedule_retention: Optional[int] = None, - is_backup_schedule_disabled: Optional[bool] = None, - name: Optional[str] = None, - tags: Optional[List[str]] = None, - logs_policy: Optional[LogsPolicy] = None, - backup_same_region: Optional[bool] = None, - backup_schedule_start_hour: Optional[int] = None, - ) -> Instance: - """ - Update a Database Instance. - Update the parameters of a Database Instance, including name, tags and backup schedule details. - :param instance_id: UUID of the Database Instance to update. - :param region: Region to target. If none is passed will use default region from the config. - :param backup_schedule_frequency: In hours. - :param backup_schedule_retention: In days. - :param is_backup_schedule_disabled: Defines whether or not the backup schedule is disabled. - :param name: Name of the Database Instance. - :param tags: Tags of a Database Instance. - :param logs_policy: Logs policy of the Database Instance. - :param backup_same_region: Store logical backups in the same region as the Database Instance. - :param backup_schedule_start_hour: Defines the start time of the autobackup. - :return: :class:`Instance ` - - Usage: - :: - - result = await api.update_instance( - instance_id="example", - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_instance_id = validate_path_param("instance_id", instance_id) - - res = self._request( - "PATCH", - f"/document-db/v1beta1/regions/{param_region}/instances/{param_instance_id}", - body=marshal_UpdateInstanceRequest( - UpdateInstanceRequest( - instance_id=instance_id, - region=region, - backup_schedule_frequency=backup_schedule_frequency, - backup_schedule_retention=backup_schedule_retention, - is_backup_schedule_disabled=is_backup_schedule_disabled, - name=name, - tags=tags, - logs_policy=logs_policy, - backup_same_region=backup_same_region, - backup_schedule_start_hour=backup_schedule_start_hour, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_Instance(res.json()) - - async def delete_instance( - self, - *, - instance_id: str, - region: Optional[Region] = None, - ) -> Instance: - """ - Delete a Database Instance. - Delete a given Database Instance, specified by the `region` and `instance_id` parameters. Deleting a Database Instance is permanent, and cannot be undone. Note that upon deletion all your data will be lost. - :param instance_id: UUID of the Database Instance to delete. - :param region: Region to target. If none is passed will use default region from the config. - :return: :class:`Instance ` - - Usage: - :: - - result = await api.delete_instance( - instance_id="example", - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_instance_id = validate_path_param("instance_id", instance_id) - - res = self._request( - "DELETE", - f"/document-db/v1beta1/regions/{param_region}/instances/{param_instance_id}", - ) - - self._throw_on_error(res) - return unmarshal_Instance(res.json()) - - async def clone_instance( - self, - *, - instance_id: str, - name: str, - region: Optional[Region] = None, - node_type: Optional[str] = None, - ) -> Instance: - """ - Clone a Database Instance. - Clone a given Database Instance, specified by the `region` and `instance_id` parameters. The clone feature allows you to create a new Database Instance from an existing one. The clone includes all existing databases, users and permissions. You can create a clone on a Database Instance bigger than your current one. - :param instance_id: UUID of the Database Instance you want to clone. - :param name: Name of the Database Instance clone. - :param region: Region to target. If none is passed will use default region from the config. - :param node_type: Node type of the clone. - :return: :class:`Instance ` - - Usage: - :: - - result = await api.clone_instance( - instance_id="example", - name="example", - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_instance_id = validate_path_param("instance_id", instance_id) - - res = self._request( - "POST", - f"/document-db/v1beta1/regions/{param_region}/instances/{param_instance_id}/clone", - body=marshal_CloneInstanceRequest( - CloneInstanceRequest( - instance_id=instance_id, - name=name, - region=region, - node_type=node_type, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_Instance(res.json()) - - async def restart_instance( - self, - *, - instance_id: str, - region: Optional[Region] = None, - ) -> Instance: - """ - Restart Database Instance. - Restart a given Database Instance, specified by the `region` and `instance_id` parameters. The status of the Database Instance returned in the response. - :param instance_id: UUID of the Database Instance you want to restart. - :param region: Region to target. If none is passed will use default region from the config. - :return: :class:`Instance ` - - Usage: - :: - - result = await api.restart_instance( - instance_id="example", - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_instance_id = validate_path_param("instance_id", instance_id) - - res = self._request( - "POST", - f"/document-db/v1beta1/regions/{param_region}/instances/{param_instance_id}/restart", - body={}, - ) - - self._throw_on_error(res) - return unmarshal_Instance(res.json()) - - async def get_instance_certificate( - self, - *, - instance_id: str, - region: Optional[Region] = None, - ) -> ScwFile: - """ - Get the TLS certificate of a Database Instance. - Retrieve information about the TLS certificate of a given Database Instance. Details like name and content are returned in the response. - :param instance_id: UUID of the Database Instance. - :param region: Region to target. If none is passed will use default region from the config. - :return: :class:`ScwFile ` - - Usage: - :: - - result = await api.get_instance_certificate( - instance_id="example", - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_instance_id = validate_path_param("instance_id", instance_id) - - res = self._request( - "GET", - f"/document-db/v1beta1/regions/{param_region}/instances/{param_instance_id}/certificate", - ) - - self._throw_on_error(res) - return unmarshal_ScwFile(res.json()) - - async def renew_instance_certificate( - self, - *, - instance_id: str, - region: Optional[Region] = None, - ) -> None: - """ - Renew the TLS certificate of a Database Instance. - Renew a TLS for a Database Instance. Renewing a certificate means that you will not be able to connect to your Database Instance using the previous certificate. You will also need to download and update the new certificate for all database clients. - :param instance_id: UUID of the Database Instance you want logs of. - :param region: Region to target. If none is passed will use default region from the config. - - Usage: - :: - - result = await api.renew_instance_certificate( - instance_id="example", - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_instance_id = validate_path_param("instance_id", instance_id) - - res = self._request( - "POST", - f"/document-db/v1beta1/regions/{param_region}/instances/{param_instance_id}/renew-certificate", - body={}, - ) - - self._throw_on_error(res) - - async def get_instance_metrics( - self, - *, - instance_id: str, - region: Optional[Region] = None, - start_date: Optional[datetime] = None, - end_date: Optional[datetime] = None, - metric_name: Optional[str] = None, - ) -> InstanceMetrics: - """ - Get Database Instance metrics. - Retrieve the time series metrics of a given Database Instance. You can define the period from which to retrieve metrics by specifying the `start_date` and `end_date`. - :param instance_id: UUID of the Database Instance. - :param region: Region to target. If none is passed will use default region from the config. - :param start_date: Start date to gather metrics from. - :param end_date: End date to gather metrics from. - :param metric_name: Name of the metric to gather. - :return: :class:`InstanceMetrics ` - - Usage: - :: - - result = await api.get_instance_metrics( - instance_id="example", - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_instance_id = validate_path_param("instance_id", instance_id) - - res = self._request( - "GET", - f"/document-db/v1beta1/regions/{param_region}/instances/{param_instance_id}/metrics", - params={ - "end_date": end_date, - "metric_name": metric_name, - "start_date": start_date, - }, - ) - - self._throw_on_error(res) - return unmarshal_InstanceMetrics(res.json()) - - async def create_read_replica( - self, - *, - instance_id: str, - region: Optional[Region] = None, - endpoint_spec: Optional[List[ReadReplicaEndpointSpec]] = None, - same_zone: Optional[bool] = None, - ) -> ReadReplica: - """ - Create a Read Replica. - Create a new Read Replica of a Database Instance. You must specify the `region` and the `instance_id`. You can only create a maximum of 3 Read Replicas per Database Instance. - :param instance_id: UUID of the Database Instance you want to create a Read Replica from. - :param region: Region to target. If none is passed will use default region from the config. - :param endpoint_spec: Specification of the endpoint you want to create. - :param same_zone: Defines whether or not to create the replica in the same Availability Zone as the main Database Instance nodes. - :return: :class:`ReadReplica ` - - Usage: - :: - - result = await api.create_read_replica( - instance_id="example", - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - - res = self._request( - "POST", - f"/document-db/v1beta1/regions/{param_region}/read-replicas", - body=marshal_CreateReadReplicaRequest( - CreateReadReplicaRequest( - instance_id=instance_id, - region=region, - endpoint_spec=endpoint_spec, - same_zone=same_zone, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_ReadReplica(res.json()) - - async def get_read_replica( - self, - *, - read_replica_id: str, - region: Optional[Region] = None, - ) -> ReadReplica: - """ - Get a Read Replica. - Retrieve information about a Database Instance Read Replica. Full details about the Read Replica, like `endpoints`, `status` and `region` are returned in the response. - :param read_replica_id: UUID of the Read Replica. - :param region: Region to target. If none is passed will use default region from the config. - :return: :class:`ReadReplica ` - - Usage: - :: - - result = await api.get_read_replica( - read_replica_id="example", - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_read_replica_id = validate_path_param("read_replica_id", read_replica_id) - - res = self._request( - "GET", - f"/document-db/v1beta1/regions/{param_region}/read-replicas/{param_read_replica_id}", - ) - - self._throw_on_error(res) - return unmarshal_ReadReplica(res.json()) - - async def wait_for_read_replica( - self, - *, - read_replica_id: str, - region: Optional[Region] = None, - options: Optional[ - WaitForOptions[ReadReplica, Union[bool, Awaitable[bool]]] - ] = None, - ) -> ReadReplica: - """ - Get a Read Replica. - Retrieve information about a Database Instance Read Replica. Full details about the Read Replica, like `endpoints`, `status` and `region` are returned in the response. - :param read_replica_id: UUID of the Read Replica. - :param region: Region to target. If none is passed will use default region from the config. - :return: :class:`ReadReplica ` - - Usage: - :: - - result = await api.get_read_replica( - read_replica_id="example", - ) - """ - - if not options: - options = WaitForOptions() - - if not options.stop: - options.stop = lambda res: res.status not in READ_REPLICA_TRANSIENT_STATUSES - - return await wait_for_resource_async( - fetcher=self.get_read_replica, - options=options, - args={ - "read_replica_id": read_replica_id, - "region": region, - }, - ) - - async def delete_read_replica( - self, - *, - read_replica_id: str, - region: Optional[Region] = None, - ) -> ReadReplica: - """ - Delete a Read Replica. - Delete a Read Replica of a Database Instance. You must specify the `region` and `read_replica_id` parameters of the Read Replica you want to delete. - :param read_replica_id: UUID of the Read Replica. - :param region: Region to target. If none is passed will use default region from the config. - :return: :class:`ReadReplica ` - - Usage: - :: - - result = await api.delete_read_replica( - read_replica_id="example", - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_read_replica_id = validate_path_param("read_replica_id", read_replica_id) - - res = self._request( - "DELETE", - f"/document-db/v1beta1/regions/{param_region}/read-replicas/{param_read_replica_id}", - ) - - self._throw_on_error(res) - return unmarshal_ReadReplica(res.json()) - - async def reset_read_replica( - self, - *, - read_replica_id: str, - region: Optional[Region] = None, - ) -> ReadReplica: - """ - Resync a Read Replica. - When you resync a Read Replica, first it is reset, then its data is resynchronized from the primary node. Your Read Replica remains unavailable during the resync process. The duration of this process is proportional to the size of your Database Instance. - The configured endpoints do not change. - :param read_replica_id: UUID of the Read Replica. - :param region: Region to target. If none is passed will use default region from the config. - :return: :class:`ReadReplica ` - - Usage: - :: - - result = await api.reset_read_replica( - read_replica_id="example", - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_read_replica_id = validate_path_param("read_replica_id", read_replica_id) - - res = self._request( - "POST", - f"/document-db/v1beta1/regions/{param_region}/read-replicas/{param_read_replica_id}/reset", - body={}, - ) - - self._throw_on_error(res) - return unmarshal_ReadReplica(res.json()) - - async def promote_read_replica( - self, - *, - read_replica_id: str, - region: Optional[Region] = None, - ) -> Instance: - """ - Promote a Read Replica. - Promote a Read Replica to Database Instance automatically. - :param read_replica_id: UUID of the Read Replica. - :param region: Region to target. If none is passed will use default region from the config. - :return: :class:`Instance ` - - Usage: - :: - - result = await api.promote_read_replica( - read_replica_id="example", - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_read_replica_id = validate_path_param("read_replica_id", read_replica_id) - - res = self._request( - "POST", - f"/document-db/v1beta1/regions/{param_region}/read-replicas/{param_read_replica_id}/promote", - body={}, - ) - - self._throw_on_error(res) - return unmarshal_Instance(res.json()) - - async def create_read_replica_endpoint( - self, - *, - read_replica_id: str, - endpoint_spec: List[ReadReplicaEndpointSpec], - region: Optional[Region] = None, - ) -> ReadReplica: - """ - Create an endpoint for a Read Replica. - Create a new endpoint for a Read Replica. Read Replicas can have at most one direct access and one Private Network endpoint. - :param read_replica_id: UUID of the Read Replica. - :param endpoint_spec: Specification of the endpoint you want to create. - :param region: Region to target. If none is passed will use default region from the config. - :return: :class:`ReadReplica ` - - Usage: - :: - - result = await api.create_read_replica_endpoint( - read_replica_id="example", - endpoint_spec=[], - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_read_replica_id = validate_path_param("read_replica_id", read_replica_id) - - res = self._request( - "POST", - f"/document-db/v1beta1/regions/{param_region}/read-replicas/{param_read_replica_id}/endpoints", - body=marshal_CreateReadReplicaEndpointRequest( - CreateReadReplicaEndpointRequest( - read_replica_id=read_replica_id, - endpoint_spec=endpoint_spec, - region=region, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_ReadReplica(res.json()) - - async def list_instance_logs( - self, - *, - instance_id: str, - region: Optional[Region] = None, - order_by: Optional[ListInstanceLogsRequestOrderBy] = None, - ) -> ListInstanceLogsResponse: - """ - List available logs of a Database Instance. - List the available logs of a Database Instance. By default, the logs returned in the list are ordered by creation date in ascending order, though this can be modified via the order_by field. - :param instance_id: UUID of the Database Instance you want logs of. - :param region: Region to target. If none is passed will use default region from the config. - :param order_by: Criteria to use when ordering Database Instance logs listing. - :return: :class:`ListInstanceLogsResponse ` - - Usage: - :: - - result = await api.list_instance_logs( - instance_id="example", - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_instance_id = validate_path_param("instance_id", instance_id) - - res = self._request( - "GET", - f"/document-db/v1beta1/regions/{param_region}/instances/{param_instance_id}/logs", - params={ - "order_by": order_by, - }, - ) - - self._throw_on_error(res) - return unmarshal_ListInstanceLogsResponse(res.json()) - - async def get_instance_log( - self, - *, - instance_log_id: str, - region: Optional[Region] = None, - ) -> InstanceLog: - """ - Get given logs of a Database Instance. - Retrieve information about the logs of a Database Instance. Specify the `instance_log_id` and `region` in your request to get information such as `download_url`, `status`, `expires_at` and `created_at` about your logs in the response. - :param instance_log_id: UUID of the instance_log you want. - :param region: Region to target. If none is passed will use default region from the config. - :return: :class:`InstanceLog ` - - Usage: - :: - - result = await api.get_instance_log( - instance_log_id="example", - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_instance_log_id = validate_path_param("instance_log_id", instance_log_id) - - res = self._request( - "GET", - f"/document-db/v1beta1/regions/{param_region}/logs/{param_instance_log_id}", - ) - - self._throw_on_error(res) - return unmarshal_InstanceLog(res.json()) - - async def wait_for_instance_log( - self, - *, - instance_log_id: str, - region: Optional[Region] = None, - options: Optional[ - WaitForOptions[InstanceLog, Union[bool, Awaitable[bool]]] - ] = None, - ) -> InstanceLog: - """ - Get given logs of a Database Instance. - Retrieve information about the logs of a Database Instance. Specify the `instance_log_id` and `region` in your request to get information such as `download_url`, `status`, `expires_at` and `created_at` about your logs in the response. - :param instance_log_id: UUID of the instance_log you want. - :param region: Region to target. If none is passed will use default region from the config. - :return: :class:`InstanceLog ` - - Usage: - :: - - result = await api.get_instance_log( - instance_log_id="example", - ) - """ - - if not options: - options = WaitForOptions() - - if not options.stop: - options.stop = lambda res: res.status not in INSTANCE_LOG_TRANSIENT_STATUSES - - return await wait_for_resource_async( - fetcher=self.get_instance_log, - options=options, - args={ - "instance_log_id": instance_log_id, - "region": region, - }, - ) - - async def purge_instance_logs( - self, - *, - instance_id: str, - region: Optional[Region] = None, - log_name: Optional[str] = None, - ) -> None: - """ - Purge remote Database Instance logs. - Purge a given remote log from a Database Instance. You can specify the `log_name` of the log you wish to clean from your Database Instance. - :param instance_id: UUID of the Database Instance you want logs of. - :param region: Region to target. If none is passed will use default region from the config. - :param log_name: Given log name to purge. - - Usage: - :: - - result = await api.purge_instance_logs( - instance_id="example", - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_instance_id = validate_path_param("instance_id", instance_id) - - res = self._request( - "POST", - f"/document-db/v1beta1/regions/{param_region}/instances/{param_instance_id}/purge-logs", - body=marshal_PurgeInstanceLogsRequest( - PurgeInstanceLogsRequest( - instance_id=instance_id, - region=region, - log_name=log_name, - ), - self.client, - ), - ) - - self._throw_on_error(res) - - async def list_instance_logs_details( - self, - *, - instance_id: str, - region: Optional[Region] = None, - ) -> ListInstanceLogsDetailsResponse: - """ - List remote Database Instance logs details. - List remote log details. By default, the details returned in the list are ordered by creation date in ascending order, though this can be modified via the order_by field. - :param instance_id: UUID of the Database Instance you want logs of. - :param region: Region to target. If none is passed will use default region from the config. - :return: :class:`ListInstanceLogsDetailsResponse ` - - Usage: - :: - - result = await api.list_instance_logs_details( - instance_id="example", - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_instance_id = validate_path_param("instance_id", instance_id) - - res = self._request( - "GET", - f"/document-db/v1beta1/regions/{param_region}/instances/{param_instance_id}/logs-details", - ) - - self._throw_on_error(res) - return unmarshal_ListInstanceLogsDetailsResponse(res.json()) - - async def add_instance_settings( - self, - *, - instance_id: str, - settings: List[InstanceSetting], - region: Optional[Region] = None, - ) -> AddInstanceSettingsResponse: - """ - Add Database Instance advanced settings. - Add an advanced setting to a Database Instance. You must set the `name` and the `value` of each setting. - :param instance_id: UUID of the Database Instance you want to add settings to. - :param settings: Settings to add to the Database Instance. - :param region: Region to target. If none is passed will use default region from the config. - :return: :class:`AddInstanceSettingsResponse ` - - Usage: - :: - - result = await api.add_instance_settings( - instance_id="example", - settings=[], - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_instance_id = validate_path_param("instance_id", instance_id) - - res = self._request( - "POST", - f"/document-db/v1beta1/regions/{param_region}/instances/{param_instance_id}/settings", - body=marshal_AddInstanceSettingsRequest( - AddInstanceSettingsRequest( - instance_id=instance_id, - settings=settings, - region=region, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_AddInstanceSettingsResponse(res.json()) - - async def delete_instance_settings( - self, - *, - instance_id: str, - setting_names: List[str], - region: Optional[Region] = None, - ) -> DeleteInstanceSettingsResponse: - """ - Delete Database Instance advanced settings. - Delete an advanced setting in a Database Instance. You must specify the names of the settings you want to delete in the request. - :param instance_id: UUID of the Database Instance to delete settings from. - :param setting_names: Settings names to delete. - :param region: Region to target. If none is passed will use default region from the config. - :return: :class:`DeleteInstanceSettingsResponse ` - - Usage: - :: - - result = await api.delete_instance_settings( - instance_id="example", - setting_names=[], - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_instance_id = validate_path_param("instance_id", instance_id) - - res = self._request( - "DELETE", - f"/document-db/v1beta1/regions/{param_region}/instances/{param_instance_id}/settings", - body=marshal_DeleteInstanceSettingsRequest( - DeleteInstanceSettingsRequest( - instance_id=instance_id, - setting_names=setting_names, - region=region, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_DeleteInstanceSettingsResponse(res.json()) - - async def set_instance_settings( - self, - *, - instance_id: str, - settings: List[InstanceSetting], - region: Optional[Region] = None, - ) -> SetInstanceSettingsResponse: - """ - Set Database Instance advanced settings. - Update an advanced setting for a Database Instance. Settings added upon database engine initalization can only be defined once, and cannot, therefore, be updated. - :param instance_id: UUID of the Database Instance where the settings must be set. - :param settings: Settings to define for the Database Instance. - :param region: Region to target. If none is passed will use default region from the config. - :return: :class:`SetInstanceSettingsResponse ` - - Usage: - :: - - result = await api.set_instance_settings( - instance_id="example", - settings=[], - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_instance_id = validate_path_param("instance_id", instance_id) - - res = self._request( - "PUT", - f"/document-db/v1beta1/regions/{param_region}/instances/{param_instance_id}/settings", - body=marshal_SetInstanceSettingsRequest( - SetInstanceSettingsRequest( - instance_id=instance_id, - settings=settings, - region=region, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_SetInstanceSettingsResponse(res.json()) - - async def list_instance_acl_rules( - self, - *, - instance_id: str, - region: Optional[Region] = None, - page: Optional[int] = None, - page_size: Optional[int] = None, - ) -> ListInstanceACLRulesResponse: - """ - List ACL rules of a Database Instance. - List the ACL rules for a given Database Instance. The response is an array of ACL objects, each one representing an ACL that denies, allows or redirects traffic based on certain conditions. - :param instance_id: UUID of the Database Instance. - :param region: Region to target. If none is passed will use default region from the config. - :param page: - :param page_size: - :return: :class:`ListInstanceACLRulesResponse ` - - Usage: - :: - - result = await api.list_instance_acl_rules( - instance_id="example", - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_instance_id = validate_path_param("instance_id", instance_id) - - res = self._request( - "GET", - f"/document-db/v1beta1/regions/{param_region}/instances/{param_instance_id}/acls", - params={ - "page": page, - "page_size": page_size or self.client.default_page_size, - }, - ) - - self._throw_on_error(res) - return unmarshal_ListInstanceACLRulesResponse(res.json()) - - async def list_instance_acl_rules_all( - self, - *, - instance_id: str, - region: Optional[Region] = None, - page: Optional[int] = None, - page_size: Optional[int] = None, - ) -> List[ACLRule]: - """ - List ACL rules of a Database Instance. - List the ACL rules for a given Database Instance. The response is an array of ACL objects, each one representing an ACL that denies, allows or redirects traffic based on certain conditions. - :param instance_id: UUID of the Database Instance. - :param region: Region to target. If none is passed will use default region from the config. - :param page: - :param page_size: - :return: :class:`List[ACLRule] ` - - Usage: - :: - - result = await api.list_instance_acl_rules_all( - instance_id="example", - ) - """ - - return await fetch_all_pages_async( - type=ListInstanceACLRulesResponse, - key="rules", - fetcher=self.list_instance_acl_rules, - args={ - "instance_id": instance_id, - "region": region, - "page": page, - "page_size": page_size, - }, - ) - - async def add_instance_acl_rules( - self, - *, - instance_id: str, - rules: List[ACLRuleRequest], - region: Optional[Region] = None, - ) -> AddInstanceACLRulesResponse: - """ - Add an ACL rule to a Database Instance. - Add an additional ACL rule to a Database Instance. - :param instance_id: UUID of the Database Instance you want to add ACL rules to. - :param rules: ACL rules to add to the Database Instance. - :param region: Region to target. If none is passed will use default region from the config. - :return: :class:`AddInstanceACLRulesResponse ` - - Usage: - :: - - result = await api.add_instance_acl_rules( - instance_id="example", - rules=[], - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_instance_id = validate_path_param("instance_id", instance_id) - - res = self._request( - "POST", - f"/document-db/v1beta1/regions/{param_region}/instances/{param_instance_id}/acls", - body=marshal_AddInstanceACLRulesRequest( - AddInstanceACLRulesRequest( - instance_id=instance_id, - rules=rules, - region=region, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_AddInstanceACLRulesResponse(res.json()) - - async def set_instance_acl_rules( - self, - *, - instance_id: str, - rules: List[ACLRuleRequest], - region: Optional[Region] = None, - ) -> SetInstanceACLRulesResponse: - """ - Set ACL rules for a Database Instance. - Replace all the ACL rules of a Database Instance. - :param instance_id: UUID of the Database Instance where the ACL rules must be set. - :param rules: ACL rules to define for the Database Instance. - :param region: Region to target. If none is passed will use default region from the config. - :return: :class:`SetInstanceACLRulesResponse ` - - Usage: - :: - - result = await api.set_instance_acl_rules( - instance_id="example", - rules=[], - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_instance_id = validate_path_param("instance_id", instance_id) - - res = self._request( - "PUT", - f"/document-db/v1beta1/regions/{param_region}/instances/{param_instance_id}/acls", - body=marshal_SetInstanceACLRulesRequest( - SetInstanceACLRulesRequest( - instance_id=instance_id, - rules=rules, - region=region, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_SetInstanceACLRulesResponse(res.json()) - - async def delete_instance_acl_rules( - self, - *, - instance_id: str, - acl_rule_ips: List[str], - region: Optional[Region] = None, - ) -> DeleteInstanceACLRulesResponse: - """ - Delete ACL rules of a Database Instance. - Delete one or more ACL rules of a Database Instance. - :param instance_id: UUID of the Database Instance you want to delete an ACL rule from. - :param acl_rule_ips: IP addresses defined in the ACL rules of the Database Instance. - :param region: Region to target. If none is passed will use default region from the config. - :return: :class:`DeleteInstanceACLRulesResponse ` - - Usage: - :: - - result = await api.delete_instance_acl_rules( - instance_id="example", - acl_rule_ips=[], - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_instance_id = validate_path_param("instance_id", instance_id) - - res = self._request( - "DELETE", - f"/document-db/v1beta1/regions/{param_region}/instances/{param_instance_id}/acls", - body=marshal_DeleteInstanceACLRulesRequest( - DeleteInstanceACLRulesRequest( - instance_id=instance_id, - acl_rule_ips=acl_rule_ips, - region=region, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_DeleteInstanceACLRulesResponse(res.json()) - - async def list_users( - self, - *, - instance_id: str, - region: Optional[Region] = None, - name: Optional[str] = None, - order_by: Optional[ListUsersRequestOrderBy] = None, - page: Optional[int] = None, - page_size: Optional[int] = None, - ) -> ListUsersResponse: - """ - List users of a Database Instance. - List all users of a given Database Instance. By default, the users returned in the list are ordered by creation date in ascending order, though this can be modified via the order_by field. - :param instance_id: UUID of the Database Instance. - :param region: Region to target. If none is passed will use default region from the config. - :param name: Name of the user. - :param order_by: Criteria to use when requesting user listing. - :param page: - :param page_size: - :return: :class:`ListUsersResponse ` - - Usage: - :: - - result = await api.list_users( - instance_id="example", - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_instance_id = validate_path_param("instance_id", instance_id) - - res = self._request( - "GET", - f"/document-db/v1beta1/regions/{param_region}/instances/{param_instance_id}/users", - params={ - "name": name, - "order_by": order_by, - "page": page, - "page_size": page_size or self.client.default_page_size, - }, - ) - - self._throw_on_error(res) - return unmarshal_ListUsersResponse(res.json()) - - async def list_users_all( - self, - *, - instance_id: str, - region: Optional[Region] = None, - name: Optional[str] = None, - order_by: Optional[ListUsersRequestOrderBy] = None, - page: Optional[int] = None, - page_size: Optional[int] = None, - ) -> List[User]: - """ - List users of a Database Instance. - List all users of a given Database Instance. By default, the users returned in the list are ordered by creation date in ascending order, though this can be modified via the order_by field. - :param instance_id: UUID of the Database Instance. - :param region: Region to target. If none is passed will use default region from the config. - :param name: Name of the user. - :param order_by: Criteria to use when requesting user listing. - :param page: - :param page_size: - :return: :class:`List[User] ` - - Usage: - :: - - result = await api.list_users_all( - instance_id="example", - ) - """ - - return await fetch_all_pages_async( - type=ListUsersResponse, - key="users", - fetcher=self.list_users, - args={ - "instance_id": instance_id, - "region": region, - "name": name, - "order_by": order_by, - "page": page, - "page_size": page_size, - }, - ) - - async def create_user( - self, - *, - instance_id: str, - name: str, - password: str, - is_admin: bool, - region: Optional[Region] = None, - ) -> User: - """ - Create a user for a Database Instance. - Create a new user for a Database Instance. You must define the `name`, `password` and `is_admin` parameters. - :param instance_id: UUID of the Database Instance in which you want to create a user. - :param name: Name of the user you want to create. - :param password: Password of the user you want to create. - :param is_admin: Defines whether the user will have administrative privileges. - :param region: Region to target. If none is passed will use default region from the config. - :return: :class:`User ` - - Usage: - :: - - result = await api.create_user( - instance_id="example", - name="example", - password="example", - is_admin=False, - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_instance_id = validate_path_param("instance_id", instance_id) - - res = self._request( - "POST", - f"/document-db/v1beta1/regions/{param_region}/instances/{param_instance_id}/users", - body=marshal_CreateUserRequest( - CreateUserRequest( - instance_id=instance_id, - name=name, - password=password, - is_admin=is_admin, - region=region, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_User(res.json()) - - async def update_user( - self, - *, - instance_id: str, - name: str, - region: Optional[Region] = None, - password: Optional[str] = None, - is_admin: Optional[bool] = None, - ) -> User: - """ - Update a user on a Database Instance. - Update the parameters of a user on a Database Instance. You can update the `password` and `is_admin` parameters, but you cannot change the name of the user. - :param instance_id: UUID of the Database Instance the user belongs to. - :param name: Name of the database user. - :param region: Region to target. If none is passed will use default region from the config. - :param password: Password of the database user. - :param is_admin: Defines whether or not this user got administrative privileges. - :return: :class:`User ` - - Usage: - :: - - result = await api.update_user( - instance_id="example", - name="example", - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_instance_id = validate_path_param("instance_id", instance_id) - param_name = validate_path_param("name", name) - - res = self._request( - "PATCH", - f"/document-db/v1beta1/regions/{param_region}/instances/{param_instance_id}/users/{param_name}", - body=marshal_UpdateUserRequest( - UpdateUserRequest( - instance_id=instance_id, - name=name, - region=region, - password=password, - is_admin=is_admin, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_User(res.json()) - - async def delete_user( - self, - *, - instance_id: str, - name: str, - region: Optional[Region] = None, - ) -> None: - """ - Delete a user on a Database Instance. - Delete a given user on a Database Instance. You must specify, in the endpoint, the `region`, `instance_id` and `name` parameters of the user you want to delete. - :param instance_id: UUID of the Database Instance to delete the user from. - :param name: Name of the user. - :param region: Region to target. If none is passed will use default region from the config. - - Usage: - :: - - result = await api.delete_user( - instance_id="example", - name="example", - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_instance_id = validate_path_param("instance_id", instance_id) - param_name = validate_path_param("name", name) - - res = self._request( - "DELETE", - f"/document-db/v1beta1/regions/{param_region}/instances/{param_instance_id}/users/{param_name}", - ) - - self._throw_on_error(res) - - async def list_databases( - self, - *, - instance_id: str, - region: Optional[Region] = None, - name: Optional[str] = None, - managed: Optional[bool] = None, - owner: Optional[str] = None, - order_by: Optional[ListDatabasesRequestOrderBy] = None, - page: Optional[int] = None, - page_size: Optional[int] = None, - ) -> ListDatabasesResponse: - """ - List databases in a Database Instance. - List all databases of a given Database Instance. By default, the databases returned in the list are ordered by creation date in ascending order, though this can be modified via the order_by field. You can define additional parameters for your query, such as `name`, `managed` and `owner`. - :param instance_id: UUID of the Database Instance to list the databases of. - :param region: Region to target. If none is passed will use default region from the config. - :param name: Name of the database. - :param managed: Defines whether or not the database is managed. - :param owner: User that owns this database. - :param order_by: Criteria to use when ordering database listing. - :param page: - :param page_size: - :return: :class:`ListDatabasesResponse ` - - Usage: - :: - - result = await api.list_databases( - instance_id="example", - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_instance_id = validate_path_param("instance_id", instance_id) - - res = self._request( - "GET", - f"/document-db/v1beta1/regions/{param_region}/instances/{param_instance_id}/databases", - params={ - "managed": managed, - "name": name, - "order_by": order_by, - "owner": owner, - "page": page, - "page_size": page_size or self.client.default_page_size, - }, - ) - - self._throw_on_error(res) - return unmarshal_ListDatabasesResponse(res.json()) - - async def list_databases_all( - self, - *, - instance_id: str, - region: Optional[Region] = None, - name: Optional[str] = None, - managed: Optional[bool] = None, - owner: Optional[str] = None, - order_by: Optional[ListDatabasesRequestOrderBy] = None, - page: Optional[int] = None, - page_size: Optional[int] = None, - ) -> List[Database]: - """ - List databases in a Database Instance. - List all databases of a given Database Instance. By default, the databases returned in the list are ordered by creation date in ascending order, though this can be modified via the order_by field. You can define additional parameters for your query, such as `name`, `managed` and `owner`. - :param instance_id: UUID of the Database Instance to list the databases of. - :param region: Region to target. If none is passed will use default region from the config. - :param name: Name of the database. - :param managed: Defines whether or not the database is managed. - :param owner: User that owns this database. - :param order_by: Criteria to use when ordering database listing. - :param page: - :param page_size: - :return: :class:`List[Database] ` - - Usage: - :: - - result = await api.list_databases_all( - instance_id="example", - ) - """ - - return await fetch_all_pages_async( - type=ListDatabasesResponse, - key="databases", - fetcher=self.list_databases, - args={ - "instance_id": instance_id, - "region": region, - "name": name, - "managed": managed, - "owner": owner, - "order_by": order_by, - "page": page, - "page_size": page_size, - }, - ) - - async def create_database( - self, - *, - instance_id: str, - name: str, - region: Optional[Region] = None, - ) -> Database: - """ - Create a database in a Database Instance. - Create a new database. You must define the `name` parameter in the request. - :param instance_id: UUID of the Database Instance where to create the database. - :param name: Name of the database. - :param region: Region to target. If none is passed will use default region from the config. - :return: :class:`Database ` - - Usage: - :: - - result = await api.create_database( - instance_id="example", - name="example", - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_instance_id = validate_path_param("instance_id", instance_id) - - res = self._request( - "POST", - f"/document-db/v1beta1/regions/{param_region}/instances/{param_instance_id}/databases", - body=marshal_CreateDatabaseRequest( - CreateDatabaseRequest( - instance_id=instance_id, - name=name, - region=region, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_Database(res.json()) - - async def delete_database( - self, - *, - instance_id: str, - name: str, - region: Optional[Region] = None, - ) -> None: - """ - Delete a database in a Database Instance. - Delete a given database on a Database Instance. You must specify, in the endpoint, the `region`, `instance_id` and `name` parameters of the database you want to delete. - :param instance_id: UUID of the Database Instance where to delete the database. - :param name: Name of the database to delete. - :param region: Region to target. If none is passed will use default region from the config. - - Usage: - :: - - result = await api.delete_database( - instance_id="example", - name="example", - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_instance_id = validate_path_param("instance_id", instance_id) - param_name = validate_path_param("name", name) - - res = self._request( - "DELETE", - f"/document-db/v1beta1/regions/{param_region}/instances/{param_instance_id}/databases/{param_name}", - ) - - self._throw_on_error(res) - - async def list_privileges( - self, - *, - instance_id: str, - region: Optional[Region] = None, - order_by: Optional[ListPrivilegesRequestOrderBy] = None, - page: Optional[int] = None, - page_size: Optional[int] = None, - database_name: Optional[str] = None, - user_name: Optional[str] = None, - ) -> ListPrivilegesResponse: - """ - List user privileges for a database. - List privileges of a user on a database. By default, the details returned in the list are ordered by creation date in ascending order, though this can be modified via the order_by field. You can define additional parameters for your query, such as `database_name` and `user_name`. - :param instance_id: UUID of the Database Instance. - :param region: Region to target. If none is passed will use default region from the config. - :param order_by: Criteria to use when ordering privileges listing. - :param page: - :param page_size: - :param database_name: Name of the database. - :param user_name: Name of the user. - :return: :class:`ListPrivilegesResponse ` - - Usage: - :: - - result = await api.list_privileges( - instance_id="example", - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_instance_id = validate_path_param("instance_id", instance_id) - - res = self._request( - "GET", - f"/document-db/v1beta1/regions/{param_region}/instances/{param_instance_id}/privileges", - params={ - "database_name": database_name, - "order_by": order_by, - "page": page, - "page_size": page_size or self.client.default_page_size, - "user_name": user_name, - }, - ) - - self._throw_on_error(res) - return unmarshal_ListPrivilegesResponse(res.json()) - - async def list_privileges_all( - self, - *, - instance_id: str, - region: Optional[Region] = None, - order_by: Optional[ListPrivilegesRequestOrderBy] = None, - page: Optional[int] = None, - page_size: Optional[int] = None, - database_name: Optional[str] = None, - user_name: Optional[str] = None, - ) -> List[Privilege]: - """ - List user privileges for a database. - List privileges of a user on a database. By default, the details returned in the list are ordered by creation date in ascending order, though this can be modified via the order_by field. You can define additional parameters for your query, such as `database_name` and `user_name`. - :param instance_id: UUID of the Database Instance. - :param region: Region to target. If none is passed will use default region from the config. - :param order_by: Criteria to use when ordering privileges listing. - :param page: - :param page_size: - :param database_name: Name of the database. - :param user_name: Name of the user. - :return: :class:`List[Privilege] ` - - Usage: - :: - - result = await api.list_privileges_all( - instance_id="example", - ) - """ - - return await fetch_all_pages_async( - type=ListPrivilegesResponse, - key="privileges", - fetcher=self.list_privileges, - args={ - "instance_id": instance_id, - "region": region, - "order_by": order_by, - "page": page, - "page_size": page_size, - "database_name": database_name, - "user_name": user_name, - }, - ) - - async def set_privilege( - self, - *, - instance_id: str, - database_name: str, - user_name: str, - region: Optional[Region] = None, - permission: Optional[Permission] = None, - ) -> Privilege: - """ - Set user privileges for a database. - Set the privileges of a user on a database. You must define `database_name`, `user_name` and `permission` in the request body. - :param instance_id: UUID of the Database Instance. - :param database_name: Name of the database. - :param user_name: Name of the user. - :param region: Region to target. If none is passed will use default region from the config. - :param permission: Permission to set (Read, Read/Write, All, Custom). - :return: :class:`Privilege ` - - Usage: - :: - - result = await api.set_privilege( - instance_id="example", - database_name="example", - user_name="example", - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_instance_id = validate_path_param("instance_id", instance_id) - - res = self._request( - "PUT", - f"/document-db/v1beta1/regions/{param_region}/instances/{param_instance_id}/privileges", - body=marshal_SetPrivilegeRequest( - SetPrivilegeRequest( - instance_id=instance_id, - database_name=database_name, - user_name=user_name, - region=region, - permission=permission, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_Privilege(res.json()) - - async def list_snapshots( - self, - *, - region: Optional[Region] = None, - name: Optional[str] = None, - order_by: Optional[ListSnapshotsRequestOrderBy] = None, - instance_id: Optional[str] = None, - organization_id: Optional[str] = None, - project_id: Optional[str] = None, - page: Optional[int] = None, - page_size: Optional[int] = None, - ) -> ListSnapshotsResponse: - """ - List snapshots. - List snapshots. You can include the `instance_id` or `project_id` in your query to get the list of snapshots for specific Database Instances and/or Projects. By default, the details returned in the list are ordered by creation date in ascending order, though this can be modified via the `order_by` field. - :param region: Region to target. If none is passed will use default region from the config. - :param name: Name of the snapshot. - :param order_by: Criteria to use when ordering snapshot listing. - :param instance_id: UUID of the Database Instance. - :param organization_id: Organization ID the snapshots belongs to. - :param project_id: Project ID the snapshots belongs to. - :param page: - :param page_size: - :return: :class:`ListSnapshotsResponse ` - - Usage: - :: - - result = await api.list_snapshots() - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - - res = self._request( - "GET", - f"/document-db/v1beta1/regions/{param_region}/snapshots", - params={ - "instance_id": instance_id, - "name": name, - "order_by": order_by, - "organization_id": organization_id - or self.client.default_organization_id, - "page": page, - "page_size": page_size or self.client.default_page_size, - "project_id": project_id or self.client.default_project_id, - }, - ) - - self._throw_on_error(res) - return unmarshal_ListSnapshotsResponse(res.json()) - - async def list_snapshots_all( - self, - *, - region: Optional[Region] = None, - name: Optional[str] = None, - order_by: Optional[ListSnapshotsRequestOrderBy] = None, - instance_id: Optional[str] = None, - organization_id: Optional[str] = None, - project_id: Optional[str] = None, - page: Optional[int] = None, - page_size: Optional[int] = None, - ) -> List[Snapshot]: - """ - List snapshots. - List snapshots. You can include the `instance_id` or `project_id` in your query to get the list of snapshots for specific Database Instances and/or Projects. By default, the details returned in the list are ordered by creation date in ascending order, though this can be modified via the `order_by` field. - :param region: Region to target. If none is passed will use default region from the config. - :param name: Name of the snapshot. - :param order_by: Criteria to use when ordering snapshot listing. - :param instance_id: UUID of the Database Instance. - :param organization_id: Organization ID the snapshots belongs to. - :param project_id: Project ID the snapshots belongs to. - :param page: - :param page_size: - :return: :class:`List[Snapshot] ` - - Usage: - :: - - result = await api.list_snapshots_all() - """ - - return await fetch_all_pages_async( - type=ListSnapshotsResponse, - key="snapshots", - fetcher=self.list_snapshots, - args={ - "region": region, - "name": name, - "order_by": order_by, - "instance_id": instance_id, - "organization_id": organization_id, - "project_id": project_id, - "page": page, - "page_size": page_size, - }, - ) - - async def get_snapshot( - self, - *, - snapshot_id: str, - region: Optional[Region] = None, - ) -> Snapshot: - """ - Get a Database Instance snapshot. - Retrieve information about a given snapshot, specified by its `snapshot_id` and `region`. Full details about the snapshot, like size and expiration date, are returned in the response. - :param snapshot_id: UUID of the snapshot. - :param region: Region to target. If none is passed will use default region from the config. - :return: :class:`Snapshot ` - - Usage: - :: - - result = await api.get_snapshot( - snapshot_id="example", - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_snapshot_id = validate_path_param("snapshot_id", snapshot_id) - - res = self._request( - "GET", - f"/document-db/v1beta1/regions/{param_region}/snapshots/{param_snapshot_id}", - ) - - self._throw_on_error(res) - return unmarshal_Snapshot(res.json()) - - async def wait_for_snapshot( - self, - *, - snapshot_id: str, - region: Optional[Region] = None, - options: Optional[ - WaitForOptions[Snapshot, Union[bool, Awaitable[bool]]] - ] = None, - ) -> Snapshot: - """ - Get a Database Instance snapshot. - Retrieve information about a given snapshot, specified by its `snapshot_id` and `region`. Full details about the snapshot, like size and expiration date, are returned in the response. - :param snapshot_id: UUID of the snapshot. - :param region: Region to target. If none is passed will use default region from the config. - :return: :class:`Snapshot ` - - Usage: - :: - - result = await api.get_snapshot( - snapshot_id="example", - ) - """ - - if not options: - options = WaitForOptions() - - if not options.stop: - options.stop = lambda res: res.status not in SNAPSHOT_TRANSIENT_STATUSES - - return await wait_for_resource_async( - fetcher=self.get_snapshot, - options=options, - args={ - "snapshot_id": snapshot_id, - "region": region, - }, - ) - - async def create_snapshot( - self, - *, - instance_id: str, - region: Optional[Region] = None, - name: Optional[str] = None, - expires_at: Optional[datetime] = None, - ) -> Snapshot: - """ - Create a Database Instance snapshot. - Create a new snapshot of a Database Instance. You must define the `name` parameter in the request. - :param instance_id: UUID of the Database Instance. - :param region: Region to target. If none is passed will use default region from the config. - :param name: Name of the snapshot. - :param expires_at: Expiration date (must follow the ISO 8601 format). - :return: :class:`Snapshot ` - - Usage: - :: - - result = await api.create_snapshot( - instance_id="example", - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_instance_id = validate_path_param("instance_id", instance_id) - - res = self._request( - "POST", - f"/document-db/v1beta1/regions/{param_region}/instances/{param_instance_id}/snapshots", - body=marshal_CreateSnapshotRequest( - CreateSnapshotRequest( - instance_id=instance_id, - region=region, - name=name or random_name(prefix="snp"), - expires_at=expires_at, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_Snapshot(res.json()) - - async def update_snapshot( - self, - *, - snapshot_id: str, - region: Optional[Region] = None, - name: Optional[str] = None, - expires_at: Optional[datetime] = None, - ) -> Snapshot: - """ - Update a Database Instance snapshot. - Update the parameters of a snapshot of a Database Instance. You can update the `name` and `expires_at` parameters. - :param snapshot_id: UUID of the snapshot to update. - :param region: Region to target. If none is passed will use default region from the config. - :param name: Name of the snapshot. - :param expires_at: Expiration date (must follow the ISO 8601 format). - :return: :class:`Snapshot ` - - Usage: - :: - - result = await api.update_snapshot( - snapshot_id="example", - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_snapshot_id = validate_path_param("snapshot_id", snapshot_id) - - res = self._request( - "PATCH", - f"/document-db/v1beta1/regions/{param_region}/snapshots/{param_snapshot_id}", - body=marshal_UpdateSnapshotRequest( - UpdateSnapshotRequest( - snapshot_id=snapshot_id, - region=region, - name=name, - expires_at=expires_at, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_Snapshot(res.json()) - - async def delete_snapshot( - self, - *, - snapshot_id: str, - region: Optional[Region] = None, - ) -> Snapshot: - """ - Delete a Database Instance snapshot. - Delete a given snapshot of a Database Instance. You must specify, in the endpoint, the `region` and `snapshot_id` parameters of the snapshot you want to delete. - :param snapshot_id: UUID of the snapshot to delete. - :param region: Region to target. If none is passed will use default region from the config. - :return: :class:`Snapshot ` - - Usage: - :: - - result = await api.delete_snapshot( - snapshot_id="example", - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_snapshot_id = validate_path_param("snapshot_id", snapshot_id) - - res = self._request( - "DELETE", - f"/document-db/v1beta1/regions/{param_region}/snapshots/{param_snapshot_id}", - ) - - self._throw_on_error(res) - return unmarshal_Snapshot(res.json()) - - async def create_instance_from_snapshot( - self, - *, - snapshot_id: str, - instance_name: str, - region: Optional[Region] = None, - is_ha_cluster: Optional[bool] = None, - node_type: Optional[str] = None, - ) -> Instance: - """ - Create a new Database Instance from a snapshot. - Restore a snapshot. When you restore a snapshot, a new Instance is created and billed to your account. Note that is possible to select a larger node type for your new Database Instance. However, the Block volume size will be the same as the size of the restored snapshot. All Instance settings will be restored if you chose a node type with the same or more memory size than the initial Instance. Settings will be reset to the default if your node type has less memory. - :param snapshot_id: Block snapshot of the Database Instance. - :param instance_name: Name of the Database Instance created with the snapshot. - :param region: Region to target. If none is passed will use default region from the config. - :param is_ha_cluster: Defines whether or not High Availability is enabled on the new Database Instance. - :param node_type: The node type used to restore the snapshot. - :return: :class:`Instance ` - - Usage: - :: - - result = await api.create_instance_from_snapshot( - snapshot_id="example", - instance_name="example", - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_snapshot_id = validate_path_param("snapshot_id", snapshot_id) - - res = self._request( - "POST", - f"/document-db/v1beta1/regions/{param_region}/snapshots/{param_snapshot_id}/create-instance", - body=marshal_CreateInstanceFromSnapshotRequest( - CreateInstanceFromSnapshotRequest( - snapshot_id=snapshot_id, - instance_name=instance_name, - region=region, - is_ha_cluster=is_ha_cluster, - node_type=node_type, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_Instance(res.json()) - - async def create_endpoint( - self, - *, - instance_id: str, - region: Optional[Region] = None, - endpoint_spec: Optional[EndpointSpec] = None, - ) -> Endpoint: - """ - Create a new Database Instance endpoint. - Create a new endpoint for a Database Instance. You can add `load_balancer` and `private_network` specifications to the body of the request. - :param instance_id: UUID of the Database Instance you to which you want to add an endpoint. - :param region: Region to target. If none is passed will use default region from the config. - :param endpoint_spec: Specification of the endpoint you want to create. - :return: :class:`Endpoint ` - - Usage: - :: - - result = await api.create_endpoint( - instance_id="example", - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_instance_id = validate_path_param("instance_id", instance_id) - - res = self._request( - "POST", - f"/document-db/v1beta1/regions/{param_region}/instances/{param_instance_id}/endpoints", - body=marshal_CreateEndpointRequest( - CreateEndpointRequest( - instance_id=instance_id, - region=region, - endpoint_spec=endpoint_spec, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_Endpoint(res.json()) - - async def delete_endpoint( - self, - *, - endpoint_id: str, - region: Optional[Region] = None, - ) -> None: - """ - Delete a Database Instance endpoint. - Delete the endpoint of a Database Instance. You must specify the `region` and `endpoint_id` parameters of the endpoint you want to delete. Note that might need to update any environment configurations that point to the deleted endpoint. - :param endpoint_id: This endpoint can also be used to delete a Read Replica endpoint. - :param region: Region to target. If none is passed will use default region from the config. - - Usage: - :: - - result = await api.delete_endpoint( - endpoint_id="example", - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_endpoint_id = validate_path_param("endpoint_id", endpoint_id) - - res = self._request( - "DELETE", - f"/document-db/v1beta1/regions/{param_region}/endpoints/{param_endpoint_id}", - ) - - self._throw_on_error(res) - - async def get_endpoint( - self, - *, - endpoint_id: str, - region: Optional[Region] = None, - ) -> Endpoint: - """ - Get a Database Instance endpoint. - Retrieve information about a Database Instance endpoint. Full details about the endpoint, like `ip`, `port`, `private_network` and `load_balancer` specifications are returned in the response. - :param endpoint_id: UUID of the endpoint you want to get. - :param region: Region to target. If none is passed will use default region from the config. - :return: :class:`Endpoint ` - - Usage: - :: - - result = await api.get_endpoint( - endpoint_id="example", - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_endpoint_id = validate_path_param("endpoint_id", endpoint_id) - - res = self._request( - "GET", - f"/document-db/v1beta1/regions/{param_region}/endpoints/{param_endpoint_id}", - ) - - self._throw_on_error(res) - return unmarshal_Endpoint(res.json()) - - async def migrate_endpoint( - self, - *, - endpoint_id: str, - instance_id: str, - region: Optional[Region] = None, - ) -> Endpoint: - """ - Migrate Database Instance endpoint. - Migrate an existing Database Instance endpoint to another Database Instance. - :param endpoint_id: UUID of the endpoint you want to migrate. - :param instance_id: UUID of the instance you want to attach the endpoint to. - :param region: Region to target. If none is passed will use default region from the config. - :return: :class:`Endpoint ` - - Usage: - :: - - result = await api.migrate_endpoint( - endpoint_id="example", - instance_id="example", - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_endpoint_id = validate_path_param("endpoint_id", endpoint_id) - - res = self._request( - "POST", - f"/document-db/v1beta1/regions/{param_region}/endpoints/{param_endpoint_id}/migrate", - body=marshal_MigrateEndpointRequest( - MigrateEndpointRequest( - endpoint_id=endpoint_id, - instance_id=instance_id, - region=region, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_Endpoint(res.json()) - - async def apply_instance_maintenance( - self, - *, - instance_id: str, - region: Optional[Region] = None, - ) -> Maintenance: - """ - Apply an instance maintenance. - Apply a pending instance maintenance on your instance. This action can generate some service interruption. - :param instance_id: UUID of the Database Instance to which you want to apply maintenance. - :param region: Region to target. If none is passed will use default region from the config. - :return: :class:`Maintenance ` - - Usage: - :: - - result = await api.apply_instance_maintenance( - instance_id="example", - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_instance_id = validate_path_param("instance_id", instance_id) - - res = self._request( - "POST", - f"/document-db/v1beta1/regions/{param_region}/instances/{param_instance_id}/apply-maintenance", - body={}, - ) - - self._throw_on_error(res) - return unmarshal_Maintenance(res.json()) diff --git a/scaleway-async/scaleway_async/document_db/v1beta1/content.py b/scaleway-async/scaleway_async/document_db/v1beta1/content.py deleted file mode 100644 index d945ef0ce..000000000 --- a/scaleway-async/scaleway_async/document_db/v1beta1/content.py +++ /dev/null @@ -1,55 +0,0 @@ -# This file was automatically generated. DO NOT EDIT. -# If you have any remark or suggestion do not hesitate to open an issue. -from typing import List - -from .types import ( - InstanceLogStatus, - InstanceStatus, - MaintenanceStatus, - ReadReplicaStatus, - SnapshotStatus, -) - -INSTANCE_LOG_TRANSIENT_STATUSES: List[InstanceLogStatus] = [ - InstanceLogStatus.CREATING, -] -""" -Lists transient statutes of the enum :class:`InstanceLogStatus `. -""" -INSTANCE_TRANSIENT_STATUSES: List[InstanceStatus] = [ - InstanceStatus.PROVISIONING, - InstanceStatus.CONFIGURING, - InstanceStatus.DELETING, - InstanceStatus.AUTOHEALING, - InstanceStatus.INITIALIZING, - InstanceStatus.BACKUPING, - InstanceStatus.SNAPSHOTTING, - InstanceStatus.RESTARTING, -] -""" -Lists transient statutes of the enum :class:`InstanceStatus `. -""" -MAINTENANCE_TRANSIENT_STATUSES: List[MaintenanceStatus] = [ - MaintenanceStatus.ONGOING, -] -""" -Lists transient statutes of the enum :class:`MaintenanceStatus `. -""" -READ_REPLICA_TRANSIENT_STATUSES: List[ReadReplicaStatus] = [ - ReadReplicaStatus.PROVISIONING, - ReadReplicaStatus.INITIALIZING, - ReadReplicaStatus.DELETING, - ReadReplicaStatus.CONFIGURING, - ReadReplicaStatus.PROMOTING, -] -""" -Lists transient statutes of the enum :class:`ReadReplicaStatus `. -""" -SNAPSHOT_TRANSIENT_STATUSES: List[SnapshotStatus] = [ - SnapshotStatus.CREATING, - SnapshotStatus.RESTORING, - SnapshotStatus.DELETING, -] -""" -Lists transient statutes of the enum :class:`SnapshotStatus `. -""" diff --git a/scaleway-async/scaleway_async/document_db/v1beta1/marshalling.py b/scaleway-async/scaleway_async/document_db/v1beta1/marshalling.py deleted file mode 100644 index 0ed12b878..000000000 --- a/scaleway-async/scaleway_async/document_db/v1beta1/marshalling.py +++ /dev/null @@ -1,1949 +0,0 @@ -# This file was automatically generated. DO NOT EDIT. -# If you have any remark or suggestion do not hesitate to open an issue. - -from typing import Any, Dict -from dateutil import parser - -from scaleway_core.profile import ProfileDefaults -from scaleway_core.bridge import ( - unmarshal_TimeSeries, -) -from scaleway_core.utils import ( - OneOfPossibility, - resolve_one_of, -) -from .types import ( - EndpointDirectAccessDetails, - EndpointLoadBalancerDetails, - EndpointPrivateNetworkDetails, - Endpoint, - Maintenance, - ReadReplica, - Database, - InstanceLog, - BackupSchedule, - InstanceSetting, - LogsPolicy, - UpgradableVersion, - Volume, - Instance, - Privilege, - SnapshotVolumeType, - Snapshot, - User, - ACLRule, - AddInstanceACLRulesResponse, - AddInstanceSettingsResponse, - DeleteInstanceACLRulesResponse, - DeleteInstanceSettingsResponse, - InstanceMetrics, - EngineSetting, - EngineVersion, - DatabaseEngine, - ListDatabaseEnginesResponse, - ListDatabasesResponse, - ListInstanceACLRulesResponse, - ListInstanceLogsDetailsResponseInstanceLogDetail, - ListInstanceLogsDetailsResponse, - ListInstanceLogsResponse, - ListInstancesResponse, - NodeTypeVolumeConstraintSizes, - NodeTypeVolumeType, - NodeType, - ListNodeTypesResponse, - ListPrivilegesResponse, - ListSnapshotsResponse, - ListUsersResponse, - SetInstanceACLRulesResponse, - SetInstanceSettingsResponse, - ACLRuleRequest, - AddInstanceACLRulesRequest, - AddInstanceSettingsRequest, - CloneInstanceRequest, - CreateDatabaseRequest, - EndpointSpecPrivateNetworkIpamConfig, - EndpointSpecLoadBalancer, - EndpointSpecPrivateNetwork, - EndpointSpec, - CreateEndpointRequest, - CreateInstanceFromSnapshotRequest, - CreateInstanceRequest, - ReadReplicaEndpointSpecPrivateNetworkIpamConfig, - ReadReplicaEndpointSpecDirectAccess, - ReadReplicaEndpointSpecPrivateNetwork, - ReadReplicaEndpointSpec, - CreateReadReplicaEndpointRequest, - CreateReadReplicaRequest, - CreateSnapshotRequest, - CreateUserRequest, - DeleteInstanceACLRulesRequest, - DeleteInstanceSettingsRequest, - MigrateEndpointRequest, - PurgeInstanceLogsRequest, - SetInstanceACLRulesRequest, - SetInstanceSettingsRequest, - SetPrivilegeRequest, - UpdateInstanceRequest, - UpdateSnapshotRequest, - UpdateUserRequest, - UpgradeInstanceRequestMajorUpgradeWorkflow, - UpgradeInstanceRequest, -) - - -def unmarshal_EndpointDirectAccessDetails(data: Any) -> EndpointDirectAccessDetails: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'EndpointDirectAccessDetails' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - return EndpointDirectAccessDetails(**args) - - -def unmarshal_EndpointLoadBalancerDetails(data: Any) -> EndpointLoadBalancerDetails: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'EndpointLoadBalancerDetails' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - return EndpointLoadBalancerDetails(**args) - - -def unmarshal_EndpointPrivateNetworkDetails(data: Any) -> EndpointPrivateNetworkDetails: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'EndpointPrivateNetworkDetails' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("private_network_id", None) - if field is not None: - args["private_network_id"] = field - - field = data.get("service_ip", None) - if field is not None: - args["service_ip"] = field - - field = data.get("zone", None) - if field is not None: - args["zone"] = field - - return EndpointPrivateNetworkDetails(**args) - - -def unmarshal_Endpoint(data: Any) -> Endpoint: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'Endpoint' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("id", None) - if field is not None: - args["id"] = field - - field = data.get("port", None) - if field is not None: - args["port"] = field - - field = data.get("ip", None) - if field is not None: - args["ip"] = field - else: - args["ip"] = None - - field = data.get("name", None) - if field is not None: - args["name"] = field - else: - args["name"] = None - - field = data.get("private_network", None) - if field is not None: - args["private_network"] = unmarshal_EndpointPrivateNetworkDetails(field) - else: - args["private_network"] = None - - field = data.get("load_balancer", None) - if field is not None: - args["load_balancer"] = unmarshal_EndpointLoadBalancerDetails(field) - else: - args["load_balancer"] = None - - field = data.get("direct_access", None) - if field is not None: - args["direct_access"] = unmarshal_EndpointDirectAccessDetails(field) - else: - args["direct_access"] = None - - field = data.get("hostname", None) - if field is not None: - args["hostname"] = field - else: - args["hostname"] = None - - return Endpoint(**args) - - -def unmarshal_Maintenance(data: Any) -> Maintenance: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'Maintenance' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("reason", None) - if field is not None: - args["reason"] = field - - field = data.get("status", None) - if field is not None: - args["status"] = field - - field = data.get("starts_at", None) - if field is not None: - args["starts_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["starts_at"] = None - - field = data.get("stops_at", None) - if field is not None: - args["stops_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["stops_at"] = None - - field = data.get("closed_at", None) - if field is not None: - args["closed_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["closed_at"] = None - - field = data.get("forced_at", None) - if field is not None: - args["forced_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["forced_at"] = None - - return Maintenance(**args) - - -def unmarshal_ReadReplica(data: Any) -> ReadReplica: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'ReadReplica' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("id", None) - if field is not None: - args["id"] = field - - field = data.get("endpoints", None) - if field is not None: - args["endpoints"] = ( - [unmarshal_Endpoint(v) for v in field] if field is not None else None - ) - - field = data.get("status", None) - if field is not None: - args["status"] = field - - field = data.get("region", None) - if field is not None: - args["region"] = field - - field = data.get("same_zone", None) - if field is not None: - args["same_zone"] = field - - return ReadReplica(**args) - - -def unmarshal_Database(data: Any) -> Database: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'Database' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("name", None) - if field is not None: - args["name"] = field - - field = data.get("owner", None) - if field is not None: - args["owner"] = field - - field = data.get("managed", None) - if field is not None: - args["managed"] = field - - field = data.get("size", None) - if field is not None: - args["size"] = field - - return Database(**args) - - -def unmarshal_InstanceLog(data: Any) -> InstanceLog: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'InstanceLog' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("id", None) - if field is not None: - args["id"] = field - - field = data.get("status", None) - if field is not None: - args["status"] = field - - field = data.get("node_name", None) - if field is not None: - args["node_name"] = field - - field = data.get("region", None) - if field is not None: - args["region"] = field - - field = data.get("download_url", None) - if field is not None: - args["download_url"] = field - else: - args["download_url"] = None - - field = data.get("expires_at", None) - if field is not None: - args["expires_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["expires_at"] = None - - field = data.get("created_at", None) - if field is not None: - args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["created_at"] = None - - return InstanceLog(**args) - - -def unmarshal_BackupSchedule(data: Any) -> BackupSchedule: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'BackupSchedule' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("frequency", None) - if field is not None: - args["frequency"] = field - - field = data.get("retention", None) - if field is not None: - args["retention"] = field - - field = data.get("disabled", None) - if field is not None: - args["disabled"] = field - - field = data.get("next_run_at", None) - if field is not None: - args["next_run_at"] = ( - parser.isoparse(field) if isinstance(field, str) else field - ) - else: - args["next_run_at"] = None - - return BackupSchedule(**args) - - -def unmarshal_InstanceSetting(data: Any) -> InstanceSetting: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'InstanceSetting' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("name", None) - if field is not None: - args["name"] = field - - field = data.get("value", None) - if field is not None: - args["value"] = field - - return InstanceSetting(**args) - - -def unmarshal_LogsPolicy(data: Any) -> LogsPolicy: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'LogsPolicy' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("max_age_retention", None) - if field is not None: - args["max_age_retention"] = field - else: - args["max_age_retention"] = None - - field = data.get("total_disk_retention", None) - if field is not None: - args["total_disk_retention"] = field - else: - args["total_disk_retention"] = None - - return LogsPolicy(**args) - - -def unmarshal_UpgradableVersion(data: Any) -> UpgradableVersion: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'UpgradableVersion' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("id", None) - if field is not None: - args["id"] = field - - field = data.get("name", None) - if field is not None: - args["name"] = field - - field = data.get("version", None) - if field is not None: - args["version"] = field - - field = data.get("minor_version", None) - if field is not None: - args["minor_version"] = field - - return UpgradableVersion(**args) - - -def unmarshal_Volume(data: Any) -> Volume: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'Volume' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("type", None) - if field is not None: - args["type_"] = field - - field = data.get("size", None) - if field is not None: - args["size"] = field - - field = data.get("class", None) - if field is not None: - args["class_"] = field - - return Volume(**args) - - -def unmarshal_Instance(data: Any) -> Instance: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'Instance' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("region", None) - if field is not None: - args["region"] = field - - field = data.get("id", None) - if field is not None: - args["id"] = field - - field = data.get("name", None) - if field is not None: - args["name"] = field - - field = data.get("organization_id", None) - if field is not None: - args["organization_id"] = field - - field = data.get("created_at", None) - if field is not None: - args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["created_at"] = None - - field = data.get("volume", None) - if field is not None: - args["volume"] = unmarshal_Volume(field) - else: - args["volume"] = None - - field = data.get("project_id", None) - if field is not None: - args["project_id"] = field - - field = data.get("status", None) - if field is not None: - args["status"] = field - - field = data.get("engine", None) - if field is not None: - args["engine"] = field - - field = data.get("upgradable_version", None) - if field is not None: - args["upgradable_version"] = ( - [unmarshal_UpgradableVersion(v) for v in field] - if field is not None - else None - ) - - field = data.get("tags", None) - if field is not None: - args["tags"] = field - - field = data.get("settings", None) - if field is not None: - args["settings"] = ( - [unmarshal_InstanceSetting(v) for v in field] if field is not None else None - ) - - field = data.get("is_ha_cluster", None) - if field is not None: - args["is_ha_cluster"] = field - - field = data.get("endpoint", None) - if field is not None: - args["endpoint"] = unmarshal_Endpoint(field) - else: - args["endpoint"] = None - - field = data.get("backup_schedule", None) - if field is not None: - args["backup_schedule"] = unmarshal_BackupSchedule(field) - else: - args["backup_schedule"] = None - - field = data.get("read_replicas", None) - if field is not None: - args["read_replicas"] = ( - [unmarshal_ReadReplica(v) for v in field] if field is not None else None - ) - - field = data.get("node_type", None) - if field is not None: - args["node_type"] = field - - field = data.get("init_settings", None) - if field is not None: - args["init_settings"] = ( - [unmarshal_InstanceSetting(v) for v in field] if field is not None else None - ) - - field = data.get("endpoints", None) - if field is not None: - args["endpoints"] = ( - [unmarshal_Endpoint(v) for v in field] if field is not None else None - ) - - field = data.get("backup_same_region", None) - if field is not None: - args["backup_same_region"] = field - - field = data.get("maintenances", None) - if field is not None: - args["maintenances"] = ( - [unmarshal_Maintenance(v) for v in field] if field is not None else None - ) - - field = data.get("logs_policy", None) - if field is not None: - args["logs_policy"] = unmarshal_LogsPolicy(field) - else: - args["logs_policy"] = None - - return Instance(**args) - - -def unmarshal_Privilege(data: Any) -> Privilege: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'Privilege' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("permission", None) - if field is not None: - args["permission"] = field - - field = data.get("database_name", None) - if field is not None: - args["database_name"] = field - - field = data.get("user_name", None) - if field is not None: - args["user_name"] = field - - return Privilege(**args) - - -def unmarshal_SnapshotVolumeType(data: Any) -> SnapshotVolumeType: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'SnapshotVolumeType' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("type", None) - if field is not None: - args["type_"] = field - - field = data.get("class", None) - if field is not None: - args["class_"] = field - - return SnapshotVolumeType(**args) - - -def unmarshal_Snapshot(data: Any) -> Snapshot: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'Snapshot' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("id", None) - if field is not None: - args["id"] = field - - field = data.get("instance_id", None) - if field is not None: - args["instance_id"] = field - - field = data.get("name", None) - if field is not None: - args["name"] = field - - field = data.get("status", None) - if field is not None: - args["status"] = field - - field = data.get("instance_name", None) - if field is not None: - args["instance_name"] = field - - field = data.get("node_type", None) - if field is not None: - args["node_type"] = field - - field = data.get("region", None) - if field is not None: - args["region"] = field - - field = data.get("size", None) - if field is not None: - args["size"] = field - else: - args["size"] = None - - field = data.get("expires_at", None) - if field is not None: - args["expires_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["expires_at"] = None - - field = data.get("created_at", None) - if field is not None: - args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["created_at"] = None - - field = data.get("updated_at", None) - if field is not None: - args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["updated_at"] = None - - field = data.get("volume_type", None) - if field is not None: - args["volume_type"] = unmarshal_SnapshotVolumeType(field) - else: - args["volume_type"] = None - - return Snapshot(**args) - - -def unmarshal_User(data: Any) -> User: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'User' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("name", None) - if field is not None: - args["name"] = field - - field = data.get("is_admin", None) - if field is not None: - args["is_admin"] = field - - return User(**args) - - -def unmarshal_ACLRule(data: Any) -> ACLRule: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'ACLRule' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("ip", None) - if field is not None: - args["ip"] = field - - field = data.get("protocol", None) - if field is not None: - args["protocol"] = field - - field = data.get("direction", None) - if field is not None: - args["direction"] = field - - field = data.get("action", None) - if field is not None: - args["action"] = field - - field = data.get("description", None) - if field is not None: - args["description"] = field - - field = data.get("port", None) - if field is not None: - args["port"] = field - else: - args["port"] = None - - return ACLRule(**args) - - -def unmarshal_AddInstanceACLRulesResponse(data: Any) -> AddInstanceACLRulesResponse: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'AddInstanceACLRulesResponse' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("rules", None) - if field is not None: - args["rules"] = ( - [unmarshal_ACLRule(v) for v in field] if field is not None else None - ) - - return AddInstanceACLRulesResponse(**args) - - -def unmarshal_AddInstanceSettingsResponse(data: Any) -> AddInstanceSettingsResponse: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'AddInstanceSettingsResponse' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("settings", None) - if field is not None: - args["settings"] = ( - [unmarshal_InstanceSetting(v) for v in field] if field is not None else None - ) - - return AddInstanceSettingsResponse(**args) - - -def unmarshal_DeleteInstanceACLRulesResponse( - data: Any, -) -> DeleteInstanceACLRulesResponse: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'DeleteInstanceACLRulesResponse' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("rules", None) - if field is not None: - args["rules"] = ( - [unmarshal_ACLRule(v) for v in field] if field is not None else None - ) - - return DeleteInstanceACLRulesResponse(**args) - - -def unmarshal_DeleteInstanceSettingsResponse( - data: Any, -) -> DeleteInstanceSettingsResponse: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'DeleteInstanceSettingsResponse' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("settings", None) - if field is not None: - args["settings"] = ( - [unmarshal_InstanceSetting(v) for v in field] if field is not None else None - ) - - return DeleteInstanceSettingsResponse(**args) - - -def unmarshal_InstanceMetrics(data: Any) -> InstanceMetrics: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'InstanceMetrics' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("timeseries", None) - if field is not None: - args["timeseries"] = ( - [unmarshal_TimeSeries(v) for v in field] if field is not None else None - ) - - return InstanceMetrics(**args) - - -def unmarshal_EngineSetting(data: Any) -> EngineSetting: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'EngineSetting' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("name", None) - if field is not None: - args["name"] = field - - field = data.get("default_value", None) - if field is not None: - args["default_value"] = field - - field = data.get("hot_configurable", None) - if field is not None: - args["hot_configurable"] = field - - field = data.get("description", None) - if field is not None: - args["description"] = field - - field = data.get("property_type", None) - if field is not None: - args["property_type"] = field - - field = data.get("unit", None) - if field is not None: - args["unit"] = field - else: - args["unit"] = None - - field = data.get("string_constraint", None) - if field is not None: - args["string_constraint"] = field - else: - args["string_constraint"] = None - - field = data.get("int_min", None) - if field is not None: - args["int_min"] = field - else: - args["int_min"] = None - - field = data.get("int_max", None) - if field is not None: - args["int_max"] = field - else: - args["int_max"] = None - - field = data.get("float_min", None) - if field is not None: - args["float_min"] = field - else: - args["float_min"] = None - - field = data.get("float_max", None) - if field is not None: - args["float_max"] = field - else: - args["float_max"] = None - - return EngineSetting(**args) - - -def unmarshal_EngineVersion(data: Any) -> EngineVersion: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'EngineVersion' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("version", None) - if field is not None: - args["version"] = field - - field = data.get("name", None) - if field is not None: - args["name"] = field - - field = data.get("available_settings", None) - if field is not None: - args["available_settings"] = ( - [unmarshal_EngineSetting(v) for v in field] if field is not None else None - ) - - field = data.get("disabled", None) - if field is not None: - args["disabled"] = field - - field = data.get("beta", None) - if field is not None: - args["beta"] = field - - field = data.get("available_init_settings", None) - if field is not None: - args["available_init_settings"] = ( - [unmarshal_EngineSetting(v) for v in field] if field is not None else None - ) - - field = data.get("end_of_life", None) - if field is not None: - args["end_of_life"] = ( - parser.isoparse(field) if isinstance(field, str) else field - ) - else: - args["end_of_life"] = None - - return EngineVersion(**args) - - -def unmarshal_DatabaseEngine(data: Any) -> DatabaseEngine: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'DatabaseEngine' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("name", None) - if field is not None: - args["name"] = field - - field = data.get("logo_url", None) - if field is not None: - args["logo_url"] = field - - field = data.get("versions", None) - if field is not None: - args["versions"] = ( - [unmarshal_EngineVersion(v) for v in field] if field is not None else None - ) - - field = data.get("region", None) - if field is not None: - args["region"] = field - - return DatabaseEngine(**args) - - -def unmarshal_ListDatabaseEnginesResponse(data: Any) -> ListDatabaseEnginesResponse: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'ListDatabaseEnginesResponse' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("engines", None) - if field is not None: - args["engines"] = ( - [unmarshal_DatabaseEngine(v) for v in field] if field is not None else None - ) - - field = data.get("total_count", None) - if field is not None: - args["total_count"] = field - - return ListDatabaseEnginesResponse(**args) - - -def unmarshal_ListDatabasesResponse(data: Any) -> ListDatabasesResponse: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'ListDatabasesResponse' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("databases", None) - if field is not None: - args["databases"] = ( - [unmarshal_Database(v) for v in field] if field is not None else None - ) - - field = data.get("total_count", None) - if field is not None: - args["total_count"] = field - - return ListDatabasesResponse(**args) - - -def unmarshal_ListInstanceACLRulesResponse(data: Any) -> ListInstanceACLRulesResponse: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'ListInstanceACLRulesResponse' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("rules", None) - if field is not None: - args["rules"] = ( - [unmarshal_ACLRule(v) for v in field] if field is not None else None - ) - - field = data.get("total_count", None) - if field is not None: - args["total_count"] = field - - return ListInstanceACLRulesResponse(**args) - - -def unmarshal_ListInstanceLogsDetailsResponseInstanceLogDetail( - data: Any, -) -> ListInstanceLogsDetailsResponseInstanceLogDetail: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'ListInstanceLogsDetailsResponseInstanceLogDetail' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("log_name", None) - if field is not None: - args["log_name"] = field - - field = data.get("size", None) - if field is not None: - args["size"] = field - - return ListInstanceLogsDetailsResponseInstanceLogDetail(**args) - - -def unmarshal_ListInstanceLogsDetailsResponse( - data: Any, -) -> ListInstanceLogsDetailsResponse: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'ListInstanceLogsDetailsResponse' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("details", None) - if field is not None: - args["details"] = ( - [ - unmarshal_ListInstanceLogsDetailsResponseInstanceLogDetail(v) - for v in field - ] - if field is not None - else None - ) - - return ListInstanceLogsDetailsResponse(**args) - - -def unmarshal_ListInstanceLogsResponse(data: Any) -> ListInstanceLogsResponse: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'ListInstanceLogsResponse' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("instance_logs", None) - if field is not None: - args["instance_logs"] = ( - [unmarshal_InstanceLog(v) for v in field] if field is not None else None - ) - - return ListInstanceLogsResponse(**args) - - -def unmarshal_ListInstancesResponse(data: Any) -> ListInstancesResponse: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'ListInstancesResponse' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("instances", None) - if field is not None: - args["instances"] = ( - [unmarshal_Instance(v) for v in field] if field is not None else None - ) - - field = data.get("total_count", None) - if field is not None: - args["total_count"] = field - - return ListInstancesResponse(**args) - - -def unmarshal_NodeTypeVolumeConstraintSizes(data: Any) -> NodeTypeVolumeConstraintSizes: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'NodeTypeVolumeConstraintSizes' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("min_size", None) - if field is not None: - args["min_size"] = field - - field = data.get("max_size", None) - if field is not None: - args["max_size"] = field - - return NodeTypeVolumeConstraintSizes(**args) - - -def unmarshal_NodeTypeVolumeType(data: Any) -> NodeTypeVolumeType: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'NodeTypeVolumeType' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("type", None) - if field is not None: - args["type_"] = field - - field = data.get("description", None) - if field is not None: - args["description"] = field - - field = data.get("min_size", None) - if field is not None: - args["min_size"] = field - - field = data.get("max_size", None) - if field is not None: - args["max_size"] = field - - field = data.get("chunk_size", None) - if field is not None: - args["chunk_size"] = field - - field = data.get("class", None) - if field is not None: - args["class_"] = field - - return NodeTypeVolumeType(**args) - - -def unmarshal_NodeType(data: Any) -> NodeType: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'NodeType' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("name", None) - if field is not None: - args["name"] = field - - field = data.get("stock_status", None) - if field is not None: - args["stock_status"] = field - - field = data.get("description", None) - if field is not None: - args["description"] = field - - field = data.get("vcpus", None) - if field is not None: - args["vcpus"] = field - - field = data.get("memory", None) - if field is not None: - args["memory"] = field - - field = data.get("disabled", None) - if field is not None: - args["disabled"] = field - - field = data.get("beta", None) - if field is not None: - args["beta"] = field - - field = data.get("volume_constraint", None) - if field is not None: - args["volume_constraint"] = unmarshal_NodeTypeVolumeConstraintSizes(field) - else: - args["volume_constraint"] = None - - field = data.get("is_bssd_compatible", None) - if field is not None: - args["is_bssd_compatible"] = field - else: - args["is_bssd_compatible"] = None - - field = data.get("available_volume_types", None) - if field is not None: - args["available_volume_types"] = ( - [unmarshal_NodeTypeVolumeType(v) for v in field] - if field is not None - else None - ) - - field = data.get("is_ha_required", None) - if field is not None: - args["is_ha_required"] = field - - field = data.get("generation", None) - if field is not None: - args["generation"] = field - - field = data.get("instance_range", None) - if field is not None: - args["instance_range"] = field - - field = data.get("region", None) - if field is not None: - args["region"] = field - - return NodeType(**args) - - -def unmarshal_ListNodeTypesResponse(data: Any) -> ListNodeTypesResponse: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'ListNodeTypesResponse' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("node_types", None) - if field is not None: - args["node_types"] = ( - [unmarshal_NodeType(v) for v in field] if field is not None else None - ) - - field = data.get("total_count", None) - if field is not None: - args["total_count"] = field - - return ListNodeTypesResponse(**args) - - -def unmarshal_ListPrivilegesResponse(data: Any) -> ListPrivilegesResponse: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'ListPrivilegesResponse' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("privileges", None) - if field is not None: - args["privileges"] = ( - [unmarshal_Privilege(v) for v in field] if field is not None else None - ) - - field = data.get("total_count", None) - if field is not None: - args["total_count"] = field - - return ListPrivilegesResponse(**args) - - -def unmarshal_ListSnapshotsResponse(data: Any) -> ListSnapshotsResponse: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'ListSnapshotsResponse' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("snapshots", None) - if field is not None: - args["snapshots"] = ( - [unmarshal_Snapshot(v) for v in field] if field is not None else None - ) - - field = data.get("total_count", None) - if field is not None: - args["total_count"] = field - - return ListSnapshotsResponse(**args) - - -def unmarshal_ListUsersResponse(data: Any) -> ListUsersResponse: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'ListUsersResponse' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("users", None) - if field is not None: - args["users"] = ( - [unmarshal_User(v) for v in field] if field is not None else None - ) - - field = data.get("total_count", None) - if field is not None: - args["total_count"] = field - - return ListUsersResponse(**args) - - -def unmarshal_SetInstanceACLRulesResponse(data: Any) -> SetInstanceACLRulesResponse: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'SetInstanceACLRulesResponse' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("rules", None) - if field is not None: - args["rules"] = ( - [unmarshal_ACLRule(v) for v in field] if field is not None else None - ) - - return SetInstanceACLRulesResponse(**args) - - -def unmarshal_SetInstanceSettingsResponse(data: Any) -> SetInstanceSettingsResponse: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'SetInstanceSettingsResponse' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("settings", None) - if field is not None: - args["settings"] = ( - [unmarshal_InstanceSetting(v) for v in field] if field is not None else None - ) - - return SetInstanceSettingsResponse(**args) - - -def marshal_ACLRuleRequest( - request: ACLRuleRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - if request.ip is not None: - output["ip"] = request.ip - - if request.description is not None: - output["description"] = request.description - - return output - - -def marshal_AddInstanceACLRulesRequest( - request: AddInstanceACLRulesRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - if request.rules is not None: - output["rules"] = [ - marshal_ACLRuleRequest(item, defaults) for item in request.rules - ] - - return output - - -def marshal_InstanceSetting( - request: InstanceSetting, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - if request.name is not None: - output["name"] = request.name - - if request.value is not None: - output["value"] = request.value - - return output - - -def marshal_AddInstanceSettingsRequest( - request: AddInstanceSettingsRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - if request.settings is not None: - output["settings"] = [ - marshal_InstanceSetting(item, defaults) for item in request.settings - ] - - return output - - -def marshal_CloneInstanceRequest( - request: CloneInstanceRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - if request.name is not None: - output["name"] = request.name - - if request.node_type is not None: - output["node_type"] = request.node_type - - return output - - -def marshal_CreateDatabaseRequest( - request: CreateDatabaseRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - if request.name is not None: - output["name"] = request.name - - return output - - -def marshal_EndpointSpecPrivateNetworkIpamConfig( - request: EndpointSpecPrivateNetworkIpamConfig, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - return output - - -def marshal_EndpointSpecLoadBalancer( - request: EndpointSpecLoadBalancer, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - return output - - -def marshal_EndpointSpecPrivateNetwork( - request: EndpointSpecPrivateNetwork, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - output.update( - resolve_one_of( - [ - OneOfPossibility("service_ip", request.service_ip), - OneOfPossibility("ipam_config", request.ipam_config), - ] - ), - ) - - if request.private_network_id is not None: - output["private_network_id"] = request.private_network_id - - return output - - -def marshal_EndpointSpec( - request: EndpointSpec, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - output.update( - resolve_one_of( - [ - OneOfPossibility("load_balancer", request.load_balancer), - OneOfPossibility("private_network", request.private_network), - ] - ), - ) - - return output - - -def marshal_CreateEndpointRequest( - request: CreateEndpointRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - if request.endpoint_spec is not None: - output["endpoint_spec"] = marshal_EndpointSpec(request.endpoint_spec, defaults) - - return output - - -def marshal_CreateInstanceFromSnapshotRequest( - request: CreateInstanceFromSnapshotRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - if request.instance_name is not None: - output["instance_name"] = request.instance_name - - if request.is_ha_cluster is not None: - output["is_ha_cluster"] = request.is_ha_cluster - - if request.node_type is not None: - output["node_type"] = request.node_type - - return output - - -def marshal_CreateInstanceRequest( - request: CreateInstanceRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - output.update( - resolve_one_of( - [ - OneOfPossibility( - "organization_id", - request.organization_id, - defaults.default_organization_id, - ), - OneOfPossibility( - "project_id", request.project_id, defaults.default_project_id - ), - ] - ), - ) - - if request.engine is not None: - output["engine"] = request.engine - - if request.user_name is not None: - output["user_name"] = request.user_name - - if request.password is not None: - output["password"] = request.password - - if request.node_type is not None: - output["node_type"] = request.node_type - - if request.name is not None: - output["name"] = request.name - - if request.is_ha_cluster is not None: - output["is_ha_cluster"] = request.is_ha_cluster - - if request.disable_backup is not None: - output["disable_backup"] = request.disable_backup - - if request.volume_size is not None: - output["volume_size"] = request.volume_size - - if request.backup_same_region is not None: - output["backup_same_region"] = request.backup_same_region - - if request.tags is not None: - output["tags"] = request.tags - - if request.init_settings is not None: - output["init_settings"] = [ - marshal_InstanceSetting(item, defaults) for item in request.init_settings - ] - - if request.volume_type is not None: - output["volume_type"] = str(request.volume_type) - - if request.init_endpoints is not None: - output["init_endpoints"] = [ - marshal_EndpointSpec(item, defaults) for item in request.init_endpoints - ] - - return output - - -def marshal_ReadReplicaEndpointSpecPrivateNetworkIpamConfig( - request: ReadReplicaEndpointSpecPrivateNetworkIpamConfig, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - return output - - -def marshal_ReadReplicaEndpointSpecDirectAccess( - request: ReadReplicaEndpointSpecDirectAccess, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - return output - - -def marshal_ReadReplicaEndpointSpecPrivateNetwork( - request: ReadReplicaEndpointSpecPrivateNetwork, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - output.update( - resolve_one_of( - [ - OneOfPossibility("service_ip", request.service_ip), - OneOfPossibility("ipam_config", request.ipam_config), - ] - ), - ) - - if request.private_network_id is not None: - output["private_network_id"] = request.private_network_id - - return output - - -def marshal_ReadReplicaEndpointSpec( - request: ReadReplicaEndpointSpec, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - output.update( - resolve_one_of( - [ - OneOfPossibility("direct_access", request.direct_access), - OneOfPossibility("private_network", request.private_network), - ] - ), - ) - - return output - - -def marshal_CreateReadReplicaEndpointRequest( - request: CreateReadReplicaEndpointRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - if request.endpoint_spec is not None: - output["endpoint_spec"] = [ - marshal_ReadReplicaEndpointSpec(item, defaults) - for item in request.endpoint_spec - ] - - return output - - -def marshal_CreateReadReplicaRequest( - request: CreateReadReplicaRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - if request.instance_id is not None: - output["instance_id"] = request.instance_id - - if request.endpoint_spec is not None: - output["endpoint_spec"] = [ - marshal_ReadReplicaEndpointSpec(item, defaults) - for item in request.endpoint_spec - ] - - if request.same_zone is not None: - output["same_zone"] = request.same_zone - - return output - - -def marshal_CreateSnapshotRequest( - request: CreateSnapshotRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - if request.name is not None: - output["name"] = request.name - - if request.expires_at is not None: - output["expires_at"] = request.expires_at.isoformat() - - return output - - -def marshal_CreateUserRequest( - request: CreateUserRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - if request.name is not None: - output["name"] = request.name - - if request.password is not None: - output["password"] = request.password - - if request.is_admin is not None: - output["is_admin"] = request.is_admin - - return output - - -def marshal_DeleteInstanceACLRulesRequest( - request: DeleteInstanceACLRulesRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - if request.acl_rule_ips is not None: - output["acl_rule_ips"] = request.acl_rule_ips - - return output - - -def marshal_DeleteInstanceSettingsRequest( - request: DeleteInstanceSettingsRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - if request.setting_names is not None: - output["setting_names"] = request.setting_names - - return output - - -def marshal_MigrateEndpointRequest( - request: MigrateEndpointRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - if request.instance_id is not None: - output["instance_id"] = request.instance_id - - return output - - -def marshal_PurgeInstanceLogsRequest( - request: PurgeInstanceLogsRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - if request.log_name is not None: - output["log_name"] = request.log_name - - return output - - -def marshal_SetInstanceACLRulesRequest( - request: SetInstanceACLRulesRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - if request.rules is not None: - output["rules"] = [ - marshal_ACLRuleRequest(item, defaults) for item in request.rules - ] - - return output - - -def marshal_SetInstanceSettingsRequest( - request: SetInstanceSettingsRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - if request.settings is not None: - output["settings"] = [ - marshal_InstanceSetting(item, defaults) for item in request.settings - ] - - return output - - -def marshal_SetPrivilegeRequest( - request: SetPrivilegeRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - if request.database_name is not None: - output["database_name"] = request.database_name - - if request.user_name is not None: - output["user_name"] = request.user_name - - if request.permission is not None: - output["permission"] = str(request.permission) - - return output - - -def marshal_LogsPolicy( - request: LogsPolicy, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - if request.max_age_retention is not None: - output["max_age_retention"] = request.max_age_retention - - if request.total_disk_retention is not None: - output["total_disk_retention"] = request.total_disk_retention - - return output - - -def marshal_UpdateInstanceRequest( - request: UpdateInstanceRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - if request.backup_schedule_frequency is not None: - output["backup_schedule_frequency"] = request.backup_schedule_frequency - - if request.backup_schedule_retention is not None: - output["backup_schedule_retention"] = request.backup_schedule_retention - - if request.is_backup_schedule_disabled is not None: - output["is_backup_schedule_disabled"] = request.is_backup_schedule_disabled - - if request.name is not None: - output["name"] = request.name - - if request.tags is not None: - output["tags"] = request.tags - - if request.logs_policy is not None: - output["logs_policy"] = marshal_LogsPolicy(request.logs_policy, defaults) - - if request.backup_same_region is not None: - output["backup_same_region"] = request.backup_same_region - - if request.backup_schedule_start_hour is not None: - output["backup_schedule_start_hour"] = request.backup_schedule_start_hour - - return output - - -def marshal_UpdateSnapshotRequest( - request: UpdateSnapshotRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - if request.name is not None: - output["name"] = request.name - - if request.expires_at is not None: - output["expires_at"] = request.expires_at.isoformat() - - return output - - -def marshal_UpdateUserRequest( - request: UpdateUserRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - if request.password is not None: - output["password"] = request.password - - if request.is_admin is not None: - output["is_admin"] = request.is_admin - - return output - - -def marshal_UpgradeInstanceRequestMajorUpgradeWorkflow( - request: UpgradeInstanceRequestMajorUpgradeWorkflow, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - if request.upgradable_version_id is not None: - output["upgradable_version_id"] = request.upgradable_version_id - - if request.with_endpoints is not None: - output["with_endpoints"] = request.with_endpoints - - return output - - -def marshal_UpgradeInstanceRequest( - request: UpgradeInstanceRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - output.update( - resolve_one_of( - [ - OneOfPossibility("node_type", request.node_type), - OneOfPossibility("enable_ha", request.enable_ha), - OneOfPossibility("volume_size", request.volume_size), - OneOfPossibility("volume_type", request.volume_type), - OneOfPossibility( - "upgradable_version_id", request.upgradable_version_id - ), - OneOfPossibility( - "major_upgrade_workflow", request.major_upgrade_workflow - ), - ] - ), - ) - - return output diff --git a/scaleway-async/scaleway_async/document_db/v1beta1/types.py b/scaleway-async/scaleway_async/document_db/v1beta1/types.py deleted file mode 100644 index 5bf4484db..000000000 --- a/scaleway-async/scaleway_async/document_db/v1beta1/types.py +++ /dev/null @@ -1,2275 +0,0 @@ -# This file was automatically generated. DO NOT EDIT. -# If you have any remark or suggestion do not hesitate to open an issue. -from __future__ import annotations - -from dataclasses import dataclass -from datetime import datetime -from enum import Enum -from typing import List, Optional - -from scaleway_core.bridge import ( - Region, - TimeSeries, - Zone, -) -from scaleway_core.utils import ( - StrEnumMeta, -) - - -class ACLRuleAction(str, Enum, metaclass=StrEnumMeta): - ALLOW = "allow" - DENY = "deny" - - def __str__(self) -> str: - return str(self.value) - - -class ACLRuleDirection(str, Enum, metaclass=StrEnumMeta): - INBOUND = "inbound" - OUTBOUND = "outbound" - - def __str__(self) -> str: - return str(self.value) - - -class ACLRuleProtocol(str, Enum, metaclass=StrEnumMeta): - TCP = "tcp" - UDP = "udp" - ICMP = "icmp" - - def __str__(self) -> str: - return str(self.value) - - -class EngineSettingPropertyType(str, Enum, metaclass=StrEnumMeta): - BOOLEAN = "boolean" - INT = "int" - STRING = "string" - FLOAT = "float" - - def __str__(self) -> str: - return str(self.value) - - -class InstanceLogStatus(str, Enum, metaclass=StrEnumMeta): - UNKNOWN = "unknown" - READY = "ready" - CREATING = "creating" - ERROR = "error" - - def __str__(self) -> str: - return str(self.value) - - -class InstanceStatus(str, Enum, metaclass=StrEnumMeta): - UNKNOWN = "unknown" - READY = "ready" - PROVISIONING = "provisioning" - CONFIGURING = "configuring" - DELETING = "deleting" - ERROR = "error" - AUTOHEALING = "autohealing" - LOCKED = "locked" - INITIALIZING = "initializing" - DISK_FULL = "disk_full" - BACKUPING = "backuping" - SNAPSHOTTING = "snapshotting" - RESTARTING = "restarting" - - def __str__(self) -> str: - return str(self.value) - - -class ListDatabasesRequestOrderBy(str, Enum, metaclass=StrEnumMeta): - NAME_ASC = "name_asc" - NAME_DESC = "name_desc" - SIZE_ASC = "size_asc" - SIZE_DESC = "size_desc" - - def __str__(self) -> str: - return str(self.value) - - -class ListInstanceLogsRequestOrderBy(str, Enum, metaclass=StrEnumMeta): - CREATED_AT_ASC = "created_at_asc" - CREATED_AT_DESC = "created_at_desc" - - def __str__(self) -> str: - return str(self.value) - - -class ListInstancesRequestOrderBy(str, Enum, metaclass=StrEnumMeta): - CREATED_AT_ASC = "created_at_asc" - CREATED_AT_DESC = "created_at_desc" - NAME_ASC = "name_asc" - NAME_DESC = "name_desc" - REGION = "region" - STATUS_ASC = "status_asc" - STATUS_DESC = "status_desc" - - def __str__(self) -> str: - return str(self.value) - - -class ListPrivilegesRequestOrderBy(str, Enum, metaclass=StrEnumMeta): - USER_NAME_ASC = "user_name_asc" - USER_NAME_DESC = "user_name_desc" - DATABASE_NAME_ASC = "database_name_asc" - DATABASE_NAME_DESC = "database_name_desc" - - def __str__(self) -> str: - return str(self.value) - - -class ListSnapshotsRequestOrderBy(str, Enum, metaclass=StrEnumMeta): - CREATED_AT_ASC = "created_at_asc" - CREATED_AT_DESC = "created_at_desc" - NAME_ASC = "name_asc" - NAME_DESC = "name_desc" - EXPIRES_AT_ASC = "expires_at_asc" - EXPIRES_AT_DESC = "expires_at_desc" - - def __str__(self) -> str: - return str(self.value) - - -class ListUsersRequestOrderBy(str, Enum, metaclass=StrEnumMeta): - NAME_ASC = "name_asc" - NAME_DESC = "name_desc" - IS_ADMIN_ASC = "is_admin_asc" - IS_ADMIN_DESC = "is_admin_desc" - - def __str__(self) -> str: - return str(self.value) - - -class MaintenanceStatus(str, Enum, metaclass=StrEnumMeta): - UNKNOWN = "unknown" - PENDING = "pending" - DONE = "done" - CANCELED = "canceled" - ONGOING = "ongoing" - - def __str__(self) -> str: - return str(self.value) - - -class NodeTypeGeneration(str, Enum, metaclass=StrEnumMeta): - UNKNOWN_GENERATION = "unknown_generation" - GENERATION_V1 = "generation_v1" - GENERATION_V2 = "generation_v2" - - def __str__(self) -> str: - return str(self.value) - - -class NodeTypeStock(str, Enum, metaclass=StrEnumMeta): - UNKNOWN = "unknown" - LOW_STOCK = "low_stock" - OUT_OF_STOCK = "out_of_stock" - AVAILABLE = "available" - - def __str__(self) -> str: - return str(self.value) - - -class Permission(str, Enum, metaclass=StrEnumMeta): - READONLY = "readonly" - READWRITE = "readwrite" - ALL = "all" - CUSTOM = "custom" - NONE = "none" - - def __str__(self) -> str: - return str(self.value) - - -class ReadReplicaStatus(str, Enum, metaclass=StrEnumMeta): - UNKNOWN = "unknown" - PROVISIONING = "provisioning" - INITIALIZING = "initializing" - READY = "ready" - DELETING = "deleting" - ERROR = "error" - LOCKED = "locked" - CONFIGURING = "configuring" - PROMOTING = "promoting" - - def __str__(self) -> str: - return str(self.value) - - -class SnapshotStatus(str, Enum, metaclass=StrEnumMeta): - UNKNOWN = "unknown" - CREATING = "creating" - READY = "ready" - RESTORING = "restoring" - DELETING = "deleting" - ERROR = "error" - LOCKED = "locked" - - def __str__(self) -> str: - return str(self.value) - - -class StorageClass(str, Enum, metaclass=StrEnumMeta): - UNKNOWN_STORAGE_CLASS = "unknown_storage_class" - LSSD = "lssd" - BSSD = "bssd" - SBS = "sbs" - - def __str__(self) -> str: - return str(self.value) - - -class VolumeType(str, Enum, metaclass=StrEnumMeta): - LSSD = "lssd" - BSSD = "bssd" - SBS_5K = "sbs_5k" - SBS_15K = "sbs_15k" - - def __str__(self) -> str: - return str(self.value) - - -@dataclass -class EndpointDirectAccessDetails: - pass - - -@dataclass -class EndpointLoadBalancerDetails: - pass - - -@dataclass -class EndpointPrivateNetworkDetails: - private_network_id: str - """ - UUID of the Private Network. - """ - - service_ip: str - """ - CIDR notation of the endpoint IPv4 address. - """ - - zone: Zone - """ - Private network zone. - """ - - -@dataclass -class EndpointSpecPrivateNetworkIpamConfig: - pass - - -@dataclass -class ReadReplicaEndpointSpecPrivateNetworkIpamConfig: - pass - - -@dataclass -class EngineSetting: - name: str - """ - Setting name from the database engine. - """ - - default_value: str - """ - Value set when not specified. - """ - - hot_configurable: bool - """ - Setting can be applied without restarting. - """ - - description: str - """ - Setting description. - """ - - property_type: EngineSettingPropertyType - """ - Setting type. - """ - - unit: Optional[str] - """ - Setting base unit. - """ - - string_constraint: Optional[str] - """ - Validation regex for string type settings. - """ - - int_min: Optional[int] - """ - Minimum value for int types. - """ - - int_max: Optional[int] - """ - Maximum value for int types. - """ - - float_min: Optional[float] - """ - Minimum value for float types. - """ - - float_max: Optional[float] - """ - Maximum value for float types. - """ - - -@dataclass -class Endpoint: - id: str - """ - UUID of the endpoint. - """ - - port: int - """ - TCP port of the endpoint. - """ - - name: Optional[str] - """ - Name of the endpoint. - """ - - ip: Optional[str] - - hostname: Optional[str] - - private_network: Optional[EndpointPrivateNetworkDetails] - - load_balancer: Optional[EndpointLoadBalancerDetails] - - direct_access: Optional[EndpointDirectAccessDetails] - - -@dataclass -class EndpointSpecLoadBalancer: - pass - - -@dataclass -class EndpointSpecPrivateNetwork: - private_network_id: str - """ - UUID of the Private Network to be connected to the Database Instance. - """ - - service_ip: Optional[str] - - ipam_config: Optional[EndpointSpecPrivateNetworkIpamConfig] - - -@dataclass -class ReadReplicaEndpointSpecDirectAccess: - pass - - -@dataclass -class ReadReplicaEndpointSpecPrivateNetwork: - private_network_id: str - """ - UUID of the Private Network to be connected to the Read Replica. - """ - - service_ip: Optional[str] - - ipam_config: Optional[ReadReplicaEndpointSpecPrivateNetworkIpamConfig] - - -@dataclass -class EngineVersion: - version: str - """ - Database engine version. - """ - - name: str - """ - Database engine name. - """ - - available_settings: List[EngineSetting] - """ - Engine settings available to be set. - """ - - disabled: bool - """ - Disabled versions cannot be created. - """ - - beta: bool - """ - Beta status of engine version. - """ - - available_init_settings: List[EngineSetting] - """ - Engine settings available to be set at database initialization. - """ - - end_of_life: Optional[datetime] - """ - End of life date. - """ - - -@dataclass -class BackupSchedule: - frequency: int - """ - Frequency of the backup schedule (in hours). - """ - - retention: int - """ - Default retention period of backups (in days). - """ - - disabled: bool - """ - Defines whether the backup schedule feature is disabled. - """ - - next_run_at: Optional[datetime] - """ - Next run of the backup schedule (accurate to 10 minutes). - """ - - -@dataclass -class InstanceSetting: - name: str - - value: str - - -@dataclass -class LogsPolicy: - max_age_retention: Optional[int] - """ - Max age (in days) of remote logs to keep on the Database Instance. - """ - - total_disk_retention: Optional[int] - """ - Max disk size of remote logs to keep on the Database Instance. - """ - - -@dataclass -class Maintenance: - reason: str - """ - Maintenance information message. - """ - - status: MaintenanceStatus - """ - Status of the maintenance. - """ - - starts_at: Optional[datetime] - """ - Start date of the maintenance window. - """ - - stops_at: Optional[datetime] - """ - End date of the maintenance window. - """ - - closed_at: Optional[datetime] - """ - Closed maintenance date. - """ - - forced_at: Optional[datetime] - """ - Time when Scaleway-side maintenance will be applied. - """ - - -@dataclass -class ReadReplica: - id: str - """ - UUID of the Read Replica. - """ - - endpoints: List[Endpoint] - """ - Display Read Replica connection information. - """ - - status: ReadReplicaStatus - """ - Read replica status. - """ - - region: Region - """ - Region the Read Replica is in. - """ - - same_zone: bool - """ - Whether the replica is in the same Availability Zone as the main Database Instance nodes or not. - """ - - -@dataclass -class UpgradableVersion: - id: str - - name: str - - version: str - - minor_version: str - - -@dataclass -class Volume: - type_: VolumeType - - size: int - - class_: StorageClass - - -@dataclass -class NodeTypeVolumeConstraintSizes: - min_size: int - """ - [deprecated] Mimimum size required for the Volume. - """ - - max_size: int - """ - [deprecated] Maximum size required for the Volume. - """ - - -@dataclass -class NodeTypeVolumeType: - type_: VolumeType - """ - Volume Type. - """ - - description: str - """ - The description of the Volume. - """ - - min_size: int - """ - Mimimum size required for the Volume. - """ - - max_size: int - """ - Maximum size required for the Volume. - """ - - chunk_size: int - """ - Minimum increment level for a Block Storage volume size. - """ - - class_: StorageClass - """ - The storage class of the volume. - """ - - -@dataclass -class SnapshotVolumeType: - type_: VolumeType - - class_: StorageClass - - -@dataclass -class ACLRuleRequest: - ip: str - - description: str - - -@dataclass -class ACLRule: - ip: str - - protocol: ACLRuleProtocol - - direction: ACLRuleDirection - - action: ACLRuleAction - - description: str - - port: Optional[int] - - -@dataclass -class EndpointSpec: - load_balancer: Optional[EndpointSpecLoadBalancer] - - private_network: Optional[EndpointSpecPrivateNetwork] - - -@dataclass -class ReadReplicaEndpointSpec: - direct_access: Optional[ReadReplicaEndpointSpecDirectAccess] - - private_network: Optional[ReadReplicaEndpointSpecPrivateNetwork] - - -@dataclass -class DatabaseEngine: - name: str - """ - Engine name. - """ - - logo_url: str - """ - Engine logo URL. - """ - - versions: List[EngineVersion] - """ - Available versions. - """ - - region: Region - """ - Region of this Database Instance. - """ - - -@dataclass -class Database: - name: str - """ - Name of the database. - """ - - owner: str - """ - Name of the database owner. - """ - - managed: bool - """ - Defines whether the database is managed or not. - """ - - size: int - """ - Size of the database. - """ - - -@dataclass -class ListInstanceLogsDetailsResponseInstanceLogDetail: - log_name: str - - size: int - - -@dataclass -class InstanceLog: - id: str - """ - UUID of the Database Instance log. - """ - - status: InstanceLogStatus - """ - Status of the logs in a Database Instance. - """ - - node_name: str - """ - Name of the underlying node. - """ - - region: Region - """ - Region the Database Instance is in. - """ - - download_url: Optional[str] - """ - Presigned S3 URL to download your log file. - """ - - expires_at: Optional[datetime] - """ - Expiration date (must follow the ISO 8601 format). - """ - - created_at: Optional[datetime] - """ - Creation date (must follow the ISO 8601 format). - """ - - -@dataclass -class Instance: - region: Region - """ - Region the Database Instance is in. - """ - - id: str - """ - UUID of the Database Instance. - """ - - name: str - """ - Name of the Database Instance. - """ - - organization_id: str - """ - Organization ID the Database Instance belongs to. - """ - - created_at: Optional[datetime] - """ - Creation date (must follow the ISO 8601 format). - """ - - volume: Optional[Volume] - """ - Volumes of the Database Instance. - """ - - project_id: str - """ - Project ID the Database Instance belongs to. - """ - - status: InstanceStatus - """ - Status of the Database Instance. - """ - - engine: str - """ - Database engine of the database. - """ - - upgradable_version: List[UpgradableVersion] - """ - Available database engine versions for upgrade. - """ - - tags: List[str] - """ - List of tags applied to the Database Instance. - """ - - settings: List[InstanceSetting] - """ - Advanced settings of the Database Instance. - """ - - is_ha_cluster: bool - """ - Defines whether or not High-Availability is enabled. - """ - - endpoint: Optional[Endpoint] - """ - Endpoint of the Database Instance. - """ - - backup_schedule: Optional[BackupSchedule] - """ - Backup schedule of the Database Instance. - """ - - read_replicas: List[ReadReplica] - """ - Read Replicas of the Database Instance. - """ - - node_type: str - """ - Node type of the Database Instance. - """ - - init_settings: List[InstanceSetting] - """ - List of engine settings to be set at Database Instance initialization. - """ - - endpoints: List[Endpoint] - """ - List of Database Instance endpoints. - """ - - backup_same_region: bool - """ - Store logical backups in the same region as the Database Instance. - """ - - maintenances: List[Maintenance] - """ - List of Database Instance maintenance events. - """ - - logs_policy: Optional[LogsPolicy] - """ - Logs policy of the Database Instance. - """ - - -@dataclass -class NodeType: - name: str - """ - Node Type name identifier. - """ - - stock_status: NodeTypeStock - """ - Current stock status for the Node Type. - """ - - description: str - """ - Current specs of the offer. - """ - - vcpus: int - """ - Number of virtual CPUs. - """ - - memory: int - """ - Quantity of RAM. - """ - - disabled: bool - """ - The Node Type is currently disabled. - """ - - beta: bool - """ - The Node Type is currently in beta. - """ - - volume_constraint: Optional[NodeTypeVolumeConstraintSizes] - """ - [deprecated] Node Type volume constraints. - """ - - is_bssd_compatible: Optional[bool] - """ - The Node Type is compliant with Block Storage. - """ - - available_volume_types: List[NodeTypeVolumeType] - """ - Available storage options for the Node Type. - """ - - is_ha_required: bool - """ - The Node Type can be used only with the High Availability option. - """ - - generation: NodeTypeGeneration - """ - Generation associated the NodeType offer. - """ - - instance_range: str - """ - Instance range associated with the NodeType offer. - """ - - region: Region - """ - Region the Node Type is in. - """ - - -@dataclass -class Privilege: - permission: Permission - """ - Permission (Read, Read/Write, All, Custom). - """ - - database_name: str - """ - Name of the database. - """ - - user_name: str - """ - Name of the user. - """ - - -@dataclass -class Snapshot: - id: str - """ - UUID of the snapshot. - """ - - instance_id: str - """ - UUID of the Database Instance. - """ - - name: str - """ - Name of the snapshot. - """ - - status: SnapshotStatus - """ - Status of the snapshot. - """ - - instance_name: str - """ - Name of the Database Instance of the snapshot. - """ - - node_type: str - """ - Source node type. - """ - - region: Region - """ - Region of this snapshot. - """ - - size: Optional[int] - """ - Size of the snapshot. - """ - - expires_at: Optional[datetime] - """ - Expiration date (must follow the ISO 8601 format). - """ - - created_at: Optional[datetime] - """ - Creation date (must follow the ISO 8601 format). - """ - - updated_at: Optional[datetime] - """ - Updated date (must follow the ISO 8601 format). - """ - - volume_type: Optional[SnapshotVolumeType] - """ - Type of volume where data is stored (lssd, bssd or sbs). - """ - - -@dataclass -class User: - name: str - """ - Name of the user (Length must be between 1 and 63 characters. First character must be an alphabet character (a-zA-Z). Your username cannot start with '_rdb' or 'pg_'. Only a-zA-Z0-9_$- characters are accepted). - """ - - is_admin: bool - """ - Defines whether or not a user got administrative privileges on the Database Instance. - """ - - -@dataclass -class UpgradeInstanceRequestMajorUpgradeWorkflow: - upgradable_version_id: str - """ - This will create a new Database Instance with same specifications as the current one and perform a Database Engine upgrade. - """ - - with_endpoints: bool - """ - At the end of the migration procedure this option let you migrate all your database endpoint to the upgraded instance. - """ - - -@dataclass -class AddInstanceACLRulesRequest: - instance_id: str - """ - UUID of the Database Instance you want to add ACL rules to. - """ - - rules: List[ACLRuleRequest] - """ - ACL rules to add to the Database Instance. - """ - - region: Optional[Region] - """ - Region to target. If none is passed will use default region from the config. - """ - - -@dataclass -class AddInstanceACLRulesResponse: - rules: List[ACLRule] - """ - ACL Rules enabled for the Database Instance. - """ - - -@dataclass -class AddInstanceSettingsRequest: - instance_id: str - """ - UUID of the Database Instance you want to add settings to. - """ - - settings: List[InstanceSetting] - """ - Settings to add to the Database Instance. - """ - - region: Optional[Region] - """ - Region to target. If none is passed will use default region from the config. - """ - - -@dataclass -class AddInstanceSettingsResponse: - settings: List[InstanceSetting] - """ - Settings available on the Database Instance. - """ - - -@dataclass -class ApplyInstanceMaintenanceRequest: - instance_id: str - """ - UUID of the Database Instance to which you want to apply maintenance. - """ - - region: Optional[Region] - """ - Region to target. If none is passed will use default region from the config. - """ - - -@dataclass -class CloneInstanceRequest: - instance_id: str - """ - UUID of the Database Instance you want to clone. - """ - - name: str - """ - Name of the Database Instance clone. - """ - - region: Optional[Region] - """ - Region to target. If none is passed will use default region from the config. - """ - - node_type: Optional[str] - """ - Node type of the clone. - """ - - -@dataclass -class CreateDatabaseRequest: - instance_id: str - """ - UUID of the Database Instance where to create the database. - """ - - name: str - """ - Name of the database. - """ - - region: Optional[Region] - """ - Region to target. If none is passed will use default region from the config. - """ - - -@dataclass -class CreateEndpointRequest: - instance_id: str - """ - UUID of the Database Instance you to which you want to add an endpoint. - """ - - region: Optional[Region] - """ - Region to target. If none is passed will use default region from the config. - """ - - endpoint_spec: Optional[EndpointSpec] - """ - Specification of the endpoint you want to create. - """ - - -@dataclass -class CreateInstanceFromSnapshotRequest: - snapshot_id: str - """ - Block snapshot of the Database Instance. - """ - - instance_name: str - """ - Name of the Database Instance created with the snapshot. - """ - - region: Optional[Region] - """ - Region to target. If none is passed will use default region from the config. - """ - - is_ha_cluster: Optional[bool] - """ - Defines whether or not High Availability is enabled on the new Database Instance. - """ - - node_type: Optional[str] - """ - The node type used to restore the snapshot. - """ - - -@dataclass -class CreateInstanceRequest: - engine: str - """ - Database engine of the Database Instance. - """ - - user_name: str - """ - Username created when the Database Instance is created. - """ - - password: str - """ - Password of the user. - """ - - node_type: str - """ - Type of node to use for the Database Instance. - """ - - region: Optional[Region] - """ - Region to target. If none is passed will use default region from the config. - """ - - name: Optional[str] - """ - Name of the Database Instance. - """ - - is_ha_cluster: bool - """ - Defines whether or not High-Availability is enabled. - """ - - disable_backup: bool - """ - Defines whether or not backups are disabled. - """ - - volume_size: int - """ - Volume size when volume_type is not lssd. - """ - - backup_same_region: bool - """ - Defines whether to or not to store logical backups in the same region as the Database Instance. - """ - - tags: Optional[List[str]] - """ - Tags to apply to the Database Instance. - """ - - init_settings: Optional[List[InstanceSetting]] - """ - List of engine settings to be set upon Database Instance initialization. - """ - - volume_type: Optional[VolumeType] - """ - Type of volume where data is stored (lssd, bssd, ...). - """ - - init_endpoints: Optional[List[EndpointSpec]] - """ - One or multiple EndpointSpec used to expose your Database Instance. A load_balancer public endpoint is systematically created. - """ - - organization_id: Optional[str] - - project_id: Optional[str] - - -@dataclass -class CreateReadReplicaEndpointRequest: - read_replica_id: str - """ - UUID of the Read Replica. - """ - - endpoint_spec: List[ReadReplicaEndpointSpec] - """ - Specification of the endpoint you want to create. - """ - - region: Optional[Region] - """ - Region to target. If none is passed will use default region from the config. - """ - - -@dataclass -class CreateReadReplicaRequest: - instance_id: str - """ - UUID of the Database Instance you want to create a Read Replica from. - """ - - region: Optional[Region] - """ - Region to target. If none is passed will use default region from the config. - """ - - endpoint_spec: Optional[List[ReadReplicaEndpointSpec]] - """ - Specification of the endpoint you want to create. - """ - - same_zone: Optional[bool] - """ - Defines whether or not to create the replica in the same Availability Zone as the main Database Instance nodes. - """ - - -@dataclass -class CreateSnapshotRequest: - instance_id: str - """ - UUID of the Database Instance. - """ - - region: Optional[Region] - """ - Region to target. If none is passed will use default region from the config. - """ - - name: Optional[str] - """ - Name of the snapshot. - """ - - expires_at: Optional[datetime] - """ - Expiration date (must follow the ISO 8601 format). - """ - - -@dataclass -class CreateUserRequest: - instance_id: str - """ - UUID of the Database Instance in which you want to create a user. - """ - - name: str - """ - Name of the user you want to create. - """ - - password: str - """ - Password of the user you want to create. - """ - - is_admin: bool - """ - Defines whether the user will have administrative privileges. - """ - - region: Optional[Region] - """ - Region to target. If none is passed will use default region from the config. - """ - - -@dataclass -class DeleteDatabaseRequest: - instance_id: str - """ - UUID of the Database Instance where to delete the database. - """ - - name: str - """ - Name of the database to delete. - """ - - region: Optional[Region] - """ - Region to target. If none is passed will use default region from the config. - """ - - -@dataclass -class DeleteEndpointRequest: - endpoint_id: str - """ - This endpoint can also be used to delete a Read Replica endpoint. - """ - - region: Optional[Region] - """ - Region to target. If none is passed will use default region from the config. - """ - - -@dataclass -class DeleteInstanceACLRulesRequest: - instance_id: str - """ - UUID of the Database Instance you want to delete an ACL rule from. - """ - - acl_rule_ips: List[str] - """ - IP addresses defined in the ACL rules of the Database Instance. - """ - - region: Optional[Region] - """ - Region to target. If none is passed will use default region from the config. - """ - - -@dataclass -class DeleteInstanceACLRulesResponse: - rules: List[ACLRule] - """ - IP addresses defined in the ACL rules of the Database Instance. - """ - - -@dataclass -class DeleteInstanceRequest: - instance_id: str - """ - UUID of the Database Instance to delete. - """ - - region: Optional[Region] - """ - Region to target. If none is passed will use default region from the config. - """ - - -@dataclass -class DeleteInstanceSettingsRequest: - instance_id: str - """ - UUID of the Database Instance to delete settings from. - """ - - setting_names: List[str] - """ - Settings names to delete. - """ - - region: Optional[Region] - """ - Region to target. If none is passed will use default region from the config. - """ - - -@dataclass -class DeleteInstanceSettingsResponse: - settings: List[InstanceSetting] - """ - Settings names to delete from the Database Instance. - """ - - -@dataclass -class DeleteReadReplicaRequest: - read_replica_id: str - """ - UUID of the Read Replica. - """ - - region: Optional[Region] - """ - Region to target. If none is passed will use default region from the config. - """ - - -@dataclass -class DeleteSnapshotRequest: - snapshot_id: str - """ - UUID of the snapshot to delete. - """ - - region: Optional[Region] - """ - Region to target. If none is passed will use default region from the config. - """ - - -@dataclass -class DeleteUserRequest: - instance_id: str - """ - UUID of the Database Instance to delete the user from. - """ - - name: str - """ - Name of the user. - """ - - region: Optional[Region] - """ - Region to target. If none is passed will use default region from the config. - """ - - -@dataclass -class GetEndpointRequest: - endpoint_id: str - """ - UUID of the endpoint you want to get. - """ - - region: Optional[Region] - """ - Region to target. If none is passed will use default region from the config. - """ - - -@dataclass -class GetInstanceCertificateRequest: - instance_id: str - """ - UUID of the Database Instance. - """ - - region: Optional[Region] - """ - Region to target. If none is passed will use default region from the config. - """ - - -@dataclass -class GetInstanceLogRequest: - instance_log_id: str - """ - UUID of the instance_log you want. - """ - - region: Optional[Region] - """ - Region to target. If none is passed will use default region from the config. - """ - - -@dataclass -class GetInstanceMetricsRequest: - instance_id: str - """ - UUID of the Database Instance. - """ - - region: Optional[Region] - """ - Region to target. If none is passed will use default region from the config. - """ - - start_date: Optional[datetime] - """ - Start date to gather metrics from. - """ - - end_date: Optional[datetime] - """ - End date to gather metrics from. - """ - - metric_name: Optional[str] - """ - Name of the metric to gather. - """ - - -@dataclass -class GetInstanceRequest: - instance_id: str - """ - UUID of the Database Instance. - """ - - region: Optional[Region] - """ - Region to target. If none is passed will use default region from the config. - """ - - -@dataclass -class GetReadReplicaRequest: - read_replica_id: str - """ - UUID of the Read Replica. - """ - - region: Optional[Region] - """ - Region to target. If none is passed will use default region from the config. - """ - - -@dataclass -class GetSnapshotRequest: - snapshot_id: str - """ - UUID of the snapshot. - """ - - region: Optional[Region] - """ - Region to target. If none is passed will use default region from the config. - """ - - -@dataclass -class InstanceMetrics: - timeseries: List[TimeSeries] - """ - Time series of metrics of a Database Instance. - """ - - -@dataclass -class ListDatabaseEnginesRequest: - region: Optional[Region] - """ - Region to target. If none is passed will use default region from the config. - """ - - name: Optional[str] - """ - Name of the database engine. - """ - - version: Optional[str] - """ - Version of the database engine. - """ - - page: Optional[int] - - page_size: Optional[int] - - -@dataclass -class ListDatabaseEnginesResponse: - engines: List[DatabaseEngine] - """ - List of the available database engines. - """ - - total_count: int - """ - Total count of database engines available. - """ - - -@dataclass -class ListDatabasesRequest: - instance_id: str - """ - UUID of the Database Instance to list the databases of. - """ - - region: Optional[Region] - """ - Region to target. If none is passed will use default region from the config. - """ - - name: Optional[str] - """ - Name of the database. - """ - - managed: Optional[bool] - """ - Defines whether or not the database is managed. - """ - - owner: Optional[str] - """ - User that owns this database. - """ - - order_by: Optional[ListDatabasesRequestOrderBy] - """ - Criteria to use when ordering database listing. - """ - - page: Optional[int] - - page_size: Optional[int] - - -@dataclass -class ListDatabasesResponse: - databases: List[Database] - """ - List of the databases. - """ - - total_count: int - """ - Total count of databases present on a Database Instance. - """ - - -@dataclass -class ListInstanceACLRulesRequest: - instance_id: str - """ - UUID of the Database Instance. - """ - - region: Optional[Region] - """ - Region to target. If none is passed will use default region from the config. - """ - - page: Optional[int] - - page_size: Optional[int] - - -@dataclass -class ListInstanceACLRulesResponse: - rules: List[ACLRule] - """ - List of ACL rules present on a Database Instance. - """ - - total_count: int - """ - Total count of ACL rules present on a Database Instance. - """ - - -@dataclass -class ListInstanceLogsDetailsRequest: - instance_id: str - """ - UUID of the Database Instance you want logs of. - """ - - region: Optional[Region] - """ - Region to target. If none is passed will use default region from the config. - """ - - -@dataclass -class ListInstanceLogsDetailsResponse: - details: List[ListInstanceLogsDetailsResponseInstanceLogDetail] - """ - Remote Database Instance logs details. - """ - - -@dataclass -class ListInstanceLogsRequest: - instance_id: str - """ - UUID of the Database Instance you want logs of. - """ - - region: Optional[Region] - """ - Region to target. If none is passed will use default region from the config. - """ - - order_by: Optional[ListInstanceLogsRequestOrderBy] - """ - Criteria to use when ordering Database Instance logs listing. - """ - - -@dataclass -class ListInstanceLogsResponse: - instance_logs: List[InstanceLog] - """ - Available logs in a Database Instance. - """ - - -@dataclass -class ListInstancesRequest: - region: Optional[Region] - """ - Region to target. If none is passed will use default region from the config. - """ - - tags: Optional[List[str]] - """ - List Database Instances that have a given tag. - """ - - name: Optional[str] - """ - Lists Database Instances that match a name pattern. - """ - - order_by: Optional[ListInstancesRequestOrderBy] - """ - Criteria to use when ordering Database Instance listings. - """ - - organization_id: Optional[str] - """ - Please use project_id instead. - """ - - project_id: Optional[str] - """ - Project ID to list the Database Instance of. - """ - - page: Optional[int] - - page_size: Optional[int] - - -@dataclass -class ListInstancesResponse: - instances: List[Instance] - """ - List of all Database Instances available in an Organization or Project. - """ - - total_count: int - """ - Total count of Database Instances available in a Organization or Project. - """ - - -@dataclass -class ListNodeTypesRequest: - include_disabled_types: bool - """ - Defines whether or not to include disabled types. - """ - - region: Optional[Region] - """ - Region to target. If none is passed will use default region from the config. - """ - - page: Optional[int] - - page_size: Optional[int] - - -@dataclass -class ListNodeTypesResponse: - node_types: List[NodeType] - """ - Types of the node. - """ - - total_count: int - """ - Total count of node-types available. - """ - - -@dataclass -class ListPrivilegesRequest: - instance_id: str - """ - UUID of the Database Instance. - """ - - region: Optional[Region] - """ - Region to target. If none is passed will use default region from the config. - """ - - order_by: Optional[ListPrivilegesRequestOrderBy] - """ - Criteria to use when ordering privileges listing. - """ - - page: Optional[int] - - page_size: Optional[int] - - database_name: Optional[str] - """ - Name of the database. - """ - - user_name: Optional[str] - """ - Name of the user. - """ - - -@dataclass -class ListPrivilegesResponse: - privileges: List[Privilege] - """ - Privileges of a user in a database in a Database Instance. - """ - - total_count: int - """ - Total count of privileges present on a database. - """ - - -@dataclass -class ListSnapshotsRequest: - region: Optional[Region] - """ - Region to target. If none is passed will use default region from the config. - """ - - name: Optional[str] - """ - Name of the snapshot. - """ - - order_by: Optional[ListSnapshotsRequestOrderBy] - """ - Criteria to use when ordering snapshot listing. - """ - - instance_id: Optional[str] - """ - UUID of the Database Instance. - """ - - organization_id: Optional[str] - """ - Organization ID the snapshots belongs to. - """ - - project_id: Optional[str] - """ - Project ID the snapshots belongs to. - """ - - page: Optional[int] - - page_size: Optional[int] - - -@dataclass -class ListSnapshotsResponse: - snapshots: List[Snapshot] - """ - List of snapshots. - """ - - total_count: int - """ - Total count of snapshots available. - """ - - -@dataclass -class ListUsersRequest: - instance_id: str - """ - UUID of the Database Instance. - """ - - region: Optional[Region] - """ - Region to target. If none is passed will use default region from the config. - """ - - name: Optional[str] - """ - Name of the user. - """ - - order_by: Optional[ListUsersRequestOrderBy] - """ - Criteria to use when requesting user listing. - """ - - page: Optional[int] - - page_size: Optional[int] - - -@dataclass -class ListUsersResponse: - users: List[User] - """ - List of users in a Database Instance. - """ - - total_count: int - """ - Total count of users present on a Database Instance. - """ - - -@dataclass -class MigrateEndpointRequest: - endpoint_id: str - """ - UUID of the endpoint you want to migrate. - """ - - instance_id: str - """ - UUID of the instance you want to attach the endpoint to. - """ - - region: Optional[Region] - """ - Region to target. If none is passed will use default region from the config. - """ - - -@dataclass -class PromoteReadReplicaRequest: - read_replica_id: str - """ - UUID of the Read Replica. - """ - - region: Optional[Region] - """ - Region to target. If none is passed will use default region from the config. - """ - - -@dataclass -class PurgeInstanceLogsRequest: - instance_id: str - """ - UUID of the Database Instance you want logs of. - """ - - region: Optional[Region] - """ - Region to target. If none is passed will use default region from the config. - """ - - log_name: Optional[str] - """ - Given log name to purge. - """ - - -@dataclass -class RenewInstanceCertificateRequest: - instance_id: str - """ - UUID of the Database Instance you want logs of. - """ - - region: Optional[Region] - """ - Region to target. If none is passed will use default region from the config. - """ - - -@dataclass -class ResetReadReplicaRequest: - read_replica_id: str - """ - UUID of the Read Replica. - """ - - region: Optional[Region] - """ - Region to target. If none is passed will use default region from the config. - """ - - -@dataclass -class RestartInstanceRequest: - instance_id: str - """ - UUID of the Database Instance you want to restart. - """ - - region: Optional[Region] - """ - Region to target. If none is passed will use default region from the config. - """ - - -@dataclass -class SetInstanceACLRulesRequest: - instance_id: str - """ - UUID of the Database Instance where the ACL rules must be set. - """ - - rules: List[ACLRuleRequest] - """ - ACL rules to define for the Database Instance. - """ - - region: Optional[Region] - """ - Region to target. If none is passed will use default region from the config. - """ - - -@dataclass -class SetInstanceACLRulesResponse: - rules: List[ACLRule] - """ - ACLs rules configured for a Database Instance. - """ - - -@dataclass -class SetInstanceSettingsRequest: - instance_id: str - """ - UUID of the Database Instance where the settings must be set. - """ - - settings: List[InstanceSetting] - """ - Settings to define for the Database Instance. - """ - - region: Optional[Region] - """ - Region to target. If none is passed will use default region from the config. - """ - - -@dataclass -class SetInstanceSettingsResponse: - settings: List[InstanceSetting] - """ - Settings configured for a Database Instance. - """ - - -@dataclass -class SetPrivilegeRequest: - instance_id: str - """ - UUID of the Database Instance. - """ - - database_name: str - """ - Name of the database. - """ - - user_name: str - """ - Name of the user. - """ - - region: Optional[Region] - """ - Region to target. If none is passed will use default region from the config. - """ - - permission: Optional[Permission] - """ - Permission to set (Read, Read/Write, All, Custom). - """ - - -@dataclass -class UpdateInstanceRequest: - instance_id: str - """ - UUID of the Database Instance to update. - """ - - region: Optional[Region] - """ - Region to target. If none is passed will use default region from the config. - """ - - backup_schedule_frequency: Optional[int] - """ - In hours. - """ - - backup_schedule_retention: Optional[int] - """ - In days. - """ - - is_backup_schedule_disabled: Optional[bool] - """ - Defines whether or not the backup schedule is disabled. - """ - - name: Optional[str] - """ - Name of the Database Instance. - """ - - tags: Optional[List[str]] - """ - Tags of a Database Instance. - """ - - logs_policy: Optional[LogsPolicy] - """ - Logs policy of the Database Instance. - """ - - backup_same_region: Optional[bool] - """ - Store logical backups in the same region as the Database Instance. - """ - - backup_schedule_start_hour: Optional[int] - """ - Defines the start time of the autobackup. - """ - - -@dataclass -class UpdateSnapshotRequest: - snapshot_id: str - """ - UUID of the snapshot to update. - """ - - region: Optional[Region] - """ - Region to target. If none is passed will use default region from the config. - """ - - name: Optional[str] - """ - Name of the snapshot. - """ - - expires_at: Optional[datetime] - """ - Expiration date (must follow the ISO 8601 format). - """ - - -@dataclass -class UpdateUserRequest: - instance_id: str - """ - UUID of the Database Instance the user belongs to. - """ - - name: str - """ - Name of the database user. - """ - - region: Optional[Region] - """ - Region to target. If none is passed will use default region from the config. - """ - - password: Optional[str] - """ - Password of the database user. - """ - - is_admin: Optional[bool] - """ - Defines whether or not this user got administrative privileges. - """ - - -@dataclass -class UpgradeInstanceRequest: - instance_id: str - """ - UUID of the Database Instance you want to upgrade. - """ - - region: Optional[Region] - """ - Region to target. If none is passed will use default region from the config. - """ - - node_type: Optional[str] - - enable_ha: Optional[bool] - - volume_size: Optional[int] - - volume_type: Optional[VolumeType] - - upgradable_version_id: Optional[str] - - major_upgrade_workflow: Optional[UpgradeInstanceRequestMajorUpgradeWorkflow] diff --git a/scaleway-async/scaleway_async/edge_services/v1alpha1/__init__.py b/scaleway-async/scaleway_async/edge_services/v1alpha1/__init__.py deleted file mode 100644 index a69731fd4..000000000 --- a/scaleway-async/scaleway_async/edge_services/v1alpha1/__init__.py +++ /dev/null @@ -1,173 +0,0 @@ -# This file was automatically generated. DO NOT EDIT. -# If you have any remark or suggestion do not hesitate to open an issue. -from .types import DNSStageType -from .types import LbOriginError -from .types import ListBackendStagesRequestOrderBy -from .types import ListCacheStagesRequestOrderBy -from .types import ListDNSStagesRequestOrderBy -from .types import ListPipelinesRequestOrderBy -from .types import ListPipelinesWithStagesRequestOrderBy -from .types import ListPurgeRequestsRequestOrderBy -from .types import ListTLSStagesRequestOrderBy -from .types import PipelineErrorCode -from .types import PipelineErrorSeverity -from .types import PipelineErrorStage -from .types import PipelineErrorType -from .types import PipelineStatus -from .content import PIPELINE_TRANSIENT_STATUSES -from .types import PlanName -from .types import PurgeRequestStatus -from .content import PURGE_REQUEST_TRANSIENT_STATUSES -from .types import ScalewayLb -from .types import ScalewayLbBackendConfig -from .types import ScalewayS3BackendConfig -from .types import PipelineError -from .types import TLSSecret -from .types import BackendStage -from .types import CacheStage -from .types import DNSStage -from .types import Pipeline -from .types import TLSStage -from .types import CheckPEMChainRequestSecretChain -from .types import PlanDetails -from .types import PlanUsageDetails -from .types import PipelineStages -from .types import PurgeRequest -from .types import TLSSecretsConfig -from .types import CheckDomainRequest -from .types import CheckDomainResponse -from .types import CheckLbOriginRequest -from .types import CheckLbOriginResponse -from .types import CheckPEMChainRequest -from .types import CheckPEMChainResponse -from .types import CreateBackendStageRequest -from .types import CreateCacheStageRequest -from .types import CreateDNSStageRequest -from .types import CreatePipelineRequest -from .types import CreatePurgeRequestRequest -from .types import CreateTLSStageRequest -from .types import DeleteBackendStageRequest -from .types import DeleteCacheStageRequest -from .types import DeleteCurrentPlanRequest -from .types import DeleteDNSStageRequest -from .types import DeletePipelineRequest -from .types import DeleteTLSStageRequest -from .types import GetBackendStageRequest -from .types import GetBillingRequest -from .types import GetBillingResponse -from .types import GetCacheStageRequest -from .types import GetCurrentPlanRequest -from .types import GetDNSStageRequest -from .types import GetPipelineRequest -from .types import GetPurgeRequestRequest -from .types import GetTLSStageRequest -from .types import ListBackendStagesRequest -from .types import ListBackendStagesResponse -from .types import ListCacheStagesRequest -from .types import ListCacheStagesResponse -from .types import ListDNSStagesRequest -from .types import ListDNSStagesResponse -from .types import ListPipelinesRequest -from .types import ListPipelinesResponse -from .types import ListPipelinesWithStagesRequest -from .types import ListPipelinesWithStagesResponse -from .types import ListPlansResponse -from .types import ListPurgeRequestsRequest -from .types import ListPurgeRequestsResponse -from .types import ListTLSStagesRequest -from .types import ListTLSStagesResponse -from .types import Plan -from .types import SelectPlanRequest -from .types import UpdateBackendStageRequest -from .types import UpdateCacheStageRequest -from .types import UpdateDNSStageRequest -from .types import UpdatePipelineRequest -from .types import UpdateTLSStageRequest -from .api import EdgeServicesV1Alpha1API - -__all__ = [ - "DNSStageType", - "LbOriginError", - "ListBackendStagesRequestOrderBy", - "ListCacheStagesRequestOrderBy", - "ListDNSStagesRequestOrderBy", - "ListPipelinesRequestOrderBy", - "ListPipelinesWithStagesRequestOrderBy", - "ListPurgeRequestsRequestOrderBy", - "ListTLSStagesRequestOrderBy", - "PipelineErrorCode", - "PipelineErrorSeverity", - "PipelineErrorStage", - "PipelineErrorType", - "PipelineStatus", - "PIPELINE_TRANSIENT_STATUSES", - "PlanName", - "PurgeRequestStatus", - "PURGE_REQUEST_TRANSIENT_STATUSES", - "ScalewayLb", - "ScalewayLbBackendConfig", - "ScalewayS3BackendConfig", - "PipelineError", - "TLSSecret", - "BackendStage", - "CacheStage", - "DNSStage", - "Pipeline", - "TLSStage", - "CheckPEMChainRequestSecretChain", - "PlanDetails", - "PlanUsageDetails", - "PipelineStages", - "PurgeRequest", - "TLSSecretsConfig", - "CheckDomainRequest", - "CheckDomainResponse", - "CheckLbOriginRequest", - "CheckLbOriginResponse", - "CheckPEMChainRequest", - "CheckPEMChainResponse", - "CreateBackendStageRequest", - "CreateCacheStageRequest", - "CreateDNSStageRequest", - "CreatePipelineRequest", - "CreatePurgeRequestRequest", - "CreateTLSStageRequest", - "DeleteBackendStageRequest", - "DeleteCacheStageRequest", - "DeleteCurrentPlanRequest", - "DeleteDNSStageRequest", - "DeletePipelineRequest", - "DeleteTLSStageRequest", - "GetBackendStageRequest", - "GetBillingRequest", - "GetBillingResponse", - "GetCacheStageRequest", - "GetCurrentPlanRequest", - "GetDNSStageRequest", - "GetPipelineRequest", - "GetPurgeRequestRequest", - "GetTLSStageRequest", - "ListBackendStagesRequest", - "ListBackendStagesResponse", - "ListCacheStagesRequest", - "ListCacheStagesResponse", - "ListDNSStagesRequest", - "ListDNSStagesResponse", - "ListPipelinesRequest", - "ListPipelinesResponse", - "ListPipelinesWithStagesRequest", - "ListPipelinesWithStagesResponse", - "ListPlansResponse", - "ListPurgeRequestsRequest", - "ListPurgeRequestsResponse", - "ListTLSStagesRequest", - "ListTLSStagesResponse", - "Plan", - "SelectPlanRequest", - "UpdateBackendStageRequest", - "UpdateCacheStageRequest", - "UpdateDNSStageRequest", - "UpdatePipelineRequest", - "UpdateTLSStageRequest", - "EdgeServicesV1Alpha1API", -] diff --git a/scaleway-async/scaleway_async/edge_services/v1alpha1/api.py b/scaleway-async/scaleway_async/edge_services/v1alpha1/api.py deleted file mode 100644 index bf03f2656..000000000 --- a/scaleway-async/scaleway_async/edge_services/v1alpha1/api.py +++ /dev/null @@ -1,1827 +0,0 @@ -# This file was automatically generated. DO NOT EDIT. -# If you have any remark or suggestion do not hesitate to open an issue. - -from typing import Awaitable, List, Optional, Union - -from scaleway_core.api import API -from scaleway_core.utils import ( - WaitForOptions, - validate_path_param, - fetch_all_pages_async, - wait_for_resource_async, -) -from .types import ( - ListBackendStagesRequestOrderBy, - ListCacheStagesRequestOrderBy, - ListDNSStagesRequestOrderBy, - ListPipelinesRequestOrderBy, - ListPipelinesWithStagesRequestOrderBy, - ListPurgeRequestsRequestOrderBy, - ListTLSStagesRequestOrderBy, - PlanName, - BackendStage, - CacheStage, - CheckDomainRequest, - CheckDomainResponse, - CheckLbOriginRequest, - CheckLbOriginResponse, - CheckPEMChainRequest, - CheckPEMChainRequestSecretChain, - CheckPEMChainResponse, - CreateBackendStageRequest, - CreateCacheStageRequest, - CreateDNSStageRequest, - CreatePipelineRequest, - CreatePurgeRequestRequest, - CreateTLSStageRequest, - DNSStage, - GetBillingResponse, - ListBackendStagesResponse, - ListCacheStagesResponse, - ListDNSStagesResponse, - ListPipelinesResponse, - ListPipelinesWithStagesResponse, - ListPlansResponse, - ListPurgeRequestsResponse, - ListTLSStagesResponse, - Pipeline, - PipelineStages, - Plan, - PurgeRequest, - ScalewayLb, - ScalewayLbBackendConfig, - ScalewayS3BackendConfig, - SelectPlanRequest, - TLSSecret, - TLSSecretsConfig, - TLSStage, - UpdateBackendStageRequest, - UpdateCacheStageRequest, - UpdateDNSStageRequest, - UpdatePipelineRequest, - UpdateTLSStageRequest, -) -from .content import ( - PIPELINE_TRANSIENT_STATUSES, - PURGE_REQUEST_TRANSIENT_STATUSES, -) -from .marshalling import ( - unmarshal_BackendStage, - unmarshal_CacheStage, - unmarshal_DNSStage, - unmarshal_Pipeline, - unmarshal_TLSStage, - unmarshal_PurgeRequest, - unmarshal_CheckDomainResponse, - unmarshal_CheckLbOriginResponse, - unmarshal_CheckPEMChainResponse, - unmarshal_GetBillingResponse, - unmarshal_ListBackendStagesResponse, - unmarshal_ListCacheStagesResponse, - unmarshal_ListDNSStagesResponse, - unmarshal_ListPipelinesResponse, - unmarshal_ListPipelinesWithStagesResponse, - unmarshal_ListPlansResponse, - unmarshal_ListPurgeRequestsResponse, - unmarshal_ListTLSStagesResponse, - unmarshal_Plan, - marshal_CheckDomainRequest, - marshal_CheckLbOriginRequest, - marshal_CheckPEMChainRequest, - marshal_CreateBackendStageRequest, - marshal_CreateCacheStageRequest, - marshal_CreateDNSStageRequest, - marshal_CreatePipelineRequest, - marshal_CreatePurgeRequestRequest, - marshal_CreateTLSStageRequest, - marshal_SelectPlanRequest, - marshal_UpdateBackendStageRequest, - marshal_UpdateCacheStageRequest, - marshal_UpdateDNSStageRequest, - marshal_UpdatePipelineRequest, - marshal_UpdateTLSStageRequest, -) - - -class EdgeServicesV1Alpha1API(API): - """ """ - - async def list_pipelines( - self, - *, - order_by: Optional[ListPipelinesRequestOrderBy] = None, - page: Optional[int] = None, - page_size: Optional[int] = None, - name: Optional[str] = None, - organization_id: Optional[str] = None, - project_id: Optional[str] = None, - has_backend_stage_lb: Optional[bool] = None, - ) -> ListPipelinesResponse: - """ - List pipelines. - List all pipelines, for a Scaleway Organization or Scaleway Project. By default, the pipelines returned in the list are ordered by creation date in ascending order, though this can be modified via the `order_by` field. - :param order_by: Sort order of pipelines in the response. - :param page: Page number to return, from the paginated results. - :param page_size: Number of pipelines to return per page. - :param name: Pipeline name to filter for, only pipelines with this string within their name will be returned. - :param organization_id: Organization ID to filter for, only pipelines from this Organization will be returned. - :param project_id: Project ID to filter for, only pipelines from this Project will be returned. - :param has_backend_stage_lb: Filter on backend stage, only pipelines with a Load Balancer origin will be returned. - :return: :class:`ListPipelinesResponse ` - - Usage: - :: - - result = await api.list_pipelines() - """ - - res = self._request( - "GET", - "/edge-services/v1alpha1/pipelines", - params={ - "has_backend_stage_lb": has_backend_stage_lb, - "name": name, - "order_by": order_by, - "organization_id": organization_id - or self.client.default_organization_id, - "page": page, - "page_size": page_size or self.client.default_page_size, - "project_id": project_id or self.client.default_project_id, - }, - ) - - self._throw_on_error(res) - return unmarshal_ListPipelinesResponse(res.json()) - - async def list_pipelines_all( - self, - *, - order_by: Optional[ListPipelinesRequestOrderBy] = None, - page: Optional[int] = None, - page_size: Optional[int] = None, - name: Optional[str] = None, - organization_id: Optional[str] = None, - project_id: Optional[str] = None, - has_backend_stage_lb: Optional[bool] = None, - ) -> List[Pipeline]: - """ - List pipelines. - List all pipelines, for a Scaleway Organization or Scaleway Project. By default, the pipelines returned in the list are ordered by creation date in ascending order, though this can be modified via the `order_by` field. - :param order_by: Sort order of pipelines in the response. - :param page: Page number to return, from the paginated results. - :param page_size: Number of pipelines to return per page. - :param name: Pipeline name to filter for, only pipelines with this string within their name will be returned. - :param organization_id: Organization ID to filter for, only pipelines from this Organization will be returned. - :param project_id: Project ID to filter for, only pipelines from this Project will be returned. - :param has_backend_stage_lb: Filter on backend stage, only pipelines with a Load Balancer origin will be returned. - :return: :class:`List[Pipeline] ` - - Usage: - :: - - result = await api.list_pipelines_all() - """ - - return await fetch_all_pages_async( - type=ListPipelinesResponse, - key="pipelines", - fetcher=self.list_pipelines, - args={ - "order_by": order_by, - "page": page, - "page_size": page_size, - "name": name, - "organization_id": organization_id, - "project_id": project_id, - "has_backend_stage_lb": has_backend_stage_lb, - }, - ) - - async def create_pipeline( - self, - *, - name: str, - description: str, - project_id: Optional[str] = None, - dns_stage_id: Optional[str] = None, - ) -> Pipeline: - """ - Create pipeline. - Create a new pipeline. You must specify a `dns_stage_id` to form a stage-chain that goes all the way to the backend stage (origin), so the HTTP request will be processed according to the stages you created. - :param name: Name of the pipeline. - :param description: Description of the pipeline. - :param project_id: Project ID in which the pipeline will be created. - :param dns_stage_id: DNS stage ID the pipeline will be attached to. - One-Of ('head'): at most one of 'dns_stage_id' could be set. - :return: :class:`Pipeline ` - - Usage: - :: - - result = await api.create_pipeline( - name="example", - description="example", - ) - """ - - res = self._request( - "POST", - "/edge-services/v1alpha1/pipelines", - body=marshal_CreatePipelineRequest( - CreatePipelineRequest( - name=name, - description=description, - project_id=project_id, - dns_stage_id=dns_stage_id, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_Pipeline(res.json()) - - async def get_pipeline( - self, - *, - pipeline_id: str, - ) -> Pipeline: - """ - Get pipeline. - Retrieve information about an existing pipeline, specified by its `pipeline_id`. Its full details, including errors, are returned in the response object. - :param pipeline_id: ID of the requested pipeline. - :return: :class:`Pipeline ` - - Usage: - :: - - result = await api.get_pipeline( - pipeline_id="example", - ) - """ - - param_pipeline_id = validate_path_param("pipeline_id", pipeline_id) - - res = self._request( - "GET", - f"/edge-services/v1alpha1/pipelines/{param_pipeline_id}", - ) - - self._throw_on_error(res) - return unmarshal_Pipeline(res.json()) - - async def wait_for_pipeline( - self, - *, - pipeline_id: str, - options: Optional[ - WaitForOptions[Pipeline, Union[bool, Awaitable[bool]]] - ] = None, - ) -> Pipeline: - """ - Get pipeline. - Retrieve information about an existing pipeline, specified by its `pipeline_id`. Its full details, including errors, are returned in the response object. - :param pipeline_id: ID of the requested pipeline. - :return: :class:`Pipeline ` - - Usage: - :: - - result = await api.get_pipeline( - pipeline_id="example", - ) - """ - - if not options: - options = WaitForOptions() - - if not options.stop: - options.stop = lambda res: res.status not in PIPELINE_TRANSIENT_STATUSES - - return await wait_for_resource_async( - fetcher=self.get_pipeline, - options=options, - args={ - "pipeline_id": pipeline_id, - }, - ) - - async def list_pipelines_with_stages( - self, - *, - order_by: Optional[ListPipelinesWithStagesRequestOrderBy] = None, - page: Optional[int] = None, - page_size: Optional[int] = None, - name: Optional[str] = None, - organization_id: Optional[str] = None, - project_id: Optional[str] = None, - ) -> ListPipelinesWithStagesResponse: - """ - :param order_by: - :param page: - :param page_size: - :param name: - :param organization_id: - :param project_id: - :return: :class:`ListPipelinesWithStagesResponse ` - - Usage: - :: - - result = await api.list_pipelines_with_stages() - """ - - res = self._request( - "GET", - "/edge-services/v1alpha1/pipelines-stages", - params={ - "name": name, - "order_by": order_by, - "organization_id": organization_id - or self.client.default_organization_id, - "page": page, - "page_size": page_size or self.client.default_page_size, - "project_id": project_id or self.client.default_project_id, - }, - ) - - self._throw_on_error(res) - return unmarshal_ListPipelinesWithStagesResponse(res.json()) - - async def list_pipelines_with_stages_all( - self, - *, - order_by: Optional[ListPipelinesWithStagesRequestOrderBy] = None, - page: Optional[int] = None, - page_size: Optional[int] = None, - name: Optional[str] = None, - organization_id: Optional[str] = None, - project_id: Optional[str] = None, - ) -> List[PipelineStages]: - """ - :param order_by: - :param page: - :param page_size: - :param name: - :param organization_id: - :param project_id: - :return: :class:`List[PipelineStages] ` - - Usage: - :: - - result = await api.list_pipelines_with_stages_all() - """ - - return await fetch_all_pages_async( - type=ListPipelinesWithStagesResponse, - key="pipelines", - fetcher=self.list_pipelines_with_stages, - args={ - "order_by": order_by, - "page": page, - "page_size": page_size, - "name": name, - "organization_id": organization_id, - "project_id": project_id, - }, - ) - - async def update_pipeline( - self, - *, - pipeline_id: str, - name: Optional[str] = None, - description: Optional[str] = None, - dns_stage_id: Optional[str] = None, - ) -> Pipeline: - """ - Update pipeline. - Update the parameters of an existing pipeline, specified by its `pipeline_id`. Parameters which can be updated include the `name`, `description` and `dns_stage_id`. - :param pipeline_id: ID of the pipeline to update. - :param name: Name of the pipeline. - :param description: Description of the pipeline. - :param dns_stage_id: DNS stage ID the pipeline will be attached to. - One-Of ('head'): at most one of 'dns_stage_id' could be set. - :return: :class:`Pipeline ` - - Usage: - :: - - result = await api.update_pipeline( - pipeline_id="example", - ) - """ - - param_pipeline_id = validate_path_param("pipeline_id", pipeline_id) - - res = self._request( - "PATCH", - f"/edge-services/v1alpha1/pipelines/{param_pipeline_id}", - body=marshal_UpdatePipelineRequest( - UpdatePipelineRequest( - pipeline_id=pipeline_id, - name=name, - description=description, - dns_stage_id=dns_stage_id, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_Pipeline(res.json()) - - async def delete_pipeline( - self, - *, - pipeline_id: str, - ) -> None: - """ - Delete pipeline. - Delete an existing pipeline, specified by its `pipeline_id`. Deleting a pipeline is permanent, and cannot be undone. Note that all stages linked to the pipeline are also deleted. - :param pipeline_id: ID of the pipeline to delete. - - Usage: - :: - - result = await api.delete_pipeline( - pipeline_id="example", - ) - """ - - param_pipeline_id = validate_path_param("pipeline_id", pipeline_id) - - res = self._request( - "DELETE", - f"/edge-services/v1alpha1/pipelines/{param_pipeline_id}", - ) - - self._throw_on_error(res) - - async def list_dns_stages( - self, - *, - order_by: Optional[ListDNSStagesRequestOrderBy] = None, - page: Optional[int] = None, - page_size: Optional[int] = None, - pipeline_id: Optional[str] = None, - project_id: Optional[str] = None, - fqdn: Optional[str] = None, - ) -> ListDNSStagesResponse: - """ - List DNS stages. - List all DNS stages, for a Scaleway Organization or Scaleway Project. By default, the DNS stages returned in the list are ordered by creation date in ascending order, though this can be modified via the `order_by` field. - :param order_by: Sort order of DNS stages in the response. - :param page: Page number to return, from the paginated results. - :param page_size: Number of DNS stages to return per page. - :param pipeline_id: Pipeline ID to filter for, only DNS stages from this pipeline will be returned. - :param project_id: Project ID to filter for, only DNS stages from this Project will be returned. - :param fqdn: Fully Qualified Domain Name to filter for (in the format subdomain.example.com), only DNS stages with this FQDN will be returned. - :return: :class:`ListDNSStagesResponse ` - - Usage: - :: - - result = await api.list_dns_stages() - """ - - res = self._request( - "GET", - "/edge-services/v1alpha1/dns-stages", - params={ - "fqdn": fqdn, - "order_by": order_by, - "page": page, - "page_size": page_size or self.client.default_page_size, - "pipeline_id": pipeline_id, - "project_id": project_id or self.client.default_project_id, - }, - ) - - self._throw_on_error(res) - return unmarshal_ListDNSStagesResponse(res.json()) - - async def list_dns_stages_all( - self, - *, - order_by: Optional[ListDNSStagesRequestOrderBy] = None, - page: Optional[int] = None, - page_size: Optional[int] = None, - pipeline_id: Optional[str] = None, - project_id: Optional[str] = None, - fqdn: Optional[str] = None, - ) -> List[DNSStage]: - """ - List DNS stages. - List all DNS stages, for a Scaleway Organization or Scaleway Project. By default, the DNS stages returned in the list are ordered by creation date in ascending order, though this can be modified via the `order_by` field. - :param order_by: Sort order of DNS stages in the response. - :param page: Page number to return, from the paginated results. - :param page_size: Number of DNS stages to return per page. - :param pipeline_id: Pipeline ID to filter for, only DNS stages from this pipeline will be returned. - :param project_id: Project ID to filter for, only DNS stages from this Project will be returned. - :param fqdn: Fully Qualified Domain Name to filter for (in the format subdomain.example.com), only DNS stages with this FQDN will be returned. - :return: :class:`List[DNSStage] ` - - Usage: - :: - - result = await api.list_dns_stages_all() - """ - - return await fetch_all_pages_async( - type=ListDNSStagesResponse, - key="stages", - fetcher=self.list_dns_stages, - args={ - "order_by": order_by, - "page": page, - "page_size": page_size, - "pipeline_id": pipeline_id, - "project_id": project_id, - "fqdn": fqdn, - }, - ) - - async def create_dns_stage( - self, - *, - project_id: Optional[str] = None, - fqdns: Optional[List[str]] = None, - tls_stage_id: Optional[str] = None, - cache_stage_id: Optional[str] = None, - backend_stage_id: Optional[str] = None, - ) -> DNSStage: - """ - Create DNS stage. - Create a new DNS stage. You must specify the `fqdns` field to customize the domain endpoint, using a domain you already own. - :param project_id: Project ID in which the DNS stage will be created. - :param fqdns: Fully Qualified Domain Name (in the format subdomain.example.com) to attach to the stage. - :param tls_stage_id: TLS stage ID the DNS stage will be linked to. - One-Of ('next'): at most one of 'tls_stage_id', 'cache_stage_id', 'backend_stage_id' could be set. - :param cache_stage_id: Cache stage ID the DNS stage will be linked to. - One-Of ('next'): at most one of 'tls_stage_id', 'cache_stage_id', 'backend_stage_id' could be set. - :param backend_stage_id: Backend stage ID the DNS stage will be linked to. - One-Of ('next'): at most one of 'tls_stage_id', 'cache_stage_id', 'backend_stage_id' could be set. - :return: :class:`DNSStage ` - - Usage: - :: - - result = await api.create_dns_stage() - """ - - res = self._request( - "POST", - "/edge-services/v1alpha1/dns-stages", - body=marshal_CreateDNSStageRequest( - CreateDNSStageRequest( - project_id=project_id, - fqdns=fqdns, - tls_stage_id=tls_stage_id, - cache_stage_id=cache_stage_id, - backend_stage_id=backend_stage_id, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_DNSStage(res.json()) - - async def get_dns_stage( - self, - *, - dns_stage_id: str, - ) -> DNSStage: - """ - Get DNS stage. - Retrieve information about an existing DNS stage, specified by its `dns_stage_id`. Its full details, including FQDNs, are returned in the response object. - :param dns_stage_id: ID of the requested DNS stage. - :return: :class:`DNSStage ` - - Usage: - :: - - result = await api.get_dns_stage( - dns_stage_id="example", - ) - """ - - param_dns_stage_id = validate_path_param("dns_stage_id", dns_stage_id) - - res = self._request( - "GET", - f"/edge-services/v1alpha1/dns-stages/{param_dns_stage_id}", - ) - - self._throw_on_error(res) - return unmarshal_DNSStage(res.json()) - - async def update_dns_stage( - self, - *, - dns_stage_id: str, - fqdns: Optional[List[str]] = None, - tls_stage_id: Optional[str] = None, - cache_stage_id: Optional[str] = None, - backend_stage_id: Optional[str] = None, - ) -> DNSStage: - """ - Update DNS stage. - Update the parameters of an existing DNS stage, specified by its `dns_stage_id`. - :param dns_stage_id: ID of the DNS stage to update. - :param fqdns: Fully Qualified Domain Name (in the format subdomain.example.com) attached to the stage. - :param tls_stage_id: TLS stage ID the DNS stage will be linked to. - One-Of ('next'): at most one of 'tls_stage_id', 'cache_stage_id', 'backend_stage_id' could be set. - :param cache_stage_id: Cache stage ID the DNS stage will be linked to. - One-Of ('next'): at most one of 'tls_stage_id', 'cache_stage_id', 'backend_stage_id' could be set. - :param backend_stage_id: Backend stage ID the DNS stage will be linked to. - One-Of ('next'): at most one of 'tls_stage_id', 'cache_stage_id', 'backend_stage_id' could be set. - :return: :class:`DNSStage ` - - Usage: - :: - - result = await api.update_dns_stage( - dns_stage_id="example", - ) - """ - - param_dns_stage_id = validate_path_param("dns_stage_id", dns_stage_id) - - res = self._request( - "PATCH", - f"/edge-services/v1alpha1/dns-stages/{param_dns_stage_id}", - body=marshal_UpdateDNSStageRequest( - UpdateDNSStageRequest( - dns_stage_id=dns_stage_id, - fqdns=fqdns, - tls_stage_id=tls_stage_id, - cache_stage_id=cache_stage_id, - backend_stage_id=backend_stage_id, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_DNSStage(res.json()) - - async def delete_dns_stage( - self, - *, - dns_stage_id: str, - ) -> None: - """ - Delete DNS stage. - Delete an existing DNS stage, specified by its `dns_stage_id`. Deleting a DNS stage is permanent, and cannot be undone. - :param dns_stage_id: ID of the DNS stage to delete. - - Usage: - :: - - result = await api.delete_dns_stage( - dns_stage_id="example", - ) - """ - - param_dns_stage_id = validate_path_param("dns_stage_id", dns_stage_id) - - res = self._request( - "DELETE", - f"/edge-services/v1alpha1/dns-stages/{param_dns_stage_id}", - ) - - self._throw_on_error(res) - - async def list_tls_stages( - self, - *, - order_by: Optional[ListTLSStagesRequestOrderBy] = None, - page: Optional[int] = None, - page_size: Optional[int] = None, - pipeline_id: Optional[str] = None, - project_id: Optional[str] = None, - secret_id: Optional[str] = None, - secret_region: Optional[str] = None, - ) -> ListTLSStagesResponse: - """ - List TLS stages. - List all TLS stages, for a Scaleway Organization or Scaleway Project. By default, the TLS stages returned in the list are ordered by creation date in ascending order, though this can be modified via the `order_by` field. - :param order_by: Sort order of TLS stages in the response. - :param page: Page number to return, from the paginated results. - :param page_size: Number of TLS stages to return per page. - :param pipeline_id: Pipeline ID to filter for, only TLS stages from this pipeline will be returned. - :param project_id: Project ID to filter for, only TLS stages from this Project will be returned. - :param secret_id: Secret ID to filter for, only TLS stages with this Secret ID will be returned. - :param secret_region: Secret region to filter for, only TLS stages with a Secret in this region will be returned. - :return: :class:`ListTLSStagesResponse ` - - Usage: - :: - - result = await api.list_tls_stages() - """ - - res = self._request( - "GET", - "/edge-services/v1alpha1/tls-stages", - params={ - "order_by": order_by, - "page": page, - "page_size": page_size or self.client.default_page_size, - "pipeline_id": pipeline_id, - "project_id": project_id or self.client.default_project_id, - "secret_id": secret_id, - "secret_region": secret_region, - }, - ) - - self._throw_on_error(res) - return unmarshal_ListTLSStagesResponse(res.json()) - - async def list_tls_stages_all( - self, - *, - order_by: Optional[ListTLSStagesRequestOrderBy] = None, - page: Optional[int] = None, - page_size: Optional[int] = None, - pipeline_id: Optional[str] = None, - project_id: Optional[str] = None, - secret_id: Optional[str] = None, - secret_region: Optional[str] = None, - ) -> List[TLSStage]: - """ - List TLS stages. - List all TLS stages, for a Scaleway Organization or Scaleway Project. By default, the TLS stages returned in the list are ordered by creation date in ascending order, though this can be modified via the `order_by` field. - :param order_by: Sort order of TLS stages in the response. - :param page: Page number to return, from the paginated results. - :param page_size: Number of TLS stages to return per page. - :param pipeline_id: Pipeline ID to filter for, only TLS stages from this pipeline will be returned. - :param project_id: Project ID to filter for, only TLS stages from this Project will be returned. - :param secret_id: Secret ID to filter for, only TLS stages with this Secret ID will be returned. - :param secret_region: Secret region to filter for, only TLS stages with a Secret in this region will be returned. - :return: :class:`List[TLSStage] ` - - Usage: - :: - - result = await api.list_tls_stages_all() - """ - - return await fetch_all_pages_async( - type=ListTLSStagesResponse, - key="stages", - fetcher=self.list_tls_stages, - args={ - "order_by": order_by, - "page": page, - "page_size": page_size, - "pipeline_id": pipeline_id, - "project_id": project_id, - "secret_id": secret_id, - "secret_region": secret_region, - }, - ) - - async def create_tls_stage( - self, - *, - project_id: Optional[str] = None, - secrets: Optional[List[TLSSecret]] = None, - managed_certificate: Optional[bool] = None, - cache_stage_id: Optional[str] = None, - backend_stage_id: Optional[str] = None, - ) -> TLSStage: - """ - Create TLS stage. - Create a new TLS stage. You must specify either the `secrets` or `managed_certificate` fields to customize the SSL/TLS certificate of your endpoint. Choose `secrets` if you are using a pre-existing certificate held in Scaleway Secret Manager, or `managed_certificate` to let Scaleway generate and manage a Let's Encrypt certificate for your customized endpoint. - :param project_id: Project ID in which the TLS stage will be created. - :param secrets: Secret (from Scaleway Secret Manager) containing your custom certificate. - :param managed_certificate: True when Scaleway generates and manages a Let's Encrypt certificate for the TLS stage/custom endpoint. - :param cache_stage_id: Cache stage ID the TLS stage will be linked to. - One-Of ('next'): at most one of 'cache_stage_id', 'backend_stage_id' could be set. - :param backend_stage_id: Backend stage ID the TLS stage will be linked to. - One-Of ('next'): at most one of 'cache_stage_id', 'backend_stage_id' could be set. - :return: :class:`TLSStage ` - - Usage: - :: - - result = await api.create_tls_stage() - """ - - res = self._request( - "POST", - "/edge-services/v1alpha1/tls-stages", - body=marshal_CreateTLSStageRequest( - CreateTLSStageRequest( - project_id=project_id, - secrets=secrets, - managed_certificate=managed_certificate, - cache_stage_id=cache_stage_id, - backend_stage_id=backend_stage_id, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_TLSStage(res.json()) - - async def get_tls_stage( - self, - *, - tls_stage_id: str, - ) -> TLSStage: - """ - Get TLS stage. - Retrieve information about an existing TLS stage, specified by its `tls_stage_id`. Its full details, including secrets and certificate expiration date are returned in the response object. - :param tls_stage_id: ID of the requested TLS stage. - :return: :class:`TLSStage ` - - Usage: - :: - - result = await api.get_tls_stage( - tls_stage_id="example", - ) - """ - - param_tls_stage_id = validate_path_param("tls_stage_id", tls_stage_id) - - res = self._request( - "GET", - f"/edge-services/v1alpha1/tls-stages/{param_tls_stage_id}", - ) - - self._throw_on_error(res) - return unmarshal_TLSStage(res.json()) - - async def update_tls_stage( - self, - *, - tls_stage_id: str, - tls_secrets_config: Optional[TLSSecretsConfig] = None, - managed_certificate: Optional[bool] = None, - cache_stage_id: Optional[str] = None, - backend_stage_id: Optional[str] = None, - ) -> TLSStage: - """ - Update TLS stage. - Update the parameters of an existing TLS stage, specified by its `tls_stage_id`. Both `tls_secrets_config` and `managed_certificate` parameters can be updated. - :param tls_stage_id: ID of the TLS stage to update. - :param tls_secrets_config: Secret (from Scaleway Secret-Manager) containing your custom certificate. - :param managed_certificate: True when Scaleway generates and manages a Let's Encrypt certificate for the TLS stage/custom endpoint. - :param cache_stage_id: Cache stage ID the TLS stage will be linked to. - One-Of ('next'): at most one of 'cache_stage_id', 'backend_stage_id' could be set. - :param backend_stage_id: Backend stage ID the TLS stage will be linked to. - One-Of ('next'): at most one of 'cache_stage_id', 'backend_stage_id' could be set. - :return: :class:`TLSStage ` - - Usage: - :: - - result = await api.update_tls_stage( - tls_stage_id="example", - ) - """ - - param_tls_stage_id = validate_path_param("tls_stage_id", tls_stage_id) - - res = self._request( - "PATCH", - f"/edge-services/v1alpha1/tls-stages/{param_tls_stage_id}", - body=marshal_UpdateTLSStageRequest( - UpdateTLSStageRequest( - tls_stage_id=tls_stage_id, - tls_secrets_config=tls_secrets_config, - managed_certificate=managed_certificate, - cache_stage_id=cache_stage_id, - backend_stage_id=backend_stage_id, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_TLSStage(res.json()) - - async def delete_tls_stage( - self, - *, - tls_stage_id: str, - ) -> None: - """ - Delete TLS stage. - Delete an existing TLS stage, specified by its `tls_stage_id`. Deleting a TLS stage is permanent, and cannot be undone. - :param tls_stage_id: ID of the TLS stage to delete. - - Usage: - :: - - result = await api.delete_tls_stage( - tls_stage_id="example", - ) - """ - - param_tls_stage_id = validate_path_param("tls_stage_id", tls_stage_id) - - res = self._request( - "DELETE", - f"/edge-services/v1alpha1/tls-stages/{param_tls_stage_id}", - ) - - self._throw_on_error(res) - - async def list_cache_stages( - self, - *, - order_by: Optional[ListCacheStagesRequestOrderBy] = None, - page: Optional[int] = None, - page_size: Optional[int] = None, - pipeline_id: Optional[str] = None, - project_id: Optional[str] = None, - ) -> ListCacheStagesResponse: - """ - List cache stages. - List all cache stages, for a Scaleway Organization or Scaleway Project. By default, the cache stages returned in the list are ordered by creation date in ascending order, though this can be modified via the `order_by` field. - :param order_by: Sort order of cache stages in the response. - :param page: Page number to return, from the paginated results. - :param page_size: Number of cache stages to return per page. - :param pipeline_id: Pipeline ID to filter for, only cache stages from this pipeline will be returned. - :param project_id: Project ID to filter for, only cache stages from this Project will be returned. - :return: :class:`ListCacheStagesResponse ` - - Usage: - :: - - result = await api.list_cache_stages() - """ - - res = self._request( - "GET", - "/edge-services/v1alpha1/cache-stages", - params={ - "order_by": order_by, - "page": page, - "page_size": page_size or self.client.default_page_size, - "pipeline_id": pipeline_id, - "project_id": project_id or self.client.default_project_id, - }, - ) - - self._throw_on_error(res) - return unmarshal_ListCacheStagesResponse(res.json()) - - async def list_cache_stages_all( - self, - *, - order_by: Optional[ListCacheStagesRequestOrderBy] = None, - page: Optional[int] = None, - page_size: Optional[int] = None, - pipeline_id: Optional[str] = None, - project_id: Optional[str] = None, - ) -> List[CacheStage]: - """ - List cache stages. - List all cache stages, for a Scaleway Organization or Scaleway Project. By default, the cache stages returned in the list are ordered by creation date in ascending order, though this can be modified via the `order_by` field. - :param order_by: Sort order of cache stages in the response. - :param page: Page number to return, from the paginated results. - :param page_size: Number of cache stages to return per page. - :param pipeline_id: Pipeline ID to filter for, only cache stages from this pipeline will be returned. - :param project_id: Project ID to filter for, only cache stages from this Project will be returned. - :return: :class:`List[CacheStage] ` - - Usage: - :: - - result = await api.list_cache_stages_all() - """ - - return await fetch_all_pages_async( - type=ListCacheStagesResponse, - key="stages", - fetcher=self.list_cache_stages, - args={ - "order_by": order_by, - "page": page, - "page_size": page_size, - "pipeline_id": pipeline_id, - "project_id": project_id, - }, - ) - - async def create_cache_stage( - self, - *, - project_id: Optional[str] = None, - fallback_ttl: Optional[str] = None, - backend_stage_id: Optional[str] = None, - ) -> CacheStage: - """ - Create cache stage. - Create a new cache stage. You must specify the `fallback_ttl` field to customize the TTL of the cache. - :param project_id: Project ID in which the cache stage will be created. - :param fallback_ttl: Time To Live (TTL) in seconds. Defines how long content is cached. - :param backend_stage_id: Backend stage ID the cache stage will be linked to. - One-Of ('next'): at most one of 'backend_stage_id' could be set. - :return: :class:`CacheStage ` - - Usage: - :: - - result = await api.create_cache_stage() - """ - - res = self._request( - "POST", - "/edge-services/v1alpha1/cache-stages", - body=marshal_CreateCacheStageRequest( - CreateCacheStageRequest( - project_id=project_id, - fallback_ttl=fallback_ttl, - backend_stage_id=backend_stage_id, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_CacheStage(res.json()) - - async def get_cache_stage( - self, - *, - cache_stage_id: str, - ) -> CacheStage: - """ - Get cache stage. - Retrieve information about an existing cache stage, specified by its `cache_stage_id`. Its full details, including Time To Live (TTL), are returned in the response object. - :param cache_stage_id: ID of the requested cache stage. - :return: :class:`CacheStage ` - - Usage: - :: - - result = await api.get_cache_stage( - cache_stage_id="example", - ) - """ - - param_cache_stage_id = validate_path_param("cache_stage_id", cache_stage_id) - - res = self._request( - "GET", - f"/edge-services/v1alpha1/cache-stages/{param_cache_stage_id}", - ) - - self._throw_on_error(res) - return unmarshal_CacheStage(res.json()) - - async def update_cache_stage( - self, - *, - cache_stage_id: str, - fallback_ttl: Optional[str] = None, - backend_stage_id: Optional[str] = None, - ) -> CacheStage: - """ - Update cache stage. - Update the parameters of an existing cache stage, specified by its `cache_stage_id`. Parameters which can be updated include the `fallback_ttl` and `backend_stage_id`. - :param cache_stage_id: ID of the cache stage to update. - :param fallback_ttl: Time To Live (TTL) in seconds. Defines how long content is cached. - :param backend_stage_id: Backend stage ID the cache stage will be linked to. - One-Of ('next'): at most one of 'backend_stage_id' could be set. - :return: :class:`CacheStage ` - - Usage: - :: - - result = await api.update_cache_stage( - cache_stage_id="example", - ) - """ - - param_cache_stage_id = validate_path_param("cache_stage_id", cache_stage_id) - - res = self._request( - "PATCH", - f"/edge-services/v1alpha1/cache-stages/{param_cache_stage_id}", - body=marshal_UpdateCacheStageRequest( - UpdateCacheStageRequest( - cache_stage_id=cache_stage_id, - fallback_ttl=fallback_ttl, - backend_stage_id=backend_stage_id, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_CacheStage(res.json()) - - async def delete_cache_stage( - self, - *, - cache_stage_id: str, - ) -> None: - """ - Delete cache stage. - Delete an existing cache stage, specified by its `cache_stage_id`. Deleting a cache stage is permanent, and cannot be undone. - :param cache_stage_id: ID of the cache stage to delete. - - Usage: - :: - - result = await api.delete_cache_stage( - cache_stage_id="example", - ) - """ - - param_cache_stage_id = validate_path_param("cache_stage_id", cache_stage_id) - - res = self._request( - "DELETE", - f"/edge-services/v1alpha1/cache-stages/{param_cache_stage_id}", - ) - - self._throw_on_error(res) - - async def list_backend_stages( - self, - *, - order_by: Optional[ListBackendStagesRequestOrderBy] = None, - page: Optional[int] = None, - page_size: Optional[int] = None, - pipeline_id: Optional[str] = None, - project_id: Optional[str] = None, - bucket_name: Optional[str] = None, - bucket_region: Optional[str] = None, - lb_id: Optional[str] = None, - ) -> ListBackendStagesResponse: - """ - List backend stages. - List all backend stages, for a Scaleway Organization or Scaleway Project. By default, the backend stages returned in the list are ordered by creation date in ascending order, though this can be modified via the `order_by` field. - :param order_by: Sort order of backend stages in the response. - :param page: Page number to return, from the paginated results. - :param page_size: Number of backend stages to return per page. - :param pipeline_id: Pipeline ID to filter for, only backend stages from this pipeline will be returned. - :param project_id: Project ID to filter for, only backend stages from this Project will be returned. - :param bucket_name: Bucket name to filter for, only backend stages from this Bucket will be returned. - :param bucket_region: Bucket region to filter for, only backend stages with buckets in this region will be returned. - :param lb_id: Load Balancer ID to filter for, only backend stages with this Load Balancer will be returned. - :return: :class:`ListBackendStagesResponse ` - - Usage: - :: - - result = await api.list_backend_stages() - """ - - res = self._request( - "GET", - "/edge-services/v1alpha1/backend-stages", - params={ - "bucket_name": bucket_name, - "bucket_region": bucket_region, - "lb_id": lb_id, - "order_by": order_by, - "page": page, - "page_size": page_size or self.client.default_page_size, - "pipeline_id": pipeline_id, - "project_id": project_id or self.client.default_project_id, - }, - ) - - self._throw_on_error(res) - return unmarshal_ListBackendStagesResponse(res.json()) - - async def list_backend_stages_all( - self, - *, - order_by: Optional[ListBackendStagesRequestOrderBy] = None, - page: Optional[int] = None, - page_size: Optional[int] = None, - pipeline_id: Optional[str] = None, - project_id: Optional[str] = None, - bucket_name: Optional[str] = None, - bucket_region: Optional[str] = None, - lb_id: Optional[str] = None, - ) -> List[BackendStage]: - """ - List backend stages. - List all backend stages, for a Scaleway Organization or Scaleway Project. By default, the backend stages returned in the list are ordered by creation date in ascending order, though this can be modified via the `order_by` field. - :param order_by: Sort order of backend stages in the response. - :param page: Page number to return, from the paginated results. - :param page_size: Number of backend stages to return per page. - :param pipeline_id: Pipeline ID to filter for, only backend stages from this pipeline will be returned. - :param project_id: Project ID to filter for, only backend stages from this Project will be returned. - :param bucket_name: Bucket name to filter for, only backend stages from this Bucket will be returned. - :param bucket_region: Bucket region to filter for, only backend stages with buckets in this region will be returned. - :param lb_id: Load Balancer ID to filter for, only backend stages with this Load Balancer will be returned. - :return: :class:`List[BackendStage] ` - - Usage: - :: - - result = await api.list_backend_stages_all() - """ - - return await fetch_all_pages_async( - type=ListBackendStagesResponse, - key="stages", - fetcher=self.list_backend_stages, - args={ - "order_by": order_by, - "page": page, - "page_size": page_size, - "pipeline_id": pipeline_id, - "project_id": project_id, - "bucket_name": bucket_name, - "bucket_region": bucket_region, - "lb_id": lb_id, - }, - ) - - async def create_backend_stage( - self, - *, - project_id: Optional[str] = None, - scaleway_s3: Optional[ScalewayS3BackendConfig] = None, - scaleway_lb: Optional[ScalewayLbBackendConfig] = None, - ) -> BackendStage: - """ - Create backend stage. - Create a new backend stage. You must specify either a `scaleway_s3` (for a Scaleway Object Storage bucket) or `scaleway_lb` (for a Scaleway Load Balancer) field to configure the origin. - :param project_id: Project ID in which the backend stage will be created. - :param scaleway_s3: Scaleway Object Storage origin bucket (S3) linked to the backend stage. - One-Of ('backend_config'): at most one of 'scaleway_s3', 'scaleway_lb' could be set. - :param scaleway_lb: Scaleway Load Balancer origin linked to the backend stage. - One-Of ('backend_config'): at most one of 'scaleway_s3', 'scaleway_lb' could be set. - :return: :class:`BackendStage ` - - Usage: - :: - - result = await api.create_backend_stage() - """ - - res = self._request( - "POST", - "/edge-services/v1alpha1/backend-stages", - body=marshal_CreateBackendStageRequest( - CreateBackendStageRequest( - project_id=project_id, - scaleway_s3=scaleway_s3, - scaleway_lb=scaleway_lb, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_BackendStage(res.json()) - - async def get_backend_stage( - self, - *, - backend_stage_id: str, - ) -> BackendStage: - """ - Get backend stage. - Retrieve information about an existing backend stage, specified by its `backend_stage_id`. Its full details, including `scaleway_s3` or `scaleway_lb`, are returned in the response object. - :param backend_stage_id: ID of the requested backend stage. - :return: :class:`BackendStage ` - - Usage: - :: - - result = await api.get_backend_stage( - backend_stage_id="example", - ) - """ - - param_backend_stage_id = validate_path_param( - "backend_stage_id", backend_stage_id - ) - - res = self._request( - "GET", - f"/edge-services/v1alpha1/backend-stages/{param_backend_stage_id}", - ) - - self._throw_on_error(res) - return unmarshal_BackendStage(res.json()) - - async def update_backend_stage( - self, - *, - backend_stage_id: str, - scaleway_s3: Optional[ScalewayS3BackendConfig] = None, - scaleway_lb: Optional[ScalewayLbBackendConfig] = None, - ) -> BackendStage: - """ - Update backend stage. - Update the parameters of an existing backend stage, specified by its `backend_stage_id`. - :param backend_stage_id: ID of the backend stage to update. - :param scaleway_s3: Scaleway Object Storage origin bucket (S3) linked to the backend stage. - One-Of ('backend_config'): at most one of 'scaleway_s3', 'scaleway_lb' could be set. - :param scaleway_lb: Scaleway Load Balancer origin linked to the backend stage. - One-Of ('backend_config'): at most one of 'scaleway_s3', 'scaleway_lb' could be set. - :return: :class:`BackendStage ` - - Usage: - :: - - result = await api.update_backend_stage( - backend_stage_id="example", - ) - """ - - param_backend_stage_id = validate_path_param( - "backend_stage_id", backend_stage_id - ) - - res = self._request( - "PATCH", - f"/edge-services/v1alpha1/backend-stages/{param_backend_stage_id}", - body=marshal_UpdateBackendStageRequest( - UpdateBackendStageRequest( - backend_stage_id=backend_stage_id, - scaleway_s3=scaleway_s3, - scaleway_lb=scaleway_lb, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_BackendStage(res.json()) - - async def delete_backend_stage( - self, - *, - backend_stage_id: str, - ) -> None: - """ - Delete backend stage. - Delete an existing backend stage, specified by its `backend_stage_id`. Deleting a backend stage is permanent, and cannot be undone. - :param backend_stage_id: ID of the backend stage to delete. - - Usage: - :: - - result = await api.delete_backend_stage( - backend_stage_id="example", - ) - """ - - param_backend_stage_id = validate_path_param( - "backend_stage_id", backend_stage_id - ) - - res = self._request( - "DELETE", - f"/edge-services/v1alpha1/backend-stages/{param_backend_stage_id}", - ) - - self._throw_on_error(res) - - async def check_domain( - self, - *, - fqdn: str, - cname: str, - project_id: Optional[str] = None, - ) -> CheckDomainResponse: - """ - :param fqdn: - :param cname: - :param project_id: - :return: :class:`CheckDomainResponse ` - - Usage: - :: - - result = await api.check_domain( - fqdn="example", - cname="example", - ) - """ - - res = self._request( - "POST", - "/edge-services/v1alpha1/check-domain", - body=marshal_CheckDomainRequest( - CheckDomainRequest( - fqdn=fqdn, - cname=cname, - project_id=project_id, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_CheckDomainResponse(res.json()) - - async def check_pem_chain( - self, - *, - fqdn: str, - project_id: Optional[str] = None, - secret: Optional[CheckPEMChainRequestSecretChain] = None, - raw: Optional[str] = None, - ) -> CheckPEMChainResponse: - """ - :param fqdn: - :param project_id: - :param secret: - One-Of ('chain'): at most one of 'secret', 'raw' could be set. - :param raw: - One-Of ('chain'): at most one of 'secret', 'raw' could be set. - :return: :class:`CheckPEMChainResponse ` - - Usage: - :: - - result = await api.check_pem_chain( - fqdn="example", - ) - """ - - res = self._request( - "POST", - "/edge-services/v1alpha1/check-pem-chain", - body=marshal_CheckPEMChainRequest( - CheckPEMChainRequest( - fqdn=fqdn, - project_id=project_id, - secret=secret, - raw=raw, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_CheckPEMChainResponse(res.json()) - - async def list_purge_requests( - self, - *, - order_by: Optional[ListPurgeRequestsRequestOrderBy] = None, - page: Optional[int] = None, - page_size: Optional[int] = None, - organization_id: Optional[str] = None, - project_id: Optional[str] = None, - pipeline_id: Optional[str] = None, - ) -> ListPurgeRequestsResponse: - """ - List purge requests. - List all purge requests, for a Scaleway Organization or Scaleway Project. This enables you to retrieve a history of all previously-made purge requests. By default, the purge requests returned in the list are ordered by creation date in ascending order, though this can be modified via the `order_by` field. - :param order_by: Sort order of purge requests in the response. - :param page: Page number to return, from the paginated results. - :param page_size: Number of purge requests to return per page. - :param organization_id: Organization ID to filter for, only purge requests from this Project will be returned. - :param project_id: Project ID to filter for, only purge requests from this Project will be returned. - :param pipeline_id: Pipeline ID to filter for, only purge requests from this pipeline will be returned. - :return: :class:`ListPurgeRequestsResponse ` - - Usage: - :: - - result = await api.list_purge_requests() - """ - - res = self._request( - "GET", - "/edge-services/v1alpha1/purge-requests", - params={ - "order_by": order_by, - "organization_id": organization_id - or self.client.default_organization_id, - "page": page, - "page_size": page_size or self.client.default_page_size, - "pipeline_id": pipeline_id, - "project_id": project_id or self.client.default_project_id, - }, - ) - - self._throw_on_error(res) - return unmarshal_ListPurgeRequestsResponse(res.json()) - - async def list_purge_requests_all( - self, - *, - order_by: Optional[ListPurgeRequestsRequestOrderBy] = None, - page: Optional[int] = None, - page_size: Optional[int] = None, - organization_id: Optional[str] = None, - project_id: Optional[str] = None, - pipeline_id: Optional[str] = None, - ) -> List[PurgeRequest]: - """ - List purge requests. - List all purge requests, for a Scaleway Organization or Scaleway Project. This enables you to retrieve a history of all previously-made purge requests. By default, the purge requests returned in the list are ordered by creation date in ascending order, though this can be modified via the `order_by` field. - :param order_by: Sort order of purge requests in the response. - :param page: Page number to return, from the paginated results. - :param page_size: Number of purge requests to return per page. - :param organization_id: Organization ID to filter for, only purge requests from this Project will be returned. - :param project_id: Project ID to filter for, only purge requests from this Project will be returned. - :param pipeline_id: Pipeline ID to filter for, only purge requests from this pipeline will be returned. - :return: :class:`List[PurgeRequest] ` - - Usage: - :: - - result = await api.list_purge_requests_all() - """ - - return await fetch_all_pages_async( - type=ListPurgeRequestsResponse, - key="purge_requests", - fetcher=self.list_purge_requests, - args={ - "order_by": order_by, - "page": page, - "page_size": page_size, - "organization_id": organization_id, - "project_id": project_id, - "pipeline_id": pipeline_id, - }, - ) - - async def create_purge_request( - self, - *, - pipeline_id: str, - assets: Optional[List[str]] = None, - all: Optional[bool] = None, - ) -> PurgeRequest: - """ - Create purge request. - Create a new purge request. You must specify either the `all` field (to purge all content) or a list of `assets` (to define the precise assets to purge). - :param pipeline_id: Pipeline ID in which the purge request will be created. - :param assets: List of asserts to purge. - One-Of ('target'): at most one of 'assets', 'all' could be set. - :param all: Defines whether to purge all content. - One-Of ('target'): at most one of 'assets', 'all' could be set. - :return: :class:`PurgeRequest ` - - Usage: - :: - - result = await api.create_purge_request( - pipeline_id="example", - ) - """ - - res = self._request( - "POST", - "/edge-services/v1alpha1/purge-requests", - body=marshal_CreatePurgeRequestRequest( - CreatePurgeRequestRequest( - pipeline_id=pipeline_id, - assets=assets, - all=all, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_PurgeRequest(res.json()) - - async def get_purge_request( - self, - *, - purge_request_id: str, - ) -> PurgeRequest: - """ - Get purge request. - Retrieve information about a purge request, specified by its `purge_request_id`. Its full details, including `status` and `target`, are returned in the response object. - :param purge_request_id: ID of the requested purge request. - :return: :class:`PurgeRequest ` - - Usage: - :: - - result = await api.get_purge_request( - purge_request_id="example", - ) - """ - - param_purge_request_id = validate_path_param( - "purge_request_id", purge_request_id - ) - - res = self._request( - "GET", - f"/edge-services/v1alpha1/purge-requests/{param_purge_request_id}", - ) - - self._throw_on_error(res) - return unmarshal_PurgeRequest(res.json()) - - async def wait_for_purge_request( - self, - *, - purge_request_id: str, - options: Optional[ - WaitForOptions[PurgeRequest, Union[bool, Awaitable[bool]]] - ] = None, - ) -> PurgeRequest: - """ - Get purge request. - Retrieve information about a purge request, specified by its `purge_request_id`. Its full details, including `status` and `target`, are returned in the response object. - :param purge_request_id: ID of the requested purge request. - :return: :class:`PurgeRequest ` - - Usage: - :: - - result = await api.get_purge_request( - purge_request_id="example", - ) - """ - - if not options: - options = WaitForOptions() - - if not options.stop: - options.stop = lambda res: ( - res.status not in PURGE_REQUEST_TRANSIENT_STATUSES - ) - - return await wait_for_resource_async( - fetcher=self.get_purge_request, - options=options, - args={ - "purge_request_id": purge_request_id, - }, - ) - - async def check_lb_origin( - self, - *, - lb: Optional[ScalewayLb] = None, - ) -> CheckLbOriginResponse: - """ - :param lb: - :return: :class:`CheckLbOriginResponse ` - - Usage: - :: - - result = await api.check_lb_origin() - """ - - res = self._request( - "POST", - "/edge-services/v1alpha1/check-lb-origin", - body=marshal_CheckLbOriginRequest( - CheckLbOriginRequest( - lb=lb, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_CheckLbOriginResponse(res.json()) - - async def list_plans( - self, - ) -> ListPlansResponse: - """ - - :return: :class:`ListPlansResponse ` - - Usage: - :: - - result = await api.list_plans() - """ - - res = self._request( - "GET", - "/edge-services/v1alpha1/plans", - ) - - self._throw_on_error(res) - return unmarshal_ListPlansResponse(res.json()) - - async def select_plan( - self, - *, - project_id: Optional[str] = None, - plan_name: Optional[PlanName] = None, - ) -> Plan: - """ - :param project_id: - :param plan_name: - :return: :class:`Plan ` - - Usage: - :: - - result = await api.select_plan() - """ - - res = self._request( - "PATCH", - "/edge-services/v1alpha1/current-plan", - body=marshal_SelectPlanRequest( - SelectPlanRequest( - project_id=project_id, - plan_name=plan_name, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_Plan(res.json()) - - async def get_current_plan( - self, - *, - project_id: Optional[str] = None, - ) -> Plan: - """ - :param project_id: - :return: :class:`Plan ` - - Usage: - :: - - result = await api.get_current_plan() - """ - - param_project_id = validate_path_param( - "project_id", project_id or self.client.default_project_id - ) - - res = self._request( - "GET", - f"/edge-services/v1alpha1/current-plan/{param_project_id}", - ) - - self._throw_on_error(res) - return unmarshal_Plan(res.json()) - - async def delete_current_plan( - self, - *, - project_id: Optional[str] = None, - ) -> None: - """ - :param project_id: - - Usage: - :: - - result = await api.delete_current_plan() - """ - - param_project_id = validate_path_param( - "project_id", project_id or self.client.default_project_id - ) - - res = self._request( - "DELETE", - f"/edge-services/v1alpha1/current-plan/{param_project_id}", - ) - - self._throw_on_error(res) - - async def get_billing( - self, - *, - project_id: Optional[str] = None, - ) -> GetBillingResponse: - """ - Gives information on the currently selected Edge Services subscription plan, resource usage and associated billing information for this calendar month (including whether consumption falls within or exceeds the currently selected subscription plan.). - :param project_id: - :return: :class:`GetBillingResponse ` - - Usage: - :: - - result = await api.get_billing() - """ - - param_project_id = validate_path_param( - "project_id", project_id or self.client.default_project_id - ) - - res = self._request( - "GET", - f"/edge-services/v1alpha1/billing/{param_project_id}", - ) - - self._throw_on_error(res) - return unmarshal_GetBillingResponse(res.json()) diff --git a/scaleway-async/scaleway_async/edge_services/v1alpha1/content.py b/scaleway-async/scaleway_async/edge_services/v1alpha1/content.py deleted file mode 100644 index ad1b5e0e6..000000000 --- a/scaleway-async/scaleway_async/edge_services/v1alpha1/content.py +++ /dev/null @@ -1,21 +0,0 @@ -# This file was automatically generated. DO NOT EDIT. -# If you have any remark or suggestion do not hesitate to open an issue. -from typing import List - -from .types import ( - PipelineStatus, - PurgeRequestStatus, -) - -PIPELINE_TRANSIENT_STATUSES: List[PipelineStatus] = [ - PipelineStatus.PENDING, -] -""" -Lists transient statutes of the enum :class:`PipelineStatus `. -""" -PURGE_REQUEST_TRANSIENT_STATUSES: List[PurgeRequestStatus] = [ - PurgeRequestStatus.PENDING, -] -""" -Lists transient statutes of the enum :class:`PurgeRequestStatus `. -""" diff --git a/scaleway-async/scaleway_async/edge_services/v1alpha1/marshalling.py b/scaleway-async/scaleway_async/edge_services/v1alpha1/marshalling.py deleted file mode 100644 index f9145ff06..000000000 --- a/scaleway-async/scaleway_async/edge_services/v1alpha1/marshalling.py +++ /dev/null @@ -1,1334 +0,0 @@ -# This file was automatically generated. DO NOT EDIT. -# If you have any remark or suggestion do not hesitate to open an issue. - -from typing import Any, Dict -from dateutil import parser - -from scaleway_core.profile import ProfileDefaults -from scaleway_core.bridge import ( - unmarshal_Money, -) -from scaleway_core.utils import ( - OneOfPossibility, - resolve_one_of, -) -from .types import ( - ScalewayLb, - ScalewayLbBackendConfig, - ScalewayS3BackendConfig, - BackendStage, - CacheStage, - DNSStage, - PipelineError, - Pipeline, - TLSSecret, - TLSStage, - PipelineStages, - PurgeRequest, - CheckDomainResponse, - CheckLbOriginResponse, - CheckPEMChainResponse, - PlanDetails, - PlanUsageDetails, - GetBillingResponse, - ListBackendStagesResponse, - ListCacheStagesResponse, - ListDNSStagesResponse, - ListPipelinesResponse, - ListPipelinesWithStagesResponse, - ListPlansResponse, - ListPurgeRequestsResponse, - ListTLSStagesResponse, - Plan, - CheckDomainRequest, - CheckLbOriginRequest, - CheckPEMChainRequestSecretChain, - CheckPEMChainRequest, - CreateBackendStageRequest, - CreateCacheStageRequest, - CreateDNSStageRequest, - CreatePipelineRequest, - CreatePurgeRequestRequest, - CreateTLSStageRequest, - SelectPlanRequest, - UpdateBackendStageRequest, - UpdateCacheStageRequest, - UpdateDNSStageRequest, - UpdatePipelineRequest, - TLSSecretsConfig, - UpdateTLSStageRequest, -) - - -def unmarshal_ScalewayLb(data: Any) -> ScalewayLb: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'ScalewayLb' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("id", None) - if field is not None: - args["id"] = field - - field = data.get("zone", None) - if field is not None: - args["zone"] = field - - field = data.get("frontend_id", None) - if field is not None: - args["frontend_id"] = field - - field = data.get("is_ssl", None) - if field is not None: - args["is_ssl"] = field - else: - args["is_ssl"] = None - - field = data.get("domain_name", None) - if field is not None: - args["domain_name"] = field - else: - args["domain_name"] = None - - return ScalewayLb(**args) - - -def unmarshal_ScalewayLbBackendConfig(data: Any) -> ScalewayLbBackendConfig: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'ScalewayLbBackendConfig' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("lbs", None) - if field is not None: - args["lbs"] = ( - [unmarshal_ScalewayLb(v) for v in field] if field is not None else None - ) - - return ScalewayLbBackendConfig(**args) - - -def unmarshal_ScalewayS3BackendConfig(data: Any) -> ScalewayS3BackendConfig: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'ScalewayS3BackendConfig' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("bucket_name", None) - if field is not None: - args["bucket_name"] = field - else: - args["bucket_name"] = None - - field = data.get("bucket_region", None) - if field is not None: - args["bucket_region"] = field - else: - args["bucket_region"] = None - - field = data.get("is_website", None) - if field is not None: - args["is_website"] = field - else: - args["is_website"] = None - - return ScalewayS3BackendConfig(**args) - - -def unmarshal_BackendStage(data: Any) -> BackendStage: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'BackendStage' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("id", None) - if field is not None: - args["id"] = field - - field = data.get("project_id", None) - if field is not None: - args["project_id"] = field - - field = data.get("pipeline_id", None) - if field is not None: - args["pipeline_id"] = field - else: - args["pipeline_id"] = None - - field = data.get("created_at", None) - if field is not None: - args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["created_at"] = None - - field = data.get("updated_at", None) - if field is not None: - args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["updated_at"] = None - - field = data.get("scaleway_s3", None) - if field is not None: - args["scaleway_s3"] = unmarshal_ScalewayS3BackendConfig(field) - else: - args["scaleway_s3"] = None - - field = data.get("scaleway_lb", None) - if field is not None: - args["scaleway_lb"] = unmarshal_ScalewayLbBackendConfig(field) - else: - args["scaleway_lb"] = None - - return BackendStage(**args) - - -def unmarshal_CacheStage(data: Any) -> CacheStage: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'CacheStage' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("id", None) - if field is not None: - args["id"] = field - - field = data.get("project_id", None) - if field is not None: - args["project_id"] = field - - field = data.get("pipeline_id", None) - if field is not None: - args["pipeline_id"] = field - else: - args["pipeline_id"] = None - - field = data.get("fallback_ttl", None) - if field is not None: - args["fallback_ttl"] = field - else: - args["fallback_ttl"] = None - - field = data.get("created_at", None) - if field is not None: - args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["created_at"] = None - - field = data.get("updated_at", None) - if field is not None: - args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["updated_at"] = None - - field = data.get("backend_stage_id", None) - if field is not None: - args["backend_stage_id"] = field - else: - args["backend_stage_id"] = None - - return CacheStage(**args) - - -def unmarshal_DNSStage(data: Any) -> DNSStage: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'DNSStage' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("id", None) - if field is not None: - args["id"] = field - - field = data.get("fqdns", None) - if field is not None: - args["fqdns"] = field - - field = data.get("type", None) - if field is not None: - args["type_"] = field - - field = data.get("project_id", None) - if field is not None: - args["project_id"] = field - - field = data.get("pipeline_id", None) - if field is not None: - args["pipeline_id"] = field - else: - args["pipeline_id"] = None - - field = data.get("created_at", None) - if field is not None: - args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["created_at"] = None - - field = data.get("updated_at", None) - if field is not None: - args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["updated_at"] = None - - field = data.get("tls_stage_id", None) - if field is not None: - args["tls_stage_id"] = field - else: - args["tls_stage_id"] = None - - field = data.get("cache_stage_id", None) - if field is not None: - args["cache_stage_id"] = field - else: - args["cache_stage_id"] = None - - field = data.get("backend_stage_id", None) - if field is not None: - args["backend_stage_id"] = field - else: - args["backend_stage_id"] = None - - return DNSStage(**args) - - -def unmarshal_PipelineError(data: Any) -> PipelineError: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'PipelineError' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("stage", None) - if field is not None: - args["stage"] = field - - field = data.get("code", None) - if field is not None: - args["code"] = field - - field = data.get("severity", None) - if field is not None: - args["severity"] = field - - field = data.get("message", None) - if field is not None: - args["message"] = field - - field = data.get("type", None) - if field is not None: - args["type_"] = field - - return PipelineError(**args) - - -def unmarshal_Pipeline(data: Any) -> Pipeline: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'Pipeline' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("id", None) - if field is not None: - args["id"] = field - - field = data.get("name", None) - if field is not None: - args["name"] = field - - field = data.get("description", None) - if field is not None: - args["description"] = field - - field = data.get("status", None) - if field is not None: - args["status"] = field - - field = data.get("errors", None) - if field is not None: - args["errors"] = ( - [unmarshal_PipelineError(v) for v in field] if field is not None else None - ) - - field = data.get("project_id", None) - if field is not None: - args["project_id"] = field - - field = data.get("organization_id", None) - if field is not None: - args["organization_id"] = field - - field = data.get("created_at", None) - if field is not None: - args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["created_at"] = None - - field = data.get("updated_at", None) - if field is not None: - args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["updated_at"] = None - - field = data.get("dns_stage_id", None) - if field is not None: - args["dns_stage_id"] = field - else: - args["dns_stage_id"] = None - - return Pipeline(**args) - - -def unmarshal_TLSSecret(data: Any) -> TLSSecret: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'TLSSecret' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("secret_id", None) - if field is not None: - args["secret_id"] = field - - field = data.get("region", None) - if field is not None: - args["region"] = field - - return TLSSecret(**args) - - -def unmarshal_TLSStage(data: Any) -> TLSStage: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'TLSStage' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("id", None) - if field is not None: - args["id"] = field - - field = data.get("secrets", None) - if field is not None: - args["secrets"] = ( - [unmarshal_TLSSecret(v) for v in field] if field is not None else None - ) - - field = data.get("managed_certificate", None) - if field is not None: - args["managed_certificate"] = field - - field = data.get("project_id", None) - if field is not None: - args["project_id"] = field - - field = data.get("pipeline_id", None) - if field is not None: - args["pipeline_id"] = field - else: - args["pipeline_id"] = None - - field = data.get("certificate_expires_at", None) - if field is not None: - args["certificate_expires_at"] = ( - parser.isoparse(field) if isinstance(field, str) else field - ) - else: - args["certificate_expires_at"] = None - - field = data.get("created_at", None) - if field is not None: - args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["created_at"] = None - - field = data.get("updated_at", None) - if field is not None: - args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["updated_at"] = None - - field = data.get("cache_stage_id", None) - if field is not None: - args["cache_stage_id"] = field - else: - args["cache_stage_id"] = None - - field = data.get("backend_stage_id", None) - if field is not None: - args["backend_stage_id"] = field - else: - args["backend_stage_id"] = None - - return TLSStage(**args) - - -def unmarshal_PipelineStages(data: Any) -> PipelineStages: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'PipelineStages' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("dns_stages", None) - if field is not None: - args["dns_stages"] = ( - [unmarshal_DNSStage(v) for v in field] if field is not None else None - ) - - field = data.get("tls_stages", None) - if field is not None: - args["tls_stages"] = ( - [unmarshal_TLSStage(v) for v in field] if field is not None else None - ) - - field = data.get("cache_stages", None) - if field is not None: - args["cache_stages"] = ( - [unmarshal_CacheStage(v) for v in field] if field is not None else None - ) - - field = data.get("backend_stages", None) - if field is not None: - args["backend_stages"] = ( - [unmarshal_BackendStage(v) for v in field] if field is not None else None - ) - - field = data.get("pipeline", None) - if field is not None: - args["pipeline"] = unmarshal_Pipeline(field) - else: - args["pipeline"] = None - - return PipelineStages(**args) - - -def unmarshal_PurgeRequest(data: Any) -> PurgeRequest: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'PurgeRequest' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("id", None) - if field is not None: - args["id"] = field - - field = data.get("pipeline_id", None) - if field is not None: - args["pipeline_id"] = field - - field = data.get("status", None) - if field is not None: - args["status"] = field - - field = data.get("assets", None) - if field is not None: - args["assets"] = field - else: - args["assets"] = None - - field = data.get("all", None) - if field is not None: - args["all"] = field - else: - args["all"] = None - - field = data.get("created_at", None) - if field is not None: - args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["created_at"] = None - - field = data.get("updated_at", None) - if field is not None: - args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["updated_at"] = None - - return PurgeRequest(**args) - - -def unmarshal_CheckDomainResponse(data: Any) -> CheckDomainResponse: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'CheckDomainResponse' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("is_valid", None) - if field is not None: - args["is_valid"] = field - - return CheckDomainResponse(**args) - - -def unmarshal_CheckLbOriginResponse(data: Any) -> CheckLbOriginResponse: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'CheckLbOriginResponse' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("is_valid", None) - if field is not None: - args["is_valid"] = field - - field = data.get("error_type", None) - if field is not None: - args["error_type"] = field - - return CheckLbOriginResponse(**args) - - -def unmarshal_CheckPEMChainResponse(data: Any) -> CheckPEMChainResponse: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'CheckPEMChainResponse' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("is_valid", None) - if field is not None: - args["is_valid"] = field - - return CheckPEMChainResponse(**args) - - -def unmarshal_PlanDetails(data: Any) -> PlanDetails: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'PlanDetails' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("plan_name", None) - if field is not None: - args["plan_name"] = field - - field = data.get("package_gb", None) - if field is not None: - args["package_gb"] = field - - field = data.get("pipeline_limit", None) - if field is not None: - args["pipeline_limit"] = field - - field = data.get("waf_requests", None) - if field is not None: - args["waf_requests"] = field - - return PlanDetails(**args) - - -def unmarshal_PlanUsageDetails(data: Any) -> PlanUsageDetails: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'PlanUsageDetails' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("plan_cost", None) - if field is not None: - args["plan_cost"] = unmarshal_Money(field) - else: - args["plan_cost"] = None - - return PlanUsageDetails(**args) - - -def unmarshal_GetBillingResponse(data: Any) -> GetBillingResponse: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'GetBillingResponse' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("current_plan", None) - if field is not None: - args["current_plan"] = unmarshal_PlanDetails(field) - else: - args["current_plan"] = None - - field = data.get("pipeline_number", None) - if field is not None: - args["pipeline_number"] = field - - field = data.get("current_plan_cache_usage", None) - if field is not None: - args["current_plan_cache_usage"] = field - - field = data.get("extra_cache_usage", None) - if field is not None: - args["extra_cache_usage"] = field - - field = data.get("current_plan_waf_usage", None) - if field is not None: - args["current_plan_waf_usage"] = field - - field = data.get("extra_waf_usage", None) - if field is not None: - args["extra_waf_usage"] = field - - field = data.get("plan_cost", None) - if field is not None: - args["plan_cost"] = unmarshal_Money(field) - else: - args["plan_cost"] = None - - field = data.get("extra_pipelines_cost", None) - if field is not None: - args["extra_pipelines_cost"] = unmarshal_Money(field) - else: - args["extra_pipelines_cost"] = None - - field = data.get("plans_usage_details", None) - if field is not None: - args["plans_usage_details"] = ( - {key: unmarshal_PlanUsageDetails(value) for key, value in field.items()} - if field is not None - else None - ) - - field = data.get("extra_cache_cost", None) - if field is not None: - args["extra_cache_cost"] = unmarshal_Money(field) - else: - args["extra_cache_cost"] = None - - field = data.get("extra_waf_cost", None) - if field is not None: - args["extra_waf_cost"] = unmarshal_Money(field) - else: - args["extra_waf_cost"] = None - - field = data.get("waf_add_on", None) - if field is not None: - args["waf_add_on"] = unmarshal_Money(field) - else: - args["waf_add_on"] = None - - field = data.get("total_cost", None) - if field is not None: - args["total_cost"] = unmarshal_Money(field) - else: - args["total_cost"] = None - - return GetBillingResponse(**args) - - -def unmarshal_ListBackendStagesResponse(data: Any) -> ListBackendStagesResponse: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'ListBackendStagesResponse' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("stages", None) - if field is not None: - args["stages"] = ( - [unmarshal_BackendStage(v) for v in field] if field is not None else None - ) - - field = data.get("total_count", None) - if field is not None: - args["total_count"] = field - - return ListBackendStagesResponse(**args) - - -def unmarshal_ListCacheStagesResponse(data: Any) -> ListCacheStagesResponse: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'ListCacheStagesResponse' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("stages", None) - if field is not None: - args["stages"] = ( - [unmarshal_CacheStage(v) for v in field] if field is not None else None - ) - - field = data.get("total_count", None) - if field is not None: - args["total_count"] = field - - return ListCacheStagesResponse(**args) - - -def unmarshal_ListDNSStagesResponse(data: Any) -> ListDNSStagesResponse: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'ListDNSStagesResponse' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("stages", None) - if field is not None: - args["stages"] = ( - [unmarshal_DNSStage(v) for v in field] if field is not None else None - ) - - field = data.get("total_count", None) - if field is not None: - args["total_count"] = field - - return ListDNSStagesResponse(**args) - - -def unmarshal_ListPipelinesResponse(data: Any) -> ListPipelinesResponse: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'ListPipelinesResponse' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("pipelines", None) - if field is not None: - args["pipelines"] = ( - [unmarshal_Pipeline(v) for v in field] if field is not None else None - ) - - field = data.get("total_count", None) - if field is not None: - args["total_count"] = field - - return ListPipelinesResponse(**args) - - -def unmarshal_ListPipelinesWithStagesResponse( - data: Any, -) -> ListPipelinesWithStagesResponse: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'ListPipelinesWithStagesResponse' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("pipelines", None) - if field is not None: - args["pipelines"] = ( - [unmarshal_PipelineStages(v) for v in field] if field is not None else None - ) - - field = data.get("total_count", None) - if field is not None: - args["total_count"] = field - - return ListPipelinesWithStagesResponse(**args) - - -def unmarshal_ListPlansResponse(data: Any) -> ListPlansResponse: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'ListPlansResponse' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("total_count", None) - if field is not None: - args["total_count"] = field - - field = data.get("plans", None) - if field is not None: - args["plans"] = ( - [unmarshal_PlanDetails(v) for v in field] if field is not None else None - ) - - return ListPlansResponse(**args) - - -def unmarshal_ListPurgeRequestsResponse(data: Any) -> ListPurgeRequestsResponse: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'ListPurgeRequestsResponse' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("purge_requests", None) - if field is not None: - args["purge_requests"] = ( - [unmarshal_PurgeRequest(v) for v in field] if field is not None else None - ) - - field = data.get("total_count", None) - if field is not None: - args["total_count"] = field - - return ListPurgeRequestsResponse(**args) - - -def unmarshal_ListTLSStagesResponse(data: Any) -> ListTLSStagesResponse: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'ListTLSStagesResponse' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("stages", None) - if field is not None: - args["stages"] = ( - [unmarshal_TLSStage(v) for v in field] if field is not None else None - ) - - field = data.get("total_count", None) - if field is not None: - args["total_count"] = field - - return ListTLSStagesResponse(**args) - - -def unmarshal_Plan(data: Any) -> Plan: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'Plan' failed as data isn't a dictionary." - ) - - args: Dict[str, Any] = {} - - field = data.get("plan_name", None) - if field is not None: - args["plan_name"] = field - - return Plan(**args) - - -def marshal_CheckDomainRequest( - request: CheckDomainRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - if request.fqdn is not None: - output["fqdn"] = request.fqdn - - if request.cname is not None: - output["cname"] = request.cname - - if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id - - return output - - -def marshal_ScalewayLb( - request: ScalewayLb, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - if request.id is not None: - output["id"] = request.id - - if request.zone is not None: - output["zone"] = request.zone or defaults.default_zone - - if request.frontend_id is not None: - output["frontend_id"] = request.frontend_id - - if request.is_ssl is not None: - output["is_ssl"] = request.is_ssl - - if request.domain_name is not None: - output["domain_name"] = request.domain_name - - return output - - -def marshal_CheckLbOriginRequest( - request: CheckLbOriginRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - if request.lb is not None: - output["lb"] = marshal_ScalewayLb(request.lb, defaults) - - return output - - -def marshal_CheckPEMChainRequestSecretChain( - request: CheckPEMChainRequestSecretChain, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - if request.secret_id is not None: - output["secret_id"] = request.secret_id - - if request.secret_region is not None: - output["secret_region"] = request.secret_region - - return output - - -def marshal_CheckPEMChainRequest( - request: CheckPEMChainRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - output.update( - resolve_one_of( - [ - OneOfPossibility("secret", request.secret), - OneOfPossibility("raw", request.raw), - ] - ), - ) - - if request.fqdn is not None: - output["fqdn"] = request.fqdn - - if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id - - return output - - -def marshal_ScalewayLbBackendConfig( - request: ScalewayLbBackendConfig, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - if request.lbs is not None: - output["lbs"] = [marshal_ScalewayLb(item, defaults) for item in request.lbs] - - return output - - -def marshal_ScalewayS3BackendConfig( - request: ScalewayS3BackendConfig, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - if request.bucket_name is not None: - output["bucket_name"] = request.bucket_name - - if request.bucket_region is not None: - output["bucket_region"] = request.bucket_region - - if request.is_website is not None: - output["is_website"] = request.is_website - - return output - - -def marshal_CreateBackendStageRequest( - request: CreateBackendStageRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - output.update( - resolve_one_of( - [ - OneOfPossibility("scaleway_s3", request.scaleway_s3), - OneOfPossibility("scaleway_lb", request.scaleway_lb), - ] - ), - ) - - if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id - - return output - - -def marshal_CreateCacheStageRequest( - request: CreateCacheStageRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - output.update( - resolve_one_of( - [ - OneOfPossibility("backend_stage_id", request.backend_stage_id), - ] - ), - ) - - if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id - - if request.fallback_ttl is not None: - output["fallback_ttl"] = request.fallback_ttl - - return output - - -def marshal_CreateDNSStageRequest( - request: CreateDNSStageRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - output.update( - resolve_one_of( - [ - OneOfPossibility("tls_stage_id", request.tls_stage_id), - OneOfPossibility("cache_stage_id", request.cache_stage_id), - OneOfPossibility("backend_stage_id", request.backend_stage_id), - ] - ), - ) - - if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id - - if request.fqdns is not None: - output["fqdns"] = request.fqdns - - return output - - -def marshal_CreatePipelineRequest( - request: CreatePipelineRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - output.update( - resolve_one_of( - [ - OneOfPossibility("dns_stage_id", request.dns_stage_id), - ] - ), - ) - - if request.name is not None: - output["name"] = request.name - - if request.description is not None: - output["description"] = request.description - - if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id - - return output - - -def marshal_CreatePurgeRequestRequest( - request: CreatePurgeRequestRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - output.update( - resolve_one_of( - [ - OneOfPossibility("assets", request.assets), - OneOfPossibility("all", request.all), - ] - ), - ) - - if request.pipeline_id is not None: - output["pipeline_id"] = request.pipeline_id - - return output - - -def marshal_TLSSecret( - request: TLSSecret, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - if request.secret_id is not None: - output["secret_id"] = request.secret_id - - if request.region is not None: - output["region"] = request.region or defaults.default_region - - return output - - -def marshal_CreateTLSStageRequest( - request: CreateTLSStageRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - output.update( - resolve_one_of( - [ - OneOfPossibility("cache_stage_id", request.cache_stage_id), - OneOfPossibility("backend_stage_id", request.backend_stage_id), - ] - ), - ) - - if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id - - if request.secrets is not None: - output["secrets"] = [ - marshal_TLSSecret(item, defaults) for item in request.secrets - ] - - if request.managed_certificate is not None: - output["managed_certificate"] = request.managed_certificate - - return output - - -def marshal_SelectPlanRequest( - request: SelectPlanRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - if request.project_id is not None: - output["project_id"] = request.project_id or defaults.default_project_id - - if request.plan_name is not None: - output["plan_name"] = str(request.plan_name) - - return output - - -def marshal_UpdateBackendStageRequest( - request: UpdateBackendStageRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - output.update( - resolve_one_of( - [ - OneOfPossibility("scaleway_s3", request.scaleway_s3), - OneOfPossibility("scaleway_lb", request.scaleway_lb), - ] - ), - ) - - return output - - -def marshal_UpdateCacheStageRequest( - request: UpdateCacheStageRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - output.update( - resolve_one_of( - [ - OneOfPossibility("backend_stage_id", request.backend_stage_id), - ] - ), - ) - - if request.fallback_ttl is not None: - output["fallback_ttl"] = request.fallback_ttl - - return output - - -def marshal_UpdateDNSStageRequest( - request: UpdateDNSStageRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - output.update( - resolve_one_of( - [ - OneOfPossibility("tls_stage_id", request.tls_stage_id), - OneOfPossibility("cache_stage_id", request.cache_stage_id), - OneOfPossibility("backend_stage_id", request.backend_stage_id), - ] - ), - ) - - if request.fqdns is not None: - output["fqdns"] = request.fqdns - - return output - - -def marshal_UpdatePipelineRequest( - request: UpdatePipelineRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - output.update( - resolve_one_of( - [ - OneOfPossibility("dns_stage_id", request.dns_stage_id), - ] - ), - ) - - if request.name is not None: - output["name"] = request.name - - if request.description is not None: - output["description"] = request.description - - return output - - -def marshal_TLSSecretsConfig( - request: TLSSecretsConfig, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - - if request.tls_secrets is not None: - output["tls_secrets"] = [ - marshal_TLSSecret(item, defaults) for item in request.tls_secrets - ] - - return output - - -def marshal_UpdateTLSStageRequest( - request: UpdateTLSStageRequest, - defaults: ProfileDefaults, -) -> Dict[str, Any]: - output: Dict[str, Any] = {} - output.update( - resolve_one_of( - [ - OneOfPossibility("cache_stage_id", request.cache_stage_id), - OneOfPossibility("backend_stage_id", request.backend_stage_id), - ] - ), - ) - - if request.tls_secrets_config is not None: - output["tls_secrets_config"] = marshal_TLSSecretsConfig( - request.tls_secrets_config, defaults - ) - - if request.managed_certificate is not None: - output["managed_certificate"] = request.managed_certificate - - return output diff --git a/scaleway-async/scaleway_async/edge_services/v1alpha1/types.py b/scaleway-async/scaleway_async/edge_services/v1alpha1/types.py deleted file mode 100644 index a4121656a..000000000 --- a/scaleway-async/scaleway_async/edge_services/v1alpha1/types.py +++ /dev/null @@ -1,1302 +0,0 @@ -# This file was automatically generated. DO NOT EDIT. -# If you have any remark or suggestion do not hesitate to open an issue. -from __future__ import annotations - -from dataclasses import dataclass -from datetime import datetime -from enum import Enum -from typing import Dict, List, Optional - -from scaleway_core.bridge import ( - Money, - Region as ScwRegion, - Zone as ScwZone, -) -from scaleway_core.utils import ( - StrEnumMeta, -) - - -class DNSStageType(str, Enum, metaclass=StrEnumMeta): - UNKNOWN_TYPE = "unknown_type" - AUTO = "auto" - MANAGED = "managed" - CUSTOM = "custom" - - def __str__(self) -> str: - return str(self.value) - - -class LbOriginError(str, Enum, metaclass=StrEnumMeta): - UNKNOWN = "unknown" - TIMEOUT = "timeout" - CONNECTION_REFUSED = "connection_refused" - TLS_ERROR = "tls_error" - - def __str__(self) -> str: - return str(self.value) - - -class ListBackendStagesRequestOrderBy(str, Enum, metaclass=StrEnumMeta): - CREATED_AT_ASC = "created_at_asc" - CREATED_AT_DESC = "created_at_desc" - - def __str__(self) -> str: - return str(self.value) - - -class ListCacheStagesRequestOrderBy(str, Enum, metaclass=StrEnumMeta): - CREATED_AT_ASC = "created_at_asc" - CREATED_AT_DESC = "created_at_desc" - - def __str__(self) -> str: - return str(self.value) - - -class ListDNSStagesRequestOrderBy(str, Enum, metaclass=StrEnumMeta): - CREATED_AT_ASC = "created_at_asc" - CREATED_AT_DESC = "created_at_desc" - - def __str__(self) -> str: - return str(self.value) - - -class ListPipelinesRequestOrderBy(str, Enum, metaclass=StrEnumMeta): - CREATED_AT_ASC = "created_at_asc" - CREATED_AT_DESC = "created_at_desc" - NAME_ASC = "name_asc" - NAME_DESC = "name_desc" - - def __str__(self) -> str: - return str(self.value) - - -class ListPipelinesWithStagesRequestOrderBy(str, Enum, metaclass=StrEnumMeta): - CREATED_AT_ASC = "created_at_asc" - CREATED_AT_DESC = "created_at_desc" - NAME_ASC = "name_asc" - NAME_DESC = "name_desc" - - def __str__(self) -> str: - return str(self.value) - - -class ListPurgeRequestsRequestOrderBy(str, Enum, metaclass=StrEnumMeta): - CREATED_AT_ASC = "created_at_asc" - CREATED_AT_DESC = "created_at_desc" - - def __str__(self) -> str: - return str(self.value) - - -class ListTLSStagesRequestOrderBy(str, Enum, metaclass=StrEnumMeta): - CREATED_AT_ASC = "created_at_asc" - CREATED_AT_DESC = "created_at_desc" - - def __str__(self) -> str: - return str(self.value) - - -class PipelineErrorCode(str, Enum, metaclass=StrEnumMeta): - UNKNOWN_CODE = "unknown_code" - DNS_INVALID_FORMAT = "dns_invalid_format" - DNS_INVALID_TLD = "dns_invalid_tld" - DNS_FORBIDDEN_ROOT_DOMAIN = "dns_forbidden_root_domain" - DNS_FORBIDDEN_SCW_CLOUD = "dns_forbidden_scw_cloud" - DNS_DOMAIN_DONT_EXIST = "dns_domain_dont_exist" - DNS_CNAME_DONT_EXIST = "dns_cname_dont_exist" - DNS_CNAME_RESOLVE = "dns_cname_resolve" - DNS_FQDN_ALREADY_EXISTS = "dns_fqdn_already_exists" - DNS_FQDN_ALREADY_IN_USE = "dns_fqdn_already_in_use" - TLS_CERT_DELETED = "tls_cert_deleted" - TLS_CERT_DISABLED = "tls_cert_disabled" - TLS_CERT_EXPIRED = "tls_cert_expired" - TLS_CERT_INVALID_FORMAT = "tls_cert_invalid_format" - TLS_CERT_MISSING = "tls_cert_missing" - TLS_CHAIN_ORDER = "tls_chain_order" - TLS_KEY_INVALID_FORMAT = "tls_key_invalid_format" - TLS_KEY_MISSING = "tls_key_missing" - TLS_KEY_TOO_MANY = "tls_key_too_many" - TLS_MANAGED_DOMAIN_RATE_LIMIT = "tls_managed_domain_rate_limit" - TLS_MANAGED_INTERNAL = "tls_managed_internal" - TLS_PAIR_MISMATCH = "tls_pair_mismatch" - TLS_ROOT_INCONSISTENT = "tls_root_inconsistent" - TLS_ROOT_INCORRECT = "tls_root_incorrect" - TLS_ROOT_MISSING = "tls_root_missing" - TLS_SAN_MISMATCH = "tls_san_mismatch" - TLS_SELF_SIGNED = "tls_self_signed" - - def __str__(self) -> str: - return str(self.value) - - -class PipelineErrorSeverity(str, Enum, metaclass=StrEnumMeta): - UNKNOWN_SEVERITY = "unknown_severity" - WARNING = "warning" - CRITICAL = "critical" - - def __str__(self) -> str: - return str(self.value) - - -class PipelineErrorStage(str, Enum, metaclass=StrEnumMeta): - UNKNOWN_STAGE = "unknown_stage" - DNS = "dns" - TLS = "tls" - CACHE = "cache" - BACKEND = "backend" - - def __str__(self) -> str: - return str(self.value) - - -class PipelineErrorType(str, Enum, metaclass=StrEnumMeta): - UNKNOWN_TYPE = "unknown_type" - RUNTIME = "runtime" - CONFIG = "config" - - def __str__(self) -> str: - return str(self.value) - - -class PipelineStatus(str, Enum, metaclass=StrEnumMeta): - UNKNOWN_STATUS = "unknown_status" - READY = "ready" - ERROR = "error" - PENDING = "pending" - WARNING = "warning" - - def __str__(self) -> str: - return str(self.value) - - -class PlanName(str, Enum, metaclass=StrEnumMeta): - UNKNOWN_NAME = "unknown_name" - STARTER = "starter" - PROFESSIONAL = "professional" - ADVANCED = "advanced" - - def __str__(self) -> str: - return str(self.value) - - -class PurgeRequestStatus(str, Enum, metaclass=StrEnumMeta): - UNKNOWN_STATUS = "unknown_status" - DONE = "done" - ERROR = "error" - PENDING = "pending" - - def __str__(self) -> str: - return str(self.value) - - -@dataclass -class ScalewayLb: - id: str - """ - ID of the Load Balancer. - """ - - zone: ScwZone - """ - Zone of the Load Balancer. - """ - - frontend_id: str - """ - ID of the frontend linked to the Load Balancer. - """ - - is_ssl: Optional[bool] - """ - Defines whether the Load Balancer's frontend handles SSL connections. - """ - - domain_name: Optional[str] - """ - Fully Qualified Domain Name (in the format subdomain.example.com) to use in HTTP requests sent towards your Load Balancer. - """ - - -@dataclass -class ScalewayLbBackendConfig: - lbs: List[ScalewayLb] - """ - Load Balancer information. - """ - - -@dataclass -class ScalewayS3BackendConfig: - bucket_name: Optional[str] - """ - Name of the Bucket. - """ - - bucket_region: Optional[str] - """ - Region of the Bucket. - """ - - is_website: Optional[bool] - """ - Defines whether the bucket website feature is enabled. - """ - - -@dataclass -class PipelineError: - stage: PipelineErrorStage - - code: PipelineErrorCode - - severity: PipelineErrorSeverity - - message: str - - type_: PipelineErrorType - - -@dataclass -class TLSSecret: - secret_id: str - """ - ID of the Secret. - """ - - region: ScwRegion - """ - Region of the Secret. - """ - - -@dataclass -class BackendStage: - id: str - """ - ID of the backend stage. - """ - - project_id: str - """ - Project ID of the backend stage. - """ - - pipeline_id: Optional[str] - """ - Pipeline ID the backend stage belongs to. - """ - - created_at: Optional[datetime] - """ - Date the backend stage was created. - """ - - updated_at: Optional[datetime] - """ - Date the backend stage was last updated. - """ - - scaleway_s3: Optional[ScalewayS3BackendConfig] - - scaleway_lb: Optional[ScalewayLbBackendConfig] - - -@dataclass -class CacheStage: - id: str - """ - ID of the cache stage. - """ - - project_id: str - """ - Project ID of the cache stage. - """ - - pipeline_id: Optional[str] - """ - Pipeline ID the cache stage belongs to. - """ - - fallback_ttl: Optional[str] - """ - Time To Live (TTL) in seconds. Defines how long content is cached. - """ - - created_at: Optional[datetime] - """ - Date the cache stage was created. - """ - - updated_at: Optional[datetime] - """ - Date the cache stage was last updated. - """ - - backend_stage_id: Optional[str] - - -@dataclass -class DNSStage: - id: str - """ - ID of the DNS stage. - """ - - fqdns: List[str] - """ - List of Fully Qualified Domain Names attached to the stage. - """ - - type_: DNSStageType - """ - Type of the stage. - """ - - project_id: str - """ - Project ID of the DNS stage. - """ - - pipeline_id: Optional[str] - """ - Pipeline ID the DNS stage belongs to. - """ - - created_at: Optional[datetime] - """ - Date the DNS stage was created. - """ - - updated_at: Optional[datetime] - """ - Date the DNS stage was last updated. - """ - - tls_stage_id: Optional[str] - - cache_stage_id: Optional[str] - - backend_stage_id: Optional[str] - - -@dataclass -class Pipeline: - id: str - """ - ID of the pipeline. - """ - - name: str - """ - Name of the pipeline. - """ - - description: str - """ - Description of the pipeline. - """ - - status: PipelineStatus - """ - Status of the pipeline. - """ - - errors: List[PipelineError] - """ - Errors of the pipeline. - """ - - project_id: str - """ - Project ID of the pipeline. - """ - - organization_id: str - """ - Organization ID of the pipeline. - """ - - created_at: Optional[datetime] - """ - Date the pipeline was created. - """ - - updated_at: Optional[datetime] - """ - Date the pipeline was last updated. - """ - - dns_stage_id: Optional[str] - - -@dataclass -class TLSStage: - id: str - """ - ID of the TLS stage. - """ - - secrets: List[TLSSecret] - """ - Secret (from Scaleway Secret Manager) containing your custom certificate. - """ - - managed_certificate: bool - """ - True when Scaleway generates and manages a Let's Encrypt certificate for the TLS stage/custom endpoint. - """ - - project_id: str - """ - Project ID of the TLS stage. - """ - - pipeline_id: Optional[str] - """ - Pipeline ID the TLS stage belongs to. - """ - - certificate_expires_at: Optional[datetime] - """ - Expiration date of the certificate. - """ - - created_at: Optional[datetime] - """ - Date the TLS stage was created. - """ - - updated_at: Optional[datetime] - """ - Date the TLS stage was last updated. - """ - - cache_stage_id: Optional[str] - - backend_stage_id: Optional[str] - - -@dataclass -class CheckPEMChainRequestSecretChain: - secret_id: str - - secret_region: str - - -@dataclass -class PlanDetails: - plan_name: PlanName - """ - Subscription plan name. - """ - - package_gb: int - """ - Amount of egress data from cache included in subscription plan. - """ - - pipeline_limit: int - """ - Number of pipelines included in subscription plan. - """ - - waf_requests: int - """ - Number of WAF requests included in subscription plan. - """ - - -@dataclass -class PlanUsageDetails: - plan_cost: Optional[Money] - """ - Cost to date (this month) for the corresponding Edge Services subscription plan. - """ - - -@dataclass -class PipelineStages: - dns_stages: List[DNSStage] - - tls_stages: List[TLSStage] - - cache_stages: List[CacheStage] - - backend_stages: List[BackendStage] - - pipeline: Optional[Pipeline] - - -@dataclass -class PurgeRequest: - id: str - """ - ID of the purge request. - """ - - pipeline_id: str - """ - Pipeline ID the purge request belongs to. - """ - - status: PurgeRequestStatus - """ - Status of the purge request. - """ - - created_at: Optional[datetime] - """ - Date the purge request was created. - """ - - updated_at: Optional[datetime] - """ - Date the purge request was last updated. - """ - - assets: Optional[List[str]] - - all: Optional[bool] - - -@dataclass -class TLSSecretsConfig: - tls_secrets: List[TLSSecret] - """ - Secret information (from Secret Manager). - """ - - -@dataclass -class CheckDomainRequest: - fqdn: str - - cname: str - - project_id: Optional[str] - - -@dataclass -class CheckDomainResponse: - is_valid: bool - - -@dataclass -class CheckLbOriginRequest: - lb: Optional[ScalewayLb] - - -@dataclass -class CheckLbOriginResponse: - is_valid: bool - - error_type: LbOriginError - - -@dataclass -class CheckPEMChainRequest: - fqdn: str - - project_id: Optional[str] - - secret: Optional[CheckPEMChainRequestSecretChain] - - raw: Optional[str] - - -@dataclass -class CheckPEMChainResponse: - is_valid: bool - - -@dataclass -class CreateBackendStageRequest: - project_id: Optional[str] - """ - Project ID in which the backend stage will be created. - """ - - scaleway_s3: Optional[ScalewayS3BackendConfig] - - scaleway_lb: Optional[ScalewayLbBackendConfig] - - -@dataclass -class CreateCacheStageRequest: - project_id: Optional[str] - """ - Project ID in which the cache stage will be created. - """ - - fallback_ttl: Optional[str] - """ - Time To Live (TTL) in seconds. Defines how long content is cached. - """ - - backend_stage_id: Optional[str] - - -@dataclass -class CreateDNSStageRequest: - project_id: Optional[str] - """ - Project ID in which the DNS stage will be created. - """ - - fqdns: Optional[List[str]] - """ - Fully Qualified Domain Name (in the format subdomain.example.com) to attach to the stage. - """ - - tls_stage_id: Optional[str] - - cache_stage_id: Optional[str] - - backend_stage_id: Optional[str] - - -@dataclass -class CreatePipelineRequest: - name: str - """ - Name of the pipeline. - """ - - description: str - """ - Description of the pipeline. - """ - - project_id: Optional[str] - """ - Project ID in which the pipeline will be created. - """ - - dns_stage_id: Optional[str] - - -@dataclass -class CreatePurgeRequestRequest: - pipeline_id: str - """ - Pipeline ID in which the purge request will be created. - """ - - assets: Optional[List[str]] - - all: Optional[bool] - - -@dataclass -class CreateTLSStageRequest: - project_id: Optional[str] - """ - Project ID in which the TLS stage will be created. - """ - - secrets: Optional[List[TLSSecret]] - """ - Secret (from Scaleway Secret Manager) containing your custom certificate. - """ - - managed_certificate: Optional[bool] - """ - True when Scaleway generates and manages a Let's Encrypt certificate for the TLS stage/custom endpoint. - """ - - cache_stage_id: Optional[str] - - backend_stage_id: Optional[str] - - -@dataclass -class DeleteBackendStageRequest: - backend_stage_id: str - """ - ID of the backend stage to delete. - """ - - -@dataclass -class DeleteCacheStageRequest: - cache_stage_id: str - """ - ID of the cache stage to delete. - """ - - -@dataclass -class DeleteCurrentPlanRequest: - project_id: Optional[str] - - -@dataclass -class DeleteDNSStageRequest: - dns_stage_id: str - """ - ID of the DNS stage to delete. - """ - - -@dataclass -class DeletePipelineRequest: - pipeline_id: str - """ - ID of the pipeline to delete. - """ - - -@dataclass -class DeleteTLSStageRequest: - tls_stage_id: str - """ - ID of the TLS stage to delete. - """ - - -@dataclass -class GetBackendStageRequest: - backend_stage_id: str - """ - ID of the requested backend stage. - """ - - -@dataclass -class GetBillingRequest: - project_id: Optional[str] - - -@dataclass -class GetBillingResponse: - current_plan: Optional[PlanDetails] - """ - Information on the currently-selected, active Edge Services subscription plan. - """ - - pipeline_number: int - """ - Total number of pipelines currently configured. - """ - - current_plan_cache_usage: int - """ - Total amount of data egressed from the cache in gigabytes from the beginning of the month, for the active subscription plan. - """ - - extra_cache_usage: int - """ - Total amount of extra data egressed from cache in gigabytes from the beginning of the month, not included in the subscription plans. - """ - - current_plan_waf_usage: int - """ - Total number of requests processed by the WAF since the beginning of the current month, for the active subscription plan. - """ - - extra_waf_usage: int - """ - Total number of extra requests processed by the WAF from the beginning of the month, not included in the subscription plans. - """ - - plan_cost: Optional[Money] - """ - Cost to date (this month) for Edge Service subscription plans. This comprises the pro-rata cost of the current subscription plan, and any previous subscription plans that were active earlier in the month. - """ - - extra_pipelines_cost: Optional[Money] - """ - Cost to date (this month) of pipelines not included in the subscription plans. - """ - - plans_usage_details: Dict[str, PlanUsageDetails] - """ - Detailed costs and usage for all Edge Services subscription plans that were activated during the month. - """ - - extra_cache_cost: Optional[Money] - """ - Cost to date (this month) of the data egressed from the cache that is not included in the subscription plans. - """ - - extra_waf_cost: Optional[Money] - """ - Cost to date (this month) of the extra requests processed by the WAF that were not included in the subscription plans. - """ - - waf_add_on: Optional[Money] - """ - Cost of activating WAF add-on (where subscription plan does not include WAF). - """ - - total_cost: Optional[Money] - """ - Total cost to date (this month) of all Edge Services resources including active subscription plan, previously active plans, extra pipelines and extra egress cache data. - """ - - -@dataclass -class GetCacheStageRequest: - cache_stage_id: str - """ - ID of the requested cache stage. - """ - - -@dataclass -class GetCurrentPlanRequest: - project_id: Optional[str] - - -@dataclass -class GetDNSStageRequest: - dns_stage_id: str - """ - ID of the requested DNS stage. - """ - - -@dataclass -class GetPipelineRequest: - pipeline_id: str - """ - ID of the requested pipeline. - """ - - -@dataclass -class GetPurgeRequestRequest: - purge_request_id: str - """ - ID of the requested purge request. - """ - - -@dataclass -class GetTLSStageRequest: - tls_stage_id: str - """ - ID of the requested TLS stage. - """ - - -@dataclass -class ListBackendStagesRequest: - order_by: Optional[ListBackendStagesRequestOrderBy] - """ - Sort order of backend stages in the response. - """ - - page: Optional[int] - """ - Page number to return, from the paginated results. - """ - - page_size: Optional[int] - """ - Number of backend stages to return per page. - """ - - pipeline_id: Optional[str] - """ - Pipeline ID to filter for, only backend stages from this pipeline will be returned. - """ - - project_id: Optional[str] - """ - Project ID to filter for, only backend stages from this Project will be returned. - """ - - bucket_name: Optional[str] - """ - Bucket name to filter for, only backend stages from this Bucket will be returned. - """ - - bucket_region: Optional[str] - """ - Bucket region to filter for, only backend stages with buckets in this region will be returned. - """ - - lb_id: Optional[str] - """ - Load Balancer ID to filter for, only backend stages with this Load Balancer will be returned. - """ - - -@dataclass -class ListBackendStagesResponse: - stages: List[BackendStage] - """ - Paginated list of backend stages. - """ - - total_count: int - """ - Count of all backend stages matching the requested criteria. - """ - - -@dataclass -class ListCacheStagesRequest: - order_by: Optional[ListCacheStagesRequestOrderBy] - """ - Sort order of cache stages in the response. - """ - - page: Optional[int] - """ - Page number to return, from the paginated results. - """ - - page_size: Optional[int] - """ - Number of cache stages to return per page. - """ - - pipeline_id: Optional[str] - """ - Pipeline ID to filter for, only cache stages from this pipeline will be returned. - """ - - project_id: Optional[str] - """ - Project ID to filter for, only cache stages from this Project will be returned. - """ - - -@dataclass -class ListCacheStagesResponse: - stages: List[CacheStage] - """ - Paginated list of cache stages. - """ - - total_count: int - """ - Count of all cache stages matching the requested criteria. - """ - - -@dataclass -class ListDNSStagesRequest: - order_by: Optional[ListDNSStagesRequestOrderBy] - """ - Sort order of DNS stages in the response. - """ - - page: Optional[int] - """ - Page number to return, from the paginated results. - """ - - page_size: Optional[int] - """ - Number of DNS stages to return per page. - """ - - pipeline_id: Optional[str] - """ - Pipeline ID to filter for, only DNS stages from this pipeline will be returned. - """ - - project_id: Optional[str] - """ - Project ID to filter for, only DNS stages from this Project will be returned. - """ - - fqdn: Optional[str] - """ - Fully Qualified Domain Name to filter for (in the format subdomain.example.com), only DNS stages with this FQDN will be returned. - """ - - -@dataclass -class ListDNSStagesResponse: - stages: List[DNSStage] - """ - Paginated list of DNS stages. - """ - - total_count: int - """ - Count of all DNS stages matching the requested criteria. - """ - - -@dataclass -class ListPipelinesRequest: - order_by: Optional[ListPipelinesRequestOrderBy] - """ - Sort order of pipelines in the response. - """ - - page: Optional[int] - """ - Page number to return, from the paginated results. - """ - - page_size: Optional[int] - """ - Number of pipelines to return per page. - """ - - name: Optional[str] - """ - Pipeline name to filter for, only pipelines with this string within their name will be returned. - """ - - organization_id: Optional[str] - """ - Organization ID to filter for, only pipelines from this Organization will be returned. - """ - - project_id: Optional[str] - """ - Project ID to filter for, only pipelines from this Project will be returned. - """ - - has_backend_stage_lb: Optional[bool] - """ - Filter on backend stage, only pipelines with a Load Balancer origin will be returned. - """ - - -@dataclass -class ListPipelinesResponse: - pipelines: List[Pipeline] - """ - Paginated list of pipelines. - """ - - total_count: int - """ - Count of all pipelines matching the requested criteria. - """ - - -@dataclass -class ListPipelinesWithStagesRequest: - order_by: Optional[ListPipelinesWithStagesRequestOrderBy] - - page: Optional[int] - - page_size: Optional[int] - - name: Optional[str] - - organization_id: Optional[str] - - project_id: Optional[str] - - -@dataclass -class ListPipelinesWithStagesResponse: - pipelines: List[PipelineStages] - - total_count: int - - -@dataclass -class ListPlansResponse: - total_count: int - - plans: List[PlanDetails] - - -@dataclass -class ListPurgeRequestsRequest: - order_by: Optional[ListPurgeRequestsRequestOrderBy] - """ - Sort order of purge requests in the response. - """ - - page: Optional[int] - """ - Page number to return, from the paginated results. - """ - - page_size: Optional[int] - """ - Number of purge requests to return per page. - """ - - organization_id: Optional[str] - """ - Organization ID to filter for, only purge requests from this Project will be returned. - """ - - project_id: Optional[str] - """ - Project ID to filter for, only purge requests from this Project will be returned. - """ - - pipeline_id: Optional[str] - """ - Pipeline ID to filter for, only purge requests from this pipeline will be returned. - """ - - -@dataclass -class ListPurgeRequestsResponse: - purge_requests: List[PurgeRequest] - """ - Paginated list of purge requests. - """ - - total_count: int - """ - Count of all purge requests matching the requested criteria. - """ - - -@dataclass -class ListTLSStagesRequest: - order_by: Optional[ListTLSStagesRequestOrderBy] - """ - Sort order of TLS stages in the response. - """ - - page: Optional[int] - """ - Page number to return, from the paginated results. - """ - - page_size: Optional[int] - """ - Number of TLS stages to return per page. - """ - - pipeline_id: Optional[str] - """ - Pipeline ID to filter for, only TLS stages from this pipeline will be returned. - """ - - project_id: Optional[str] - """ - Project ID to filter for, only TLS stages from this Project will be returned. - """ - - secret_id: Optional[str] - """ - Secret ID to filter for, only TLS stages with this Secret ID will be returned. - """ - - secret_region: Optional[str] - """ - Secret region to filter for, only TLS stages with a Secret in this region will be returned. - """ - - -@dataclass -class ListTLSStagesResponse: - stages: List[TLSStage] - """ - Paginated list of TLS stages. - """ - - total_count: int - """ - Count of all TLS stages matching the requested criteria. - """ - - -@dataclass -class Plan: - plan_name: PlanName - - -@dataclass -class SelectPlanRequest: - project_id: Optional[str] - - plan_name: Optional[PlanName] - - -@dataclass -class UpdateBackendStageRequest: - backend_stage_id: str - """ - ID of the backend stage to update. - """ - - scaleway_s3: Optional[ScalewayS3BackendConfig] - - scaleway_lb: Optional[ScalewayLbBackendConfig] - - -@dataclass -class UpdateCacheStageRequest: - cache_stage_id: str - """ - ID of the cache stage to update. - """ - - fallback_ttl: Optional[str] - """ - Time To Live (TTL) in seconds. Defines how long content is cached. - """ - - backend_stage_id: Optional[str] - - -@dataclass -class UpdateDNSStageRequest: - dns_stage_id: str - """ - ID of the DNS stage to update. - """ - - fqdns: Optional[List[str]] - """ - Fully Qualified Domain Name (in the format subdomain.example.com) attached to the stage. - """ - - tls_stage_id: Optional[str] - - cache_stage_id: Optional[str] - - backend_stage_id: Optional[str] - - -@dataclass -class UpdatePipelineRequest: - pipeline_id: str - """ - ID of the pipeline to update. - """ - - name: Optional[str] - """ - Name of the pipeline. - """ - - description: Optional[str] - """ - Description of the pipeline. - """ - - dns_stage_id: Optional[str] - - -@dataclass -class UpdateTLSStageRequest: - tls_stage_id: str - """ - ID of the TLS stage to update. - """ - - tls_secrets_config: Optional[TLSSecretsConfig] - """ - Secret (from Scaleway Secret-Manager) containing your custom certificate. - """ - - managed_certificate: Optional[bool] - """ - True when Scaleway generates and manages a Let's Encrypt certificate for the TLS stage/custom endpoint. - """ - - cache_stage_id: Optional[str] - - backend_stage_id: Optional[str] diff --git a/scaleway-async/scaleway_async/inference/v1beta1/__init__.py b/scaleway-async/scaleway_async/inference/v1beta1/__init__.py deleted file mode 100644 index b542f3598..000000000 --- a/scaleway-async/scaleway_async/inference/v1beta1/__init__.py +++ /dev/null @@ -1,89 +0,0 @@ -# This file was automatically generated. DO NOT EDIT. -# If you have any remark or suggestion do not hesitate to open an issue. -from .types import DeploymentStatus -from .content import DEPLOYMENT_TRANSIENT_STATUSES -from .types import ListDeploymentsRequestOrderBy -from .types import ListModelsRequestOrderBy -from .types import NodeTypeStock -from .types import EndpointPrivateNetworkDetails -from .types import EndpointPublicAccessDetails -from .types import EndpointSpecPrivateNetwork -from .types import EndpointSpecPublic -from .types import Endpoint -from .types import ModelS3Model -from .types import ACLRuleRequest -from .types import ACLRule -from .types import EndpointSpec -from .types import Deployment -from .types import Model -from .types import NodeType -from .types import AddDeploymentACLRulesRequest -from .types import AddDeploymentACLRulesResponse -from .types import CreateDeploymentRequest -from .types import CreateEndpointRequest -from .types import DeleteDeploymentACLRuleRequest -from .types import DeleteDeploymentRequest -from .types import DeleteEndpointRequest -from .types import Eula -from .types import GetDeploymentCertificateRequest -from .types import GetDeploymentRequest -from .types import GetModelEulaRequest -from .types import GetModelRequest -from .types import ListDeploymentACLRulesRequest -from .types import ListDeploymentACLRulesResponse -from .types import ListDeploymentsRequest -from .types import ListDeploymentsResponse -from .types import ListModelsRequest -from .types import ListModelsResponse -from .types import ListNodeTypesRequest -from .types import ListNodeTypesResponse -from .types import SetDeploymentACLRulesRequest -from .types import SetDeploymentACLRulesResponse -from .types import UpdateDeploymentRequest -from .types import UpdateEndpointRequest -from .api import InferenceV1Beta1API - -__all__ = [ - "DeploymentStatus", - "DEPLOYMENT_TRANSIENT_STATUSES", - "ListDeploymentsRequestOrderBy", - "ListModelsRequestOrderBy", - "NodeTypeStock", - "EndpointPrivateNetworkDetails", - "EndpointPublicAccessDetails", - "EndpointSpecPrivateNetwork", - "EndpointSpecPublic", - "Endpoint", - "ModelS3Model", - "ACLRuleRequest", - "ACLRule", - "EndpointSpec", - "Deployment", - "Model", - "NodeType", - "AddDeploymentACLRulesRequest", - "AddDeploymentACLRulesResponse", - "CreateDeploymentRequest", - "CreateEndpointRequest", - "DeleteDeploymentACLRuleRequest", - "DeleteDeploymentRequest", - "DeleteEndpointRequest", - "Eula", - "GetDeploymentCertificateRequest", - "GetDeploymentRequest", - "GetModelEulaRequest", - "GetModelRequest", - "ListDeploymentACLRulesRequest", - "ListDeploymentACLRulesResponse", - "ListDeploymentsRequest", - "ListDeploymentsResponse", - "ListModelsRequest", - "ListModelsResponse", - "ListNodeTypesRequest", - "ListNodeTypesResponse", - "SetDeploymentACLRulesRequest", - "SetDeploymentACLRulesResponse", - "UpdateDeploymentRequest", - "UpdateEndpointRequest", - "InferenceV1Beta1API", -] diff --git a/scaleway-async/scaleway_async/inference/v1beta1/api.py b/scaleway-async/scaleway_async/inference/v1beta1/api.py deleted file mode 100644 index c4060f387..000000000 --- a/scaleway-async/scaleway_async/inference/v1beta1/api.py +++ /dev/null @@ -1,988 +0,0 @@ -# This file was automatically generated. DO NOT EDIT. -# If you have any remark or suggestion do not hesitate to open an issue. - -from typing import Awaitable, Optional, Union - -from scaleway_core.api import API -from scaleway_core.bridge import ( - Region as ScwRegion, - ScwFile, - unmarshal_ScwFile, -) -from scaleway_core.utils import ( - WaitForOptions, - random_name, - validate_path_param, - fetch_all_pages_async, - wait_for_resource_async, -) -from .types import ( - ListDeploymentsRequestOrderBy, - ListModelsRequestOrderBy, - ACLRule, - ACLRuleRequest, - AddDeploymentACLRulesRequest, - AddDeploymentACLRulesResponse, - CreateDeploymentRequest, - CreateEndpointRequest, - Deployment, - Endpoint, - EndpointSpec, - Eula, - ListDeploymentACLRulesResponse, - ListDeploymentsResponse, - ListModelsResponse, - ListNodeTypesResponse, - Model, - NodeType, - SetDeploymentACLRulesRequest, - SetDeploymentACLRulesResponse, - UpdateDeploymentRequest, - UpdateEndpointRequest, -) -from .content import ( - DEPLOYMENT_TRANSIENT_STATUSES, -) -from .marshalling import ( - unmarshal_Endpoint, - unmarshal_Deployment, - unmarshal_Model, - unmarshal_AddDeploymentACLRulesResponse, - unmarshal_Eula, - unmarshal_ListDeploymentACLRulesResponse, - unmarshal_ListDeploymentsResponse, - unmarshal_ListModelsResponse, - unmarshal_ListNodeTypesResponse, - unmarshal_SetDeploymentACLRulesResponse, - marshal_AddDeploymentACLRulesRequest, - marshal_CreateDeploymentRequest, - marshal_CreateEndpointRequest, - marshal_SetDeploymentACLRulesRequest, - marshal_UpdateDeploymentRequest, - marshal_UpdateEndpointRequest, -) - - -class InferenceV1Beta1API(API): - """ - This API allows you to manage your Inference services. - """ - - async def list_deployments( - self, - *, - region: Optional[ScwRegion] = None, - page: Optional[int] = None, - page_size: Optional[int] = None, - order_by: Optional[ListDeploymentsRequestOrderBy] = None, - project_id: Optional[str] = None, - organization_id: Optional[str] = None, - name: Optional[str] = None, - tags: Optional[list[str]] = None, - ) -> ListDeploymentsResponse: - """ - List inference deployments. - List all your inference deployments. - :param region: Region to target. If none is passed will use default region from the config. - :param page: Page number to return. - :param page_size: Maximum number of deployments to return per page. - :param order_by: Order in which to return results. - :param project_id: Filter by Project ID. - :param organization_id: Filter by Organization ID. - :param name: Filter by deployment name. - :param tags: Filter by tags. - :return: :class:`ListDeploymentsResponse ` - - Usage: - :: - - result = await api.list_deployments() - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - - res = self._request( - "GET", - f"/inference/v1beta1/regions/{param_region}/deployments", - params={ - "name": name, - "order_by": order_by, - "organization_id": organization_id - or self.client.default_organization_id, - "page": page, - "page_size": page_size or self.client.default_page_size, - "project_id": project_id or self.client.default_project_id, - "tags": tags, - }, - ) - - self._throw_on_error(res) - return unmarshal_ListDeploymentsResponse(res.json()) - - async def list_deployments_all( - self, - *, - region: Optional[ScwRegion] = None, - page: Optional[int] = None, - page_size: Optional[int] = None, - order_by: Optional[ListDeploymentsRequestOrderBy] = None, - project_id: Optional[str] = None, - organization_id: Optional[str] = None, - name: Optional[str] = None, - tags: Optional[list[str]] = None, - ) -> list[Deployment]: - """ - List inference deployments. - List all your inference deployments. - :param region: Region to target. If none is passed will use default region from the config. - :param page: Page number to return. - :param page_size: Maximum number of deployments to return per page. - :param order_by: Order in which to return results. - :param project_id: Filter by Project ID. - :param organization_id: Filter by Organization ID. - :param name: Filter by deployment name. - :param tags: Filter by tags. - :return: :class:`list[Deployment] ` - - Usage: - :: - - result = await api.list_deployments_all() - """ - - return await fetch_all_pages_async( - type=ListDeploymentsResponse, - key="deployments", - fetcher=self.list_deployments, - args={ - "region": region, - "page": page, - "page_size": page_size, - "order_by": order_by, - "project_id": project_id, - "organization_id": organization_id, - "name": name, - "tags": tags, - }, - ) - - async def get_deployment( - self, - *, - deployment_id: str, - region: Optional[ScwRegion] = None, - ) -> Deployment: - """ - Get a deployment. - Get the deployment for the given ID. - :param deployment_id: ID of the deployment to get. - :param region: Region to target. If none is passed will use default region from the config. - :return: :class:`Deployment ` - - Usage: - :: - - result = await api.get_deployment( - deployment_id="example", - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_deployment_id = validate_path_param("deployment_id", deployment_id) - - res = self._request( - "GET", - f"/inference/v1beta1/regions/{param_region}/deployments/{param_deployment_id}", - ) - - self._throw_on_error(res) - return unmarshal_Deployment(res.json()) - - async def wait_for_deployment( - self, - *, - deployment_id: str, - region: Optional[ScwRegion] = None, - options: Optional[ - WaitForOptions[Deployment, Union[bool, Awaitable[bool]]] - ] = None, - ) -> Deployment: - """ - Get a deployment. - Get the deployment for the given ID. - :param deployment_id: ID of the deployment to get. - :param region: Region to target. If none is passed will use default region from the config. - :return: :class:`Deployment ` - - Usage: - :: - - result = await api.get_deployment( - deployment_id="example", - ) - """ - - if not options: - options = WaitForOptions() - - if not options.stop: - options.stop = lambda res: res.status not in DEPLOYMENT_TRANSIENT_STATUSES - - return await wait_for_resource_async( - fetcher=self.get_deployment, - options=options, - args={ - "deployment_id": deployment_id, - "region": region, - }, - ) - - async def create_deployment( - self, - *, - model_name: str, - node_type: str, - endpoints: list[EndpointSpec], - region: Optional[ScwRegion] = None, - name: Optional[str] = None, - project_id: Optional[str] = None, - accept_eula: Optional[bool] = None, - tags: Optional[list[str]] = None, - min_size: Optional[int] = None, - max_size: Optional[int] = None, - ) -> Deployment: - """ - Create a deployment. - Create a new inference deployment related to a specific model. - :param model_name: Name of the model to use. - :param node_type: Name of the node type to use. - :param endpoints: List of endpoints to create. - :param region: Region to target. If none is passed will use default region from the config. - :param name: Name of the deployment. - :param project_id: ID of the Project to create the deployment in. - :param accept_eula: If the model has an EULA, you must accept it before proceeding. - The terms of the EULA can be retrieved using the `GetModelEula` API call. - :param tags: List of tags to apply to the deployment. - :param min_size: Defines the minimum size of the pool. - :param max_size: Defines the maximum size of the pool. - :return: :class:`Deployment ` - - Usage: - :: - - result = await api.create_deployment( - model_name="example", - node_type="example", - endpoints=[], - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - - res = self._request( - "POST", - f"/inference/v1beta1/regions/{param_region}/deployments", - body=marshal_CreateDeploymentRequest( - CreateDeploymentRequest( - model_name=model_name, - node_type=node_type, - endpoints=endpoints, - region=region, - name=name or random_name(prefix="inference"), - project_id=project_id, - accept_eula=accept_eula, - tags=tags, - min_size=min_size, - max_size=max_size, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_Deployment(res.json()) - - async def update_deployment( - self, - *, - deployment_id: str, - region: Optional[ScwRegion] = None, - name: Optional[str] = None, - tags: Optional[list[str]] = None, - min_size: Optional[int] = None, - max_size: Optional[int] = None, - ) -> Deployment: - """ - Update a deployment. - Update an existing inference deployment. - :param deployment_id: ID of the deployment to update. - :param region: Region to target. If none is passed will use default region from the config. - :param name: Name of the deployment. - :param tags: List of tags to apply to the deployment. - :param min_size: Defines the new minimum size of the pool. - :param max_size: Defines the new maximum size of the pool. - :return: :class:`Deployment ` - - Usage: - :: - - result = await api.update_deployment( - deployment_id="example", - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_deployment_id = validate_path_param("deployment_id", deployment_id) - - res = self._request( - "PATCH", - f"/inference/v1beta1/regions/{param_region}/deployments/{param_deployment_id}", - body=marshal_UpdateDeploymentRequest( - UpdateDeploymentRequest( - deployment_id=deployment_id, - region=region, - name=name, - tags=tags, - min_size=min_size, - max_size=max_size, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_Deployment(res.json()) - - async def delete_deployment( - self, - *, - deployment_id: str, - region: Optional[ScwRegion] = None, - ) -> Deployment: - """ - Delete a deployment. - Delete an existing inference deployment. - :param deployment_id: ID of the deployment to delete. - :param region: Region to target. If none is passed will use default region from the config. - :return: :class:`Deployment ` - - Usage: - :: - - result = await api.delete_deployment( - deployment_id="example", - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_deployment_id = validate_path_param("deployment_id", deployment_id) - - res = self._request( - "DELETE", - f"/inference/v1beta1/regions/{param_region}/deployments/{param_deployment_id}", - ) - - self._throw_on_error(res) - return unmarshal_Deployment(res.json()) - - async def get_deployment_certificate( - self, - *, - deployment_id: str, - region: Optional[ScwRegion] = None, - ) -> ScwFile: - """ - Get the CA certificate. - Get the CA certificate used for the deployment of private endpoints. - The CA certificate will be returned as a PEM file. - :param deployment_id: - :param region: Region to target. If none is passed will use default region from the config. - :return: :class:`ScwFile ` - - Usage: - :: - - result = await api.get_deployment_certificate( - deployment_id="example", - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_deployment_id = validate_path_param("deployment_id", deployment_id) - - res = self._request( - "GET", - f"/inference/v1beta1/regions/{param_region}/deployments/{param_deployment_id}/certificate", - ) - - self._throw_on_error(res) - return unmarshal_ScwFile(res.json()) - - async def create_endpoint( - self, - *, - deployment_id: str, - endpoint: EndpointSpec, - region: Optional[ScwRegion] = None, - ) -> Endpoint: - """ - Create an endpoint. - Create a new Endpoint related to a specific deployment. - :param deployment_id: ID of the deployment to create the endpoint for. - :param endpoint: Specification of the endpoint. - :param region: Region to target. If none is passed will use default region from the config. - :return: :class:`Endpoint ` - - Usage: - :: - - result = await api.create_endpoint( - deployment_id="example", - endpoint=EndpointSpec(), - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - - res = self._request( - "POST", - f"/inference/v1beta1/regions/{param_region}/endpoints", - body=marshal_CreateEndpointRequest( - CreateEndpointRequest( - deployment_id=deployment_id, - endpoint=endpoint, - region=region, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_Endpoint(res.json()) - - async def update_endpoint( - self, - *, - endpoint_id: str, - region: Optional[ScwRegion] = None, - disable_auth: Optional[bool] = None, - ) -> Endpoint: - """ - Update an endpoint. - Update an existing Endpoint. - :param endpoint_id: ID of the endpoint to update. - :param region: Region to target. If none is passed will use default region from the config. - :param disable_auth: By default, deployments are protected by IAM authentication. - When setting this field to true, the authentication will be disabled. - :return: :class:`Endpoint ` - - Usage: - :: - - result = await api.update_endpoint( - endpoint_id="example", - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_endpoint_id = validate_path_param("endpoint_id", endpoint_id) - - res = self._request( - "PATCH", - f"/inference/v1beta1/regions/{param_region}/endpoints/{param_endpoint_id}", - body=marshal_UpdateEndpointRequest( - UpdateEndpointRequest( - endpoint_id=endpoint_id, - region=region, - disable_auth=disable_auth, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_Endpoint(res.json()) - - async def delete_endpoint( - self, - *, - endpoint_id: str, - region: Optional[ScwRegion] = None, - ) -> None: - """ - Delete an endpoint. - Delete an existing Endpoint. - :param endpoint_id: ID of the endpoint to delete. - :param region: Region to target. If none is passed will use default region from the config. - - Usage: - :: - - result = await api.delete_endpoint( - endpoint_id="example", - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_endpoint_id = validate_path_param("endpoint_id", endpoint_id) - - res = self._request( - "DELETE", - f"/inference/v1beta1/regions/{param_region}/endpoints/{param_endpoint_id}", - ) - - self._throw_on_error(res) - - async def list_deployment_acl_rules( - self, - *, - deployment_id: str, - region: Optional[ScwRegion] = None, - page: Optional[int] = None, - page_size: Optional[int] = None, - ) -> ListDeploymentACLRulesResponse: - """ - List your ACLs. - List ACLs for a specific deployment. - :param deployment_id: ID of the deployment to list ACL rules for. - :param region: Region to target. If none is passed will use default region from the config. - :param page: Page number to return. - :param page_size: Maximum number of ACL rules to return per page. - :return: :class:`ListDeploymentACLRulesResponse ` - - Usage: - :: - - result = await api.list_deployment_acl_rules( - deployment_id="example", - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_deployment_id = validate_path_param("deployment_id", deployment_id) - - res = self._request( - "GET", - f"/inference/v1beta1/regions/{param_region}/deployments/{param_deployment_id}/acls", - params={ - "page": page, - "page_size": page_size or self.client.default_page_size, - }, - ) - - self._throw_on_error(res) - return unmarshal_ListDeploymentACLRulesResponse(res.json()) - - async def list_deployment_acl_rules_all( - self, - *, - deployment_id: str, - region: Optional[ScwRegion] = None, - page: Optional[int] = None, - page_size: Optional[int] = None, - ) -> list[ACLRule]: - """ - List your ACLs. - List ACLs for a specific deployment. - :param deployment_id: ID of the deployment to list ACL rules for. - :param region: Region to target. If none is passed will use default region from the config. - :param page: Page number to return. - :param page_size: Maximum number of ACL rules to return per page. - :return: :class:`list[ACLRule] ` - - Usage: - :: - - result = await api.list_deployment_acl_rules_all( - deployment_id="example", - ) - """ - - return await fetch_all_pages_async( - type=ListDeploymentACLRulesResponse, - key="rules", - fetcher=self.list_deployment_acl_rules, - args={ - "deployment_id": deployment_id, - "region": region, - "page": page, - "page_size": page_size, - }, - ) - - async def add_deployment_acl_rules( - self, - *, - deployment_id: str, - region: Optional[ScwRegion] = None, - acls: Optional[list[ACLRuleRequest]] = None, - ) -> AddDeploymentACLRulesResponse: - """ - Add new ACLs. - Add new ACL rules for a specific deployment. - :param deployment_id: ID of the deployment to add ACL rules to. - :param region: Region to target. If none is passed will use default region from the config. - :param acls: List of ACL rules to add. - :return: :class:`AddDeploymentACLRulesResponse ` - - Usage: - :: - - result = await api.add_deployment_acl_rules( - deployment_id="example", - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_deployment_id = validate_path_param("deployment_id", deployment_id) - - res = self._request( - "POST", - f"/inference/v1beta1/regions/{param_region}/deployments/{param_deployment_id}/acls", - body=marshal_AddDeploymentACLRulesRequest( - AddDeploymentACLRulesRequest( - deployment_id=deployment_id, - region=region, - acls=acls, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_AddDeploymentACLRulesResponse(res.json()) - - async def set_deployment_acl_rules( - self, - *, - deployment_id: str, - region: Optional[ScwRegion] = None, - acls: Optional[list[ACLRuleRequest]] = None, - ) -> SetDeploymentACLRulesResponse: - """ - Set new ACL. - Set new ACL rules for a specific deployment. - :param deployment_id: ID of the deployment to set ACL rules for. - :param region: Region to target. If none is passed will use default region from the config. - :param acls: All existing ACL rules will be replaced by the new ones. - :return: :class:`SetDeploymentACLRulesResponse ` - - Usage: - :: - - result = await api.set_deployment_acl_rules( - deployment_id="example", - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_deployment_id = validate_path_param("deployment_id", deployment_id) - - res = self._request( - "PUT", - f"/inference/v1beta1/regions/{param_region}/deployments/{param_deployment_id}/acls", - body=marshal_SetDeploymentACLRulesRequest( - SetDeploymentACLRulesRequest( - deployment_id=deployment_id, - region=region, - acls=acls, - ), - self.client, - ), - ) - - self._throw_on_error(res) - return unmarshal_SetDeploymentACLRulesResponse(res.json()) - - async def delete_deployment_acl_rule( - self, - *, - acl_id: str, - region: Optional[ScwRegion] = None, - ) -> None: - """ - Delete an existing ACL. - :param acl_id: ID of the ACL rule to delete. - :param region: Region to target. If none is passed will use default region from the config. - - Usage: - :: - - result = await api.delete_deployment_acl_rule( - acl_id="example", - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_acl_id = validate_path_param("acl_id", acl_id) - - res = self._request( - "DELETE", - f"/inference/v1beta1/regions/{param_region}/acls/{param_acl_id}", - ) - - self._throw_on_error(res) - - async def list_models( - self, - *, - region: Optional[ScwRegion] = None, - order_by: Optional[ListModelsRequestOrderBy] = None, - page: Optional[int] = None, - page_size: Optional[int] = None, - project_id: Optional[str] = None, - name: Optional[str] = None, - tags: Optional[list[str]] = None, - ) -> ListModelsResponse: - """ - List models. - List all available models. - :param region: Region to target. If none is passed will use default region from the config. - :param order_by: Order in which to return results. - :param page: Page number to return. - :param page_size: Maximum number of models to return per page. - :param project_id: Filter by Project ID. - :param name: Filter by model name. - :param tags: Filter by tags. - :return: :class:`ListModelsResponse ` - - Usage: - :: - - result = await api.list_models() - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - - res = self._request( - "GET", - f"/inference/v1beta1/regions/{param_region}/models", - params={ - "name": name, - "order_by": order_by, - "page": page, - "page_size": page_size or self.client.default_page_size, - "project_id": project_id or self.client.default_project_id, - "tags": tags, - }, - ) - - self._throw_on_error(res) - return unmarshal_ListModelsResponse(res.json()) - - async def list_models_all( - self, - *, - region: Optional[ScwRegion] = None, - order_by: Optional[ListModelsRequestOrderBy] = None, - page: Optional[int] = None, - page_size: Optional[int] = None, - project_id: Optional[str] = None, - name: Optional[str] = None, - tags: Optional[list[str]] = None, - ) -> list[Model]: - """ - List models. - List all available models. - :param region: Region to target. If none is passed will use default region from the config. - :param order_by: Order in which to return results. - :param page: Page number to return. - :param page_size: Maximum number of models to return per page. - :param project_id: Filter by Project ID. - :param name: Filter by model name. - :param tags: Filter by tags. - :return: :class:`list[Model] ` - - Usage: - :: - - result = await api.list_models_all() - """ - - return await fetch_all_pages_async( - type=ListModelsResponse, - key="models", - fetcher=self.list_models, - args={ - "region": region, - "order_by": order_by, - "page": page, - "page_size": page_size, - "project_id": project_id, - "name": name, - "tags": tags, - }, - ) - - async def get_model( - self, - *, - model_id: str, - region: Optional[ScwRegion] = None, - ) -> Model: - """ - Get a model. - Get the model for the given ID. - :param model_id: ID of the model to get. - :param region: Region to target. If none is passed will use default region from the config. - :return: :class:`Model ` - - Usage: - :: - - result = await api.get_model( - model_id="example", - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_model_id = validate_path_param("model_id", model_id) - - res = self._request( - "GET", - f"/inference/v1beta1/regions/{param_region}/models/{param_model_id}", - ) - - self._throw_on_error(res) - return unmarshal_Model(res.json()) - - async def get_model_eula( - self, - *, - model_id: str, - region: Optional[ScwRegion] = None, - ) -> Eula: - """ - :param model_id: - :param region: Region to target. If none is passed will use default region from the config. - :return: :class:`Eula ` - - Usage: - :: - - result = await api.get_model_eula( - model_id="example", - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - param_model_id = validate_path_param("model_id", model_id) - - res = self._request( - "GET", - f"/inference/v1beta1/regions/{param_region}/models/{param_model_id}/eula", - ) - - self._throw_on_error(res) - return unmarshal_Eula(res.json()) - - async def list_node_types( - self, - *, - include_disabled_types: bool, - region: Optional[ScwRegion] = None, - page: Optional[int] = None, - page_size: Optional[int] = None, - ) -> ListNodeTypesResponse: - """ - List available node types. - List all available node types. By default, the node types returned in the list are ordered by creation date in ascending order, though this can be modified via the `order_by` field. - :param include_disabled_types: Include disabled node types in the response. - :param region: Region to target. If none is passed will use default region from the config. - :param page: Page number to return. - :param page_size: Maximum number of node types to return per page. - :return: :class:`ListNodeTypesResponse ` - - Usage: - :: - - result = await api.list_node_types( - include_disabled_types=False, - ) - """ - - param_region = validate_path_param( - "region", region or self.client.default_region - ) - - res = self._request( - "GET", - f"/inference/v1beta1/regions/{param_region}/node-types", - params={ - "include_disabled_types": include_disabled_types, - "page": page, - "page_size": page_size or self.client.default_page_size, - }, - ) - - self._throw_on_error(res) - return unmarshal_ListNodeTypesResponse(res.json()) - - async def list_node_types_all( - self, - *, - include_disabled_types: bool, - region: Optional[ScwRegion] = None, - page: Optional[int] = None, - page_size: Optional[int] = None, - ) -> list[NodeType]: - """ - List available node types. - List all available node types. By default, the node types returned in the list are ordered by creation date in ascending order, though this can be modified via the `order_by` field. - :param include_disabled_types: Include disabled node types in the response. - :param region: Region to target. If none is passed will use default region from the config. - :param page: Page number to return. - :param page_size: Maximum number of node types to return per page. - :return: :class:`list[NodeType] ` - - Usage: - :: - - result = await api.list_node_types_all( - include_disabled_types=False, - ) - """ - - return await fetch_all_pages_async( - type=ListNodeTypesResponse, - key="node_types", - fetcher=self.list_node_types, - args={ - "include_disabled_types": include_disabled_types, - "region": region, - "page": page, - "page_size": page_size, - }, - ) diff --git a/scaleway-async/scaleway_async/inference/v1beta1/content.py b/scaleway-async/scaleway_async/inference/v1beta1/content.py deleted file mode 100644 index 23a1e6ec0..000000000 --- a/scaleway-async/scaleway_async/inference/v1beta1/content.py +++ /dev/null @@ -1,16 +0,0 @@ -# This file was automatically generated. DO NOT EDIT. -# If you have any remark or suggestion do not hesitate to open an issue. - -from .types import ( - DeploymentStatus, -) - -DEPLOYMENT_TRANSIENT_STATUSES: list[DeploymentStatus] = [ - DeploymentStatus.CREATING, - DeploymentStatus.DEPLOYING, - DeploymentStatus.DELETING, - DeploymentStatus.SCALING, -] -""" -Lists transient statutes of the enum :class:`DeploymentStatus `. -""" diff --git a/scaleway-async/scaleway_async/inference/v1beta1/marshalling.py b/scaleway-async/scaleway_async/inference/v1beta1/marshalling.py deleted file mode 100644 index 95c41875b..000000000 --- a/scaleway-async/scaleway_async/inference/v1beta1/marshalling.py +++ /dev/null @@ -1,797 +0,0 @@ -# This file was automatically generated. DO NOT EDIT. -# If you have any remark or suggestion do not hesitate to open an issue. - -from typing import Any -from dateutil import parser - -from scaleway_core.profile import ProfileDefaults -from scaleway_core.utils import ( - OneOfPossibility, - resolve_one_of, -) -from .types import ( - DeploymentStatus, - NodeTypeStock, - EndpointPrivateNetworkDetails, - EndpointPublicAccessDetails, - Endpoint, - Deployment, - ModelS3Model, - Model, - ACLRule, - AddDeploymentACLRulesResponse, - Eula, - ListDeploymentACLRulesResponse, - ListDeploymentsResponse, - ListModelsResponse, - NodeType, - ListNodeTypesResponse, - SetDeploymentACLRulesResponse, - ACLRuleRequest, - AddDeploymentACLRulesRequest, - EndpointSpecPrivateNetwork, - EndpointSpecPublic, - EndpointSpec, - CreateDeploymentRequest, - CreateEndpointRequest, - SetDeploymentACLRulesRequest, - UpdateDeploymentRequest, - UpdateEndpointRequest, -) - - -def unmarshal_EndpointPrivateNetworkDetails(data: Any) -> EndpointPrivateNetworkDetails: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'EndpointPrivateNetworkDetails' failed as data isn't a dictionary." - ) - - args: dict[str, Any] = {} - - field = data.get("private_network_id", None) - if field is not None: - args["private_network_id"] = field - else: - args["private_network_id"] = None - - return EndpointPrivateNetworkDetails(**args) - - -def unmarshal_EndpointPublicAccessDetails(data: Any) -> EndpointPublicAccessDetails: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'EndpointPublicAccessDetails' failed as data isn't a dictionary." - ) - - args: dict[str, Any] = {} - - return EndpointPublicAccessDetails(**args) - - -def unmarshal_Endpoint(data: Any) -> Endpoint: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'Endpoint' failed as data isn't a dictionary." - ) - - args: dict[str, Any] = {} - - field = data.get("id", None) - if field is not None: - args["id"] = field - else: - args["id"] = None - - field = data.get("url", None) - if field is not None: - args["url"] = field - else: - args["url"] = None - - field = data.get("disable_auth", None) - if field is not None: - args["disable_auth"] = field - else: - args["disable_auth"] = False - - field = data.get("public_access", None) - if field is not None: - args["public_access"] = unmarshal_EndpointPublicAccessDetails(field) - else: - args["public_access"] = None - - field = data.get("private_network", None) - if field is not None: - args["private_network"] = unmarshal_EndpointPrivateNetworkDetails(field) - else: - args["private_network"] = None - - return Endpoint(**args) - - -def unmarshal_Deployment(data: Any) -> Deployment: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'Deployment' failed as data isn't a dictionary." - ) - - args: dict[str, Any] = {} - - field = data.get("id", None) - if field is not None: - args["id"] = field - else: - args["id"] = None - - field = data.get("name", None) - if field is not None: - args["name"] = field - else: - args["name"] = None - - field = data.get("project_id", None) - if field is not None: - args["project_id"] = field - else: - args["project_id"] = None - - field = data.get("status", None) - if field is not None: - args["status"] = field - else: - args["status"] = DeploymentStatus.UNKNOWN_STATUS - - field = data.get("tags", None) - if field is not None: - args["tags"] = field - else: - args["tags"] = [] - - field = data.get("node_type", None) - if field is not None: - args["node_type"] = field - else: - args["node_type"] = None - - field = data.get("endpoints", None) - if field is not None: - args["endpoints"] = ( - [unmarshal_Endpoint(v) for v in field] if field is not None else None - ) - else: - args["endpoints"] = [] - - field = data.get("size", None) - if field is not None: - args["size"] = field - else: - args["size"] = 0 - - field = data.get("min_size", None) - if field is not None: - args["min_size"] = field - else: - args["min_size"] = 0 - - field = data.get("max_size", None) - if field is not None: - args["max_size"] = field - else: - args["max_size"] = 0 - - field = data.get("model_name", None) - if field is not None: - args["model_name"] = field - else: - args["model_name"] = None - - field = data.get("model_id", None) - if field is not None: - args["model_id"] = field - else: - args["model_id"] = None - - field = data.get("region", None) - if field is not None: - args["region"] = field - else: - args["region"] = None - - field = data.get("error_message", None) - if field is not None: - args["error_message"] = field - else: - args["error_message"] = None - - field = data.get("created_at", None) - if field is not None: - args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["created_at"] = None - - field = data.get("updated_at", None) - if field is not None: - args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["updated_at"] = None - - return Deployment(**args) - - -def unmarshal_ModelS3Model(data: Any) -> ModelS3Model: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'ModelS3Model' failed as data isn't a dictionary." - ) - - args: dict[str, Any] = {} - - field = data.get("s3_url", None) - if field is not None: - args["s3_url"] = field - else: - args["s3_url"] = None - - field = data.get("python_dependencies", None) - if field is not None: - args["python_dependencies"] = field - else: - args["python_dependencies"] = None - - field = data.get("node_type", None) - if field is not None: - args["node_type"] = field - else: - args["node_type"] = None - - field = data.get("triton_server_version", None) - if field is not None: - args["triton_server_version"] = field - else: - args["triton_server_version"] = None - - return ModelS3Model(**args) - - -def unmarshal_Model(data: Any) -> Model: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'Model' failed as data isn't a dictionary." - ) - - args: dict[str, Any] = {} - - field = data.get("id", None) - if field is not None: - args["id"] = field - else: - args["id"] = None - - field = data.get("name", None) - if field is not None: - args["name"] = field - else: - args["name"] = None - - field = data.get("project_id", None) - if field is not None: - args["project_id"] = field - else: - args["project_id"] = None - - field = data.get("provider", None) - if field is not None: - args["provider"] = field - else: - args["provider"] = None - - field = data.get("tags", None) - if field is not None: - args["tags"] = field - else: - args["tags"] = [] - - field = data.get("description", None) - if field is not None: - args["description"] = field - else: - args["description"] = None - - field = data.get("has_eula", None) - if field is not None: - args["has_eula"] = field - else: - args["has_eula"] = False - - field = data.get("region", None) - if field is not None: - args["region"] = field - else: - args["region"] = None - - field = data.get("is_public", None) - if field is not None: - args["is_public"] = field - else: - args["is_public"] = False - - field = data.get("compatible_node_types", None) - if field is not None: - args["compatible_node_types"] = field - else: - args["compatible_node_types"] = [] - - field = data.get("quantization_level", None) - if field is not None: - args["quantization_level"] = field - else: - args["quantization_level"] = None - - field = data.get("created_at", None) - if field is not None: - args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["created_at"] = None - - field = data.get("updated_at", None) - if field is not None: - args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["updated_at"] = None - - field = data.get("s3_model", None) - if field is not None: - args["s3_model"] = unmarshal_ModelS3Model(field) - else: - args["s3_model"] = None - - return Model(**args) - - -def unmarshal_ACLRule(data: Any) -> ACLRule: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'ACLRule' failed as data isn't a dictionary." - ) - - args: dict[str, Any] = {} - - field = data.get("id", None) - if field is not None: - args["id"] = field - else: - args["id"] = None - - field = data.get("ip", None) - if field is not None: - args["ip"] = field - else: - args["ip"] = None - - field = data.get("description", None) - if field is not None: - args["description"] = field - else: - args["description"] = None - - return ACLRule(**args) - - -def unmarshal_AddDeploymentACLRulesResponse(data: Any) -> AddDeploymentACLRulesResponse: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'AddDeploymentACLRulesResponse' failed as data isn't a dictionary." - ) - - args: dict[str, Any] = {} - - field = data.get("rules", None) - if field is not None: - args["rules"] = ( - [unmarshal_ACLRule(v) for v in field] if field is not None else None - ) - else: - args["rules"] = [] - - return AddDeploymentACLRulesResponse(**args) - - -def unmarshal_Eula(data: Any) -> Eula: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'Eula' failed as data isn't a dictionary." - ) - - args: dict[str, Any] = {} - - field = data.get("content", None) - if field is not None: - args["content"] = field - else: - args["content"] = None - - return Eula(**args) - - -def unmarshal_ListDeploymentACLRulesResponse( - data: Any, -) -> ListDeploymentACLRulesResponse: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'ListDeploymentACLRulesResponse' failed as data isn't a dictionary." - ) - - args: dict[str, Any] = {} - - field = data.get("rules", None) - if field is not None: - args["rules"] = ( - [unmarshal_ACLRule(v) for v in field] if field is not None else None - ) - else: - args["rules"] = [] - - field = data.get("total_count", None) - if field is not None: - args["total_count"] = field - else: - args["total_count"] = 0 - - return ListDeploymentACLRulesResponse(**args) - - -def unmarshal_ListDeploymentsResponse(data: Any) -> ListDeploymentsResponse: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'ListDeploymentsResponse' failed as data isn't a dictionary." - ) - - args: dict[str, Any] = {} - - field = data.get("deployments", None) - if field is not None: - args["deployments"] = ( - [unmarshal_Deployment(v) for v in field] if field is not None else None - ) - else: - args["deployments"] = [] - - field = data.get("total_count", None) - if field is not None: - args["total_count"] = field - else: - args["total_count"] = 0 - - return ListDeploymentsResponse(**args) - - -def unmarshal_ListModelsResponse(data: Any) -> ListModelsResponse: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'ListModelsResponse' failed as data isn't a dictionary." - ) - - args: dict[str, Any] = {} - - field = data.get("models", None) - if field is not None: - args["models"] = ( - [unmarshal_Model(v) for v in field] if field is not None else None - ) - else: - args["models"] = [] - - field = data.get("total_count", None) - if field is not None: - args["total_count"] = field - else: - args["total_count"] = 0 - - return ListModelsResponse(**args) - - -def unmarshal_NodeType(data: Any) -> NodeType: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'NodeType' failed as data isn't a dictionary." - ) - - args: dict[str, Any] = {} - - field = data.get("name", None) - if field is not None: - args["name"] = field - else: - args["name"] = None - - field = data.get("stock_status", None) - if field is not None: - args["stock_status"] = field - else: - args["stock_status"] = NodeTypeStock.UNKNOWN_STOCK - - field = data.get("description", None) - if field is not None: - args["description"] = field - else: - args["description"] = None - - field = data.get("vcpus", None) - if field is not None: - args["vcpus"] = field - else: - args["vcpus"] = 0 - - field = data.get("memory", None) - if field is not None: - args["memory"] = field - else: - args["memory"] = 0 - - field = data.get("vram", None) - if field is not None: - args["vram"] = field - else: - args["vram"] = 0 - - field = data.get("disabled", None) - if field is not None: - args["disabled"] = field - else: - args["disabled"] = False - - field = data.get("beta", None) - if field is not None: - args["beta"] = field - else: - args["beta"] = False - - field = data.get("gpus", None) - if field is not None: - args["gpus"] = field - else: - args["gpus"] = 0 - - field = data.get("region", None) - if field is not None: - args["region"] = field - else: - args["region"] = None - - field = data.get("created_at", None) - if field is not None: - args["created_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["created_at"] = None - - field = data.get("updated_at", None) - if field is not None: - args["updated_at"] = parser.isoparse(field) if isinstance(field, str) else field - else: - args["updated_at"] = None - - return NodeType(**args) - - -def unmarshal_ListNodeTypesResponse(data: Any) -> ListNodeTypesResponse: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'ListNodeTypesResponse' failed as data isn't a dictionary." - ) - - args: dict[str, Any] = {} - - field = data.get("node_types", None) - if field is not None: - args["node_types"] = ( - [unmarshal_NodeType(v) for v in field] if field is not None else None - ) - else: - args["node_types"] = [] - - field = data.get("total_count", None) - if field is not None: - args["total_count"] = field - else: - args["total_count"] = 0 - - return ListNodeTypesResponse(**args) - - -def unmarshal_SetDeploymentACLRulesResponse(data: Any) -> SetDeploymentACLRulesResponse: - if not isinstance(data, dict): - raise TypeError( - "Unmarshalling the type 'SetDeploymentACLRulesResponse' failed as data isn't a dictionary." - ) - - args: dict[str, Any] = {} - - field = data.get("rules", None) - if field is not None: - args["rules"] = ( - [unmarshal_ACLRule(v) for v in field] if field is not None else None - ) - else: - args["rules"] = [] - - return SetDeploymentACLRulesResponse(**args) - - -def marshal_ACLRuleRequest( - request: ACLRuleRequest, - defaults: ProfileDefaults, -) -> dict[str, Any]: - output: dict[str, Any] = {} - - if request.ip is not None: - output["ip"] = request.ip - - if request.description is not None: - output["description"] = request.description - - return output - - -def marshal_AddDeploymentACLRulesRequest( - request: AddDeploymentACLRulesRequest, - defaults: ProfileDefaults, -) -> dict[str, Any]: - output: dict[str, Any] = {} - - if request.acls is not None: - output["acls"] = [ - marshal_ACLRuleRequest(item, defaults) for item in request.acls - ] - - return output - - -def marshal_EndpointSpecPrivateNetwork( - request: EndpointSpecPrivateNetwork, - defaults: ProfileDefaults, -) -> dict[str, Any]: - output: dict[str, Any] = {} - - if request.private_network_id is not None: - output["private_network_id"] = request.private_network_id - - return output - - -def marshal_EndpointSpecPublic( - request: EndpointSpecPublic, - defaults: ProfileDefaults, -) -> dict[str, Any]: - output: dict[str, Any] = {} - - return output - - -def marshal_EndpointSpec( - request: EndpointSpec, - defaults: ProfileDefaults, -) -> dict[str, Any]: - output: dict[str, Any] = {} - output.update( - resolve_one_of( - [ - OneOfPossibility( - param="public", - value=request.public, - marshal_func=marshal_EndpointSpecPublic, - ), - OneOfPossibility( - param="private_network", - value=request.private_network, - marshal_func=marshal_EndpointSpecPrivateNetwork, - ), - ] - ), - ) - - if request.disable_auth is not None: - output["disable_auth"] = request.disable_auth - - return output - - -def marshal_CreateDeploymentRequest( - request: CreateDeploymentRequest, - defaults: ProfileDefaults, -) -> dict[str, Any]: - output: dict[str, Any] = {} - - if request.model_name is not None: - output["model_name"] = request.model_name - - if request.node_type is not None: - output["node_type"] = request.node_type - - if request.endpoints is not None: - output["endpoints"] = [ - marshal_EndpointSpec(item, defaults) for item in request.endpoints - ] - - if request.name is not None: - output["name"] = request.name - - if request.project_id is not None: - output["project_id"] = request.project_id - else: - output["project_id"] = defaults.default_project_id - - if request.accept_eula is not None: - output["accept_eula"] = request.accept_eula - - if request.tags is not None: - output["tags"] = request.tags - - if request.min_size is not None: - output["min_size"] = request.min_size - - if request.max_size is not None: - output["max_size"] = request.max_size - - return output - - -def marshal_CreateEndpointRequest( - request: CreateEndpointRequest, - defaults: ProfileDefaults, -) -> dict[str, Any]: - output: dict[str, Any] = {} - - if request.deployment_id is not None: - output["deployment_id"] = request.deployment_id - - if request.endpoint is not None: - output["endpoint"] = marshal_EndpointSpec(request.endpoint, defaults) - - return output - - -def marshal_SetDeploymentACLRulesRequest( - request: SetDeploymentACLRulesRequest, - defaults: ProfileDefaults, -) -> dict[str, Any]: - output: dict[str, Any] = {} - - if request.acls is not None: - output["acls"] = [ - marshal_ACLRuleRequest(item, defaults) for item in request.acls - ] - - return output - - -def marshal_UpdateDeploymentRequest( - request: UpdateDeploymentRequest, - defaults: ProfileDefaults, -) -> dict[str, Any]: - output: dict[str, Any] = {} - - if request.name is not None: - output["name"] = request.name - - if request.tags is not None: - output["tags"] = request.tags - - if request.min_size is not None: - output["min_size"] = request.min_size - - if request.max_size is not None: - output["max_size"] = request.max_size - - return output - - -def marshal_UpdateEndpointRequest( - request: UpdateEndpointRequest, - defaults: ProfileDefaults, -) -> dict[str, Any]: - output: dict[str, Any] = {} - - if request.disable_auth is not None: - output["disable_auth"] = request.disable_auth - - return output diff --git a/scaleway-async/scaleway_async/inference/v1beta1/types.py b/scaleway-async/scaleway_async/inference/v1beta1/types.py deleted file mode 100644 index fdcc315ef..000000000 --- a/scaleway-async/scaleway_async/inference/v1beta1/types.py +++ /dev/null @@ -1,828 +0,0 @@ -# This file was automatically generated. DO NOT EDIT. -# If you have any remark or suggestion do not hesitate to open an issue. -from __future__ import annotations - -from dataclasses import dataclass, field -from datetime import datetime -from enum import Enum -from typing import Optional - -from scaleway_core.bridge import ( - Region as ScwRegion, -) -from scaleway_core.utils import ( - StrEnumMeta, -) - - -class DeploymentStatus(str, Enum, metaclass=StrEnumMeta): - UNKNOWN_STATUS = "unknown_status" - CREATING = "creating" - DEPLOYING = "deploying" - READY = "ready" - ERROR = "error" - DELETING = "deleting" - LOCKED = "locked" - SCALING = "scaling" - - def __str__(self) -> str: - return str(self.value) - - -class ListDeploymentsRequestOrderBy(str, Enum, metaclass=StrEnumMeta): - CREATED_AT_DESC = "created_at_desc" - CREATED_AT_ASC = "created_at_asc" - NAME_ASC = "name_asc" - NAME_DESC = "name_desc" - - def __str__(self) -> str: - return str(self.value) - - -class ListModelsRequestOrderBy(str, Enum, metaclass=StrEnumMeta): - DISPLAY_RANK_ASC = "display_rank_asc" - CREATED_AT_ASC = "created_at_asc" - CREATED_AT_DESC = "created_at_desc" - NAME_ASC = "name_asc" - NAME_DESC = "name_desc" - - def __str__(self) -> str: - return str(self.value) - - -class NodeTypeStock(str, Enum, metaclass=StrEnumMeta): - UNKNOWN_STOCK = "unknown_stock" - LOW_STOCK = "low_stock" - OUT_OF_STOCK = "out_of_stock" - AVAILABLE = "available" - - def __str__(self) -> str: - return str(self.value) - - -@dataclass -class EndpointPrivateNetworkDetails: - private_network_id: str - """ - ID of the Private Network. - """ - - -@dataclass -class EndpointPublicAccessDetails: - pass - - -@dataclass -class EndpointSpecPrivateNetwork: - private_network_id: str - """ - ID of the Private Network. - """ - - -@dataclass -class EndpointSpecPublic: - pass - - -@dataclass -class Endpoint: - id: str - """ - Unique identifier. - """ - - url: str - """ - For private endpoints, the URL will be accessible only from the Private Network. -In addition, private endpoints will expose a CA certificate that can be used to verify the server's identity. -This CA certificate can be retrieved using the `GetDeploymentCertificate` API call. - """ - - disable_auth: bool - """ - Defines whether the authentication is disabled. - """ - - public_access: Optional[EndpointPublicAccessDetails] = None - - private_network: Optional[EndpointPrivateNetworkDetails] = None - - -@dataclass -class ModelS3Model: - s3_url: str - python_dependencies: dict[str, str] - node_type: Optional[str] = None - triton_server_version: Optional[str] = None - - -@dataclass -class ACLRuleRequest: - ip: str - """ - It can be specified as a single IP address or a range of IP addresses in CIDR notation. - """ - - description: str - """ - Description of the ACL rule. - """ - - -@dataclass -class ACLRule: - id: str - """ - Unique identifier. - """ - - ip: str - """ - Allowed IP address or CIDR range. - """ - - description: str - """ - Description of the ACL rule. - """ - - -@dataclass -class EndpointSpec: - disable_auth: bool - """ - By default, deployments are protected by IAM authentication. -When setting this field to true, the authentication will be disabled. - """ - - public: Optional[EndpointSpecPublic] = None - - private_network: Optional[EndpointSpecPrivateNetwork] = None - - -@dataclass -class Deployment: - id: str - """ - Unique identifier. - """ - - name: str - """ - Name of the deployment. - """ - - project_id: str - """ - Project ID. - """ - - status: DeploymentStatus - """ - Status of the deployment. - """ - - tags: list[str] - """ - List of tags applied to the deployment. - """ - - node_type: str - """ - Node type of the deployment. - """ - - endpoints: list[Endpoint] - """ - List of endpoints. - """ - - size: int - """ - Current size of the pool. - """ - - min_size: int - """ - Defines the minimum size of the pool. - """ - - max_size: int - """ - Defines the maximum size of the pool. - """ - - model_name: str - """ - The inference model used for the deployment. - """ - - model_id: str - """ - ID of the model used for the deployment. - """ - - region: ScwRegion - """ - Region of the deployment. - """ - - error_message: Optional[str] = None - """ - Displays information if your deployment is in error state. - """ - - created_at: Optional[datetime] = None - """ - Creation date of the deployment. - """ - - updated_at: Optional[datetime] = None - """ - Last modification date of the deployment. - """ - - -@dataclass -class Model: - id: str - """ - Unique identifier. - """ - - name: str - """ - Unique Name identifier. - """ - - project_id: str - """ - Project ID. - """ - - provider: str - """ - Name of the model provider. - """ - - tags: list[str] - """ - List of tags applied to the model. - """ - - description: str - """ - Purpose of the model. - """ - - has_eula: bool - """ - Defines whether the model has an end user license agreement. - """ - - region: ScwRegion - """ - Region of the model. - """ - - is_public: bool - """ - Defines whether the model is public or not. - """ - - compatible_node_types: list[str] - """ - Names of the node types compatible with the model. - """ - - quantization_level: str - """ - Quantization level of the model. - """ - - created_at: Optional[datetime] = None - """ - Creation date of the model. - """ - - updated_at: Optional[datetime] = None - """ - Last modification date of the model. - """ - - s3_model: Optional[ModelS3Model] = None - - -@dataclass -class NodeType: - name: str - """ - Name of the node type. - """ - - stock_status: NodeTypeStock - """ - Current stock status for the node type. - """ - - description: str - """ - Current specs of the offer. - """ - - vcpus: int - """ - Number of virtual CPUs. - """ - - memory: int - """ - Quantity of RAM. - """ - - vram: int - """ - Quantity of GPU RAM. - """ - - disabled: bool - """ - The node type is currently disabled. - """ - - beta: bool - """ - The node type is currently in beta. - """ - - gpus: int - """ - Number of GPUs. - """ - - region: ScwRegion - """ - Region of the node type. - """ - - created_at: Optional[datetime] = None - """ - Creation date of the node type. - """ - - updated_at: Optional[datetime] = None - """ - Last modification date of the node type. - """ - - -@dataclass -class AddDeploymentACLRulesRequest: - deployment_id: str - """ - ID of the deployment to add ACL rules to. - """ - - region: Optional[ScwRegion] = None - """ - Region to target. If none is passed will use default region from the config. - """ - - acls: Optional[list[ACLRuleRequest]] = field(default_factory=list) - """ - List of ACL rules to add. - """ - - -@dataclass -class AddDeploymentACLRulesResponse: - rules: list[ACLRule] - """ - List of ACL rules added. - """ - - -@dataclass -class CreateDeploymentRequest: - model_name: str - """ - Name of the model to use. - """ - - node_type: str - """ - Name of the node type to use. - """ - - endpoints: list[EndpointSpec] - """ - List of endpoints to create. - """ - - region: Optional[ScwRegion] = None - """ - Region to target. If none is passed will use default region from the config. - """ - - name: Optional[str] = None - """ - Name of the deployment. - """ - - project_id: Optional[str] = None - """ - ID of the Project to create the deployment in. - """ - - accept_eula: Optional[bool] = False - """ - If the model has an EULA, you must accept it before proceeding. -The terms of the EULA can be retrieved using the `GetModelEula` API call. - """ - - tags: Optional[list[str]] = field(default_factory=list) - """ - List of tags to apply to the deployment. - """ - - min_size: Optional[int] = 0 - """ - Defines the minimum size of the pool. - """ - - max_size: Optional[int] = 0 - """ - Defines the maximum size of the pool. - """ - - -@dataclass -class CreateEndpointRequest: - deployment_id: str - """ - ID of the deployment to create the endpoint for. - """ - - endpoint: EndpointSpec - """ - Specification of the endpoint. - """ - - region: Optional[ScwRegion] = None - """ - Region to target. If none is passed will use default region from the config. - """ - - -@dataclass -class DeleteDeploymentACLRuleRequest: - acl_id: str - """ - ID of the ACL rule to delete. - """ - - region: Optional[ScwRegion] = None - """ - Region to target. If none is passed will use default region from the config. - """ - - -@dataclass -class DeleteDeploymentRequest: - deployment_id: str - """ - ID of the deployment to delete. - """ - - region: Optional[ScwRegion] = None - """ - Region to target. If none is passed will use default region from the config. - """ - - -@dataclass -class DeleteEndpointRequest: - endpoint_id: str - """ - ID of the endpoint to delete. - """ - - region: Optional[ScwRegion] = None - """ - Region to target. If none is passed will use default region from the config. - """ - - -@dataclass -class Eula: - content: str - """ - Content of the end user license agreement. - """ - - -@dataclass -class GetDeploymentCertificateRequest: - deployment_id: str - region: Optional[ScwRegion] = None - """ - Region to target. If none is passed will use default region from the config. - """ - - -@dataclass -class GetDeploymentRequest: - deployment_id: str - """ - ID of the deployment to get. - """ - - region: Optional[ScwRegion] = None - """ - Region to target. If none is passed will use default region from the config. - """ - - -@dataclass -class GetModelEulaRequest: - model_id: str - region: Optional[ScwRegion] = None - """ - Region to target. If none is passed will use default region from the config. - """ - - -@dataclass -class GetModelRequest: - model_id: str - """ - ID of the model to get. - """ - - region: Optional[ScwRegion] = None - """ - Region to target. If none is passed will use default region from the config. - """ - - -@dataclass -class ListDeploymentACLRulesRequest: - deployment_id: str - """ - ID of the deployment to list ACL rules for. - """ - - region: Optional[ScwRegion] = None - """ - Region to target. If none is passed will use default region from the config. - """ - - page: Optional[int] = 0 - """ - Page number to return. - """ - - page_size: Optional[int] = 0 - """ - Maximum number of ACL rules to return per page. - """ - - -@dataclass -class ListDeploymentACLRulesResponse: - rules: list[ACLRule] - """ - List of ACL rules on the current page. - """ - - total_count: int - """ - Total number of ACL rules. - """ - - -@dataclass -class ListDeploymentsRequest: - region: Optional[ScwRegion] = None - """ - Region to target. If none is passed will use default region from the config. - """ - - page: Optional[int] = 0 - """ - Page number to return. - """ - - page_size: Optional[int] = 0 - """ - Maximum number of deployments to return per page. - """ - - order_by: Optional[ListDeploymentsRequestOrderBy] = ( - ListDeploymentsRequestOrderBy.CREATED_AT_DESC - ) - """ - Order in which to return results. - """ - - project_id: Optional[str] = None - """ - Filter by Project ID. - """ - - organization_id: Optional[str] = None - """ - Filter by Organization ID. - """ - - name: Optional[str] = None - """ - Filter by deployment name. - """ - - tags: Optional[list[str]] = field(default_factory=list) - """ - Filter by tags. - """ - - -@dataclass -class ListDeploymentsResponse: - deployments: list[Deployment] - """ - List of deployments on the current page. - """ - - total_count: int - """ - Total number of deployments. - """ - - -@dataclass -class ListModelsRequest: - region: Optional[ScwRegion] = None - """ - Region to target. If none is passed will use default region from the config. - """ - - order_by: Optional[ListModelsRequestOrderBy] = ( - ListModelsRequestOrderBy.DISPLAY_RANK_ASC - ) - """ - Order in which to return results. - """ - - page: Optional[int] = 0 - """ - Page number to return. - """ - - page_size: Optional[int] = 0 - """ - Maximum number of models to return per page. - """ - - project_id: Optional[str] = None - """ - Filter by Project ID. - """ - - name: Optional[str] = None - """ - Filter by model name. - """ - - tags: Optional[list[str]] = field(default_factory=list) - """ - Filter by tags. - """ - - -@dataclass -class ListModelsResponse: - models: list[Model] - """ - List of models on the current page. - """ - - total_count: int - """ - Total number of models. - """ - - -@dataclass -class ListNodeTypesRequest: - include_disabled_types: bool - """ - Include disabled node types in the response. - """ - - region: Optional[ScwRegion] = None - """ - Region to target. If none is passed will use default region from the config. - """ - - page: Optional[int] = 0 - """ - Page number to return. - """ - - page_size: Optional[int] = 0 - """ - Maximum number of node types to return per page. - """ - - -@dataclass -class ListNodeTypesResponse: - node_types: list[NodeType] - """ - List of node types. - """ - - total_count: int - """ - Total number of node types. - """ - - -@dataclass -class SetDeploymentACLRulesRequest: - deployment_id: str - """ - ID of the deployment to set ACL rules for. - """ - - region: Optional[ScwRegion] = None - """ - Region to target. If none is passed will use default region from the config. - """ - - acls: Optional[list[ACLRuleRequest]] = field(default_factory=list) - """ - All existing ACL rules will be replaced by the new ones. - """ - - -@dataclass -class SetDeploymentACLRulesResponse: - rules: list[ACLRule] - """ - List of ACL rules that were set. - """ - - -@dataclass -class UpdateDeploymentRequest: - deployment_id: str - """ - ID of the deployment to update. - """ - - region: Optional[ScwRegion] = None - """ - Region to target. If none is passed will use default region from the config. - """ - - name: Optional[str] = None - """ - Name of the deployment. - """ - - tags: Optional[list[str]] = field(default_factory=list) - """ - List of tags to apply to the deployment. - """ - - min_size: Optional[int] = 0 - """ - Defines the new minimum size of the pool. - """ - - max_size: Optional[int] = 0 - """ - Defines the new maximum size of the pool. - """ - - -@dataclass -class UpdateEndpointRequest: - endpoint_id: str - """ - ID of the endpoint to update. - """ - - region: Optional[ScwRegion] = None - """ - Region to target. If none is passed will use default region from the config. - """ - - disable_auth: Optional[bool] = False - """ - By default, deployments are protected by IAM authentication. -When setting this field to true, the authentication will be disabled. - """ diff --git a/scaleway-async/scaleway_async/instance/v2alpha1/__init__.py b/scaleway-async/scaleway_async/instance/v2alpha1/__init__.py index 3d05b58cd..793d3fa7f 100644 --- a/scaleway-async/scaleway_async/instance/v2alpha1/__init__.py +++ b/scaleway-async/scaleway_async/instance/v2alpha1/__init__.py @@ -43,7 +43,7 @@ from .types import CreateServerRequestPublicNetworkInterface from .types import CreateServerRequestServerVolume from .types import PlacementGroup -from .types import PrivateNetworkInterface +from .types import PrivateNetworkInterfaceSummary from .types import SecurityGroupSummary from .types import ServerType from .types import ServerSummary @@ -87,6 +87,7 @@ from .types import GetSecurityGroupRequest from .types import GetServerCloudInitRequest from .types import GetServerRequest +from .types import GetServiceInfoRequest from .types import GetTemplateCloudInitRequest from .types import GetTemplateRequest from .types import GetTemplateUserDataRequest @@ -108,6 +109,7 @@ from .types import ListUserDataKeysRequest from .types import ListUserDataKeysResponse from .types import PauseServerRequest +from .types import PrivateNetworkInterface from .types import RebootServerRequest from .types import ResourceCounts from .types import Server @@ -174,7 +176,7 @@ "CreateServerRequestPublicNetworkInterface", "CreateServerRequestServerVolume", "PlacementGroup", - "PrivateNetworkInterface", + "PrivateNetworkInterfaceSummary", "SecurityGroupSummary", "ServerType", "ServerSummary", @@ -218,6 +220,7 @@ "GetSecurityGroupRequest", "GetServerCloudInitRequest", "GetServerRequest", + "GetServiceInfoRequest", "GetTemplateCloudInitRequest", "GetTemplateRequest", "GetTemplateUserDataRequest", @@ -239,6 +242,7 @@ "ListUserDataKeysRequest", "ListUserDataKeysResponse", "PauseServerRequest", + "PrivateNetworkInterface", "RebootServerRequest", "ResourceCounts", "Server", diff --git a/scaleway-async/scaleway_async/instance/v2alpha1/api.py b/scaleway-async/scaleway_async/instance/v2alpha1/api.py index 7d3ca29c5..810e89665 100644 --- a/scaleway-async/scaleway_async/instance/v2alpha1/api.py +++ b/scaleway-async/scaleway_async/instance/v2alpha1/api.py @@ -5,7 +5,9 @@ from scaleway_core.api import API from scaleway_core.bridge import ( + ServiceInfo, Zone as ScwZone, + unmarshal_ServiceInfo, ) from scaleway_core.utils import ( OneOfPossibility, @@ -88,7 +90,6 @@ from .marshalling import ( unmarshal_SecurityGroup, unmarshal_PlacementGroup, - unmarshal_PrivateNetworkInterface, unmarshal_AddSecurityGroupRulesResponse, unmarshal_ListPlacementGroupsResponse, unmarshal_ListPrivateNetworkInterfacesResponse, @@ -98,6 +99,7 @@ unmarshal_ListTemplateUserDataKeysResponse, unmarshal_ListTemplatesResponse, unmarshal_ListUserDataKeysResponse, + unmarshal_PrivateNetworkInterface, unmarshal_ResourceCounts, unmarshal_Server, unmarshal_Template, @@ -136,9 +138,34 @@ class InstanceV2Alpha1API(API): """ - This API allows you to manage your CPU and GPU Instances. + This API allows you to manage Instance local and scratch volumes. """ + async def get_service_info( + self, + *, + zone: Optional[ScwZone] = None, + ) -> ServiceInfo: + """ + :param zone: Zone to target. If none is passed will use default zone from the config. + :return: :class:`ServiceInfo ` + + Usage: + :: + + result = await api.get_service_info() + """ + + param_zone = validate_path_param("zone", zone or self.client.default_zone) + + res = self._request( + "GET", + f"/instance/v2alpha1/zones/{param_zone}", + ) + + self._throw_on_error(res) + return unmarshal_ServiceInfo(res.json()) + async def get_resource_counts( self, *, @@ -147,12 +174,10 @@ async def get_resource_counts( project_id: Optional[str] = None, ) -> ResourceCounts: """ - Get resource counts. - Get counts of various resources (e.g. servers, volumes). :param zone: Zone to target. If none is passed will use default zone from the config. - :param organization_id: + :param organization_id: Organization ID to filter resource counts. One-Of ('project_identifier'): at most one of 'organization_id', 'project_id' could be set. - :param project_id: + :param project_id: Project ID to filter resource counts. One-Of ('project_identifier'): at most one of 'organization_id', 'project_id' could be set. :return: :class:`ResourceCounts ` @@ -198,20 +223,19 @@ async def list_servers( mac_addresses: Optional[list[str]] = None, ) -> ListServersResponse: """ - List all Instances. :param zone: Zone to target. If none is passed will use default zone from the config. - :param page_token: - :param page_size: - :param order_by: - :param project_id: - :param server_ids: - :param name: - :param server_type: - :param tags: - :param security_group_ids: - :param placement_group_ids: - :param private_network_ids: - :param mac_addresses: + :param page_token: Token for pagination. + :param page_size: Number of servers to return per page. + :param order_by: Order of the returned servers. + :param project_id: Project ID to filter servers. + :param server_ids: List of server IDs to filter. + :param name: Name to filter servers. + :param server_type: Server type to filter. + :param tags: Tags to filter servers. + :param security_group_ids: Security group IDs to filter servers. + :param placement_group_ids: Placement group IDs to filter servers. + :param private_network_ids: Private Network IDs to filter servers. + :param mac_addresses: MAC addresses to filter servers. :return: :class:`ListServersResponse ` Usage: @@ -260,17 +284,15 @@ async def create_server( ] = None, ) -> Server: """ - Create an Instance. - Create a new Instance of a specified server_type. - :param name: - :param server_type: + :param name: Name of the server. + :param server_type: Type of the server. :param zone: Zone to target. If none is passed will use default zone from the config. - :param project_id: - :param tags: - :param placement_group_id: - :param volumes: - :param windows_rdp_ssh_key_id: - :param public_network_interface: + :param project_id: Project ID for the server. + :param tags: Tags to associate with the server. + :param placement_group_id: ID of the placement group the server belongs to. + :param volumes: Volumes to attach to the server. + :param windows_rdp_ssh_key_id: IAM ID of the SSH key used to encrypt the Windows `Administrator` password for RDP use. + :param public_network_interface: Public network interface configuration. :return: :class:`Server ` Usage: @@ -313,9 +335,7 @@ async def get_server( zone: Optional[ScwZone] = None, ) -> Server: """ - Get an Instance. - Get the details of a specified Instance. - :param server_id: + :param server_id: ID of the server to retrieve. :param zone: Zone to target. If none is passed will use default zone from the config. :return: :class:`Server ` @@ -346,9 +366,7 @@ async def wait_for_server( options: Optional[WaitForOptions[Server, Union[bool, Awaitable[bool]]]] = None, ) -> Server: """ - Get an Instance. - Get the details of a specified Instance. - :param server_id: + :param server_id: ID of the server to retrieve. :param zone: Zone to target. If none is passed will use default zone from the config. :return: :class:`Server ` @@ -393,19 +411,17 @@ async def update_server( ] = None, ) -> Server: """ - Update an Instance. - Update the properties of a specified Instance information, such as name, rescue_mode, or tags. - :param server_id: + :param server_id: ID of the server to update. :param zone: Zone to target. If none is passed will use default zone from the config. - :param name: - :param tags: - :param server_type: - :param placement_group_id: - :param rescue_mode: - :param boot_volume_id: - :param windows_rdp_ssh_key_id: - :param protected: - :param public_network_interface: + :param name: New name for the server. + :param tags: New tags for the server. + :param server_type: New server type. + :param placement_group_id: New placement group ID. + :param rescue_mode: New rescue mode setting. + :param boot_volume_id: New boot volume ID. + :param windows_rdp_ssh_key_id: New IAM ID of the SSH key used to encrypt the Windows `Administrator` password for RDP use. + :param protected: Protection status of the server. + :param public_network_interface: New public network interface configuration. :return: :class:`Server ` Usage: @@ -456,21 +472,19 @@ async def delete_server( delete_private_nic_ids: Optional[list[str]] = None, ) -> None: """ - Delete an Instance. - Delete a specified Instance. - :param server_id: + :param server_id: ID of the server to delete. :param zone: Zone to target. If none is passed will use default zone from the config. - :param delete_all_ips: + :param delete_all_ips: Whether to delete all IPs attached to the server. One-Of ('ips'): at most one of 'delete_all_ips', 'delete_ip_ids' could be set. - :param delete_ip_ids: + :param delete_ip_ids: List of IP IDs to delete. One-Of ('ips'): at most one of 'delete_all_ips', 'delete_ip_ids' could be set. - :param delete_all_volumes: + :param delete_all_volumes: Whether to delete all volumes attached to the server. One-Of ('volumes'): at most one of 'delete_all_volumes', 'delete_volume_ids' could be set. - :param delete_volume_ids: + :param delete_volume_ids: List of volume IDs to delete. One-Of ('volumes'): at most one of 'delete_all_volumes', 'delete_volume_ids' could be set. - :param keep_all_private_nics: + :param keep_all_private_nics: Whether to keep all private network interfaces. One-Of ('private_nics'): at most one of 'keep_all_private_nics', 'delete_private_nic_ids' could be set. - :param delete_private_nic_ids: + :param delete_private_nic_ids: List of private network interface IDs to delete. One-Of ('private_nics'): at most one of 'keep_all_private_nics', 'delete_private_nic_ids' could be set. Usage: @@ -523,11 +537,9 @@ async def list_server_types( page_size: Optional[int] = None, ) -> ListServerTypesResponse: """ - List Instance types. - List available Instance types and their technical details. :param zone: Zone to target. If none is passed will use default zone from the config. - :param page_token: - :param page_size: + :param page_token: Token for pagination. + :param page_size: Number of server types to return per page. :return: :class:`ListServerTypesResponse ` Usage: @@ -557,9 +569,7 @@ async def start_server( zone: Optional[ScwZone] = None, ) -> Server: """ - Start an Instance. - Start a stopped or paused Instance. - :param server_id: + :param server_id: ID of the server to start. :param zone: Zone to target. If none is passed will use default zone from the config. :return: :class:`Server ` @@ -590,9 +600,7 @@ async def reboot_server( zone: Optional[ScwZone] = None, ) -> Server: """ - Reboot an Instance. - Reboot a running or paused Instance. - :param server_id: + :param server_id: ID of the server to reboot. :param zone: Zone to target. If none is passed will use default zone from the config. :return: :class:`Server ` @@ -623,9 +631,7 @@ async def pause_server( zone: Optional[ScwZone] = None, ) -> Server: """ - Pause an Instance. - Pause a running Instance. - :param server_id: + :param server_id: ID of the server to pause. :param zone: Zone to target. If none is passed will use default zone from the config. :return: :class:`Server ` @@ -656,9 +662,7 @@ async def stop_server( zone: Optional[ScwZone] = None, ) -> Server: """ - Stop an Instance. - Stop a running or paused Instance. - :param server_id: + :param server_id: ID of the server to stop. :param zone: Zone to target. If none is passed will use default zone from the config. :return: :class:`Server ` @@ -695,21 +699,19 @@ async def stop_and_delete_server( delete_private_nic_ids: Optional[list[str]] = None, ) -> Server: """ - Stop and delete an Instance. - Stop and delete a running or paused Instance. - :param server_id: + :param server_id: ID of the server to stop and delete. :param zone: Zone to target. If none is passed will use default zone from the config. - :param delete_all_ips: + :param delete_all_ips: Whether to delete all IPs attached to the server. One-Of ('ips'): at most one of 'delete_all_ips', 'delete_ip_ids' could be set. - :param delete_ip_ids: + :param delete_ip_ids: List of IP IDs to delete. One-Of ('ips'): at most one of 'delete_all_ips', 'delete_ip_ids' could be set. - :param delete_all_volumes: + :param delete_all_volumes: Whether to delete all volumes attached to the server. One-Of ('volumes'): at most one of 'delete_all_volumes', 'delete_volume_ids' could be set. - :param delete_volume_ids: + :param delete_volume_ids: List of volume IDs to delete. One-Of ('volumes'): at most one of 'delete_all_volumes', 'delete_volume_ids' could be set. - :param keep_all_private_nics: + :param keep_all_private_nics: Whether to keep all private network interfaces. One-Of ('private_nics'): at most one of 'keep_all_private_nics', 'delete_private_nic_ids' could be set. - :param delete_private_nic_ids: + :param delete_private_nic_ids: List of private network interface IDs to delete. One-Of ('private_nics'): at most one of 'keep_all_private_nics', 'delete_private_nic_ids' could be set. :return: :class:`Server ` @@ -755,13 +757,11 @@ async def attach_server_volume( volume_type: Optional[ServerVolumeVolumeType] = None, ) -> Server: """ - Attach a volume to an Instance. - Attach a l_ssd or SBS volume to an Instance. - :param server_id: - :param volume_id: - :param boot_volume: + :param server_id: ID of the server to attach the volume to. + :param volume_id: ID of the volume to attach. + :param boot_volume: Whether the volume should be used as the boot volume. :param zone: Zone to target. If none is passed will use default zone from the config. - :param volume_type: + :param volume_type: Type of the volume. :return: :class:`Server ` Usage: @@ -803,9 +803,8 @@ async def detach_server_volume( zone: Optional[ScwZone] = None, ) -> Server: """ - Detach a volume from an Instance. - :param server_id: - :param volume_id: + :param server_id: ID of the server to detach the volume from. + :param volume_id: ID of the volume to detach. :param zone: Zone to target. If none is passed will use default zone from the config. :return: :class:`Server ` @@ -845,9 +844,8 @@ async def attach_server_file_system( zone: Optional[ScwZone] = None, ) -> Server: """ - Attach a filesystem volume to an Instance. - :param server_id: - :param filesystem_id: + :param server_id: ID of the server to attach the filesystem to. + :param filesystem_id: ID of the filesystem to attach. :param zone: Zone to target. If none is passed will use default zone from the config. :return: :class:`Server ` @@ -887,9 +885,8 @@ async def detach_server_file_system( zone: Optional[ScwZone] = None, ) -> Server: """ - Detach a filesystem volume from an Instance. - :param server_id: - :param filesystem_id: + :param server_id: ID of the server to detach the filesystem from. + :param filesystem_id: ID of the filesystem to detach. :param zone: Zone to target. If none is passed will use default zone from the config. :return: :class:`Server ` @@ -931,11 +928,10 @@ async def attach_server_ip( zone: Optional[ScwZone] = None, ) -> Server: """ - Attach an IP to an Instance. - :param server_id: - :param ip_id: - :param default: - :param move_allowed: + :param server_id: ID of the server to attach the IP to. + :param ip_id: ID of the IP to attach. + :param default: Whether the IP should be the default IP. + :param move_allowed: Whether moving the IP is allowed. :param zone: Zone to target. If none is passed will use default zone from the config. :return: :class:`Server ` @@ -979,9 +975,8 @@ async def detach_server_ip( zone: Optional[ScwZone] = None, ) -> Server: """ - Detach an IP from an Instance. - :param server_id: - :param ip_id: + :param server_id: ID of the server to detach the IP from. + :param ip_id: ID of the IP to detach. :param zone: Zone to target. If none is passed will use default zone from the config. :return: :class:`Server ` @@ -1021,10 +1016,8 @@ async def set_server_default_ip( zone: Optional[ScwZone] = None, ) -> Server: """ - Set default IP for an Instance. - Set the default IP for an Instance. - :param server_id: - :param ip_id: + :param server_id: ID of the server to set the default IP for. + :param ip_id: ID of the IP to set as default. :param zone: Zone to target. If none is passed will use default zone from the config. :return: :class:`Server ` @@ -1064,9 +1057,8 @@ async def attach_server_private_network_interface( zone: Optional[ScwZone] = None, ) -> Server: """ - Attach a private network interface to an Instance. - :param server_id: - :param private_network_interface_id: + :param server_id: ID of the server to attach the private network interface to. + :param private_network_interface_id: ID of the private network interface to attach. :param zone: Zone to target. If none is passed will use default zone from the config. :return: :class:`Server ` @@ -1106,9 +1098,8 @@ async def detach_server_private_network_interface( zone: Optional[ScwZone] = None, ) -> Server: """ - Detach a private network interface from an Instance. - :param server_id: - :param private_network_interface_id: + :param server_id: ID of the server to detach the private network interface from. + :param private_network_interface_id: ID of the private network interface to detach. :param zone: Zone to target. If none is passed will use default zone from the config. :return: :class:`Server ` @@ -1149,22 +1140,18 @@ async def list_private_network_interfaces( order_by: Optional[ListPrivateNetworkInterfacesRequestOrderBy] = None, project_id: Optional[str] = None, server_ids: Optional[list[str]] = None, - security_group_ids: Optional[list[str]] = None, private_network_ids: Optional[list[str]] = None, tags: Optional[list[str]] = None, ) -> ListPrivateNetworkInterfacesResponse: """ - List private network interfaces. - List all private network interfaces. :param zone: Zone to target. If none is passed will use default zone from the config. - :param page_token: - :param page_size: - :param order_by: - :param project_id: - :param server_ids: - :param security_group_ids: - :param private_network_ids: - :param tags: + :param page_token: Token for pagination. + :param page_size: Number of items to return per page. + :param order_by: Field to order results by. + :param project_id: Filter by Project ID. + :param server_ids: Filter by server IDs. + :param private_network_ids: Filter by Private Network IDs. + :param tags: Filter by tags. :return: :class:`ListPrivateNetworkInterfacesResponse ` Usage: @@ -1184,7 +1171,6 @@ async def list_private_network_interfaces( "page_token": page_token, "private_network_ids": private_network_ids, "project_id": project_id or self.client.default_project_id, - "security_group_ids": security_group_ids, "server_ids": server_ids, "tags": tags, }, @@ -1200,20 +1186,16 @@ async def create_private_network_interface( zone: Optional[ScwZone] = None, project_id: Optional[str] = None, server_id: Optional[str] = None, - security_group_id: Optional[str] = None, ip_ids: Optional[list[str]] = None, tags: Optional[list[str]] = None, ) -> PrivateNetworkInterface: """ - Create a private network interface. - Create a private network interface linked to a Private Network. It can be attached to an Instance. - :param private_network_id: + :param private_network_id: ID of the Private Network to attach to. :param zone: Zone to target. If none is passed will use default zone from the config. - :param project_id: - :param server_id: - :param security_group_id: - :param ip_ids: - :param tags: + :param project_id: Project ID for the private network interface. + :param server_id: ID of the Instance to attach the interface to. + :param ip_ids: List of IP IDs to attach to the interface. + :param tags: Tags to assign to the private network interface. :return: :class:`PrivateNetworkInterface ` Usage: @@ -1235,7 +1217,6 @@ async def create_private_network_interface( zone=zone, project_id=project_id, server_id=server_id, - security_group_id=security_group_id, ip_ids=ip_ids, tags=tags, ), @@ -1253,9 +1234,7 @@ async def get_private_network_interface( zone: Optional[ScwZone] = None, ) -> PrivateNetworkInterface: """ - Get a private network interface. - Get details of a specified private network interface. - :param private_network_interface_id: + :param private_network_interface_id: ID of the private network interface to retrieve. :param zone: Zone to target. If none is passed will use default zone from the config. :return: :class:`PrivateNetworkInterface ` @@ -1290,9 +1269,7 @@ async def wait_for_private_network_interface( ] = None, ) -> PrivateNetworkInterface: """ - Get a private network interface. - Get details of a specified private network interface. - :param private_network_interface_id: + :param private_network_interface_id: ID of the private network interface to retrieve. :param zone: Zone to target. If none is passed will use default zone from the config. :return: :class:`PrivateNetworkInterface ` @@ -1326,16 +1303,12 @@ async def update_private_network_interface( *, private_network_interface_id: str, zone: Optional[ScwZone] = None, - security_group_id: Optional[str] = None, tags: Optional[list[str]] = None, ) -> PrivateNetworkInterface: """ - Update a private network interface. - Update the properties of a specified private network interface. - :param private_network_interface_id: + :param private_network_interface_id: ID of the private network interface to update. :param zone: Zone to target. If none is passed will use default zone from the config. - :param security_group_id: - :param tags: + :param tags: New tags to assign to the private network interface. :return: :class:`PrivateNetworkInterface ` Usage: @@ -1358,7 +1331,6 @@ async def update_private_network_interface( UpdatePrivateNetworkInterfaceRequest( private_network_interface_id=private_network_interface_id, zone=zone, - security_group_id=security_group_id, tags=tags, ), self.client, @@ -1375,9 +1347,7 @@ async def delete_private_network_interface( zone: Optional[ScwZone] = None, ) -> None: """ - Delete a private network interface. - Delete a specified private network interface. - :param private_network_interface_id: + :param private_network_interface_id: ID of the private network interface to delete. :param zone: Zone to target. If none is passed will use default zone from the config. Usage: @@ -1413,16 +1383,14 @@ async def list_placement_groups( tags: Optional[list[str]] = None, ) -> ListPlacementGroupsResponse: """ - List placement groups. - List all placement groups. :param zone: Zone to target. If none is passed will use default zone from the config. - :param page_token: - :param page_size: - :param order_by: - :param project_id: - :param placement_group_ids: - :param name: - :param tags: + :param page_token: The initial pagination token to start from. + :param page_size: The maximum number of placement groups to return. + :param order_by: The field by which to order the result list. + :param project_id: List only placement groups of this Project ID. + :param placement_group_ids: List only placement groups with these IDs. + :param name: Filter placement groups by name. + :param tags: List placement groups with these exact tags. :return: :class:`ListPlacementGroupsResponse ` Usage: @@ -1460,13 +1428,11 @@ async def create_placement_group( tags: Optional[list[str]] = None, ) -> PlacementGroup: """ - Create a placement group. - Create a new placement group. - :param name: + :param name: Name of the placement group. :param zone: Zone to target. If none is passed will use default zone from the config. - :param project_id: - :param policy_type: - :param tags: + :param project_id: Project ID of the placement group. + :param policy_type: Policy type of the placement group. + :param tags: Tags of the placement group. :return: :class:`PlacementGroup ` Usage: @@ -1504,9 +1470,7 @@ async def get_placement_group( zone: Optional[ScwZone] = None, ) -> PlacementGroup: """ - Get a placement group. - Get a specified placement group. - :param placement_group_id: + :param placement_group_id: UUID of the placement group you want to get. :param zone: Zone to target. If none is passed will use default zone from the config. :return: :class:`PlacementGroup ` @@ -1541,13 +1505,11 @@ async def update_placement_group( tags: Optional[list[str]] = None, ) -> PlacementGroup: """ - Update a placement group. - Update the properties of a specified placement group. - :param placement_group_id: + :param placement_group_id: UUID of the placement group. :param zone: Zone to target. If none is passed will use default zone from the config. - :param name: - :param policy_type: - :param tags: + :param name: Name of the placement group. + :param policy_type: Policy type of the placement group. + :param tags: Tags of the placement group. :return: :class:`PlacementGroup ` Usage: @@ -1588,9 +1550,7 @@ async def delete_placement_group( zone: Optional[ScwZone] = None, ) -> None: """ - Delete a placement group. - Delete a specified placement group. - :param placement_group_id: + :param placement_group_id: UUID of the placement group you want to delete. :param zone: Zone to target. If none is passed will use default zone from the config. Usage: @@ -1626,16 +1586,14 @@ async def list_security_groups( security_group_ids: Optional[list[str]] = None, ) -> ListSecurityGroupsResponse: """ - List security groups. - List all security groups. :param zone: Zone to target. If none is passed will use default zone from the config. - :param page_token: - :param page_size: - :param order_by: - :param project_id: - :param name: - :param tags: - :param security_group_ids: + :param page_token: Token for pagination. + :param page_size: Number of items to return per page. + :param order_by: Field and direction to sort by. + :param project_id: Filter by Project ID. + :param name: Filter by name. + :param tags: Filter by tags. + :param security_group_ids: Filter by specific security group IDs. :return: :class:`ListSecurityGroupsResponse ` Usage: @@ -1678,18 +1636,16 @@ async def create_security_group( outbound_default_action: Optional[SecurityGroupAction] = None, ) -> SecurityGroup: """ - Create a security group. - Create a security group with a specified name and description. - :param name: - :param description: - :param disable_default_rules: - :param project_default: - :param stateless: + :param name: Name of the security group. + :param description: Description of the security group. + :param disable_default_rules: Whether to disable default rules. + :param project_default: Whether this should be the default security group for the project. + :param stateless: Whether the security group should be stateless. :param zone: Zone to target. If none is passed will use default zone from the config. - :param project_id: - :param tags: - :param inbound_default_action: - :param outbound_default_action: + :param project_id: Project ID the security group belongs to. + :param tags: Tags for the security group. + :param inbound_default_action: Default action for inbound rules. + :param outbound_default_action: Default action for outbound rules. :return: :class:`SecurityGroup ` Usage: @@ -1736,9 +1692,7 @@ async def get_security_group( zone: Optional[ScwZone] = None, ) -> SecurityGroup: """ - Get a security group. - Get the details of a specified security group. - :param security_group_id: + :param security_group_id: ID of the security group to retrieve. :param zone: Zone to target. If none is passed will use default zone from the config. :return: :class:`SecurityGroup ` @@ -1778,18 +1732,16 @@ async def update_security_group( stateless: Optional[bool] = None, ) -> SecurityGroup: """ - Update a security group. - Update the properties of a security group. - :param security_group_id: + :param security_group_id: ID of the security group to update. :param zone: Zone to target. If none is passed will use default zone from the config. - :param name: - :param description: - :param disable_default_rules: - :param tags: - :param project_default: - :param inbound_default_action: - :param outbound_default_action: - :param stateless: + :param name: New name for the security group. + :param description: New description for the security group. + :param disable_default_rules: Whether to disable default rules. + :param tags: New tags for the security group. + :param project_default: Whether this should be the default security group for the project. + :param inbound_default_action: New default action for inbound rules. + :param outbound_default_action: New default action for outbound rules. + :param stateless: Whether the security group should be stateless. :return: :class:`SecurityGroup ` Usage: @@ -1835,9 +1787,7 @@ async def delete_security_group( zone: Optional[ScwZone] = None, ) -> None: """ - Delete a security group. - Delete a specified security group. - :param security_group_id: + :param security_group_id: ID of the security group to delete. :param zone: Zone to target. If none is passed will use default zone from the config. Usage: @@ -1868,11 +1818,9 @@ async def add_security_group_rules( security_group_rules: Optional[list[SecurityGroupRuleConfig]] = None, ) -> AddSecurityGroupRulesResponse: """ - Add rules to a security group. - Add one or more rules to a security group. - :param security_group_id: + :param security_group_id: ID of the security group to add rules to. :param zone: Zone to target. If none is passed will use default zone from the config. - :param security_group_rules: + :param security_group_rules: List of rules to add. :return: :class:`AddSecurityGroupRulesResponse ` Usage: @@ -1909,11 +1857,9 @@ async def set_security_group_rules( security_group_rules: Optional[list[SecurityGroupRuleConfig]] = None, ) -> SecurityGroup: """ - Set all rules of a security group. - Replace all rules of a specified security group with the provided rules. - :param security_group_id: + :param security_group_id: ID of the security group to set rules for. :param zone: Zone to target. If none is passed will use default zone from the config. - :param security_group_rules: + :param security_group_rules: List of rules to set. :return: :class:`SecurityGroup ` Usage: @@ -1957,18 +1903,16 @@ async def update_security_group_rule( position: Optional[int] = None, ) -> SecurityGroup: """ - Update a security group rule. - Update the properties of a rule from a specified security group. - :param security_group_rule_id: + :param security_group_rule_id: ID of the rule to update. :param zone: Zone to target. If none is passed will use default zone from the config. - :param protocol: - :param direction: - :param action: - :param source_ip_range: - :param destination_ip_range: - :param source_ports: - :param destination_ports: - :param position: + :param protocol: New protocol for the rule. + :param direction: New direction for the rule. + :param action: New action for the rule. + :param source_ip_range: New source IP range for the rule. + :param destination_ip_range: New destination IP range for the rule. + :param source_ports: New source port range for the rule. + :param destination_ports: New destination port range for the rule. + :param position: New position for the rule. :return: :class:`SecurityGroup ` Usage: @@ -2014,10 +1958,8 @@ async def delete_security_group_rules( security_group_rule_ids: Optional[list[str]] = None, ) -> None: """ - Delete rules from a security group. - Delete specified security groups. :param zone: Zone to target. If none is passed will use default zone from the config. - :param security_group_rule_ids: + :param security_group_rule_ids: List of rule IDs to delete. Usage: :: @@ -2050,12 +1992,10 @@ async def list_user_data_keys( page_size: Optional[int] = None, ) -> ListUserDataKeysResponse: """ - List user data keys. - List all user data keys registered on a specified Instance. - :param server_id: + :param server_id: The ID of the server. :param zone: Zone to target. If none is passed will use default zone from the config. - :param page_token: - :param page_size: + :param page_token: Page token for pagination. + :param page_size: Number of items to return per page. :return: :class:`ListUserDataKeysResponse ` Usage: @@ -2089,10 +2029,8 @@ async def get_user_data( zone: Optional[ScwZone] = None, ) -> UserData: """ - Get user data. - Get the content of a user data with a specified key on an Instance. - :param server_id: - :param key: + :param server_id: The ID of the server. + :param key: The key of the user data to retrieve. :param zone: Zone to target. If none is passed will use default zone from the config. :return: :class:`UserData ` @@ -2126,11 +2064,9 @@ async def set_user_data( zone: Optional[ScwZone] = None, ) -> None: """ - Add/set user data. - Add or update a user data with a specified key on an Instance. - :param server_id: - :param key: - :param content: + :param server_id: The ID of the server. + :param key: The key of the user data to set. + :param content: The content to set for the user data. :param zone: Zone to target. If none is passed will use default zone from the config. Usage: @@ -2171,10 +2107,8 @@ async def delete_user_data( zone: Optional[ScwZone] = None, ) -> None: """ - Delete user data. - Delete a specified key from an Instance's user data. - :param server_id: - :param key: + :param server_id: The ID of the server. + :param key: The key of the user data to delete. :param zone: Zone to target. If none is passed will use default zone from the config. Usage: @@ -2204,9 +2138,7 @@ async def get_server_cloud_init( zone: Optional[ScwZone] = None, ) -> UserData: """ - Get cloud-init user data. - Get the cloud-init configuration of a specified Instance. - :param server_id: + :param server_id: The ID of the server. :param zone: Zone to target. If none is passed will use default zone from the config. :return: :class:`UserData ` @@ -2237,10 +2169,8 @@ async def set_server_cloud_init( zone: Optional[ScwZone] = None, ) -> None: """ - Set cloud-init user data. - Set the cloud-init configuration for a specified Instance. - :param server_id: - :param content: + :param server_id: The ID of the server. + :param content: The cloud-init configuration content. :param zone: Zone to target. If none is passed will use default zone from the config. Usage: @@ -2286,19 +2216,17 @@ async def list_templates( placement_group_ids: Optional[list[str]] = None, ) -> ListTemplatesResponse: """ - List templates. - List all available templates. :param zone: Zone to target. If none is passed will use default zone from the config. - :param page_token: - :param page_size: - :param order_by: - :param project_id: - :param template_ids: - :param name: - :param tags: - :param server_tags: - :param security_group_ids: - :param placement_group_ids: + :param page_token: Token for pagination. + :param page_size: Number of items to return per page. + :param order_by: Field to sort results by. + :param project_id: Filter by Project ID. + :param template_ids: Filter by specific template IDs. + :param name: Filter by template name. + :param tags: Filter by tags. + :param server_tags: Filter by server tags. + :param security_group_ids: Filter by security group IDs. + :param placement_group_ids: Filter by placement group IDs. :return: :class:`ListTemplatesResponse ` Usage: @@ -2346,26 +2274,24 @@ async def create_template( private_networks: Optional[ list[CreateTemplateRequestPrivateNetworkTemplate] ] = None, - windows_rdp_ssh_key_id: Optional[str] = None, filesystem_ids: Optional[list[str]] = None, + windows_rdp_ssh_key_id: Optional[str] = None, ) -> Template: """ - Create a template. - Create a new template from an Instance. :param zone: Zone to target. If none is passed will use default zone from the config. - :param name: - :param server_type: - :param project_id: - :param tags: - :param server_tags: - :param public_ip_v4_count: - :param public_ip_v6_count: - :param security_group_id: - :param placement_group_id: - :param volumes: - :param private_networks: - :param windows_rdp_ssh_key_id: - :param filesystem_ids: + :param name: Name of the template. + :param server_type: Commercial type of the server defined by the template. + :param project_id: Project ID for the template. + :param tags: Tags to associate with the template. + :param server_tags: Tags to associate with servers created from the template. + :param public_ip_v4_count: Number of IPv4 public IPs to attach to servers created from this template. + :param public_ip_v6_count: Number of IPv6 public IPs to attach to servers created from this template. + :param security_group_id: Security group ID for the template. + :param placement_group_id: Placement group ID for the template. + :param volumes: List of volume templates to define volumes for servers. + :param private_networks: List of private networks to associate with the template. + :param filesystem_ids: List of filesystem IDs to associate with the template. + :param windows_rdp_ssh_key_id: IAM ID of the SSH key used to encrypt the Windows `Administrator` password for RDP use. :return: :class:`Template