diff --git a/.github/workflows/check-api-outdated.yml b/.github/workflows/check-api-outdated.yml new file mode 100644 index 0000000..1527aac --- /dev/null +++ b/.github/workflows/check-api-outdated.yml @@ -0,0 +1,47 @@ +name: Check if OpenAPI is Outdated + +on: + push: + branches-ignore: + - "github-pages/*" + - "gh-pages/*" + pull_request: + # check results of former push could be outdated + types: [opened, reopened] + workflow_dispatch: + schedule: + # “At 4 am on every day.” (https://crontab.guru) + - cron: "0 4 * * *" + + +jobs: + + check-api-outdated: + name: Check if OpenAPI Generated From JSON is Outdated + runs-on: ubuntu-latest + strategy: + fail-fast: false + + steps: + - name: SCM Checkout + uses: actions/checkout@v3 + + - name: Setup Python & Poetry Environment + uses: exasol/python-toolbox/.github/actions/python-environment@0.8.0 + with: + python-version: "3.10" + + - name: Run Nox Task check-api-outdated + run: poetry run nox -s check-api-outdated + + - name: Report Failure Status to Slack Channel + if: ${{ failure() }} + uses: ravsamhq/notify-slack-action@v2 + with: + status: ${{ job.status }} + token: ${{ github.token }} + notification_title: "Generated OpenAPI seems to be outdated." + message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>" + notify_when: "failure,cancelled,warnings,skipped" + env: + SLACK_WEBHOOK_URL: ${{ secrets.INTEGRATION_TEAM_SLACK_NOTIFICATION_WEBHOOK }} diff --git a/README.md b/README.md index 66a83eb..5365f25 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,10 @@ API enabling Python applications connecting to Exasol database SaaS instances and using their SaaS services. +The model layer of this API is generated from the OpenAPI specification in JSON format of the SaaS API https://cloud.exasol.com/openapi.json using [openapi-python-client](https://github.com/openapi-generators/openapi-python-client). + +A GitHub action will check each morning if the generated model layer is outdated. + +See +* [User Guide](doc/user_guide/user-guide.md) +* [Developer Guide](doc/developer_guide/developer_guide.md) diff --git a/doc/changes/changes_0.1.0.md b/doc/changes/changes_0.1.0.md index 3cfd60a..b510469 100644 --- a/doc/changes/changes_0.1.0.md +++ b/doc/changes/changes_0.1.0.md @@ -15,3 +15,4 @@ n/a ## Feature * #6: Added Nox task for generating the API +* #8: Add CI task to check if the generated API is outdated diff --git a/doc/developer_guide/developer_guide.md b/doc/developer_guide/developer_guide.md index fd9aa11..0ca9a25 100644 --- a/doc/developer_guide/developer_guide.md +++ b/doc/developer_guide/developer_guide.md @@ -4,8 +4,7 @@ saas-api-python includes a file `.pre-commit-config.yaml`. -The following command installs the pre-commit hooks, see also [framework pre-commmit](https://pre-commit.com/) and Git -documentation on [Customizing Git Git Hooks](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks): +The following command installs the pre-commit hooks, see also [framework pre-commmit](https://pre-commit.com/) and Git documentation on [Customizing Git Git Hooks](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks): ```shell poetry run pre-commit install @@ -15,13 +14,9 @@ When the hooks are installed, then git will run each of the hooks on the resp. s ## Generate the API Model -The model layer of this API has been generated from the OpenAPI specification -in JSON format of the SaaS API https://cloud.exasol.com/openapi.json using -[openapi-python-client](https://github.com/openapi-generators/openapi-python-client). +The model layer of this API has been generated from the OpenAPI specification in JSON format of the SaaS API https://cloud.exasol.com/openapi.json using [openapi-python-client](https://github.com/openapi-generators/openapi-python-client). -See also -[API Documentation](https://docs.exasol.com/saas/administration/rest_api/rest_api.htm) -and [Swagger UI](https://cloud.exasol.com/openapi/index.html). +See also [API Documentation](https://docs.exasol.com/saas/administration/rest_api/rest_api.htm) and [Swagger UI](https://cloud.exasol.com/openapi/index.html). In order to regenerate the model layer please use the following command line: @@ -29,10 +24,9 @@ In order to regenerate the model layer please use the following command line: poetry run nox generate-api ``` -### Change the Source URL of API Model JSON Definition +### Change the Source URL of the API Model JSON Definition -If you want to retrieve the JSON definition for the API model from a different -source then just edit file `noxfile.py`. +If you want to retrieve the JSON definition for the API model from a different source then just edit file `noxfile.py`. ### Read JSON definition From a Local File diff --git a/exasol/saas/client/openapi/__init__.py b/exasol/saas/client/openapi/__init__.py index c449ca5..96a49c6 100644 --- a/exasol/saas/client/openapi/__init__.py +++ b/exasol/saas/client/openapi/__init__.py @@ -1,4 +1,11 @@ -""" -openapi-python-client will replace all files and folders in this directory -recursively. -""" + +""" A client library for accessing Exasol SaaS REST-API """ +from .client import ( + AuthenticatedClient, + Client, +) + +__all__ = ( + "AuthenticatedClient", + "Client", +) diff --git a/exasol/saas/client/openapi/api/__init__.py b/exasol/saas/client/openapi/api/__init__.py new file mode 100644 index 0000000..dc035f4 --- /dev/null +++ b/exasol/saas/client/openapi/api/__init__.py @@ -0,0 +1 @@ +""" Contains methods for accessing the API """ diff --git a/exasol/saas/client/openapi/api/clusters/__init__.py b/exasol/saas/client/openapi/api/clusters/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/exasol/saas/client/openapi/api/clusters/create_cluster.py b/exasol/saas/client/openapi/api/clusters/create_cluster.py new file mode 100644 index 0000000..4d7dff3 --- /dev/null +++ b/exasol/saas/client/openapi/api/clusters/create_cluster.py @@ -0,0 +1,221 @@ +from http import HTTPStatus +from typing import ( + Any, + Dict, + List, + Optional, + Union, + cast, +) + +import httpx + +from ... import errors +from ...client import ( + AuthenticatedClient, + Client, +) +from ...models.cluster import Cluster +from ...models.create_cluster import CreateCluster +from ...types import ( + UNSET, + Response, +) + + +def _get_kwargs( + account_id: str, + database_id: str, + *, + body: CreateCluster, + +) -> Dict[str, Any]: + headers: Dict[str, Any] = {} + + + + + + + _kwargs: Dict[str, Any] = { + "method": "post", + "url": "/api/v1/accounts/{account_id}/databases/{database_id}/clusters".format(account_id=account_id,database_id=database_id,), + } + + _body = body.to_dict() + + + _kwargs["json"] = _body + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Cluster]: + if response.status_code == HTTPStatus.OK: + response_200 = Cluster.from_dict(response.json()) + + + + return response_200 + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Cluster]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + account_id: str, + database_id: str, + *, + client: AuthenticatedClient, + body: CreateCluster, + +) -> Response[Cluster]: + """ Create cluster + + Create a new cluster + + Args: + account_id (str): + database_id (str): + body (CreateCluster): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Cluster] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +database_id=database_id, +body=body, + + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + +def sync( + account_id: str, + database_id: str, + *, + client: AuthenticatedClient, + body: CreateCluster, + +) -> Optional[Cluster]: + """ Create cluster + + Create a new cluster + + Args: + account_id (str): + database_id (str): + body (CreateCluster): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Cluster + """ + + + return sync_detailed( + account_id=account_id, +database_id=database_id, +client=client, +body=body, + + ).parsed + +async def asyncio_detailed( + account_id: str, + database_id: str, + *, + client: AuthenticatedClient, + body: CreateCluster, + +) -> Response[Cluster]: + """ Create cluster + + Create a new cluster + + Args: + account_id (str): + database_id (str): + body (CreateCluster): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Cluster] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +database_id=database_id, +body=body, + + ) + + response = await client.get_async_httpx_client().request( + **kwargs + ) + + return _build_response(client=client, response=response) + +async def asyncio( + account_id: str, + database_id: str, + *, + client: AuthenticatedClient, + body: CreateCluster, + +) -> Optional[Cluster]: + """ Create cluster + + Create a new cluster + + Args: + account_id (str): + database_id (str): + body (CreateCluster): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Cluster + """ + + + return (await asyncio_detailed( + account_id=account_id, +database_id=database_id, +client=client, +body=body, + + )).parsed diff --git a/exasol/saas/client/openapi/api/clusters/delete_cluster.py b/exasol/saas/client/openapi/api/clusters/delete_cluster.py new file mode 100644 index 0000000..d0aa721 --- /dev/null +++ b/exasol/saas/client/openapi/api/clusters/delete_cluster.py @@ -0,0 +1,141 @@ +from http import HTTPStatus +from typing import ( + Any, + Dict, + List, + Optional, + Union, + cast, +) + +import httpx + +from ... import errors +from ...client import ( + AuthenticatedClient, + Client, +) +from ...types import ( + UNSET, + Response, +) + + +def _get_kwargs( + account_id: str, + database_id: str, + cluster_id: str, + +) -> Dict[str, Any]: + + + + + + + _kwargs: Dict[str, Any] = { + "method": "delete", + "url": "/api/v1/accounts/{account_id}/databases/{database_id}/clusters/{cluster_id}".format(account_id=account_id,database_id=database_id,cluster_id=cluster_id,), + } + + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: + if response.status_code == HTTPStatus.NO_CONTENT: + return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + account_id: str, + database_id: str, + cluster_id: str, + *, + client: AuthenticatedClient, + +) -> Response[Any]: + """ Delete cluster + + Delete the cluster, if main cluster is deleted, the whole database will be deleted. + + Args: + account_id (str): + database_id (str): + cluster_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +database_id=database_id, +cluster_id=cluster_id, + + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +async def asyncio_detailed( + account_id: str, + database_id: str, + cluster_id: str, + *, + client: AuthenticatedClient, + +) -> Response[Any]: + """ Delete cluster + + Delete the cluster, if main cluster is deleted, the whole database will be deleted. + + Args: + account_id (str): + database_id (str): + cluster_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +database_id=database_id, +cluster_id=cluster_id, + + ) + + response = await client.get_async_httpx_client().request( + **kwargs + ) + + return _build_response(client=client, response=response) + diff --git a/exasol/saas/client/openapi/api/clusters/get_cluster.py b/exasol/saas/client/openapi/api/clusters/get_cluster.py new file mode 100644 index 0000000..4982292 --- /dev/null +++ b/exasol/saas/client/openapi/api/clusters/get_cluster.py @@ -0,0 +1,212 @@ +from http import HTTPStatus +from typing import ( + Any, + Dict, + List, + Optional, + Union, + cast, +) + +import httpx + +from ... import errors +from ...client import ( + AuthenticatedClient, + Client, +) +from ...models.cluster import Cluster +from ...types import ( + UNSET, + Response, +) + + +def _get_kwargs( + account_id: str, + database_id: str, + cluster_id: str, + +) -> Dict[str, Any]: + + + + + + + _kwargs: Dict[str, Any] = { + "method": "get", + "url": "/api/v1/accounts/{account_id}/databases/{database_id}/clusters/{cluster_id}".format(account_id=account_id,database_id=database_id,cluster_id=cluster_id,), + } + + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Cluster]: + if response.status_code == HTTPStatus.OK: + response_200 = Cluster.from_dict(response.json()) + + + + return response_200 + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Cluster]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + account_id: str, + database_id: str, + cluster_id: str, + *, + client: AuthenticatedClient, + +) -> Response[Cluster]: + """ Get cluster + + Get cluster + + Args: + account_id (str): + database_id (str): + cluster_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Cluster] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +database_id=database_id, +cluster_id=cluster_id, + + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + +def sync( + account_id: str, + database_id: str, + cluster_id: str, + *, + client: AuthenticatedClient, + +) -> Optional[Cluster]: + """ Get cluster + + Get cluster + + Args: + account_id (str): + database_id (str): + cluster_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Cluster + """ + + + return sync_detailed( + account_id=account_id, +database_id=database_id, +cluster_id=cluster_id, +client=client, + + ).parsed + +async def asyncio_detailed( + account_id: str, + database_id: str, + cluster_id: str, + *, + client: AuthenticatedClient, + +) -> Response[Cluster]: + """ Get cluster + + Get cluster + + Args: + account_id (str): + database_id (str): + cluster_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Cluster] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +database_id=database_id, +cluster_id=cluster_id, + + ) + + response = await client.get_async_httpx_client().request( + **kwargs + ) + + return _build_response(client=client, response=response) + +async def asyncio( + account_id: str, + database_id: str, + cluster_id: str, + *, + client: AuthenticatedClient, + +) -> Optional[Cluster]: + """ Get cluster + + Get cluster + + Args: + account_id (str): + database_id (str): + cluster_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Cluster + """ + + + return (await asyncio_detailed( + account_id=account_id, +database_id=database_id, +cluster_id=cluster_id, +client=client, + + )).parsed diff --git a/exasol/saas/client/openapi/api/clusters/get_cluster_connection.py b/exasol/saas/client/openapi/api/clusters/get_cluster_connection.py new file mode 100644 index 0000000..aa40832 --- /dev/null +++ b/exasol/saas/client/openapi/api/clusters/get_cluster_connection.py @@ -0,0 +1,212 @@ +from http import HTTPStatus +from typing import ( + Any, + Dict, + List, + Optional, + Union, + cast, +) + +import httpx + +from ... import errors +from ...client import ( + AuthenticatedClient, + Client, +) +from ...models.connections import Connections +from ...types import ( + UNSET, + Response, +) + + +def _get_kwargs( + account_id: str, + database_id: str, + cluster_id: str, + +) -> Dict[str, Any]: + + + + + + + _kwargs: Dict[str, Any] = { + "method": "get", + "url": "/api/v1/accounts/{account_id}/databases/{database_id}/clusters/{cluster_id}/connect".format(account_id=account_id,database_id=database_id,cluster_id=cluster_id,), + } + + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Connections]: + if response.status_code == HTTPStatus.OK: + response_200 = Connections.from_dict(response.json()) + + + + return response_200 + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Connections]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + account_id: str, + database_id: str, + cluster_id: str, + *, + client: AuthenticatedClient, + +) -> Response[Connections]: + """ Get connection information + + Get connection information + + Args: + account_id (str): + database_id (str): + cluster_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Connections] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +database_id=database_id, +cluster_id=cluster_id, + + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + +def sync( + account_id: str, + database_id: str, + cluster_id: str, + *, + client: AuthenticatedClient, + +) -> Optional[Connections]: + """ Get connection information + + Get connection information + + Args: + account_id (str): + database_id (str): + cluster_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Connections + """ + + + return sync_detailed( + account_id=account_id, +database_id=database_id, +cluster_id=cluster_id, +client=client, + + ).parsed + +async def asyncio_detailed( + account_id: str, + database_id: str, + cluster_id: str, + *, + client: AuthenticatedClient, + +) -> Response[Connections]: + """ Get connection information + + Get connection information + + Args: + account_id (str): + database_id (str): + cluster_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Connections] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +database_id=database_id, +cluster_id=cluster_id, + + ) + + response = await client.get_async_httpx_client().request( + **kwargs + ) + + return _build_response(client=client, response=response) + +async def asyncio( + account_id: str, + database_id: str, + cluster_id: str, + *, + client: AuthenticatedClient, + +) -> Optional[Connections]: + """ Get connection information + + Get connection information + + Args: + account_id (str): + database_id (str): + cluster_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Connections + """ + + + return (await asyncio_detailed( + account_id=account_id, +database_id=database_id, +cluster_id=cluster_id, +client=client, + + )).parsed diff --git a/exasol/saas/client/openapi/api/clusters/list_clusters.py b/exasol/saas/client/openapi/api/clusters/list_clusters.py new file mode 100644 index 0000000..cd92bdd --- /dev/null +++ b/exasol/saas/client/openapi/api/clusters/list_clusters.py @@ -0,0 +1,204 @@ +from http import HTTPStatus +from typing import ( + Any, + Dict, + List, + Optional, + Union, + cast, +) + +import httpx + +from ... import errors +from ...client import ( + AuthenticatedClient, + Client, +) +from ...models.cluster import Cluster +from ...types import ( + UNSET, + Response, +) + + +def _get_kwargs( + account_id: str, + database_id: str, + +) -> Dict[str, Any]: + + + + + + + _kwargs: Dict[str, Any] = { + "method": "get", + "url": "/api/v1/accounts/{account_id}/databases/{database_id}/clusters".format(account_id=account_id,database_id=database_id,), + } + + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[List['Cluster']]: + if response.status_code == HTTPStatus.OK: + response_200 = [] + _response_200 = response.json() + for response_200_item_data in (_response_200): + response_200_item = Cluster.from_dict(response_200_item_data) + + + + response_200.append(response_200_item) + + return response_200 + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[List['Cluster']]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + account_id: str, + database_id: str, + *, + client: AuthenticatedClient, + +) -> Response[List['Cluster']]: + """ List clusters + + List clusters from a database + + Args: + account_id (str): + database_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[List['Cluster']] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +database_id=database_id, + + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + +def sync( + account_id: str, + database_id: str, + *, + client: AuthenticatedClient, + +) -> Optional[List['Cluster']]: + """ List clusters + + List clusters from a database + + Args: + account_id (str): + database_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + List['Cluster'] + """ + + + return sync_detailed( + account_id=account_id, +database_id=database_id, +client=client, + + ).parsed + +async def asyncio_detailed( + account_id: str, + database_id: str, + *, + client: AuthenticatedClient, + +) -> Response[List['Cluster']]: + """ List clusters + + List clusters from a database + + Args: + account_id (str): + database_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[List['Cluster']] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +database_id=database_id, + + ) + + response = await client.get_async_httpx_client().request( + **kwargs + ) + + return _build_response(client=client, response=response) + +async def asyncio( + account_id: str, + database_id: str, + *, + client: AuthenticatedClient, + +) -> Optional[List['Cluster']]: + """ List clusters + + List clusters from a database + + Args: + account_id (str): + database_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + List['Cluster'] + """ + + + return (await asyncio_detailed( + account_id=account_id, +database_id=database_id, +client=client, + + )).parsed diff --git a/exasol/saas/client/openapi/api/clusters/scale_cluster.py b/exasol/saas/client/openapi/api/clusters/scale_cluster.py new file mode 100644 index 0000000..802c9bc --- /dev/null +++ b/exasol/saas/client/openapi/api/clusters/scale_cluster.py @@ -0,0 +1,157 @@ +from http import HTTPStatus +from typing import ( + Any, + Dict, + List, + Optional, + Union, + cast, +) + +import httpx + +from ... import errors +from ...client import ( + AuthenticatedClient, + Client, +) +from ...models.scale_cluster import ScaleCluster +from ...types import ( + UNSET, + Response, +) + + +def _get_kwargs( + account_id: str, + database_id: str, + cluster_id: str, + *, + body: ScaleCluster, + +) -> Dict[str, Any]: + headers: Dict[str, Any] = {} + + + + + + + _kwargs: Dict[str, Any] = { + "method": "put", + "url": "/api/v1/accounts/{account_id}/databases/{database_id}/clusters/{cluster_id}/scale".format(account_id=account_id,database_id=database_id,cluster_id=cluster_id,), + } + + _body = body.to_dict() + + + _kwargs["json"] = _body + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: + if response.status_code == HTTPStatus.NO_CONTENT: + return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + account_id: str, + database_id: str, + cluster_id: str, + *, + client: AuthenticatedClient, + body: ScaleCluster, + +) -> Response[Any]: + """ Scale cluster + + Scale cluster + + Args: + account_id (str): + database_id (str): + cluster_id (str): + body (ScaleCluster): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +database_id=database_id, +cluster_id=cluster_id, +body=body, + + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +async def asyncio_detailed( + account_id: str, + database_id: str, + cluster_id: str, + *, + client: AuthenticatedClient, + body: ScaleCluster, + +) -> Response[Any]: + """ Scale cluster + + Scale cluster + + Args: + account_id (str): + database_id (str): + cluster_id (str): + body (ScaleCluster): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +database_id=database_id, +cluster_id=cluster_id, +body=body, + + ) + + response = await client.get_async_httpx_client().request( + **kwargs + ) + + return _build_response(client=client, response=response) + diff --git a/exasol/saas/client/openapi/api/clusters/start_cluster.py b/exasol/saas/client/openapi/api/clusters/start_cluster.py new file mode 100644 index 0000000..4cd724c --- /dev/null +++ b/exasol/saas/client/openapi/api/clusters/start_cluster.py @@ -0,0 +1,141 @@ +from http import HTTPStatus +from typing import ( + Any, + Dict, + List, + Optional, + Union, + cast, +) + +import httpx + +from ... import errors +from ...client import ( + AuthenticatedClient, + Client, +) +from ...types import ( + UNSET, + Response, +) + + +def _get_kwargs( + account_id: str, + database_id: str, + cluster_id: str, + +) -> Dict[str, Any]: + + + + + + + _kwargs: Dict[str, Any] = { + "method": "put", + "url": "/api/v1/accounts/{account_id}/databases/{database_id}/clusters/{cluster_id}/start".format(account_id=account_id,database_id=database_id,cluster_id=cluster_id,), + } + + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: + if response.status_code == HTTPStatus.NO_CONTENT: + return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + account_id: str, + database_id: str, + cluster_id: str, + *, + client: AuthenticatedClient, + +) -> Response[Any]: + """ Start cluster + + Start cluster + + Args: + account_id (str): + database_id (str): + cluster_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +database_id=database_id, +cluster_id=cluster_id, + + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +async def asyncio_detailed( + account_id: str, + database_id: str, + cluster_id: str, + *, + client: AuthenticatedClient, + +) -> Response[Any]: + """ Start cluster + + Start cluster + + Args: + account_id (str): + database_id (str): + cluster_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +database_id=database_id, +cluster_id=cluster_id, + + ) + + response = await client.get_async_httpx_client().request( + **kwargs + ) + + return _build_response(client=client, response=response) + diff --git a/exasol/saas/client/openapi/api/clusters/stop_cluster.py b/exasol/saas/client/openapi/api/clusters/stop_cluster.py new file mode 100644 index 0000000..443e5b2 --- /dev/null +++ b/exasol/saas/client/openapi/api/clusters/stop_cluster.py @@ -0,0 +1,141 @@ +from http import HTTPStatus +from typing import ( + Any, + Dict, + List, + Optional, + Union, + cast, +) + +import httpx + +from ... import errors +from ...client import ( + AuthenticatedClient, + Client, +) +from ...types import ( + UNSET, + Response, +) + + +def _get_kwargs( + account_id: str, + database_id: str, + cluster_id: str, + +) -> Dict[str, Any]: + + + + + + + _kwargs: Dict[str, Any] = { + "method": "put", + "url": "/api/v1/accounts/{account_id}/databases/{database_id}/clusters/{cluster_id}/stop".format(account_id=account_id,database_id=database_id,cluster_id=cluster_id,), + } + + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: + if response.status_code == HTTPStatus.NO_CONTENT: + return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + account_id: str, + database_id: str, + cluster_id: str, + *, + client: AuthenticatedClient, + +) -> Response[Any]: + """ Stop cluster + + Stop cluster + + Args: + account_id (str): + database_id (str): + cluster_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +database_id=database_id, +cluster_id=cluster_id, + + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +async def asyncio_detailed( + account_id: str, + database_id: str, + cluster_id: str, + *, + client: AuthenticatedClient, + +) -> Response[Any]: + """ Stop cluster + + Stop cluster + + Args: + account_id (str): + database_id (str): + cluster_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +database_id=database_id, +cluster_id=cluster_id, + + ) + + response = await client.get_async_httpx_client().request( + **kwargs + ) + + return _build_response(client=client, response=response) + diff --git a/exasol/saas/client/openapi/api/clusters/update_cluster.py b/exasol/saas/client/openapi/api/clusters/update_cluster.py new file mode 100644 index 0000000..a20d50c --- /dev/null +++ b/exasol/saas/client/openapi/api/clusters/update_cluster.py @@ -0,0 +1,159 @@ +from http import HTTPStatus +from typing import ( + Any, + Dict, + List, + Optional, + Union, + cast, +) + +import httpx + +from ... import errors +from ...client import ( + AuthenticatedClient, + Client, +) +from ...models.update_cluster import UpdateCluster +from ...types import ( + UNSET, + Response, +) + + +def _get_kwargs( + account_id: str, + database_id: str, + cluster_id: str, + *, + body: UpdateCluster, + +) -> Dict[str, Any]: + headers: Dict[str, Any] = {} + + + + + + + _kwargs: Dict[str, Any] = { + "method": "put", + "url": "/api/v1/accounts/{account_id}/databases/{database_id}/clusters/{cluster_id}".format(account_id=account_id,database_id=database_id,cluster_id=cluster_id,), + } + + _body = body.to_dict() + + + _kwargs["json"] = _body + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: + if response.status_code == HTTPStatus.NO_CONTENT: + return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + account_id: str, + database_id: str, + cluster_id: str, + *, + client: AuthenticatedClient, + body: UpdateCluster, + +) -> Response[Any]: + """ Update cluster + + Update the cluster with the specified ID. + Only metadata can be changed. To scale the cluster size, use the scale cluster endpoint. + + Args: + account_id (str): + database_id (str): + cluster_id (str): + body (UpdateCluster): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +database_id=database_id, +cluster_id=cluster_id, +body=body, + + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +async def asyncio_detailed( + account_id: str, + database_id: str, + cluster_id: str, + *, + client: AuthenticatedClient, + body: UpdateCluster, + +) -> Response[Any]: + """ Update cluster + + Update the cluster with the specified ID. + Only metadata can be changed. To scale the cluster size, use the scale cluster endpoint. + + Args: + account_id (str): + database_id (str): + cluster_id (str): + body (UpdateCluster): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +database_id=database_id, +cluster_id=cluster_id, +body=body, + + ) + + response = await client.get_async_httpx_client().request( + **kwargs + ) + + return _build_response(client=client, response=response) + diff --git a/exasol/saas/client/openapi/api/databases/__init__.py b/exasol/saas/client/openapi/api/databases/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/exasol/saas/client/openapi/api/databases/create_database.py b/exasol/saas/client/openapi/api/databases/create_database.py new file mode 100644 index 0000000..49ee990 --- /dev/null +++ b/exasol/saas/client/openapi/api/databases/create_database.py @@ -0,0 +1,208 @@ +from http import HTTPStatus +from typing import ( + Any, + Dict, + List, + Optional, + Union, + cast, +) + +import httpx + +from ... import errors +from ...client import ( + AuthenticatedClient, + Client, +) +from ...models.create_database import CreateDatabase +from ...models.database import Database +from ...types import ( + UNSET, + Response, +) + + +def _get_kwargs( + account_id: str, + *, + body: CreateDatabase, + +) -> Dict[str, Any]: + headers: Dict[str, Any] = {} + + + + + + + _kwargs: Dict[str, Any] = { + "method": "post", + "url": "/api/v1/accounts/{account_id}/databases".format(account_id=account_id,), + } + + _body = body.to_dict() + + + _kwargs["json"] = _body + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Database]: + if response.status_code == HTTPStatus.OK: + response_200 = Database.from_dict(response.json()) + + + + return response_200 + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Database]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + account_id: str, + *, + client: AuthenticatedClient, + body: CreateDatabase, + +) -> Response[Database]: + """ Create database + + Create a new database + + Args: + account_id (str): + body (CreateDatabase): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Database] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +body=body, + + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + +def sync( + account_id: str, + *, + client: AuthenticatedClient, + body: CreateDatabase, + +) -> Optional[Database]: + """ Create database + + Create a new database + + Args: + account_id (str): + body (CreateDatabase): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Database + """ + + + return sync_detailed( + account_id=account_id, +client=client, +body=body, + + ).parsed + +async def asyncio_detailed( + account_id: str, + *, + client: AuthenticatedClient, + body: CreateDatabase, + +) -> Response[Database]: + """ Create database + + Create a new database + + Args: + account_id (str): + body (CreateDatabase): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Database] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +body=body, + + ) + + response = await client.get_async_httpx_client().request( + **kwargs + ) + + return _build_response(client=client, response=response) + +async def asyncio( + account_id: str, + *, + client: AuthenticatedClient, + body: CreateDatabase, + +) -> Optional[Database]: + """ Create database + + Create a new database + + Args: + account_id (str): + body (CreateDatabase): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Database + """ + + + return (await asyncio_detailed( + account_id=account_id, +client=client, +body=body, + + )).parsed diff --git a/exasol/saas/client/openapi/api/databases/delete_database.py b/exasol/saas/client/openapi/api/databases/delete_database.py new file mode 100644 index 0000000..d5c02a5 --- /dev/null +++ b/exasol/saas/client/openapi/api/databases/delete_database.py @@ -0,0 +1,134 @@ +from http import HTTPStatus +from typing import ( + Any, + Dict, + List, + Optional, + Union, + cast, +) + +import httpx + +from ... import errors +from ...client import ( + AuthenticatedClient, + Client, +) +from ...types import ( + UNSET, + Response, +) + + +def _get_kwargs( + account_id: str, + database_id: str, + +) -> Dict[str, Any]: + + + + + + + _kwargs: Dict[str, Any] = { + "method": "delete", + "url": "/api/v1/accounts/{account_id}/databases/{database_id}".format(account_id=account_id,database_id=database_id,), + } + + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: + if response.status_code == HTTPStatus.NO_CONTENT: + return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + account_id: str, + database_id: str, + *, + client: AuthenticatedClient, + +) -> Response[Any]: + """ Delete database + + Delete the database and all cluster + + Args: + account_id (str): + database_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +database_id=database_id, + + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +async def asyncio_detailed( + account_id: str, + database_id: str, + *, + client: AuthenticatedClient, + +) -> Response[Any]: + """ Delete database + + Delete the database and all cluster + + Args: + account_id (str): + database_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +database_id=database_id, + + ) + + response = await client.get_async_httpx_client().request( + **kwargs + ) + + return _build_response(client=client, response=response) + diff --git a/exasol/saas/client/openapi/api/databases/get_database.py b/exasol/saas/client/openapi/api/databases/get_database.py new file mode 100644 index 0000000..a746eb4 --- /dev/null +++ b/exasol/saas/client/openapi/api/databases/get_database.py @@ -0,0 +1,199 @@ +from http import HTTPStatus +from typing import ( + Any, + Dict, + List, + Optional, + Union, + cast, +) + +import httpx + +from ... import errors +from ...client import ( + AuthenticatedClient, + Client, +) +from ...models.database import Database +from ...types import ( + UNSET, + Response, +) + + +def _get_kwargs( + account_id: str, + database_id: str, + +) -> Dict[str, Any]: + + + + + + + _kwargs: Dict[str, Any] = { + "method": "get", + "url": "/api/v1/accounts/{account_id}/databases/{database_id}".format(account_id=account_id,database_id=database_id,), + } + + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Database]: + if response.status_code == HTTPStatus.OK: + response_200 = Database.from_dict(response.json()) + + + + return response_200 + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Database]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + account_id: str, + database_id: str, + *, + client: AuthenticatedClient, + +) -> Response[Database]: + """ Get database + + Get the database + + Args: + account_id (str): + database_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Database] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +database_id=database_id, + + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + +def sync( + account_id: str, + database_id: str, + *, + client: AuthenticatedClient, + +) -> Optional[Database]: + """ Get database + + Get the database + + Args: + account_id (str): + database_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Database + """ + + + return sync_detailed( + account_id=account_id, +database_id=database_id, +client=client, + + ).parsed + +async def asyncio_detailed( + account_id: str, + database_id: str, + *, + client: AuthenticatedClient, + +) -> Response[Database]: + """ Get database + + Get the database + + Args: + account_id (str): + database_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Database] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +database_id=database_id, + + ) + + response = await client.get_async_httpx_client().request( + **kwargs + ) + + return _build_response(client=client, response=response) + +async def asyncio( + account_id: str, + database_id: str, + *, + client: AuthenticatedClient, + +) -> Optional[Database]: + """ Get database + + Get the database + + Args: + account_id (str): + database_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Database + """ + + + return (await asyncio_detailed( + account_id=account_id, +database_id=database_id, +client=client, + + )).parsed diff --git a/exasol/saas/client/openapi/api/databases/list_databases.py b/exasol/saas/client/openapi/api/databases/list_databases.py new file mode 100644 index 0000000..b143b91 --- /dev/null +++ b/exasol/saas/client/openapi/api/databases/list_databases.py @@ -0,0 +1,191 @@ +from http import HTTPStatus +from typing import ( + Any, + Dict, + List, + Optional, + Union, + cast, +) + +import httpx + +from ... import errors +from ...client import ( + AuthenticatedClient, + Client, +) +from ...models.database import Database +from ...types import ( + UNSET, + Response, +) + + +def _get_kwargs( + account_id: str, + +) -> Dict[str, Any]: + + + + + + + _kwargs: Dict[str, Any] = { + "method": "get", + "url": "/api/v1/accounts/{account_id}/databases".format(account_id=account_id,), + } + + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[List['Database']]: + if response.status_code == HTTPStatus.OK: + response_200 = [] + _response_200 = response.json() + for response_200_item_data in (_response_200): + response_200_item = Database.from_dict(response_200_item_data) + + + + response_200.append(response_200_item) + + return response_200 + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[List['Database']]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + account_id: str, + *, + client: AuthenticatedClient, + +) -> Response[List['Database']]: + """ List databases + + List databases + + Args: + account_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[List['Database']] + """ + + + kwargs = _get_kwargs( + account_id=account_id, + + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + +def sync( + account_id: str, + *, + client: AuthenticatedClient, + +) -> Optional[List['Database']]: + """ List databases + + List databases + + Args: + account_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + List['Database'] + """ + + + return sync_detailed( + account_id=account_id, +client=client, + + ).parsed + +async def asyncio_detailed( + account_id: str, + *, + client: AuthenticatedClient, + +) -> Response[List['Database']]: + """ List databases + + List databases + + Args: + account_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[List['Database']] + """ + + + kwargs = _get_kwargs( + account_id=account_id, + + ) + + response = await client.get_async_httpx_client().request( + **kwargs + ) + + return _build_response(client=client, response=response) + +async def asyncio( + account_id: str, + *, + client: AuthenticatedClient, + +) -> Optional[List['Database']]: + """ List databases + + List databases + + Args: + account_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + List['Database'] + """ + + + return (await asyncio_detailed( + account_id=account_id, +client=client, + + )).parsed diff --git a/exasol/saas/client/openapi/api/databases/start_database.py b/exasol/saas/client/openapi/api/databases/start_database.py new file mode 100644 index 0000000..9724a1a --- /dev/null +++ b/exasol/saas/client/openapi/api/databases/start_database.py @@ -0,0 +1,136 @@ +from http import HTTPStatus +from typing import ( + Any, + Dict, + List, + Optional, + Union, + cast, +) + +import httpx + +from ... import errors +from ...client import ( + AuthenticatedClient, + Client, +) +from ...types import ( + UNSET, + Response, +) + + +def _get_kwargs( + account_id: str, + database_id: str, + +) -> Dict[str, Any]: + + + + + + + _kwargs: Dict[str, Any] = { + "method": "put", + "url": "/api/v1/accounts/{account_id}/databases/{database_id}/start".format(account_id=account_id,database_id=database_id,), + } + + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: + if response.status_code == HTTPStatus.NO_CONTENT: + return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + account_id: str, + database_id: str, + *, + client: AuthenticatedClient, + +) -> Response[Any]: + """ Start database + + Start database + If database is from type main, workers will be also started + + Args: + account_id (str): + database_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +database_id=database_id, + + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +async def asyncio_detailed( + account_id: str, + database_id: str, + *, + client: AuthenticatedClient, + +) -> Response[Any]: + """ Start database + + Start database + If database is from type main, workers will be also started + + Args: + account_id (str): + database_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +database_id=database_id, + + ) + + response = await client.get_async_httpx_client().request( + **kwargs + ) + + return _build_response(client=client, response=response) + diff --git a/exasol/saas/client/openapi/api/databases/stop_database.py b/exasol/saas/client/openapi/api/databases/stop_database.py new file mode 100644 index 0000000..2f77c2a --- /dev/null +++ b/exasol/saas/client/openapi/api/databases/stop_database.py @@ -0,0 +1,136 @@ +from http import HTTPStatus +from typing import ( + Any, + Dict, + List, + Optional, + Union, + cast, +) + +import httpx + +from ... import errors +from ...client import ( + AuthenticatedClient, + Client, +) +from ...types import ( + UNSET, + Response, +) + + +def _get_kwargs( + account_id: str, + database_id: str, + +) -> Dict[str, Any]: + + + + + + + _kwargs: Dict[str, Any] = { + "method": "put", + "url": "/api/v1/accounts/{account_id}/databases/{database_id}/stop".format(account_id=account_id,database_id=database_id,), + } + + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: + if response.status_code == HTTPStatus.NO_CONTENT: + return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + account_id: str, + database_id: str, + *, + client: AuthenticatedClient, + +) -> Response[Any]: + """ Stop database + + Stop database + If database is from type main, workers will be also stopped + + Args: + account_id (str): + database_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +database_id=database_id, + + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +async def asyncio_detailed( + account_id: str, + database_id: str, + *, + client: AuthenticatedClient, + +) -> Response[Any]: + """ Stop database + + Stop database + If database is from type main, workers will be also stopped + + Args: + account_id (str): + database_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +database_id=database_id, + + ) + + response = await client.get_async_httpx_client().request( + **kwargs + ) + + return _build_response(client=client, response=response) + diff --git a/exasol/saas/client/openapi/api/databases/update_database.py b/exasol/saas/client/openapi/api/databases/update_database.py new file mode 100644 index 0000000..8ec927c --- /dev/null +++ b/exasol/saas/client/openapi/api/databases/update_database.py @@ -0,0 +1,150 @@ +from http import HTTPStatus +from typing import ( + Any, + Dict, + List, + Optional, + Union, + cast, +) + +import httpx + +from ... import errors +from ...client import ( + AuthenticatedClient, + Client, +) +from ...models.update_database import UpdateDatabase +from ...types import ( + UNSET, + Response, +) + + +def _get_kwargs( + account_id: str, + database_id: str, + *, + body: UpdateDatabase, + +) -> Dict[str, Any]: + headers: Dict[str, Any] = {} + + + + + + + _kwargs: Dict[str, Any] = { + "method": "put", + "url": "/api/v1/accounts/{account_id}/databases/{database_id}".format(account_id=account_id,database_id=database_id,), + } + + _body = body.to_dict() + + + _kwargs["json"] = _body + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: + if response.status_code == HTTPStatus.NO_CONTENT: + return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + account_id: str, + database_id: str, + *, + client: AuthenticatedClient, + body: UpdateDatabase, + +) -> Response[Any]: + """ Update database + + Update database + + Args: + account_id (str): + database_id (str): + body (UpdateDatabase): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +database_id=database_id, +body=body, + + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +async def asyncio_detailed( + account_id: str, + database_id: str, + *, + client: AuthenticatedClient, + body: UpdateDatabase, + +) -> Response[Any]: + """ Update database + + Update database + + Args: + account_id (str): + database_id (str): + body (UpdateDatabase): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +database_id=database_id, +body=body, + + ) + + response = await client.get_async_httpx_client().request( + **kwargs + ) + + return _build_response(client=client, response=response) + diff --git a/exasol/saas/client/openapi/api/files/__init__.py b/exasol/saas/client/openapi/api/files/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/exasol/saas/client/openapi/api/files/create_folder.py b/exasol/saas/client/openapi/api/files/create_folder.py new file mode 100644 index 0000000..3bfe60b --- /dev/null +++ b/exasol/saas/client/openapi/api/files/create_folder.py @@ -0,0 +1,141 @@ +from http import HTTPStatus +from typing import ( + Any, + Dict, + List, + Optional, + Union, + cast, +) + +import httpx + +from ... import errors +from ...client import ( + AuthenticatedClient, + Client, +) +from ...types import ( + UNSET, + Response, +) + + +def _get_kwargs( + account_id: str, + database_id: str, + path: str, + +) -> Dict[str, Any]: + + + + + + + _kwargs: Dict[str, Any] = { + "method": "post", + "url": "/api/v1/accounts/{account_id}/databases/{database_id}/folder/{path}".format(account_id=account_id,database_id=database_id,path=path,), + } + + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: + if response.status_code == HTTPStatus.NO_CONTENT: + return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + account_id: str, + database_id: str, + path: str, + *, + client: AuthenticatedClient, + +) -> Response[Any]: + """ Create folder + + Create folder + + Args: + account_id (str): + database_id (str): + path (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +database_id=database_id, +path=path, + + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +async def asyncio_detailed( + account_id: str, + database_id: str, + path: str, + *, + client: AuthenticatedClient, + +) -> Response[Any]: + """ Create folder + + Create folder + + Args: + account_id (str): + database_id (str): + path (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +database_id=database_id, +path=path, + + ) + + response = await client.get_async_httpx_client().request( + **kwargs + ) + + return _build_response(client=client, response=response) + diff --git a/exasol/saas/client/openapi/api/files/delete_file.py b/exasol/saas/client/openapi/api/files/delete_file.py new file mode 100644 index 0000000..fade37f --- /dev/null +++ b/exasol/saas/client/openapi/api/files/delete_file.py @@ -0,0 +1,141 @@ +from http import HTTPStatus +from typing import ( + Any, + Dict, + List, + Optional, + Union, + cast, +) + +import httpx + +from ... import errors +from ...client import ( + AuthenticatedClient, + Client, +) +from ...types import ( + UNSET, + Response, +) + + +def _get_kwargs( + account_id: str, + database_id: str, + path: str, + +) -> Dict[str, Any]: + + + + + + + _kwargs: Dict[str, Any] = { + "method": "delete", + "url": "/api/v1/accounts/{account_id}/databases/{database_id}/files/{path}".format(account_id=account_id,database_id=database_id,path=path,), + } + + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: + if response.status_code == HTTPStatus.NO_CONTENT: + return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + account_id: str, + database_id: str, + path: str, + *, + client: AuthenticatedClient, + +) -> Response[Any]: + """ Delete file + + Delete file from database + + Args: + account_id (str): + database_id (str): + path (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +database_id=database_id, +path=path, + + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +async def asyncio_detailed( + account_id: str, + database_id: str, + path: str, + *, + client: AuthenticatedClient, + +) -> Response[Any]: + """ Delete file + + Delete file from database + + Args: + account_id (str): + database_id (str): + path (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +database_id=database_id, +path=path, + + ) + + response = await client.get_async_httpx_client().request( + **kwargs + ) + + return _build_response(client=client, response=response) + diff --git a/exasol/saas/client/openapi/api/files/delete_folder.py b/exasol/saas/client/openapi/api/files/delete_folder.py new file mode 100644 index 0000000..9f23a7c --- /dev/null +++ b/exasol/saas/client/openapi/api/files/delete_folder.py @@ -0,0 +1,141 @@ +from http import HTTPStatus +from typing import ( + Any, + Dict, + List, + Optional, + Union, + cast, +) + +import httpx + +from ... import errors +from ...client import ( + AuthenticatedClient, + Client, +) +from ...types import ( + UNSET, + Response, +) + + +def _get_kwargs( + account_id: str, + database_id: str, + key: str, + +) -> Dict[str, Any]: + + + + + + + _kwargs: Dict[str, Any] = { + "method": "delete", + "url": "/api/v1/accounts/{account_id}/databases/{database_id}/folder/{key}".format(account_id=account_id,database_id=database_id,key=key,), + } + + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: + if response.status_code == HTTPStatus.NO_CONTENT: + return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + account_id: str, + database_id: str, + key: str, + *, + client: AuthenticatedClient, + +) -> Response[Any]: + """ Delete folder + + Delete folder from database + + Args: + account_id (str): + database_id (str): + key (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +database_id=database_id, +key=key, + + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +async def asyncio_detailed( + account_id: str, + database_id: str, + key: str, + *, + client: AuthenticatedClient, + +) -> Response[Any]: + """ Delete folder + + Delete folder from database + + Args: + account_id (str): + database_id (str): + key (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +database_id=database_id, +key=key, + + ) + + response = await client.get_async_httpx_client().request( + **kwargs + ) + + return _build_response(client=client, response=response) + diff --git a/exasol/saas/client/openapi/api/files/download_file.py b/exasol/saas/client/openapi/api/files/download_file.py new file mode 100644 index 0000000..7b2cde2 --- /dev/null +++ b/exasol/saas/client/openapi/api/files/download_file.py @@ -0,0 +1,212 @@ +from http import HTTPStatus +from typing import ( + Any, + Dict, + List, + Optional, + Union, + cast, +) + +import httpx + +from ... import errors +from ...client import ( + AuthenticatedClient, + Client, +) +from ...models.download_file import DownloadFile +from ...types import ( + UNSET, + Response, +) + + +def _get_kwargs( + account_id: str, + database_id: str, + path: str, + +) -> Dict[str, Any]: + + + + + + + _kwargs: Dict[str, Any] = { + "method": "get", + "url": "/api/v1/accounts/{account_id}/databases/{database_id}/files/{path}".format(account_id=account_id,database_id=database_id,path=path,), + } + + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[DownloadFile]: + if response.status_code == HTTPStatus.OK: + response_200 = DownloadFile.from_dict(response.json()) + + + + return response_200 + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[DownloadFile]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + account_id: str, + database_id: str, + path: str, + *, + client: AuthenticatedClient, + +) -> Response[DownloadFile]: + """ Download file + + Download file from bucket via one time link + + Args: + account_id (str): + database_id (str): + path (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[DownloadFile] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +database_id=database_id, +path=path, + + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + +def sync( + account_id: str, + database_id: str, + path: str, + *, + client: AuthenticatedClient, + +) -> Optional[DownloadFile]: + """ Download file + + Download file from bucket via one time link + + Args: + account_id (str): + database_id (str): + path (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + DownloadFile + """ + + + return sync_detailed( + account_id=account_id, +database_id=database_id, +path=path, +client=client, + + ).parsed + +async def asyncio_detailed( + account_id: str, + database_id: str, + path: str, + *, + client: AuthenticatedClient, + +) -> Response[DownloadFile]: + """ Download file + + Download file from bucket via one time link + + Args: + account_id (str): + database_id (str): + path (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[DownloadFile] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +database_id=database_id, +path=path, + + ) + + response = await client.get_async_httpx_client().request( + **kwargs + ) + + return _build_response(client=client, response=response) + +async def asyncio( + account_id: str, + database_id: str, + path: str, + *, + client: AuthenticatedClient, + +) -> Optional[DownloadFile]: + """ Download file + + Download file from bucket via one time link + + Args: + account_id (str): + database_id (str): + path (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + DownloadFile + """ + + + return (await asyncio_detailed( + account_id=account_id, +database_id=database_id, +path=path, +client=client, + + )).parsed diff --git a/exasol/saas/client/openapi/api/files/list_files.py b/exasol/saas/client/openapi/api/files/list_files.py new file mode 100644 index 0000000..f761bef --- /dev/null +++ b/exasol/saas/client/openapi/api/files/list_files.py @@ -0,0 +1,204 @@ +from http import HTTPStatus +from typing import ( + Any, + Dict, + List, + Optional, + Union, + cast, +) + +import httpx + +from ... import errors +from ...client import ( + AuthenticatedClient, + Client, +) +from ...models.file import File +from ...types import ( + UNSET, + Response, +) + + +def _get_kwargs( + account_id: str, + database_id: str, + +) -> Dict[str, Any]: + + + + + + + _kwargs: Dict[str, Any] = { + "method": "get", + "url": "/api/v1/accounts/{account_id}/databases/{database_id}/files".format(account_id=account_id,database_id=database_id,), + } + + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[List['File']]: + if response.status_code == HTTPStatus.OK: + response_200 = [] + _response_200 = response.json() + for response_200_item_data in (_response_200): + response_200_item = File.from_dict(response_200_item_data) + + + + response_200.append(response_200_item) + + return response_200 + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[List['File']]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + account_id: str, + database_id: str, + *, + client: AuthenticatedClient, + +) -> Response[List['File']]: + """ List files + + List files uploaded to the database + + Args: + account_id (str): + database_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[List['File']] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +database_id=database_id, + + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + +def sync( + account_id: str, + database_id: str, + *, + client: AuthenticatedClient, + +) -> Optional[List['File']]: + """ List files + + List files uploaded to the database + + Args: + account_id (str): + database_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + List['File'] + """ + + + return sync_detailed( + account_id=account_id, +database_id=database_id, +client=client, + + ).parsed + +async def asyncio_detailed( + account_id: str, + database_id: str, + *, + client: AuthenticatedClient, + +) -> Response[List['File']]: + """ List files + + List files uploaded to the database + + Args: + account_id (str): + database_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[List['File']] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +database_id=database_id, + + ) + + response = await client.get_async_httpx_client().request( + **kwargs + ) + + return _build_response(client=client, response=response) + +async def asyncio( + account_id: str, + database_id: str, + *, + client: AuthenticatedClient, + +) -> Optional[List['File']]: + """ List files + + List files uploaded to the database + + Args: + account_id (str): + database_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + List['File'] + """ + + + return (await asyncio_detailed( + account_id=account_id, +database_id=database_id, +client=client, + + )).parsed diff --git a/exasol/saas/client/openapi/api/files/upload_file.py b/exasol/saas/client/openapi/api/files/upload_file.py new file mode 100644 index 0000000..b791b5c --- /dev/null +++ b/exasol/saas/client/openapi/api/files/upload_file.py @@ -0,0 +1,212 @@ +from http import HTTPStatus +from typing import ( + Any, + Dict, + List, + Optional, + Union, + cast, +) + +import httpx + +from ... import errors +from ...client import ( + AuthenticatedClient, + Client, +) +from ...models.upload_file import UploadFile +from ...types import ( + UNSET, + Response, +) + + +def _get_kwargs( + account_id: str, + database_id: str, + path: str, + +) -> Dict[str, Any]: + + + + + + + _kwargs: Dict[str, Any] = { + "method": "post", + "url": "/api/v1/accounts/{account_id}/databases/{database_id}/files/{path}".format(account_id=account_id,database_id=database_id,path=path,), + } + + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[UploadFile]: + if response.status_code == HTTPStatus.OK: + response_200 = UploadFile.from_dict(response.json()) + + + + return response_200 + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[UploadFile]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + account_id: str, + database_id: str, + path: str, + *, + client: AuthenticatedClient, + +) -> Response[UploadFile]: + """ Get upload file url + + Get one time url to upload any file to the database + + Args: + account_id (str): + database_id (str): + path (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[UploadFile] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +database_id=database_id, +path=path, + + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + +def sync( + account_id: str, + database_id: str, + path: str, + *, + client: AuthenticatedClient, + +) -> Optional[UploadFile]: + """ Get upload file url + + Get one time url to upload any file to the database + + Args: + account_id (str): + database_id (str): + path (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + UploadFile + """ + + + return sync_detailed( + account_id=account_id, +database_id=database_id, +path=path, +client=client, + + ).parsed + +async def asyncio_detailed( + account_id: str, + database_id: str, + path: str, + *, + client: AuthenticatedClient, + +) -> Response[UploadFile]: + """ Get upload file url + + Get one time url to upload any file to the database + + Args: + account_id (str): + database_id (str): + path (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[UploadFile] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +database_id=database_id, +path=path, + + ) + + response = await client.get_async_httpx_client().request( + **kwargs + ) + + return _build_response(client=client, response=response) + +async def asyncio( + account_id: str, + database_id: str, + path: str, + *, + client: AuthenticatedClient, + +) -> Optional[UploadFile]: + """ Get upload file url + + Get one time url to upload any file to the database + + Args: + account_id (str): + database_id (str): + path (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + UploadFile + """ + + + return (await asyncio_detailed( + account_id=account_id, +database_id=database_id, +path=path, +client=client, + + )).parsed diff --git a/exasol/saas/client/openapi/api/platform/__init__.py b/exasol/saas/client/openapi/api/platform/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/exasol/saas/client/openapi/api/platform/list_cluster_sizes.py b/exasol/saas/client/openapi/api/platform/list_cluster_sizes.py new file mode 100644 index 0000000..5001f37 --- /dev/null +++ b/exasol/saas/client/openapi/api/platform/list_cluster_sizes.py @@ -0,0 +1,191 @@ +from http import HTTPStatus +from typing import ( + Any, + Dict, + List, + Optional, + Union, + cast, +) + +import httpx + +from ... import errors +from ...client import ( + AuthenticatedClient, + Client, +) +from ...models.cluster_size import ClusterSize +from ...types import ( + UNSET, + Response, +) + + +def _get_kwargs( + platform: str, + +) -> Dict[str, Any]: + + + + + + + _kwargs: Dict[str, Any] = { + "method": "get", + "url": "/api/v1/platforms/{platform}/sizes".format(platform=platform,), + } + + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[List['ClusterSize']]: + if response.status_code == HTTPStatus.OK: + response_200 = [] + _response_200 = response.json() + for response_200_item_data in (_response_200): + response_200_item = ClusterSize.from_dict(response_200_item_data) + + + + response_200.append(response_200_item) + + return response_200 + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[List['ClusterSize']]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + platform: str, + *, + client: AuthenticatedClient, + +) -> Response[List['ClusterSize']]: + """ Get cluster sizes for platform + + Get available cluster sizes for platform + + Args: + platform (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[List['ClusterSize']] + """ + + + kwargs = _get_kwargs( + platform=platform, + + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + +def sync( + platform: str, + *, + client: AuthenticatedClient, + +) -> Optional[List['ClusterSize']]: + """ Get cluster sizes for platform + + Get available cluster sizes for platform + + Args: + platform (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + List['ClusterSize'] + """ + + + return sync_detailed( + platform=platform, +client=client, + + ).parsed + +async def asyncio_detailed( + platform: str, + *, + client: AuthenticatedClient, + +) -> Response[List['ClusterSize']]: + """ Get cluster sizes for platform + + Get available cluster sizes for platform + + Args: + platform (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[List['ClusterSize']] + """ + + + kwargs = _get_kwargs( + platform=platform, + + ) + + response = await client.get_async_httpx_client().request( + **kwargs + ) + + return _build_response(client=client, response=response) + +async def asyncio( + platform: str, + *, + client: AuthenticatedClient, + +) -> Optional[List['ClusterSize']]: + """ Get cluster sizes for platform + + Get available cluster sizes for platform + + Args: + platform (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + List['ClusterSize'] + """ + + + return (await asyncio_detailed( + platform=platform, +client=client, + + )).parsed diff --git a/exasol/saas/client/openapi/api/platform/list_platforms.py b/exasol/saas/client/openapi/api/platform/list_platforms.py new file mode 100644 index 0000000..76fd501 --- /dev/null +++ b/exasol/saas/client/openapi/api/platform/list_platforms.py @@ -0,0 +1,170 @@ +from http import HTTPStatus +from typing import ( + Any, + Dict, + List, + Optional, + Union, + cast, +) + +import httpx + +from ... import errors +from ...client import ( + AuthenticatedClient, + Client, +) +from ...models.platform import Platform +from ...types import ( + UNSET, + Response, +) + + +def _get_kwargs( + +) -> Dict[str, Any]: + + + + + + + _kwargs: Dict[str, Any] = { + "method": "get", + "url": "/api/v1/platforms", + } + + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[List['Platform']]: + if response.status_code == HTTPStatus.OK: + response_200 = [] + _response_200 = response.json() + for response_200_item_data in (_response_200): + response_200_item = Platform.from_dict(response_200_item_data) + + + + response_200.append(response_200_item) + + return response_200 + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[List['Platform']]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient, + +) -> Response[List['Platform']]: + """ List platforms + + Get available platforms + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[List['Platform']] + """ + + + kwargs = _get_kwargs( + + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + +def sync( + *, + client: AuthenticatedClient, + +) -> Optional[List['Platform']]: + """ List platforms + + Get available platforms + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + List['Platform'] + """ + + + return sync_detailed( + client=client, + + ).parsed + +async def asyncio_detailed( + *, + client: AuthenticatedClient, + +) -> Response[List['Platform']]: + """ List platforms + + Get available platforms + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[List['Platform']] + """ + + + kwargs = _get_kwargs( + + ) + + response = await client.get_async_httpx_client().request( + **kwargs + ) + + return _build_response(client=client, response=response) + +async def asyncio( + *, + client: AuthenticatedClient, + +) -> Optional[List['Platform']]: + """ List platforms + + Get available platforms + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + List['Platform'] + """ + + + return (await asyncio_detailed( + client=client, + + )).parsed diff --git a/exasol/saas/client/openapi/api/platform/list_regions.py b/exasol/saas/client/openapi/api/platform/list_regions.py new file mode 100644 index 0000000..6d131da --- /dev/null +++ b/exasol/saas/client/openapi/api/platform/list_regions.py @@ -0,0 +1,191 @@ +from http import HTTPStatus +from typing import ( + Any, + Dict, + List, + Optional, + Union, + cast, +) + +import httpx + +from ... import errors +from ...client import ( + AuthenticatedClient, + Client, +) +from ...models.region import Region +from ...types import ( + UNSET, + Response, +) + + +def _get_kwargs( + platform: str, + +) -> Dict[str, Any]: + + + + + + + _kwargs: Dict[str, Any] = { + "method": "get", + "url": "/api/v1/platforms/{platform}/regions".format(platform=platform,), + } + + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[List['Region']]: + if response.status_code == HTTPStatus.OK: + response_200 = [] + _response_200 = response.json() + for response_200_item_data in (_response_200): + response_200_item = Region.from_dict(response_200_item_data) + + + + response_200.append(response_200_item) + + return response_200 + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[List['Region']]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + platform: str, + *, + client: AuthenticatedClient, + +) -> Response[List['Region']]: + """ Get regions for platform + + Get available regions for platform + + Args: + platform (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[List['Region']] + """ + + + kwargs = _get_kwargs( + platform=platform, + + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + +def sync( + platform: str, + *, + client: AuthenticatedClient, + +) -> Optional[List['Region']]: + """ Get regions for platform + + Get available regions for platform + + Args: + platform (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + List['Region'] + """ + + + return sync_detailed( + platform=platform, +client=client, + + ).parsed + +async def asyncio_detailed( + platform: str, + *, + client: AuthenticatedClient, + +) -> Response[List['Region']]: + """ Get regions for platform + + Get available regions for platform + + Args: + platform (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[List['Region']] + """ + + + kwargs = _get_kwargs( + platform=platform, + + ) + + response = await client.get_async_httpx_client().request( + **kwargs + ) + + return _build_response(client=client, response=response) + +async def asyncio( + platform: str, + *, + client: AuthenticatedClient, + +) -> Optional[List['Region']]: + """ Get regions for platform + + Get available regions for platform + + Args: + platform (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + List['Region'] + """ + + + return (await asyncio_detailed( + platform=platform, +client=client, + + )).parsed diff --git a/exasol/saas/client/openapi/api/profile/__init__.py b/exasol/saas/client/openapi/api/profile/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/exasol/saas/client/openapi/api/profile/update_profile.py b/exasol/saas/client/openapi/api/profile/update_profile.py new file mode 100644 index 0000000..8a814d3 --- /dev/null +++ b/exasol/saas/client/openapi/api/profile/update_profile.py @@ -0,0 +1,136 @@ +from http import HTTPStatus +from typing import ( + Any, + Dict, + List, + Optional, + Union, + cast, +) + +import httpx + +from ... import errors +from ...client import ( + AuthenticatedClient, + Client, +) +from ...models.update_profile import UpdateProfile +from ...types import ( + UNSET, + Response, +) + + +def _get_kwargs( + *, + body: UpdateProfile, + +) -> Dict[str, Any]: + headers: Dict[str, Any] = {} + + + + + + + _kwargs: Dict[str, Any] = { + "method": "put", + "url": "/api/v1/me", + } + + _body = body.to_dict() + + + _kwargs["json"] = _body + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: + if response.status_code == HTTPStatus.NO_CONTENT: + return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + *, + client: AuthenticatedClient, + body: UpdateProfile, + +) -> Response[Any]: + """ Update user profile + + Set first and last name of a user profile + + Args: + body (UpdateProfile): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any] + """ + + + kwargs = _get_kwargs( + body=body, + + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +async def asyncio_detailed( + *, + client: AuthenticatedClient, + body: UpdateProfile, + +) -> Response[Any]: + """ Update user profile + + Set first and last name of a user profile + + Args: + body (UpdateProfile): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any] + """ + + + kwargs = _get_kwargs( + body=body, + + ) + + response = await client.get_async_httpx_client().request( + **kwargs + ) + + return _build_response(client=client, response=response) + diff --git a/exasol/saas/client/openapi/api/security/__init__.py b/exasol/saas/client/openapi/api/security/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/exasol/saas/client/openapi/api/security/add_allowed_ip.py b/exasol/saas/client/openapi/api/security/add_allowed_ip.py new file mode 100644 index 0000000..6bca895 --- /dev/null +++ b/exasol/saas/client/openapi/api/security/add_allowed_ip.py @@ -0,0 +1,208 @@ +from http import HTTPStatus +from typing import ( + Any, + Dict, + List, + Optional, + Union, + cast, +) + +import httpx + +from ... import errors +from ...client import ( + AuthenticatedClient, + Client, +) +from ...models.allowed_ip import AllowedIP +from ...models.create_allowed_ip import CreateAllowedIP +from ...types import ( + UNSET, + Response, +) + + +def _get_kwargs( + account_id: str, + *, + body: CreateAllowedIP, + +) -> Dict[str, Any]: + headers: Dict[str, Any] = {} + + + + + + + _kwargs: Dict[str, Any] = { + "method": "post", + "url": "/api/v1/accounts/{account_id}/security/allowlist_ip".format(account_id=account_id,), + } + + _body = body.to_dict() + + + _kwargs["json"] = _body + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[AllowedIP]: + if response.status_code == HTTPStatus.OK: + response_200 = AllowedIP.from_dict(response.json()) + + + + return response_200 + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[AllowedIP]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + account_id: str, + *, + client: AuthenticatedClient, + body: CreateAllowedIP, + +) -> Response[AllowedIP]: + """ Add security rule (CIDR) + + Add security rule to allow access from CIDR + + Args: + account_id (str): + body (CreateAllowedIP): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AllowedIP] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +body=body, + + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + +def sync( + account_id: str, + *, + client: AuthenticatedClient, + body: CreateAllowedIP, + +) -> Optional[AllowedIP]: + """ Add security rule (CIDR) + + Add security rule to allow access from CIDR + + Args: + account_id (str): + body (CreateAllowedIP): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AllowedIP + """ + + + return sync_detailed( + account_id=account_id, +client=client, +body=body, + + ).parsed + +async def asyncio_detailed( + account_id: str, + *, + client: AuthenticatedClient, + body: CreateAllowedIP, + +) -> Response[AllowedIP]: + """ Add security rule (CIDR) + + Add security rule to allow access from CIDR + + Args: + account_id (str): + body (CreateAllowedIP): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AllowedIP] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +body=body, + + ) + + response = await client.get_async_httpx_client().request( + **kwargs + ) + + return _build_response(client=client, response=response) + +async def asyncio( + account_id: str, + *, + client: AuthenticatedClient, + body: CreateAllowedIP, + +) -> Optional[AllowedIP]: + """ Add security rule (CIDR) + + Add security rule to allow access from CIDR + + Args: + account_id (str): + body (CreateAllowedIP): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AllowedIP + """ + + + return (await asyncio_detailed( + account_id=account_id, +client=client, +body=body, + + )).parsed diff --git a/exasol/saas/client/openapi/api/security/delete_allowed_ip.py b/exasol/saas/client/openapi/api/security/delete_allowed_ip.py new file mode 100644 index 0000000..3180d8b --- /dev/null +++ b/exasol/saas/client/openapi/api/security/delete_allowed_ip.py @@ -0,0 +1,134 @@ +from http import HTTPStatus +from typing import ( + Any, + Dict, + List, + Optional, + Union, + cast, +) + +import httpx + +from ... import errors +from ...client import ( + AuthenticatedClient, + Client, +) +from ...types import ( + UNSET, + Response, +) + + +def _get_kwargs( + account_id: str, + id: str, + +) -> Dict[str, Any]: + + + + + + + _kwargs: Dict[str, Any] = { + "method": "delete", + "url": "/api/v1/accounts/{account_id}/security/allowlist_ip/{id}".format(account_id=account_id,id=id,), + } + + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: + if response.status_code == HTTPStatus.NO_CONTENT: + return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + account_id: str, + id: str, + *, + client: AuthenticatedClient, + +) -> Response[Any]: + """ Delete security rule (CIDR) + + Delete security rule (CIDR). No access to database possible after deletion from CIDR + + Args: + account_id (str): + id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +id=id, + + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +async def asyncio_detailed( + account_id: str, + id: str, + *, + client: AuthenticatedClient, + +) -> Response[Any]: + """ Delete security rule (CIDR) + + Delete security rule (CIDR). No access to database possible after deletion from CIDR + + Args: + account_id (str): + id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +id=id, + + ) + + response = await client.get_async_httpx_client().request( + **kwargs + ) + + return _build_response(client=client, response=response) + diff --git a/exasol/saas/client/openapi/api/security/get_allowed_ip.py b/exasol/saas/client/openapi/api/security/get_allowed_ip.py new file mode 100644 index 0000000..24ed13c --- /dev/null +++ b/exasol/saas/client/openapi/api/security/get_allowed_ip.py @@ -0,0 +1,199 @@ +from http import HTTPStatus +from typing import ( + Any, + Dict, + List, + Optional, + Union, + cast, +) + +import httpx + +from ... import errors +from ...client import ( + AuthenticatedClient, + Client, +) +from ...models.allowed_ip import AllowedIP +from ...types import ( + UNSET, + Response, +) + + +def _get_kwargs( + account_id: str, + id: str, + +) -> Dict[str, Any]: + + + + + + + _kwargs: Dict[str, Any] = { + "method": "get", + "url": "/api/v1/accounts/{account_id}/security/allowlist_ip/{id}".format(account_id=account_id,id=id,), + } + + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[AllowedIP]: + if response.status_code == HTTPStatus.OK: + response_200 = AllowedIP.from_dict(response.json()) + + + + return response_200 + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[AllowedIP]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + account_id: str, + id: str, + *, + client: AuthenticatedClient, + +) -> Response[AllowedIP]: + """ Get security rule (CIDR) + + Get security rule (CIDR) + + Args: + account_id (str): + id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AllowedIP] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +id=id, + + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + +def sync( + account_id: str, + id: str, + *, + client: AuthenticatedClient, + +) -> Optional[AllowedIP]: + """ Get security rule (CIDR) + + Get security rule (CIDR) + + Args: + account_id (str): + id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AllowedIP + """ + + + return sync_detailed( + account_id=account_id, +id=id, +client=client, + + ).parsed + +async def asyncio_detailed( + account_id: str, + id: str, + *, + client: AuthenticatedClient, + +) -> Response[AllowedIP]: + """ Get security rule (CIDR) + + Get security rule (CIDR) + + Args: + account_id (str): + id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AllowedIP] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +id=id, + + ) + + response = await client.get_async_httpx_client().request( + **kwargs + ) + + return _build_response(client=client, response=response) + +async def asyncio( + account_id: str, + id: str, + *, + client: AuthenticatedClient, + +) -> Optional[AllowedIP]: + """ Get security rule (CIDR) + + Get security rule (CIDR) + + Args: + account_id (str): + id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AllowedIP + """ + + + return (await asyncio_detailed( + account_id=account_id, +id=id, +client=client, + + )).parsed diff --git a/exasol/saas/client/openapi/api/security/list_allowed_i_ps.py b/exasol/saas/client/openapi/api/security/list_allowed_i_ps.py new file mode 100644 index 0000000..47e9937 --- /dev/null +++ b/exasol/saas/client/openapi/api/security/list_allowed_i_ps.py @@ -0,0 +1,191 @@ +from http import HTTPStatus +from typing import ( + Any, + Dict, + List, + Optional, + Union, + cast, +) + +import httpx + +from ... import errors +from ...client import ( + AuthenticatedClient, + Client, +) +from ...models.allowed_ip import AllowedIP +from ...types import ( + UNSET, + Response, +) + + +def _get_kwargs( + account_id: str, + +) -> Dict[str, Any]: + + + + + + + _kwargs: Dict[str, Any] = { + "method": "get", + "url": "/api/v1/accounts/{account_id}/security/allowlist_ip".format(account_id=account_id,), + } + + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[List['AllowedIP']]: + if response.status_code == HTTPStatus.OK: + response_200 = [] + _response_200 = response.json() + for response_200_item_data in (_response_200): + response_200_item = AllowedIP.from_dict(response_200_item_data) + + + + response_200.append(response_200_item) + + return response_200 + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[List['AllowedIP']]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + account_id: str, + *, + client: AuthenticatedClient, + +) -> Response[List['AllowedIP']]: + """ List security rules (CIDR) + + List security rules (CIDR) + + Args: + account_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[List['AllowedIP']] + """ + + + kwargs = _get_kwargs( + account_id=account_id, + + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + +def sync( + account_id: str, + *, + client: AuthenticatedClient, + +) -> Optional[List['AllowedIP']]: + """ List security rules (CIDR) + + List security rules (CIDR) + + Args: + account_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + List['AllowedIP'] + """ + + + return sync_detailed( + account_id=account_id, +client=client, + + ).parsed + +async def asyncio_detailed( + account_id: str, + *, + client: AuthenticatedClient, + +) -> Response[List['AllowedIP']]: + """ List security rules (CIDR) + + List security rules (CIDR) + + Args: + account_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[List['AllowedIP']] + """ + + + kwargs = _get_kwargs( + account_id=account_id, + + ) + + response = await client.get_async_httpx_client().request( + **kwargs + ) + + return _build_response(client=client, response=response) + +async def asyncio( + account_id: str, + *, + client: AuthenticatedClient, + +) -> Optional[List['AllowedIP']]: + """ List security rules (CIDR) + + List security rules (CIDR) + + Args: + account_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + List['AllowedIP'] + """ + + + return (await asyncio_detailed( + account_id=account_id, +client=client, + + )).parsed diff --git a/exasol/saas/client/openapi/api/security/update_allowed_ip.py b/exasol/saas/client/openapi/api/security/update_allowed_ip.py new file mode 100644 index 0000000..2b11552 --- /dev/null +++ b/exasol/saas/client/openapi/api/security/update_allowed_ip.py @@ -0,0 +1,150 @@ +from http import HTTPStatus +from typing import ( + Any, + Dict, + List, + Optional, + Union, + cast, +) + +import httpx + +from ... import errors +from ...client import ( + AuthenticatedClient, + Client, +) +from ...models.update_allowed_ip import UpdateAllowedIP +from ...types import ( + UNSET, + Response, +) + + +def _get_kwargs( + account_id: str, + id: str, + *, + body: UpdateAllowedIP, + +) -> Dict[str, Any]: + headers: Dict[str, Any] = {} + + + + + + + _kwargs: Dict[str, Any] = { + "method": "put", + "url": "/api/v1/accounts/{account_id}/security/allowlist_ip/{id}".format(account_id=account_id,id=id,), + } + + _body = body.to_dict() + + + _kwargs["json"] = _body + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: + if response.status_code == HTTPStatus.NO_CONTENT: + return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + account_id: str, + id: str, + *, + client: AuthenticatedClient, + body: UpdateAllowedIP, + +) -> Response[Any]: + """ Update security rule (CIDR) + + Update security rule (CIDR) + + Args: + account_id (str): + id (str): + body (UpdateAllowedIP): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +id=id, +body=body, + + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +async def asyncio_detailed( + account_id: str, + id: str, + *, + client: AuthenticatedClient, + body: UpdateAllowedIP, + +) -> Response[Any]: + """ Update security rule (CIDR) + + Update security rule (CIDR) + + Args: + account_id (str): + id (str): + body (UpdateAllowedIP): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +id=id, +body=body, + + ) + + response = await client.get_async_httpx_client().request( + **kwargs + ) + + return _build_response(client=client, response=response) + diff --git a/exasol/saas/client/openapi/api/usage/__init__.py b/exasol/saas/client/openapi/api/usage/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/exasol/saas/client/openapi/api/usage/get_usage.py b/exasol/saas/client/openapi/api/usage/get_usage.py new file mode 100644 index 0000000..ec9bf85 --- /dev/null +++ b/exasol/saas/client/openapi/api/usage/get_usage.py @@ -0,0 +1,228 @@ +from http import HTTPStatus +from typing import ( + Any, + Dict, + List, + Optional, + Union, + cast, +) + +import httpx + +from ... import errors +from ...client import ( + AuthenticatedClient, + Client, +) +from ...models.get_usage_response_200 import GetUsageResponse200 +from ...models.get_usage_type import GetUsageType +from ...types import ( + UNSET, + Response, + Unset, +) + + +def _get_kwargs( + account_id: str, + *, + year_month: str, + type: Union[Unset, GetUsageType] = UNSET, + +) -> Dict[str, Any]: + + + + + params: Dict[str, Any] = {} + + params["yearMonth"] = year_month + + json_type: Union[Unset, str] = UNSET + if not isinstance(type, Unset): + json_type = type.value + + params["type"] = json_type + + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + + _kwargs: Dict[str, Any] = { + "method": "get", + "url": "/api/v1/accounts/{account_id}/usage".format(account_id=account_id,), + "params": params, + } + + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[GetUsageResponse200]: + if response.status_code == HTTPStatus.OK: + response_200 = GetUsageResponse200.from_dict(response.json()) + + + + return response_200 + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[GetUsageResponse200]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + account_id: str, + *, + client: AuthenticatedClient, + year_month: str, + type: Union[Unset, GetUsageType] = UNSET, + +) -> Response[GetUsageResponse200]: + """ Get usage + + Show usage for one month + + Args: + account_id (str): + year_month (str): + type (Union[Unset, GetUsageType]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[GetUsageResponse200] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +year_month=year_month, +type=type, + + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + +def sync( + account_id: str, + *, + client: AuthenticatedClient, + year_month: str, + type: Union[Unset, GetUsageType] = UNSET, + +) -> Optional[GetUsageResponse200]: + """ Get usage + + Show usage for one month + + Args: + account_id (str): + year_month (str): + type (Union[Unset, GetUsageType]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + GetUsageResponse200 + """ + + + return sync_detailed( + account_id=account_id, +client=client, +year_month=year_month, +type=type, + + ).parsed + +async def asyncio_detailed( + account_id: str, + *, + client: AuthenticatedClient, + year_month: str, + type: Union[Unset, GetUsageType] = UNSET, + +) -> Response[GetUsageResponse200]: + """ Get usage + + Show usage for one month + + Args: + account_id (str): + year_month (str): + type (Union[Unset, GetUsageType]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[GetUsageResponse200] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +year_month=year_month, +type=type, + + ) + + response = await client.get_async_httpx_client().request( + **kwargs + ) + + return _build_response(client=client, response=response) + +async def asyncio( + account_id: str, + *, + client: AuthenticatedClient, + year_month: str, + type: Union[Unset, GetUsageType] = UNSET, + +) -> Optional[GetUsageResponse200]: + """ Get usage + + Show usage for one month + + Args: + account_id (str): + year_month (str): + type (Union[Unset, GetUsageType]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + GetUsageResponse200 + """ + + + return (await asyncio_detailed( + account_id=account_id, +client=client, +year_month=year_month, +type=type, + + )).parsed diff --git a/exasol/saas/client/openapi/api/users/__init__.py b/exasol/saas/client/openapi/api/users/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/exasol/saas/client/openapi/api/users/delete_user.py b/exasol/saas/client/openapi/api/users/delete_user.py new file mode 100644 index 0000000..30de9da --- /dev/null +++ b/exasol/saas/client/openapi/api/users/delete_user.py @@ -0,0 +1,134 @@ +from http import HTTPStatus +from typing import ( + Any, + Dict, + List, + Optional, + Union, + cast, +) + +import httpx + +from ... import errors +from ...client import ( + AuthenticatedClient, + Client, +) +from ...types import ( + UNSET, + Response, +) + + +def _get_kwargs( + account_id: str, + user_id: str, + +) -> Dict[str, Any]: + + + + + + + _kwargs: Dict[str, Any] = { + "method": "delete", + "url": "/api/v1/accounts/{account_id}/users/{user_id}".format(account_id=account_id,user_id=user_id,), + } + + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: + if response.status_code == HTTPStatus.NO_CONTENT: + return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + account_id: str, + user_id: str, + *, + client: AuthenticatedClient, + +) -> Response[Any]: + """ Remove user + + Remove user from account + + Args: + account_id (str): + user_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +user_id=user_id, + + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +async def asyncio_detailed( + account_id: str, + user_id: str, + *, + client: AuthenticatedClient, + +) -> Response[Any]: + """ Remove user + + Remove user from account + + Args: + account_id (str): + user_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +user_id=user_id, + + ) + + response = await client.get_async_httpx_client().request( + **kwargs + ) + + return _build_response(client=client, response=response) + diff --git a/exasol/saas/client/openapi/api/users/list_users.py b/exasol/saas/client/openapi/api/users/list_users.py new file mode 100644 index 0000000..9b1432b --- /dev/null +++ b/exasol/saas/client/openapi/api/users/list_users.py @@ -0,0 +1,243 @@ +from http import HTTPStatus +from typing import ( + Any, + Dict, + List, + Optional, + Union, + cast, +) + +import httpx + +from ... import errors +from ...client import ( + AuthenticatedClient, + Client, +) +from ...models.profile import Profile +from ...types import ( + UNSET, + Response, + Unset, +) + + +def _get_kwargs( + account_id: str, + *, + filter_: Union[Unset, str] = UNSET, + next_: Union[Unset, int] = UNSET, + limit: Union[Unset, int] = UNSET, + +) -> Dict[str, Any]: + + + + + params: Dict[str, Any] = {} + + params["filter"] = filter_ + + params["next"] = next_ + + params["limit"] = limit + + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + + _kwargs: Dict[str, Any] = { + "method": "get", + "url": "/api/v1/accounts/{account_id}/users".format(account_id=account_id,), + "params": params, + } + + + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[List['Profile']]: + if response.status_code == HTTPStatus.OK: + response_200 = [] + _response_200 = response.json() + for response_200_item_data in (_response_200): + response_200_item = Profile.from_dict(response_200_item_data) + + + + response_200.append(response_200_item) + + return response_200 + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[List['Profile']]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + account_id: str, + *, + client: AuthenticatedClient, + filter_: Union[Unset, str] = UNSET, + next_: Union[Unset, int] = UNSET, + limit: Union[Unset, int] = UNSET, + +) -> Response[List['Profile']]: + """ List users + + List users for account + + Args: + account_id (str): + filter_ (Union[Unset, str]): + next_ (Union[Unset, int]): + limit (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[List['Profile']] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +filter_=filter_, +next_=next_, +limit=limit, + + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + +def sync( + account_id: str, + *, + client: AuthenticatedClient, + filter_: Union[Unset, str] = UNSET, + next_: Union[Unset, int] = UNSET, + limit: Union[Unset, int] = UNSET, + +) -> Optional[List['Profile']]: + """ List users + + List users for account + + Args: + account_id (str): + filter_ (Union[Unset, str]): + next_ (Union[Unset, int]): + limit (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + List['Profile'] + """ + + + return sync_detailed( + account_id=account_id, +client=client, +filter_=filter_, +next_=next_, +limit=limit, + + ).parsed + +async def asyncio_detailed( + account_id: str, + *, + client: AuthenticatedClient, + filter_: Union[Unset, str] = UNSET, + next_: Union[Unset, int] = UNSET, + limit: Union[Unset, int] = UNSET, + +) -> Response[List['Profile']]: + """ List users + + List users for account + + Args: + account_id (str): + filter_ (Union[Unset, str]): + next_ (Union[Unset, int]): + limit (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[List['Profile']] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +filter_=filter_, +next_=next_, +limit=limit, + + ) + + response = await client.get_async_httpx_client().request( + **kwargs + ) + + return _build_response(client=client, response=response) + +async def asyncio( + account_id: str, + *, + client: AuthenticatedClient, + filter_: Union[Unset, str] = UNSET, + next_: Union[Unset, int] = UNSET, + limit: Union[Unset, int] = UNSET, + +) -> Optional[List['Profile']]: + """ List users + + List users for account + + Args: + account_id (str): + filter_ (Union[Unset, str]): + next_ (Union[Unset, int]): + limit (Union[Unset, int]): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + List['Profile'] + """ + + + return (await asyncio_detailed( + account_id=account_id, +client=client, +filter_=filter_, +next_=next_, +limit=limit, + + )).parsed diff --git a/exasol/saas/client/openapi/api/users/patch_user.py b/exasol/saas/client/openapi/api/users/patch_user.py new file mode 100644 index 0000000..56a7f9a --- /dev/null +++ b/exasol/saas/client/openapi/api/users/patch_user.py @@ -0,0 +1,150 @@ +from http import HTTPStatus +from typing import ( + Any, + Dict, + List, + Optional, + Union, + cast, +) + +import httpx + +from ... import errors +from ...client import ( + AuthenticatedClient, + Client, +) +from ...models.patch_user import PatchUser +from ...types import ( + UNSET, + Response, +) + + +def _get_kwargs( + account_id: str, + user_id: str, + *, + body: PatchUser, + +) -> Dict[str, Any]: + headers: Dict[str, Any] = {} + + + + + + + _kwargs: Dict[str, Any] = { + "method": "patch", + "url": "/api/v1/accounts/{account_id}/users/{user_id}".format(account_id=account_id,user_id=user_id,), + } + + _body = body.to_dict() + + + _kwargs["json"] = _body + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + +def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]: + if response.status_code == HTTPStatus.NO_CONTENT: + return None + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + account_id: str, + user_id: str, + *, + client: AuthenticatedClient, + body: PatchUser, + +) -> Response[Any]: + """ Patch user + + Patch user + + Args: + account_id (str): + user_id (str): + body (PatchUser): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +user_id=user_id, +body=body, + + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +async def asyncio_detailed( + account_id: str, + user_id: str, + *, + client: AuthenticatedClient, + body: PatchUser, + +) -> Response[Any]: + """ Patch user + + Patch user + + Args: + account_id (str): + user_id (str): + body (PatchUser): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Any] + """ + + + kwargs = _get_kwargs( + account_id=account_id, +user_id=user_id, +body=body, + + ) + + response = await client.get_async_httpx_client().request( + **kwargs + ) + + return _build_response(client=client, response=response) + diff --git a/exasol/saas/client/openapi/client.py b/exasol/saas/client/openapi/client.py new file mode 100644 index 0000000..e0bf922 --- /dev/null +++ b/exasol/saas/client/openapi/client.py @@ -0,0 +1,277 @@ +import ssl +from typing import ( + Any, + Dict, + Optional, + Union, +) + +import httpx +from attrs import ( + define, + evolve, + field, +) + + +@define +class Client: + """A class for keeping track of data related to the API + + The following are accepted as keyword arguments and will be used to construct httpx Clients internally: + + ``base_url``: The base URL for the API, all requests are made to a relative path to this URL + + ``cookies``: A dictionary of cookies to be sent with every request + + ``headers``: A dictionary of headers to be sent with every request + + ``timeout``: The maximum amount of a time a request can take. API functions will raise + httpx.TimeoutException if this is exceeded. + + ``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production, + but can be set to False for testing purposes. + + ``follow_redirects``: Whether or not to follow redirects. Default value is False. + + ``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor. + + + Attributes: + raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a + status code that was not documented in the source OpenAPI document. Can also be provided as a keyword + argument to the constructor. + """ + raise_on_unexpected_status: bool = field(default=False, kw_only=True) + _base_url: str = field(alias="base_url") + _cookies: Dict[str, str] = field(factory=dict, kw_only=True, alias="cookies") + _headers: Dict[str, str] = field(factory=dict, kw_only=True, alias="headers") + _timeout: Optional[httpx.Timeout] = field(default=None, kw_only=True, alias="timeout") + _verify_ssl: Union[str, bool, ssl.SSLContext] = field(default=True, kw_only=True, alias="verify_ssl") + _follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects") + _httpx_args: Dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args") + _client: Optional[httpx.Client] = field(default=None, init=False) + _async_client: Optional[httpx.AsyncClient] = field(default=None, init=False) + + def with_headers(self, headers: Dict[str, str]) -> "Client": + """Get a new client matching this one with additional headers""" + if self._client is not None: + self._client.headers.update(headers) + if self._async_client is not None: + self._async_client.headers.update(headers) + return evolve(self, headers={**self._headers, **headers}) + + def with_cookies(self, cookies: Dict[str, str]) -> "Client": + """Get a new client matching this one with additional cookies""" + if self._client is not None: + self._client.cookies.update(cookies) + if self._async_client is not None: + self._async_client.cookies.update(cookies) + return evolve(self, cookies={**self._cookies, **cookies}) + + def with_timeout(self, timeout: httpx.Timeout) -> "Client": + """Get a new client matching this one with a new timeout (in seconds)""" + if self._client is not None: + self._client.timeout = timeout + if self._async_client is not None: + self._async_client.timeout = timeout + return evolve(self, timeout=timeout) + + def set_httpx_client(self, client: httpx.Client) -> "Client": + """Manually the underlying httpx.Client + + **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. + """ + self._client = client + return self + + def get_httpx_client(self) -> httpx.Client: + """Get the underlying httpx.Client, constructing a new one if not previously set""" + if self._client is None: + self._client = httpx.Client( + base_url=self._base_url, + cookies=self._cookies, + headers=self._headers, + timeout=self._timeout, + verify=self._verify_ssl, + follow_redirects=self._follow_redirects, + **self._httpx_args, + ) + return self._client + + def __enter__(self) -> "Client": + """Enter a context manager for self.client—you cannot enter twice (see httpx docs)""" + self.get_httpx_client().__enter__() + return self + + def __exit__(self, *args: Any, **kwargs: Any) -> None: + """Exit a context manager for internal httpx.Client (see httpx docs)""" + self.get_httpx_client().__exit__(*args, **kwargs) + + def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "Client": + """Manually the underlying httpx.AsyncClient + + **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. + """ + self._async_client = async_client + return self + + def get_async_httpx_client(self) -> httpx.AsyncClient: + """Get the underlying httpx.AsyncClient, constructing a new one if not previously set""" + if self._async_client is None: + self._async_client = httpx.AsyncClient( + base_url=self._base_url, + cookies=self._cookies, + headers=self._headers, + timeout=self._timeout, + verify=self._verify_ssl, + follow_redirects=self._follow_redirects, + **self._httpx_args, + ) + return self._async_client + + async def __aenter__(self) -> "Client": + """Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)""" + await self.get_async_httpx_client().__aenter__() + return self + + async def __aexit__(self, *args: Any, **kwargs: Any) -> None: + """Exit a context manager for underlying httpx.AsyncClient (see httpx docs)""" + await self.get_async_httpx_client().__aexit__(*args, **kwargs) + + +@define +class AuthenticatedClient: + """A Client which has been authenticated for use on secured endpoints + + The following are accepted as keyword arguments and will be used to construct httpx Clients internally: + + ``base_url``: The base URL for the API, all requests are made to a relative path to this URL + + ``cookies``: A dictionary of cookies to be sent with every request + + ``headers``: A dictionary of headers to be sent with every request + + ``timeout``: The maximum amount of a time a request can take. API functions will raise + httpx.TimeoutException if this is exceeded. + + ``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production, + but can be set to False for testing purposes. + + ``follow_redirects``: Whether or not to follow redirects. Default value is False. + + ``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor. + + + Attributes: + raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a + status code that was not documented in the source OpenAPI document. Can also be provided as a keyword + argument to the constructor. + token: The token to use for authentication + prefix: The prefix to use for the Authorization header + auth_header_name: The name of the Authorization header + """ + + raise_on_unexpected_status: bool = field(default=False, kw_only=True) + _base_url: str = field(alias="base_url") + _cookies: Dict[str, str] = field(factory=dict, kw_only=True, alias="cookies") + _headers: Dict[str, str] = field(factory=dict, kw_only=True, alias="headers") + _timeout: Optional[httpx.Timeout] = field(default=None, kw_only=True, alias="timeout") + _verify_ssl: Union[str, bool, ssl.SSLContext] = field(default=True, kw_only=True, alias="verify_ssl") + _follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects") + _httpx_args: Dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args") + _client: Optional[httpx.Client] = field(default=None, init=False) + _async_client: Optional[httpx.AsyncClient] = field(default=None, init=False) + + token: str + prefix: str = "Bearer" + auth_header_name: str = "Authorization" + + def with_headers(self, headers: Dict[str, str]) -> "AuthenticatedClient": + """Get a new client matching this one with additional headers""" + if self._client is not None: + self._client.headers.update(headers) + if self._async_client is not None: + self._async_client.headers.update(headers) + return evolve(self, headers={**self._headers, **headers}) + + def with_cookies(self, cookies: Dict[str, str]) -> "AuthenticatedClient": + """Get a new client matching this one with additional cookies""" + if self._client is not None: + self._client.cookies.update(cookies) + if self._async_client is not None: + self._async_client.cookies.update(cookies) + return evolve(self, cookies={**self._cookies, **cookies}) + + def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient": + """Get a new client matching this one with a new timeout (in seconds)""" + if self._client is not None: + self._client.timeout = timeout + if self._async_client is not None: + self._async_client.timeout = timeout + return evolve(self, timeout=timeout) + + def set_httpx_client(self, client: httpx.Client) -> "AuthenticatedClient": + """Manually the underlying httpx.Client + + **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. + """ + self._client = client + return self + + def get_httpx_client(self) -> httpx.Client: + """Get the underlying httpx.Client, constructing a new one if not previously set""" + if self._client is None: + self._headers[self.auth_header_name] = f"{self.prefix} {self.token}" if self.prefix else self.token + self._client = httpx.Client( + base_url=self._base_url, + cookies=self._cookies, + headers=self._headers, + timeout=self._timeout, + verify=self._verify_ssl, + follow_redirects=self._follow_redirects, + **self._httpx_args, + ) + return self._client + + def __enter__(self) -> "AuthenticatedClient": + """Enter a context manager for self.client—you cannot enter twice (see httpx docs)""" + self.get_httpx_client().__enter__() + return self + + def __exit__(self, *args: Any, **kwargs: Any) -> None: + """Exit a context manager for internal httpx.Client (see httpx docs)""" + self.get_httpx_client().__exit__(*args, **kwargs) + + def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "AuthenticatedClient": + """Manually the underlying httpx.AsyncClient + + **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. + """ + self._async_client = async_client + return self + + def get_async_httpx_client(self) -> httpx.AsyncClient: + """Get the underlying httpx.AsyncClient, constructing a new one if not previously set""" + if self._async_client is None: + self._headers[self.auth_header_name] = f"{self.prefix} {self.token}" if self.prefix else self.token + self._async_client = httpx.AsyncClient( + base_url=self._base_url, + cookies=self._cookies, + headers=self._headers, + timeout=self._timeout, + verify=self._verify_ssl, + follow_redirects=self._follow_redirects, + **self._httpx_args, + ) + return self._async_client + + async def __aenter__(self) -> "AuthenticatedClient": + """Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)""" + await self.get_async_httpx_client().__aenter__() + return self + + async def __aexit__(self, *args: Any, **kwargs: Any) -> None: + """Exit a context manager for underlying httpx.AsyncClient (see httpx docs)""" + await self.get_async_httpx_client().__aexit__(*args, **kwargs) + diff --git a/exasol/saas/client/openapi/errors.py b/exasol/saas/client/openapi/errors.py new file mode 100644 index 0000000..b912123 --- /dev/null +++ b/exasol/saas/client/openapi/errors.py @@ -0,0 +1,14 @@ +""" Contains shared errors types that can be raised from API functions """ + +class UnexpectedStatus(Exception): + """Raised by api functions when the response status an undocumented status and Client.raise_on_unexpected_status is True""" + + def __init__(self, status_code: int, content: bytes): + self.status_code = status_code + self.content = content + + super().__init__( + f"Unexpected status code: {status_code}\n\nResponse content:\n{content.decode(errors='ignore')}" + ) + +__all__ = ["UnexpectedStatus"] diff --git a/exasol/saas/client/openapi/models/__init__.py b/exasol/saas/client/openapi/models/__init__.py new file mode 100644 index 0000000..f4fb5e0 --- /dev/null +++ b/exasol/saas/client/openapi/models/__init__.py @@ -0,0 +1,75 @@ +""" Contains all the data models used in inputs/outputs """ + +from .allowed_ip import AllowedIP +from .api_error import APIError +from .api_error_causes import APIErrorCauses +from .auto_stop import AutoStop +from .cluster import Cluster +from .cluster_overview import ClusterOverview +from .cluster_size import ClusterSize +from .connection_i_ps import ConnectionIPs +from .connections import Connections +from .create_allowed_ip import CreateAllowedIP +from .create_cluster import CreateCluster +from .create_database import CreateDatabase +from .database import Database +from .download_file import DownloadFile +from .file import File +from .get_usage_response_200 import GetUsageResponse200 +from .get_usage_type import GetUsageType +from .integrations import Integrations +from .patch_databases import PatchDatabases +from .patch_user import PatchUser +from .platform import Platform +from .profile import Profile +from .region import Region +from .scale_cluster import ScaleCluster +from .status import Status +from .update_allowed_ip import UpdateAllowedIP +from .update_cluster import UpdateCluster +from .update_database import UpdateDatabase +from .update_profile import UpdateProfile +from .upload_file import UploadFile +from .usage_cluster import UsageCluster +from .usage_database import UsageDatabase +from .user_database import UserDatabase +from .user_role import UserRole +from .user_status import UserStatus + +__all__ = ( + "AllowedIP", + "APIError", + "APIErrorCauses", + "AutoStop", + "Cluster", + "ClusterOverview", + "ClusterSize", + "ConnectionIPs", + "Connections", + "CreateAllowedIP", + "CreateCluster", + "CreateDatabase", + "Database", + "DownloadFile", + "File", + "GetUsageResponse200", + "GetUsageType", + "Integrations", + "PatchDatabases", + "PatchUser", + "Platform", + "Profile", + "Region", + "ScaleCluster", + "Status", + "UpdateAllowedIP", + "UpdateCluster", + "UpdateDatabase", + "UpdateProfile", + "UploadFile", + "UsageCluster", + "UsageDatabase", + "UserDatabase", + "UserRole", + "UserStatus", +) diff --git a/exasol/saas/client/openapi/models/allowed_ip.py b/exasol/saas/client/openapi/models/allowed_ip.py new file mode 100644 index 0000000..f48e69b --- /dev/null +++ b/exasol/saas/client/openapi/models/allowed_ip.py @@ -0,0 +1,124 @@ +import datetime +from typing import ( + TYPE_CHECKING, + Any, + BinaryIO, + Dict, + Optional, + TextIO, + Tuple, + Type, + TypeVar, + Union, + cast, +) + +from attrs import define as _attrs_define +from attrs import field as _attrs_field +from dateutil.parser import isoparse + +from ..types import ( + UNSET, + Unset, +) + +T = TypeVar("T", bound="AllowedIP") + + +@_attrs_define +class AllowedIP: + """ + Attributes: + id (str): + name (str): + cidr_ip (str): + created_at (datetime.datetime): + created_by (str): + deleted_by (Union[Unset, str]): + deleted_at (Union[Unset, datetime.datetime]): + """ + + id: str + name: str + cidr_ip: str + created_at: datetime.datetime + created_by: str + deleted_by: Union[Unset, str] = UNSET + deleted_at: Union[Unset, datetime.datetime] = UNSET + + + def to_dict(self) -> Dict[str, Any]: + id = self.id + + name = self.name + + cidr_ip = self.cidr_ip + + created_at = self.created_at.isoformat() + + created_by = self.created_by + + deleted_by = self.deleted_by + + deleted_at: Union[Unset, str] = UNSET + if not isinstance(self.deleted_at, Unset): + deleted_at = self.deleted_at.isoformat() + + + field_dict: Dict[str, Any] = {} + field_dict.update({ + "id": id, + "name": name, + "cidrIp": cidr_ip, + "createdAt": created_at, + "createdBy": created_by, + }) + if deleted_by is not UNSET: + field_dict["deletedBy"] = deleted_by + if deleted_at is not UNSET: + field_dict["deletedAt"] = deleted_at + + return field_dict + + + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + d = src_dict.copy() + id = d.pop("id") + + name = d.pop("name") + + cidr_ip = d.pop("cidrIp") + + created_at = isoparse(d.pop("createdAt")) + + + + + created_by = d.pop("createdBy") + + deleted_by = d.pop("deletedBy", UNSET) + + _deleted_at = d.pop("deletedAt", UNSET) + deleted_at: Union[Unset, datetime.datetime] + if isinstance(_deleted_at, Unset): + deleted_at = UNSET + else: + deleted_at = isoparse(_deleted_at) + + + + + allowed_ip = cls( + id=id, + name=name, + cidr_ip=cidr_ip, + created_at=created_at, + created_by=created_by, + deleted_by=deleted_by, + deleted_at=deleted_at, + ) + + return allowed_ip + diff --git a/exasol/saas/client/openapi/models/api_error.py b/exasol/saas/client/openapi/models/api_error.py new file mode 100644 index 0000000..543230d --- /dev/null +++ b/exasol/saas/client/openapi/models/api_error.py @@ -0,0 +1,134 @@ +import datetime +from typing import ( + TYPE_CHECKING, + Any, + BinaryIO, + Dict, + Optional, + TextIO, + Tuple, + Type, + TypeVar, + Union, + cast, +) + +from attrs import define as _attrs_define +from attrs import field as _attrs_field +from dateutil.parser import isoparse + +from ..types import ( + UNSET, + Unset, +) + +if TYPE_CHECKING: + from ..models.api_error_causes import APIErrorCauses + + + + + +T = TypeVar("T", bound="APIError") + + +@_attrs_define +class APIError: + """ + Attributes: + code (int): + message (str): + causes (Union[Unset, APIErrorCauses]): + request_id (Union[Unset, str]): + timestamp (Union[Unset, datetime.datetime]): + api_id (Union[Unset, str]): + """ + + code: int + message: str + causes: Union[Unset, 'APIErrorCauses'] = UNSET + request_id: Union[Unset, str] = UNSET + timestamp: Union[Unset, datetime.datetime] = UNSET + api_id: Union[Unset, str] = UNSET + + + def to_dict(self) -> Dict[str, Any]: + from ..models.api_error_causes import APIErrorCauses + code = self.code + + message = self.message + + causes: Union[Unset, Dict[str, Any]] = UNSET + if not isinstance(self.causes, Unset): + causes = self.causes.to_dict() + + request_id = self.request_id + + timestamp: Union[Unset, str] = UNSET + if not isinstance(self.timestamp, Unset): + timestamp = self.timestamp.isoformat() + + api_id = self.api_id + + + field_dict: Dict[str, Any] = {} + field_dict.update({ + "code": code, + "message": message, + }) + if causes is not UNSET: + field_dict["causes"] = causes + if request_id is not UNSET: + field_dict["requestID"] = request_id + if timestamp is not UNSET: + field_dict["timestamp"] = timestamp + if api_id is not UNSET: + field_dict["apiID"] = api_id + + return field_dict + + + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.api_error_causes import APIErrorCauses + d = src_dict.copy() + code = d.pop("code") + + message = d.pop("message") + + _causes = d.pop("causes", UNSET) + causes: Union[Unset, APIErrorCauses] + if isinstance(_causes, Unset): + causes = UNSET + else: + causes = APIErrorCauses.from_dict(_causes) + + + + + request_id = d.pop("requestID", UNSET) + + _timestamp = d.pop("timestamp", UNSET) + timestamp: Union[Unset, datetime.datetime] + if isinstance(_timestamp, Unset): + timestamp = UNSET + else: + timestamp = isoparse(_timestamp) + + + + + api_id = d.pop("apiID", UNSET) + + api_error = cls( + code=code, + message=message, + causes=causes, + request_id=request_id, + timestamp=timestamp, + api_id=api_id, + ) + + return api_error + diff --git a/exasol/saas/client/openapi/models/api_error_causes.py b/exasol/saas/client/openapi/models/api_error_causes.py new file mode 100644 index 0000000..2e115bf --- /dev/null +++ b/exasol/saas/client/openapi/models/api_error_causes.py @@ -0,0 +1,66 @@ +from typing import ( + TYPE_CHECKING, + Any, + BinaryIO, + Dict, + List, + Optional, + TextIO, + Tuple, + Type, + TypeVar, +) + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import ( + UNSET, + Unset, +) + +T = TypeVar("T", bound="APIErrorCauses") + + +@_attrs_define +class APIErrorCauses: + """ + """ + + additional_properties: Dict[str, bool] = _attrs_field(init=False, factory=dict) + + + def to_dict(self) -> Dict[str, Any]: + + field_dict: Dict[str, Any] = {} + field_dict.update(self.additional_properties) + + return field_dict + + + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + d = src_dict.copy() + api_error_causes = cls( + ) + + + api_error_causes.additional_properties = d + return api_error_causes + + @property + def additional_keys(self) -> List[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> bool: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: bool) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/exasol/saas/client/openapi/models/auto_stop.py b/exasol/saas/client/openapi/models/auto_stop.py new file mode 100644 index 0000000..1eb0ce5 --- /dev/null +++ b/exasol/saas/client/openapi/models/auto_stop.py @@ -0,0 +1,65 @@ +from typing import ( + TYPE_CHECKING, + Any, + BinaryIO, + Dict, + Optional, + TextIO, + Tuple, + Type, + TypeVar, +) + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import ( + UNSET, + Unset, +) + +T = TypeVar("T", bound="AutoStop") + + +@_attrs_define +class AutoStop: + """ + Attributes: + enabled (bool): + idle_time (int): + """ + + enabled: bool + idle_time: int + + + def to_dict(self) -> Dict[str, Any]: + enabled = self.enabled + + idle_time = self.idle_time + + + field_dict: Dict[str, Any] = {} + field_dict.update({ + "enabled": enabled, + "idleTime": idle_time, + }) + + return field_dict + + + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + d = src_dict.copy() + enabled = d.pop("enabled") + + idle_time = d.pop("idleTime") + + auto_stop = cls( + enabled=enabled, + idle_time=idle_time, + ) + + return auto_stop + diff --git a/exasol/saas/client/openapi/models/cluster.py b/exasol/saas/client/openapi/models/cluster.py new file mode 100644 index 0000000..e6c86dc --- /dev/null +++ b/exasol/saas/client/openapi/models/cluster.py @@ -0,0 +1,172 @@ +import datetime +from typing import ( + TYPE_CHECKING, + Any, + BinaryIO, + Dict, + Optional, + TextIO, + Tuple, + Type, + TypeVar, + Union, + cast, +) + +from attrs import define as _attrs_define +from attrs import field as _attrs_field +from dateutil.parser import isoparse + +from ..models.status import Status +from ..types import ( + UNSET, + Unset, +) + +if TYPE_CHECKING: + from ..models.auto_stop import AutoStop + + + + + +T = TypeVar("T", bound="Cluster") + + +@_attrs_define +class Cluster: + """ + Attributes: + status (Status): + id (str): + name (str): + size (str): + created_at (datetime.datetime): + created_by (str): + main_cluster (bool): + deleted_at (Union[Unset, datetime.datetime]): + deleted_by (Union[Unset, str]): + auto_stop (Union[Unset, AutoStop]): + """ + + status: Status + id: str + name: str + size: str + created_at: datetime.datetime + created_by: str + main_cluster: bool + deleted_at: Union[Unset, datetime.datetime] = UNSET + deleted_by: Union[Unset, str] = UNSET + auto_stop: Union[Unset, 'AutoStop'] = UNSET + + + def to_dict(self) -> Dict[str, Any]: + from ..models.auto_stop import AutoStop + status = self.status.value + + id = self.id + + name = self.name + + size = self.size + + created_at = self.created_at.isoformat() + + created_by = self.created_by + + main_cluster = self.main_cluster + + deleted_at: Union[Unset, str] = UNSET + if not isinstance(self.deleted_at, Unset): + deleted_at = self.deleted_at.isoformat() + + deleted_by = self.deleted_by + + auto_stop: Union[Unset, Dict[str, Any]] = UNSET + if not isinstance(self.auto_stop, Unset): + auto_stop = self.auto_stop.to_dict() + + + field_dict: Dict[str, Any] = {} + field_dict.update({ + "status": status, + "id": id, + "name": name, + "size": size, + "createdAt": created_at, + "createdBy": created_by, + "mainCluster": main_cluster, + }) + if deleted_at is not UNSET: + field_dict["deletedAt"] = deleted_at + if deleted_by is not UNSET: + field_dict["deletedBy"] = deleted_by + if auto_stop is not UNSET: + field_dict["autoStop"] = auto_stop + + return field_dict + + + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.auto_stop import AutoStop + d = src_dict.copy() + status = Status(d.pop("status")) + + + + + id = d.pop("id") + + name = d.pop("name") + + size = d.pop("size") + + created_at = isoparse(d.pop("createdAt")) + + + + + created_by = d.pop("createdBy") + + main_cluster = d.pop("mainCluster") + + _deleted_at = d.pop("deletedAt", UNSET) + deleted_at: Union[Unset, datetime.datetime] + if isinstance(_deleted_at, Unset): + deleted_at = UNSET + else: + deleted_at = isoparse(_deleted_at) + + + + + deleted_by = d.pop("deletedBy", UNSET) + + _auto_stop = d.pop("autoStop", UNSET) + auto_stop: Union[Unset, AutoStop] + if isinstance(_auto_stop, Unset): + auto_stop = UNSET + else: + auto_stop = AutoStop.from_dict(_auto_stop) + + + + + cluster = cls( + status=status, + id=id, + name=name, + size=size, + created_at=created_at, + created_by=created_by, + main_cluster=main_cluster, + deleted_at=deleted_at, + deleted_by=deleted_by, + auto_stop=auto_stop, + ) + + return cluster + diff --git a/exasol/saas/client/openapi/models/cluster_overview.py b/exasol/saas/client/openapi/models/cluster_overview.py new file mode 100644 index 0000000..ac40686 --- /dev/null +++ b/exasol/saas/client/openapi/models/cluster_overview.py @@ -0,0 +1,65 @@ +from typing import ( + TYPE_CHECKING, + Any, + BinaryIO, + Dict, + Optional, + TextIO, + Tuple, + Type, + TypeVar, +) + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import ( + UNSET, + Unset, +) + +T = TypeVar("T", bound="ClusterOverview") + + +@_attrs_define +class ClusterOverview: + """ + Attributes: + total (int): + running (int): + """ + + total: int + running: int + + + def to_dict(self) -> Dict[str, Any]: + total = self.total + + running = self.running + + + field_dict: Dict[str, Any] = {} + field_dict.update({ + "total": total, + "running": running, + }) + + return field_dict + + + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + d = src_dict.copy() + total = d.pop("total") + + running = d.pop("running") + + cluster_overview = cls( + total=total, + running=running, + ) + + return cluster_overview + diff --git a/exasol/saas/client/openapi/models/cluster_size.py b/exasol/saas/client/openapi/models/cluster_size.py new file mode 100644 index 0000000..542616c --- /dev/null +++ b/exasol/saas/client/openapi/models/cluster_size.py @@ -0,0 +1,97 @@ +from typing import ( + TYPE_CHECKING, + Any, + BinaryIO, + Dict, + Optional, + TextIO, + Tuple, + Type, + TypeVar, +) + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import ( + UNSET, + Unset, +) + +T = TypeVar("T", bound="ClusterSize") + + +@_attrs_define +class ClusterSize: + """ + Attributes: + size (str): + price (float): + vcpu (float): + ram (float): + is_default (bool): + name (str): + """ + + size: str + price: float + vcpu: float + ram: float + is_default: bool + name: str + + + def to_dict(self) -> Dict[str, Any]: + size = self.size + + price = self.price + + vcpu = self.vcpu + + ram = self.ram + + is_default = self.is_default + + name = self.name + + + field_dict: Dict[str, Any] = {} + field_dict.update({ + "size": size, + "price": price, + "vcpu": vcpu, + "ram": ram, + "isDefault": is_default, + "name": name, + }) + + return field_dict + + + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + d = src_dict.copy() + size = d.pop("size") + + price = d.pop("price") + + vcpu = d.pop("vcpu") + + ram = d.pop("ram") + + is_default = d.pop("isDefault") + + name = d.pop("name") + + cluster_size = cls( + size=size, + price=price, + vcpu=vcpu, + ram=ram, + is_default=is_default, + name=name, + ) + + return cluster_size + diff --git a/exasol/saas/client/openapi/models/connection_i_ps.py b/exasol/saas/client/openapi/models/connection_i_ps.py new file mode 100644 index 0000000..0157b00 --- /dev/null +++ b/exasol/saas/client/openapi/models/connection_i_ps.py @@ -0,0 +1,77 @@ +from typing import ( + TYPE_CHECKING, + Any, + BinaryIO, + Dict, + List, + Optional, + TextIO, + Tuple, + Type, + TypeVar, + cast, +) + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import ( + UNSET, + Unset, +) + +T = TypeVar("T", bound="ConnectionIPs") + + +@_attrs_define +class ConnectionIPs: + """ + Attributes: + private (List[str]): + public (List[str]): + """ + + private: List[str] + public: List[str] + + + def to_dict(self) -> Dict[str, Any]: + private = self.private + + + + + + public = self.public + + + + + + + field_dict: Dict[str, Any] = {} + field_dict.update({ + "private": private, + "public": public, + }) + + return field_dict + + + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + d = src_dict.copy() + private = cast(List[str], d.pop("private")) + + + public = cast(List[str], d.pop("public")) + + + connection_i_ps = cls( + private=private, + public=public, + ) + + return connection_i_ps + diff --git a/exasol/saas/client/openapi/models/connections.py b/exasol/saas/client/openapi/models/connections.py new file mode 100644 index 0000000..5390324 --- /dev/null +++ b/exasol/saas/client/openapi/models/connections.py @@ -0,0 +1,102 @@ +from typing import ( + TYPE_CHECKING, + Any, + BinaryIO, + Dict, + Optional, + TextIO, + Tuple, + Type, + TypeVar, + cast, +) + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import ( + UNSET, + Unset, +) + +if TYPE_CHECKING: + from ..models.connection_i_ps import ConnectionIPs + + + + + +T = TypeVar("T", bound="Connections") + + +@_attrs_define +class Connections: + """ + Attributes: + dns (str): + port (int): + jdbc (str): + ips (ConnectionIPs): + db_username (str): + """ + + dns: str + port: int + jdbc: str + ips: 'ConnectionIPs' + db_username: str + + + def to_dict(self) -> Dict[str, Any]: + from ..models.connection_i_ps import ConnectionIPs + dns = self.dns + + port = self.port + + jdbc = self.jdbc + + ips = self.ips.to_dict() + + db_username = self.db_username + + + field_dict: Dict[str, Any] = {} + field_dict.update({ + "dns": dns, + "port": port, + "jdbc": jdbc, + "ips": ips, + "dbUsername": db_username, + }) + + return field_dict + + + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.connection_i_ps import ConnectionIPs + d = src_dict.copy() + dns = d.pop("dns") + + port = d.pop("port") + + jdbc = d.pop("jdbc") + + ips = ConnectionIPs.from_dict(d.pop("ips")) + + + + + db_username = d.pop("dbUsername") + + connections = cls( + dns=dns, + port=port, + jdbc=jdbc, + ips=ips, + db_username=db_username, + ) + + return connections + diff --git a/exasol/saas/client/openapi/models/create_allowed_ip.py b/exasol/saas/client/openapi/models/create_allowed_ip.py new file mode 100644 index 0000000..f4df090 --- /dev/null +++ b/exasol/saas/client/openapi/models/create_allowed_ip.py @@ -0,0 +1,65 @@ +from typing import ( + TYPE_CHECKING, + Any, + BinaryIO, + Dict, + Optional, + TextIO, + Tuple, + Type, + TypeVar, +) + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import ( + UNSET, + Unset, +) + +T = TypeVar("T", bound="CreateAllowedIP") + + +@_attrs_define +class CreateAllowedIP: + """ + Attributes: + name (str): + cidr_ip (str): + """ + + name: str + cidr_ip: str + + + def to_dict(self) -> Dict[str, Any]: + name = self.name + + cidr_ip = self.cidr_ip + + + field_dict: Dict[str, Any] = {} + field_dict.update({ + "name": name, + "cidrIp": cidr_ip, + }) + + return field_dict + + + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + d = src_dict.copy() + name = d.pop("name") + + cidr_ip = d.pop("cidrIp") + + create_allowed_ip = cls( + name=name, + cidr_ip=cidr_ip, + ) + + return create_allowed_ip + diff --git a/exasol/saas/client/openapi/models/create_cluster.py b/exasol/saas/client/openapi/models/create_cluster.py new file mode 100644 index 0000000..315592e --- /dev/null +++ b/exasol/saas/client/openapi/models/create_cluster.py @@ -0,0 +1,95 @@ +from typing import ( + TYPE_CHECKING, + Any, + BinaryIO, + Dict, + Optional, + TextIO, + Tuple, + Type, + TypeVar, + Union, + cast, +) + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import ( + UNSET, + Unset, +) + +if TYPE_CHECKING: + from ..models.auto_stop import AutoStop + + + + + +T = TypeVar("T", bound="CreateCluster") + + +@_attrs_define +class CreateCluster: + """ + Attributes: + name (str): + size (str): + auto_stop (Union[Unset, AutoStop]): + """ + + name: str + size: str + auto_stop: Union[Unset, 'AutoStop'] = UNSET + + + def to_dict(self) -> Dict[str, Any]: + from ..models.auto_stop import AutoStop + name = self.name + + size = self.size + + auto_stop: Union[Unset, Dict[str, Any]] = UNSET + if not isinstance(self.auto_stop, Unset): + auto_stop = self.auto_stop.to_dict() + + + field_dict: Dict[str, Any] = {} + field_dict.update({ + "name": name, + "size": size, + }) + if auto_stop is not UNSET: + field_dict["autoStop"] = auto_stop + + return field_dict + + + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.auto_stop import AutoStop + d = src_dict.copy() + name = d.pop("name") + + size = d.pop("size") + + _auto_stop = d.pop("autoStop", UNSET) + auto_stop: Union[Unset, AutoStop] + if isinstance(_auto_stop, Unset): + auto_stop = UNSET + else: + auto_stop = AutoStop.from_dict(_auto_stop) + + + + + create_cluster = cls( + name=name, + size=size, + auto_stop=auto_stop, + ) + + return create_cluster + diff --git a/exasol/saas/client/openapi/models/create_database.py b/exasol/saas/client/openapi/models/create_database.py new file mode 100644 index 0000000..0175ccb --- /dev/null +++ b/exasol/saas/client/openapi/models/create_database.py @@ -0,0 +1,94 @@ +from typing import ( + TYPE_CHECKING, + Any, + BinaryIO, + Dict, + Optional, + TextIO, + Tuple, + Type, + TypeVar, + cast, +) + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import ( + UNSET, + Unset, +) + +if TYPE_CHECKING: + from ..models.create_cluster import CreateCluster + + + + + +T = TypeVar("T", bound="CreateDatabase") + + +@_attrs_define +class CreateDatabase: + """ + Attributes: + name (str): + initial_cluster (CreateCluster): + provider (str): + region (str): + """ + + name: str + initial_cluster: 'CreateCluster' + provider: str + region: str + + + def to_dict(self) -> Dict[str, Any]: + from ..models.create_cluster import CreateCluster + name = self.name + + initial_cluster = self.initial_cluster.to_dict() + + provider = self.provider + + region = self.region + + + field_dict: Dict[str, Any] = {} + field_dict.update({ + "name": name, + "initialCluster": initial_cluster, + "provider": provider, + "region": region, + }) + + return field_dict + + + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.create_cluster import CreateCluster + d = src_dict.copy() + name = d.pop("name") + + initial_cluster = CreateCluster.from_dict(d.pop("initialCluster")) + + + + + provider = d.pop("provider") + + region = d.pop("region") + + create_database = cls( + name=name, + initial_cluster=initial_cluster, + provider=provider, + region=region, + ) + + return create_database + diff --git a/exasol/saas/client/openapi/models/database.py b/exasol/saas/client/openapi/models/database.py new file mode 100644 index 0000000..b051a49 --- /dev/null +++ b/exasol/saas/client/openapi/models/database.py @@ -0,0 +1,194 @@ +import datetime +from typing import ( + TYPE_CHECKING, + Any, + BinaryIO, + Dict, + List, + Optional, + TextIO, + Tuple, + Type, + TypeVar, + Union, + cast, +) + +from attrs import define as _attrs_define +from attrs import field as _attrs_field +from dateutil.parser import isoparse + +from ..models.status import Status +from ..types import ( + UNSET, + Unset, +) + +if TYPE_CHECKING: + from ..models.cluster_overview import ClusterOverview + from ..models.integrations import Integrations + + + + + +T = TypeVar("T", bound="Database") + + +@_attrs_define +class Database: + """ + Attributes: + status (Status): + id (str): + name (str): + clusters (ClusterOverview): + provider (str): + region (str): + created_at (datetime.datetime): + created_by (str): + integrations (Union[Unset, List['Integrations']]): + deleted_by (Union[Unset, str]): + deleted_at (Union[Unset, datetime.datetime]): + """ + + status: Status + id: str + name: str + clusters: 'ClusterOverview' + provider: str + region: str + created_at: datetime.datetime + created_by: str + integrations: Union[Unset, List['Integrations']] = UNSET + deleted_by: Union[Unset, str] = UNSET + deleted_at: Union[Unset, datetime.datetime] = UNSET + + + def to_dict(self) -> Dict[str, Any]: + from ..models.cluster_overview import ClusterOverview + from ..models.integrations import Integrations + status = self.status.value + + id = self.id + + name = self.name + + clusters = self.clusters.to_dict() + + provider = self.provider + + region = self.region + + created_at = self.created_at.isoformat() + + created_by = self.created_by + + integrations: Union[Unset, List[Dict[str, Any]]] = UNSET + if not isinstance(self.integrations, Unset): + integrations = [] + for integrations_item_data in self.integrations: + integrations_item = integrations_item_data.to_dict() + integrations.append(integrations_item) + + + + + + deleted_by = self.deleted_by + + deleted_at: Union[Unset, str] = UNSET + if not isinstance(self.deleted_at, Unset): + deleted_at = self.deleted_at.isoformat() + + + field_dict: Dict[str, Any] = {} + field_dict.update({ + "status": status, + "id": id, + "name": name, + "clusters": clusters, + "provider": provider, + "region": region, + "createdAt": created_at, + "createdBy": created_by, + }) + if integrations is not UNSET: + field_dict["integrations"] = integrations + if deleted_by is not UNSET: + field_dict["deletedBy"] = deleted_by + if deleted_at is not UNSET: + field_dict["deletedAt"] = deleted_at + + return field_dict + + + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.cluster_overview import ClusterOverview + from ..models.integrations import Integrations + d = src_dict.copy() + status = Status(d.pop("status")) + + + + + id = d.pop("id") + + name = d.pop("name") + + clusters = ClusterOverview.from_dict(d.pop("clusters")) + + + + + provider = d.pop("provider") + + region = d.pop("region") + + created_at = isoparse(d.pop("createdAt")) + + + + + created_by = d.pop("createdBy") + + integrations = [] + _integrations = d.pop("integrations", UNSET) + for integrations_item_data in (_integrations or []): + integrations_item = Integrations.from_dict(integrations_item_data) + + + + integrations.append(integrations_item) + + + deleted_by = d.pop("deletedBy", UNSET) + + _deleted_at = d.pop("deletedAt", UNSET) + deleted_at: Union[Unset, datetime.datetime] + if isinstance(_deleted_at, Unset): + deleted_at = UNSET + else: + deleted_at = isoparse(_deleted_at) + + + + + database = cls( + status=status, + id=id, + name=name, + clusters=clusters, + provider=provider, + region=region, + created_at=created_at, + created_by=created_by, + integrations=integrations, + deleted_by=deleted_by, + deleted_at=deleted_at, + ) + + return database + diff --git a/exasol/saas/client/openapi/models/download_file.py b/exasol/saas/client/openapi/models/download_file.py new file mode 100644 index 0000000..fba6252 --- /dev/null +++ b/exasol/saas/client/openapi/models/download_file.py @@ -0,0 +1,57 @@ +from typing import ( + TYPE_CHECKING, + Any, + BinaryIO, + Dict, + Optional, + TextIO, + Tuple, + Type, + TypeVar, +) + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import ( + UNSET, + Unset, +) + +T = TypeVar("T", bound="DownloadFile") + + +@_attrs_define +class DownloadFile: + """ + Attributes: + url (str): + """ + + url: str + + + def to_dict(self) -> Dict[str, Any]: + url = self.url + + + field_dict: Dict[str, Any] = {} + field_dict.update({ + "url": url, + }) + + return field_dict + + + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + d = src_dict.copy() + url = d.pop("url") + + download_file = cls( + url=url, + ) + + return download_file + diff --git a/exasol/saas/client/openapi/models/file.py b/exasol/saas/client/openapi/models/file.py new file mode 100644 index 0000000..34e256c --- /dev/null +++ b/exasol/saas/client/openapi/models/file.py @@ -0,0 +1,124 @@ +import datetime +from typing import ( + TYPE_CHECKING, + Any, + BinaryIO, + Dict, + List, + Optional, + TextIO, + Tuple, + Type, + TypeVar, + Union, + cast, +) + +from attrs import define as _attrs_define +from attrs import field as _attrs_field +from dateutil.parser import isoparse + +from ..types import ( + UNSET, + Unset, +) + +T = TypeVar("T", bound="File") + + +@_attrs_define +class File: + """ + Attributes: + name (str): + type (str): + path (str): + last_modified (datetime.datetime): + size (Union[Unset, int]): + children (Union[Unset, List['File']]): + """ + + name: str + type: str + path: str + last_modified: datetime.datetime + size: Union[Unset, int] = UNSET + children: Union[Unset, List['File']] = UNSET + + + def to_dict(self) -> Dict[str, Any]: + name = self.name + + type = self.type + + path = self.path + + last_modified = self.last_modified.isoformat() + + size = self.size + + children: Union[Unset, List[Dict[str, Any]]] = UNSET + if not isinstance(self.children, Unset): + children = [] + for children_item_data in self.children: + children_item = children_item_data.to_dict() + children.append(children_item) + + + + + + + field_dict: Dict[str, Any] = {} + field_dict.update({ + "name": name, + "type": type, + "path": path, + "lastModified": last_modified, + }) + if size is not UNSET: + field_dict["size"] = size + if children is not UNSET: + field_dict["children"] = children + + return field_dict + + + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + d = src_dict.copy() + name = d.pop("name") + + type = d.pop("type") + + path = d.pop("path") + + last_modified = isoparse(d.pop("lastModified")) + + + + + size = d.pop("size", UNSET) + + children = [] + _children = d.pop("children", UNSET) + for children_item_data in (_children or []): + children_item = File.from_dict(children_item_data) + + + + children.append(children_item) + + + file = cls( + name=name, + type=type, + path=path, + last_modified=last_modified, + size=size, + children=children, + ) + + return file + diff --git a/exasol/saas/client/openapi/models/get_usage_response_200.py b/exasol/saas/client/openapi/models/get_usage_response_200.py new file mode 100644 index 0000000..358405f --- /dev/null +++ b/exasol/saas/client/openapi/models/get_usage_response_200.py @@ -0,0 +1,97 @@ +from typing import ( + TYPE_CHECKING, + Any, + BinaryIO, + Dict, + List, + Optional, + TextIO, + Tuple, + Type, + TypeVar, + cast, +) + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import ( + UNSET, + Unset, +) + +if TYPE_CHECKING: + from ..models.usage_database import UsageDatabase + + + + + +T = TypeVar("T", bound="GetUsageResponse200") + + +@_attrs_define +class GetUsageResponse200: + """ + """ + + additional_properties: Dict[str, List['UsageDatabase']] = _attrs_field(init=False, factory=dict) + + + def to_dict(self) -> Dict[str, Any]: + from ..models.usage_database import UsageDatabase + + field_dict: Dict[str, Any] = {} + for prop_name, prop in self.additional_properties.items(): + field_dict[prop_name] = [] + for additional_property_item_data in prop: + additional_property_item = additional_property_item_data.to_dict() + field_dict[prop_name].append(additional_property_item) + + + + + + return field_dict + + + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.usage_database import UsageDatabase + d = src_dict.copy() + get_usage_response_200 = cls( + ) + + + additional_properties = {} + for prop_name, prop_dict in d.items(): + additional_property = [] + _additional_property = prop_dict + for additional_property_item_data in (_additional_property): + additional_property_item = UsageDatabase.from_dict(additional_property_item_data) + + + + additional_property.append(additional_property_item) + + additional_properties[prop_name] = additional_property + + get_usage_response_200.additional_properties = additional_properties + return get_usage_response_200 + + @property + def additional_keys(self) -> List[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> List['UsageDatabase']: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: List['UsageDatabase']) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/exasol/saas/client/openapi/models/get_usage_type.py b/exasol/saas/client/openapi/models/get_usage_type.py new file mode 100644 index 0000000..723f200 --- /dev/null +++ b/exasol/saas/client/openapi/models/get_usage_type.py @@ -0,0 +1,9 @@ +from enum import Enum + + +class GetUsageType(str, Enum): + CSV = "csv" + JSON = "json" + + def __str__(self) -> str: + return str(self.value) diff --git a/exasol/saas/client/openapi/models/integrations.py b/exasol/saas/client/openapi/models/integrations.py new file mode 100644 index 0000000..9ae0f40 --- /dev/null +++ b/exasol/saas/client/openapi/models/integrations.py @@ -0,0 +1,75 @@ +from typing import ( + TYPE_CHECKING, + Any, + BinaryIO, + Dict, + Optional, + TextIO, + Tuple, + Type, + TypeVar, + Union, +) + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import ( + UNSET, + Unset, +) + +T = TypeVar("T", bound="Integrations") + + +@_attrs_define +class Integrations: + """ + Attributes: + id (str): + name (str): + url (Union[Unset, str]): + """ + + id: str + name: str + url: Union[Unset, str] = UNSET + + + def to_dict(self) -> Dict[str, Any]: + id = self.id + + name = self.name + + url = self.url + + + field_dict: Dict[str, Any] = {} + field_dict.update({ + "id": id, + "name": name, + }) + if url is not UNSET: + field_dict["url"] = url + + return field_dict + + + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + d = src_dict.copy() + id = d.pop("id") + + name = d.pop("name") + + url = d.pop("url", UNSET) + + integrations = cls( + id=id, + name=name, + url=url, + ) + + return integrations + diff --git a/exasol/saas/client/openapi/models/patch_databases.py b/exasol/saas/client/openapi/models/patch_databases.py new file mode 100644 index 0000000..b881788 --- /dev/null +++ b/exasol/saas/client/openapi/models/patch_databases.py @@ -0,0 +1,77 @@ +from typing import ( + TYPE_CHECKING, + Any, + BinaryIO, + Dict, + List, + Optional, + TextIO, + Tuple, + Type, + TypeVar, + cast, +) + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import ( + UNSET, + Unset, +) + +T = TypeVar("T", bound="PatchDatabases") + + +@_attrs_define +class PatchDatabases: + """ + Attributes: + delete (List[str]): + add (List[str]): + """ + + delete: List[str] + add: List[str] + + + def to_dict(self) -> Dict[str, Any]: + delete = self.delete + + + + + + add = self.add + + + + + + + field_dict: Dict[str, Any] = {} + field_dict.update({ + "delete": delete, + "add": add, + }) + + return field_dict + + + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + d = src_dict.copy() + delete = cast(List[str], d.pop("delete")) + + + add = cast(List[str], d.pop("add")) + + + patch_databases = cls( + delete=delete, + add=add, + ) + + return patch_databases + diff --git a/exasol/saas/client/openapi/models/patch_user.py b/exasol/saas/client/openapi/models/patch_user.py new file mode 100644 index 0000000..6c730ea --- /dev/null +++ b/exasol/saas/client/openapi/models/patch_user.py @@ -0,0 +1,97 @@ +from typing import ( + TYPE_CHECKING, + Any, + BinaryIO, + Dict, + Optional, + TextIO, + Tuple, + Type, + TypeVar, + Union, + cast, +) + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import ( + UNSET, + Unset, +) + +if TYPE_CHECKING: + from ..models.patch_databases import PatchDatabases + + + + + +T = TypeVar("T", bound="PatchUser") + + +@_attrs_define +class PatchUser: + """ + Attributes: + role_id (Union[Unset, str]): + databases (Union[Unset, PatchDatabases]): + db_username (Union[Unset, str]): + """ + + role_id: Union[Unset, str] = UNSET + databases: Union[Unset, 'PatchDatabases'] = UNSET + db_username: Union[Unset, str] = UNSET + + + def to_dict(self) -> Dict[str, Any]: + from ..models.patch_databases import PatchDatabases + role_id = self.role_id + + databases: Union[Unset, Dict[str, Any]] = UNSET + if not isinstance(self.databases, Unset): + databases = self.databases.to_dict() + + db_username = self.db_username + + + field_dict: Dict[str, Any] = {} + field_dict.update({ + }) + if role_id is not UNSET: + field_dict["roleID"] = role_id + if databases is not UNSET: + field_dict["databases"] = databases + if db_username is not UNSET: + field_dict["dbUsername"] = db_username + + return field_dict + + + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.patch_databases import PatchDatabases + d = src_dict.copy() + role_id = d.pop("roleID", UNSET) + + _databases = d.pop("databases", UNSET) + databases: Union[Unset, PatchDatabases] + if isinstance(_databases, Unset): + databases = UNSET + else: + databases = PatchDatabases.from_dict(_databases) + + + + + db_username = d.pop("dbUsername", UNSET) + + patch_user = cls( + role_id=role_id, + databases=databases, + db_username=db_username, + ) + + return patch_user + diff --git a/exasol/saas/client/openapi/models/platform.py b/exasol/saas/client/openapi/models/platform.py new file mode 100644 index 0000000..f6f6e9e --- /dev/null +++ b/exasol/saas/client/openapi/models/platform.py @@ -0,0 +1,65 @@ +from typing import ( + TYPE_CHECKING, + Any, + BinaryIO, + Dict, + Optional, + TextIO, + Tuple, + Type, + TypeVar, +) + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import ( + UNSET, + Unset, +) + +T = TypeVar("T", bound="Platform") + + +@_attrs_define +class Platform: + """ + Attributes: + id (str): + name (str): + """ + + id: str + name: str + + + def to_dict(self) -> Dict[str, Any]: + id = self.id + + name = self.name + + + field_dict: Dict[str, Any] = {} + field_dict.update({ + "id": id, + "name": name, + }) + + return field_dict + + + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + d = src_dict.copy() + id = d.pop("id") + + name = d.pop("name") + + platform = cls( + id=id, + name=name, + ) + + return platform + diff --git a/exasol/saas/client/openapi/models/profile.py b/exasol/saas/client/openapi/models/profile.py new file mode 100644 index 0000000..27e0e7a --- /dev/null +++ b/exasol/saas/client/openapi/models/profile.py @@ -0,0 +1,197 @@ +import datetime +from typing import ( + TYPE_CHECKING, + Any, + BinaryIO, + Dict, + List, + Optional, + TextIO, + Tuple, + Type, + TypeVar, + Union, + cast, +) + +from attrs import define as _attrs_define +from attrs import field as _attrs_field +from dateutil.parser import isoparse + +from ..models.user_status import UserStatus +from ..types import ( + UNSET, + Unset, +) + +if TYPE_CHECKING: + from ..models.user_database import UserDatabase + from ..models.user_role import UserRole + + + + + +T = TypeVar("T", bound="Profile") + + +@_attrs_define +class Profile: + """ + Attributes: + email (str): + id (str): + created_at (datetime.datetime): + created_by (str): + status (UserStatus): + roles (List['UserRole']): + is_deletable (bool): + first_name (Union[Unset, str]): + last_name (Union[Unset, str]): + databases (Union[Unset, List['UserDatabase']]): + db_username (Union[Unset, str]): + """ + + email: str + id: str + created_at: datetime.datetime + created_by: str + status: UserStatus + roles: List['UserRole'] + is_deletable: bool + first_name: Union[Unset, str] = UNSET + last_name: Union[Unset, str] = UNSET + databases: Union[Unset, List['UserDatabase']] = UNSET + db_username: Union[Unset, str] = UNSET + + + def to_dict(self) -> Dict[str, Any]: + from ..models.user_database import UserDatabase + from ..models.user_role import UserRole + email = self.email + + id = self.id + + created_at = self.created_at.isoformat() + + created_by = self.created_by + + status = self.status.value + + roles = [] + for roles_item_data in self.roles: + roles_item = roles_item_data.to_dict() + roles.append(roles_item) + + + + + + is_deletable = self.is_deletable + + first_name = self.first_name + + last_name = self.last_name + + databases: Union[Unset, List[Dict[str, Any]]] = UNSET + if not isinstance(self.databases, Unset): + databases = [] + for databases_item_data in self.databases: + databases_item = databases_item_data.to_dict() + databases.append(databases_item) + + + + + + db_username = self.db_username + + + field_dict: Dict[str, Any] = {} + field_dict.update({ + "email": email, + "id": id, + "createdAt": created_at, + "createdBy": created_by, + "status": status, + "roles": roles, + "isDeletable": is_deletable, + }) + if first_name is not UNSET: + field_dict["firstName"] = first_name + if last_name is not UNSET: + field_dict["lastName"] = last_name + if databases is not UNSET: + field_dict["databases"] = databases + if db_username is not UNSET: + field_dict["dbUsername"] = db_username + + return field_dict + + + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.user_database import UserDatabase + from ..models.user_role import UserRole + d = src_dict.copy() + email = d.pop("email") + + id = d.pop("id") + + created_at = isoparse(d.pop("createdAt")) + + + + + created_by = d.pop("createdBy") + + status = UserStatus(d.pop("status")) + + + + + roles = [] + _roles = d.pop("roles") + for roles_item_data in (_roles): + roles_item = UserRole.from_dict(roles_item_data) + + + + roles.append(roles_item) + + + is_deletable = d.pop("isDeletable") + + first_name = d.pop("firstName", UNSET) + + last_name = d.pop("lastName", UNSET) + + databases = [] + _databases = d.pop("databases", UNSET) + for databases_item_data in (_databases or []): + databases_item = UserDatabase.from_dict(databases_item_data) + + + + databases.append(databases_item) + + + db_username = d.pop("dbUsername", UNSET) + + profile = cls( + email=email, + id=id, + created_at=created_at, + created_by=created_by, + status=status, + roles=roles, + is_deletable=is_deletable, + first_name=first_name, + last_name=last_name, + databases=databases, + db_username=db_username, + ) + + return profile + diff --git a/exasol/saas/client/openapi/models/region.py b/exasol/saas/client/openapi/models/region.py new file mode 100644 index 0000000..9895672 --- /dev/null +++ b/exasol/saas/client/openapi/models/region.py @@ -0,0 +1,81 @@ +from typing import ( + TYPE_CHECKING, + Any, + BinaryIO, + Dict, + Optional, + TextIO, + Tuple, + Type, + TypeVar, +) + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import ( + UNSET, + Unset, +) + +T = TypeVar("T", bound="Region") + + +@_attrs_define +class Region: + """ + Attributes: + id (str): + name (str): + price_multiplier (float): + storage_price (float): + """ + + id: str + name: str + price_multiplier: float + storage_price: float + + + def to_dict(self) -> Dict[str, Any]: + id = self.id + + name = self.name + + price_multiplier = self.price_multiplier + + storage_price = self.storage_price + + + field_dict: Dict[str, Any] = {} + field_dict.update({ + "id": id, + "name": name, + "priceMultiplier": price_multiplier, + "storagePrice": storage_price, + }) + + return field_dict + + + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + d = src_dict.copy() + id = d.pop("id") + + name = d.pop("name") + + price_multiplier = d.pop("priceMultiplier") + + storage_price = d.pop("storagePrice") + + region = cls( + id=id, + name=name, + price_multiplier=price_multiplier, + storage_price=storage_price, + ) + + return region + diff --git a/exasol/saas/client/openapi/models/scale_cluster.py b/exasol/saas/client/openapi/models/scale_cluster.py new file mode 100644 index 0000000..81d058b --- /dev/null +++ b/exasol/saas/client/openapi/models/scale_cluster.py @@ -0,0 +1,57 @@ +from typing import ( + TYPE_CHECKING, + Any, + BinaryIO, + Dict, + Optional, + TextIO, + Tuple, + Type, + TypeVar, +) + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import ( + UNSET, + Unset, +) + +T = TypeVar("T", bound="ScaleCluster") + + +@_attrs_define +class ScaleCluster: + """ + Attributes: + size (str): + """ + + size: str + + + def to_dict(self) -> Dict[str, Any]: + size = self.size + + + field_dict: Dict[str, Any] = {} + field_dict.update({ + "size": size, + }) + + return field_dict + + + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + d = src_dict.copy() + size = d.pop("size") + + scale_cluster = cls( + size=size, + ) + + return scale_cluster + diff --git a/exasol/saas/client/openapi/models/status.py b/exasol/saas/client/openapi/models/status.py new file mode 100644 index 0000000..126b865 --- /dev/null +++ b/exasol/saas/client/openapi/models/status.py @@ -0,0 +1,20 @@ +from enum import Enum + + +class Status(str, Enum): + CREATING = "creating" + DELETED = "deleted" + DELETING = "deleting" + ERROR = "error" + MAINTENANCE = "maintenance" + RUNNING = "running" + STARTING = "starting" + STOPPED = "stopped" + STOPPING = "stopping" + TOCREATE = "tocreate" + TODELETE = "todelete" + TOSTART = "tostart" + TOSTOP = "tostop" + + def __str__(self) -> str: + return str(self.value) diff --git a/exasol/saas/client/openapi/models/update_allowed_ip.py b/exasol/saas/client/openapi/models/update_allowed_ip.py new file mode 100644 index 0000000..9545ed5 --- /dev/null +++ b/exasol/saas/client/openapi/models/update_allowed_ip.py @@ -0,0 +1,65 @@ +from typing import ( + TYPE_CHECKING, + Any, + BinaryIO, + Dict, + Optional, + TextIO, + Tuple, + Type, + TypeVar, +) + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import ( + UNSET, + Unset, +) + +T = TypeVar("T", bound="UpdateAllowedIP") + + +@_attrs_define +class UpdateAllowedIP: + """ + Attributes: + name (str): + cidr_ip (str): + """ + + name: str + cidr_ip: str + + + def to_dict(self) -> Dict[str, Any]: + name = self.name + + cidr_ip = self.cidr_ip + + + field_dict: Dict[str, Any] = {} + field_dict.update({ + "name": name, + "cidrIp": cidr_ip, + }) + + return field_dict + + + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + d = src_dict.copy() + name = d.pop("name") + + cidr_ip = d.pop("cidrIp") + + update_allowed_ip = cls( + name=name, + cidr_ip=cidr_ip, + ) + + return update_allowed_ip + diff --git a/exasol/saas/client/openapi/models/update_cluster.py b/exasol/saas/client/openapi/models/update_cluster.py new file mode 100644 index 0000000..4276735 --- /dev/null +++ b/exasol/saas/client/openapi/models/update_cluster.py @@ -0,0 +1,87 @@ +from typing import ( + TYPE_CHECKING, + Any, + BinaryIO, + Dict, + Optional, + TextIO, + Tuple, + Type, + TypeVar, + Union, + cast, +) + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import ( + UNSET, + Unset, +) + +if TYPE_CHECKING: + from ..models.auto_stop import AutoStop + + + + + +T = TypeVar("T", bound="UpdateCluster") + + +@_attrs_define +class UpdateCluster: + """ + Attributes: + name (str): + auto_stop (Union[Unset, AutoStop]): + """ + + name: str + auto_stop: Union[Unset, 'AutoStop'] = UNSET + + + def to_dict(self) -> Dict[str, Any]: + from ..models.auto_stop import AutoStop + name = self.name + + auto_stop: Union[Unset, Dict[str, Any]] = UNSET + if not isinstance(self.auto_stop, Unset): + auto_stop = self.auto_stop.to_dict() + + + field_dict: Dict[str, Any] = {} + field_dict.update({ + "name": name, + }) + if auto_stop is not UNSET: + field_dict["autoStop"] = auto_stop + + return field_dict + + + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.auto_stop import AutoStop + d = src_dict.copy() + name = d.pop("name") + + _auto_stop = d.pop("autoStop", UNSET) + auto_stop: Union[Unset, AutoStop] + if isinstance(_auto_stop, Unset): + auto_stop = UNSET + else: + auto_stop = AutoStop.from_dict(_auto_stop) + + + + + update_cluster = cls( + name=name, + auto_stop=auto_stop, + ) + + return update_cluster + diff --git a/exasol/saas/client/openapi/models/update_database.py b/exasol/saas/client/openapi/models/update_database.py new file mode 100644 index 0000000..670eb3b --- /dev/null +++ b/exasol/saas/client/openapi/models/update_database.py @@ -0,0 +1,57 @@ +from typing import ( + TYPE_CHECKING, + Any, + BinaryIO, + Dict, + Optional, + TextIO, + Tuple, + Type, + TypeVar, +) + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import ( + UNSET, + Unset, +) + +T = TypeVar("T", bound="UpdateDatabase") + + +@_attrs_define +class UpdateDatabase: + """ + Attributes: + name (str): + """ + + name: str + + + def to_dict(self) -> Dict[str, Any]: + name = self.name + + + field_dict: Dict[str, Any] = {} + field_dict.update({ + "name": name, + }) + + return field_dict + + + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + d = src_dict.copy() + name = d.pop("name") + + update_database = cls( + name=name, + ) + + return update_database + diff --git a/exasol/saas/client/openapi/models/update_profile.py b/exasol/saas/client/openapi/models/update_profile.py new file mode 100644 index 0000000..6b4cc39 --- /dev/null +++ b/exasol/saas/client/openapi/models/update_profile.py @@ -0,0 +1,65 @@ +from typing import ( + TYPE_CHECKING, + Any, + BinaryIO, + Dict, + Optional, + TextIO, + Tuple, + Type, + TypeVar, +) + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import ( + UNSET, + Unset, +) + +T = TypeVar("T", bound="UpdateProfile") + + +@_attrs_define +class UpdateProfile: + """ + Attributes: + first_name (str): + last_name (str): + """ + + first_name: str + last_name: str + + + def to_dict(self) -> Dict[str, Any]: + first_name = self.first_name + + last_name = self.last_name + + + field_dict: Dict[str, Any] = {} + field_dict.update({ + "firstName": first_name, + "lastName": last_name, + }) + + return field_dict + + + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + d = src_dict.copy() + first_name = d.pop("firstName") + + last_name = d.pop("lastName") + + update_profile = cls( + first_name=first_name, + last_name=last_name, + ) + + return update_profile + diff --git a/exasol/saas/client/openapi/models/upload_file.py b/exasol/saas/client/openapi/models/upload_file.py new file mode 100644 index 0000000..8e70cf2 --- /dev/null +++ b/exasol/saas/client/openapi/models/upload_file.py @@ -0,0 +1,57 @@ +from typing import ( + TYPE_CHECKING, + Any, + BinaryIO, + Dict, + Optional, + TextIO, + Tuple, + Type, + TypeVar, +) + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import ( + UNSET, + Unset, +) + +T = TypeVar("T", bound="UploadFile") + + +@_attrs_define +class UploadFile: + """ + Attributes: + url (str): + """ + + url: str + + + def to_dict(self) -> Dict[str, Any]: + url = self.url + + + field_dict: Dict[str, Any] = {} + field_dict.update({ + "url": url, + }) + + return field_dict + + + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + d = src_dict.copy() + url = d.pop("url") + + upload_file = cls( + url=url, + ) + + return upload_file + diff --git a/exasol/saas/client/openapi/models/usage_cluster.py b/exasol/saas/client/openapi/models/usage_cluster.py new file mode 100644 index 0000000..cd2218d --- /dev/null +++ b/exasol/saas/client/openapi/models/usage_cluster.py @@ -0,0 +1,110 @@ +from typing import ( + TYPE_CHECKING, + Any, + BinaryIO, + Dict, + Optional, + TextIO, + Tuple, + Type, + TypeVar, + Union, +) + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import ( + UNSET, + Unset, +) + +T = TypeVar("T", bound="UsageCluster") + + +@_attrs_define +class UsageCluster: + """ + Attributes: + id (str): + size (str): + name (str): + compute (Union[Unset, float]): + out_same_region (Union[Unset, float]): + out_different_region (Union[Unset, float]): + out_internet (Union[Unset, float]): + """ + + id: str + size: str + name: str + compute: Union[Unset, float] = UNSET + out_same_region: Union[Unset, float] = UNSET + out_different_region: Union[Unset, float] = UNSET + out_internet: Union[Unset, float] = UNSET + + + def to_dict(self) -> Dict[str, Any]: + id = self.id + + size = self.size + + name = self.name + + compute = self.compute + + out_same_region = self.out_same_region + + out_different_region = self.out_different_region + + out_internet = self.out_internet + + + field_dict: Dict[str, Any] = {} + field_dict.update({ + "id": id, + "size": size, + "name": name, + }) + if compute is not UNSET: + field_dict["compute"] = compute + if out_same_region is not UNSET: + field_dict["outSameRegion"] = out_same_region + if out_different_region is not UNSET: + field_dict["outDifferentRegion"] = out_different_region + if out_internet is not UNSET: + field_dict["outInternet"] = out_internet + + return field_dict + + + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + d = src_dict.copy() + id = d.pop("id") + + size = d.pop("size") + + name = d.pop("name") + + compute = d.pop("compute", UNSET) + + out_same_region = d.pop("outSameRegion", UNSET) + + out_different_region = d.pop("outDifferentRegion", UNSET) + + out_internet = d.pop("outInternet", UNSET) + + usage_cluster = cls( + id=id, + size=size, + name=name, + compute=compute, + out_same_region=out_same_region, + out_different_region=out_different_region, + out_internet=out_internet, + ) + + return usage_cluster + diff --git a/exasol/saas/client/openapi/models/usage_database.py b/exasol/saas/client/openapi/models/usage_database.py new file mode 100644 index 0000000..d595f04 --- /dev/null +++ b/exasol/saas/client/openapi/models/usage_database.py @@ -0,0 +1,109 @@ +from typing import ( + TYPE_CHECKING, + Any, + BinaryIO, + Dict, + List, + Optional, + TextIO, + Tuple, + Type, + TypeVar, + Union, + cast, +) + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import ( + UNSET, + Unset, +) + +if TYPE_CHECKING: + from ..models.usage_cluster import UsageCluster + + + + + +T = TypeVar("T", bound="UsageDatabase") + + +@_attrs_define +class UsageDatabase: + """ + Attributes: + id (str): + name (str): + clusters (List['UsageCluster']): + used_storage (Union[Unset, float]): + """ + + id: str + name: str + clusters: List['UsageCluster'] + used_storage: Union[Unset, float] = UNSET + + + def to_dict(self) -> Dict[str, Any]: + from ..models.usage_cluster import UsageCluster + id = self.id + + name = self.name + + clusters = [] + for clusters_item_data in self.clusters: + clusters_item = clusters_item_data.to_dict() + clusters.append(clusters_item) + + + + + + used_storage = self.used_storage + + + field_dict: Dict[str, Any] = {} + field_dict.update({ + "id": id, + "name": name, + "clusters": clusters, + }) + if used_storage is not UNSET: + field_dict["usedStorage"] = used_storage + + return field_dict + + + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + from ..models.usage_cluster import UsageCluster + d = src_dict.copy() + id = d.pop("id") + + name = d.pop("name") + + clusters = [] + _clusters = d.pop("clusters") + for clusters_item_data in (_clusters): + clusters_item = UsageCluster.from_dict(clusters_item_data) + + + + clusters.append(clusters_item) + + + used_storage = d.pop("usedStorage", UNSET) + + usage_database = cls( + id=id, + name=name, + clusters=clusters, + used_storage=used_storage, + ) + + return usage_database + diff --git a/exasol/saas/client/openapi/models/user_database.py b/exasol/saas/client/openapi/models/user_database.py new file mode 100644 index 0000000..71eb3b1 --- /dev/null +++ b/exasol/saas/client/openapi/models/user_database.py @@ -0,0 +1,65 @@ +from typing import ( + TYPE_CHECKING, + Any, + BinaryIO, + Dict, + Optional, + TextIO, + Tuple, + Type, + TypeVar, +) + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import ( + UNSET, + Unset, +) + +T = TypeVar("T", bound="UserDatabase") + + +@_attrs_define +class UserDatabase: + """ + Attributes: + id (str): + name (str): + """ + + id: str + name: str + + + def to_dict(self) -> Dict[str, Any]: + id = self.id + + name = self.name + + + field_dict: Dict[str, Any] = {} + field_dict.update({ + "id": id, + "name": name, + }) + + return field_dict + + + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + d = src_dict.copy() + id = d.pop("id") + + name = d.pop("name") + + user_database = cls( + id=id, + name=name, + ) + + return user_database + diff --git a/exasol/saas/client/openapi/models/user_role.py b/exasol/saas/client/openapi/models/user_role.py new file mode 100644 index 0000000..ec47577 --- /dev/null +++ b/exasol/saas/client/openapi/models/user_role.py @@ -0,0 +1,65 @@ +from typing import ( + TYPE_CHECKING, + Any, + BinaryIO, + Dict, + Optional, + TextIO, + Tuple, + Type, + TypeVar, +) + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import ( + UNSET, + Unset, +) + +T = TypeVar("T", bound="UserRole") + + +@_attrs_define +class UserRole: + """ + Attributes: + id (str): + name (str): + """ + + id: str + name: str + + + def to_dict(self) -> Dict[str, Any]: + id = self.id + + name = self.name + + + field_dict: Dict[str, Any] = {} + field_dict.update({ + "id": id, + "name": name, + }) + + return field_dict + + + + @classmethod + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: + d = src_dict.copy() + id = d.pop("id") + + name = d.pop("name") + + user_role = cls( + id=id, + name=name, + ) + + return user_role + diff --git a/exasol/saas/client/openapi/models/user_status.py b/exasol/saas/client/openapi/models/user_status.py new file mode 100644 index 0000000..e685862 --- /dev/null +++ b/exasol/saas/client/openapi/models/user_status.py @@ -0,0 +1,10 @@ +from enum import Enum + + +class UserStatus(str, Enum): + ACTIVE = "active" + DEACTIVATED = "deactivated" + PENDING = "pending" + + def __str__(self) -> str: + return str(self.value) diff --git a/exasol/saas/client/openapi/py.typed b/exasol/saas/client/openapi/py.typed new file mode 100644 index 0000000..1aad327 --- /dev/null +++ b/exasol/saas/client/openapi/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561 \ No newline at end of file diff --git a/exasol/saas/client/openapi/types.py b/exasol/saas/client/openapi/types.py new file mode 100644 index 0000000..adff73d --- /dev/null +++ b/exasol/saas/client/openapi/types.py @@ -0,0 +1,53 @@ +""" Contains some shared types for properties """ +from http import HTTPStatus +from typing import ( + Any, + BinaryIO, + Generic, + Literal, + MutableMapping, + Optional, + Tuple, + TypeVar, +) + +from attrs import define + + +class Unset: + def __bool__(self) -> Literal[False]: + return False + + +UNSET: Unset = Unset() + +FileJsonType = Tuple[Optional[str], BinaryIO, Optional[str]] + + +@define +class File: + """ Contains information for file uploads """ + + payload: BinaryIO + file_name: Optional[str] = None + mime_type: Optional[str] = None + + def to_tuple(self) -> FileJsonType: + """ Return a tuple representation that httpx will accept for multipart/form-data """ + return self.file_name, self.payload, self.mime_type + + +T = TypeVar("T") + + +@define +class Response(Generic[T]): + """ A response from an endpoint """ + + status_code: HTTPStatus + content: bytes + headers: MutableMapping[str, str] + parsed: Optional[T] + + +__all__ = ["File", "Response", "FileJsonType", "Unset", "UNSET"] diff --git a/noxfile.py b/noxfile.py index f8437bd..1fb4bba 100644 --- a/noxfile.py +++ b/noxfile.py @@ -1,3 +1,4 @@ +import os import nox from nox import Session from noxconfig import PROJECT_CONFIG @@ -9,17 +10,34 @@ # default actions to be run if nothing is explicitly specified with the -s option nox.options.sessions = ["fix"] + @nox.session(name="generate-api", python=False) def generate_api(session: Session): """ Call openapi-python-client to generate the client api based on the openapi specification for Exasol SaaS in JSON format, see https://github.com/openapi-generators/openapi-python-client. + + By default run generator silently, Except for CI build, which is detected + by environment variable ``CI``, see + https://docs.github.com/en/actions/learn-github-actions/variables. + #default-environment-variables. """ + silent = "CI" in os.environ session.run( "openapi-python-client", "update", "--url", f"{SAAS_HOST}/openapi.json", "--config", "openapi_config.yml", + silent=silent, ) session.run("isort", "-q", "exasol/saas/client/openapi") + + +@nox.session(name="check-api-outdated", python=False) +def check_api_outdated(session: Session): + """ + Generate API and run git diff to verify if API is out-dated. + """ + generate_api(session) + session.run("git", "diff", "--exit-code") diff --git a/pyproject.toml b/pyproject.toml index 524f3dd..a298612 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -83,12 +83,14 @@ ignore-paths = [ [[tool.mypy.overrides]] module = [ "exasol.toolbox.nox.tasks", + "exasol.saas.client.openapi.*", "test.conftest.*", "test.*", ] ignore_errors = true ignore_missing_imports = true + [tool.pylint.format] max-line-length = 88 max-module-lines = 800