exasol-saas-api 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. exasol_saas_api-0.3.0/LICENSE +21 -0
  2. exasol_saas_api-0.3.0/PKG-INFO +43 -0
  3. exasol_saas_api-0.3.0/README.md +11 -0
  4. exasol_saas_api-0.3.0/exasol/saas/client/__init__.py +32 -0
  5. exasol_saas_api-0.3.0/exasol/saas/client/openapi/__init__.py +11 -0
  6. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/__init__.py +1 -0
  7. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/clusters/__init__.py +0 -0
  8. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/clusters/create_cluster.py +209 -0
  9. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/clusters/delete_cluster.py +135 -0
  10. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/clusters/get_cluster.py +200 -0
  11. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/clusters/get_cluster_connection.py +200 -0
  12. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/clusters/list_clusters.py +192 -0
  13. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/clusters/scale_cluster.py +151 -0
  14. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/clusters/start_cluster.py +135 -0
  15. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/clusters/stop_cluster.py +135 -0
  16. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/clusters/update_cluster.py +151 -0
  17. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/databases/__init__.py +0 -0
  18. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/databases/create_database.py +196 -0
  19. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/databases/delete_database.py +128 -0
  20. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/databases/get_database.py +187 -0
  21. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/databases/list_databases.py +179 -0
  22. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/databases/start_database.py +128 -0
  23. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/databases/stop_database.py +128 -0
  24. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/databases/update_database.py +144 -0
  25. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/extensions/__init__.py +0 -0
  26. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/extensions/create_extension_instance.py +235 -0
  27. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/extensions/delete_extension_instance.py +149 -0
  28. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/extensions/get_extension.py +213 -0
  29. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/extensions/install_extension.py +142 -0
  30. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/extensions/list_extension_instances.py +218 -0
  31. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/extensions/list_extensions.py +192 -0
  32. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/extensions/uninstall_extension.py +142 -0
  33. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/files/__init__.py +0 -0
  34. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/files/create_folder.py +135 -0
  35. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/files/delete_file.py +135 -0
  36. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/files/delete_folder.py +135 -0
  37. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/files/download_file.py +200 -0
  38. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/files/list_files.py +192 -0
  39. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/files/upload_file.py +200 -0
  40. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/platform/__init__.py +0 -0
  41. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/platform/list_cluster_sizes.py +179 -0
  42. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/platform/list_platforms.py +158 -0
  43. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/platform/list_regions.py +179 -0
  44. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/profile/__init__.py +0 -0
  45. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/profile/update_profile.py +130 -0
  46. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/security/__init__.py +0 -0
  47. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/security/add_allowed_ip.py +196 -0
  48. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/security/delete_allowed_ip.py +128 -0
  49. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/security/get_allowed_ip.py +187 -0
  50. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/security/list_allowed_i_ps.py +179 -0
  51. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/security/update_allowed_ip.py +144 -0
  52. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/usage/__init__.py +0 -0
  53. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/usage/get_usage.py +216 -0
  54. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/users/__init__.py +0 -0
  55. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/users/delete_user.py +128 -0
  56. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/users/get_user.py +187 -0
  57. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/users/list_users.py +231 -0
  58. exasol_saas_api-0.3.0/exasol/saas/client/openapi/api/users/patch_user.py +144 -0
  59. exasol_saas_api-0.3.0/exasol/saas/client/openapi/client.py +277 -0
  60. exasol_saas_api-0.3.0/exasol/saas/client/openapi/errors.py +14 -0
  61. exasol_saas_api-0.3.0/exasol/saas/client/openapi/models/__init__.py +89 -0
  62. exasol_saas_api-0.3.0/exasol/saas/client/openapi/models/allowed_ip.py +124 -0
  63. exasol_saas_api-0.3.0/exasol/saas/client/openapi/models/api_error.py +123 -0
  64. exasol_saas_api-0.3.0/exasol/saas/client/openapi/models/auto_stop.py +65 -0
  65. exasol_saas_api-0.3.0/exasol/saas/client/openapi/models/cluster.py +172 -0
  66. exasol_saas_api-0.3.0/exasol/saas/client/openapi/models/cluster_connection.py +102 -0
  67. exasol_saas_api-0.3.0/exasol/saas/client/openapi/models/cluster_size.py +97 -0
  68. exasol_saas_api-0.3.0/exasol/saas/client/openapi/models/connection_i_ps.py +77 -0
  69. exasol_saas_api-0.3.0/exasol/saas/client/openapi/models/create_allowed_ip.py +65 -0
  70. exasol_saas_api-0.3.0/exasol/saas/client/openapi/models/create_cluster.py +95 -0
  71. exasol_saas_api-0.3.0/exasol/saas/client/openapi/models/create_database.py +117 -0
  72. exasol_saas_api-0.3.0/exasol/saas/client/openapi/models/create_database_initial_cluster.py +95 -0
  73. exasol_saas_api-0.3.0/exasol/saas/client/openapi/models/create_extension_instance.py +83 -0
  74. exasol_saas_api-0.3.0/exasol/saas/client/openapi/models/database.py +212 -0
  75. exasol_saas_api-0.3.0/exasol/saas/client/openapi/models/database_clusters.py +65 -0
  76. exasol_saas_api-0.3.0/exasol/saas/client/openapi/models/database_integrations_item.py +94 -0
  77. exasol_saas_api-0.3.0/exasol/saas/client/openapi/models/download_file.py +57 -0
  78. exasol_saas_api-0.3.0/exasol/saas/client/openapi/models/extension.py +115 -0
  79. exasol_saas_api-0.3.0/exasol/saas/client/openapi/models/extension_detail.py +103 -0
  80. exasol_saas_api-0.3.0/exasol/saas/client/openapi/models/extension_instance.py +65 -0
  81. exasol_saas_api-0.3.0/exasol/saas/client/openapi/models/extension_parameter_definitions.py +75 -0
  82. exasol_saas_api-0.3.0/exasol/saas/client/openapi/models/extension_parameter_value.py +65 -0
  83. exasol_saas_api-0.3.0/exasol/saas/client/openapi/models/extension_version.py +81 -0
  84. exasol_saas_api-0.3.0/exasol/saas/client/openapi/models/file.py +124 -0
  85. exasol_saas_api-0.3.0/exasol/saas/client/openapi/models/get_usage_type.py +9 -0
  86. exasol_saas_api-0.3.0/exasol/saas/client/openapi/models/patch_user.py +97 -0
  87. exasol_saas_api-0.3.0/exasol/saas/client/openapi/models/patch_user_databases.py +77 -0
  88. exasol_saas_api-0.3.0/exasol/saas/client/openapi/models/platform.py +65 -0
  89. exasol_saas_api-0.3.0/exasol/saas/client/openapi/models/region.py +81 -0
  90. exasol_saas_api-0.3.0/exasol/saas/client/openapi/models/scale_cluster.py +57 -0
  91. exasol_saas_api-0.3.0/exasol/saas/client/openapi/models/status.py +22 -0
  92. exasol_saas_api-0.3.0/exasol/saas/client/openapi/models/update_allowed_ip.py +65 -0
  93. exasol_saas_api-0.3.0/exasol/saas/client/openapi/models/update_cluster.py +87 -0
  94. exasol_saas_api-0.3.0/exasol/saas/client/openapi/models/update_database.py +76 -0
  95. exasol_saas_api-0.3.0/exasol/saas/client/openapi/models/update_profile.py +65 -0
  96. exasol_saas_api-0.3.0/exasol/saas/client/openapi/models/upload_file.py +57 -0
  97. exasol_saas_api-0.3.0/exasol/saas/client/openapi/models/usage.py +97 -0
  98. exasol_saas_api-0.3.0/exasol/saas/client/openapi/models/usage_additional_property_item.py +109 -0
  99. exasol_saas_api-0.3.0/exasol/saas/client/openapi/models/usage_cluster.py +110 -0
  100. exasol_saas_api-0.3.0/exasol/saas/client/openapi/models/user.py +197 -0
  101. exasol_saas_api-0.3.0/exasol/saas/client/openapi/models/user_database.py +65 -0
  102. exasol_saas_api-0.3.0/exasol/saas/client/openapi/models/user_role.py +65 -0
  103. exasol_saas_api-0.3.0/exasol/saas/client/openapi/models/user_status.py +10 -0
  104. exasol_saas_api-0.3.0/exasol/saas/client/openapi/py.typed +1 -0
  105. exasol_saas_api-0.3.0/exasol/saas/client/openapi/types.py +53 -0
  106. exasol_saas_api-0.3.0/pyproject.toml +110 -0
  107. exasol_saas_api-0.3.0/setup.py +53 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Exasol
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,43 @@
1
+ Metadata-Version: 2.1
2
+ Name: exasol-saas-api
3
+ Version: 0.3.0
4
+ Summary: API enabling Python applications connecting to Exasol database SaaS instances and using their SaaS services
5
+ License: MIT
6
+ Author: Christoph Kuhnke
7
+ Author-email: christoph.kuhnke@exasol.com
8
+ Maintainer: Christoph Kuhnke
9
+ Maintainer-email: christoph.kuhnke@exasol.com
10
+ Requires-Python: >=3.8.0,<4.0
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.8
15
+ Classifier: Programming Language :: Python :: 3.9
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3
19
+ Requires-Dist: attrs (>=21.3.0)
20
+ Requires-Dist: httpx (>=0.20.0,<0.28.0)
21
+ Requires-Dist: ifaddr (>=0.2.0,<0.3.0)
22
+ Requires-Dist: python-dateutil (>=2.8.0,<3.0.0)
23
+ Requires-Dist: requests (>=2.31.0,<3.0.0)
24
+ Requires-Dist: tenacity (>=8.2.3,<9.0.0)
25
+ Requires-Dist: types-requests (>=2.31.0.6,<3.0.0.0)
26
+ Project-URL: Documentation, https://github.io/exasol/saas-api-python
27
+ Project-URL: Homepage, https://github.io/exasol/saas-api-python
28
+ Project-URL: Issues, https://github.io/exasol/saas-api-python/issues
29
+ Project-URL: Source, https://github.io/exasol/saas-api-python
30
+ Description-Content-Type: text/markdown
31
+
32
+ # SaaS API for Python
33
+
34
+ API enabling Python applications connecting to Exasol database SaaS instances and using their SaaS services.
35
+
36
+ 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).
37
+
38
+ A GitHub action will check each morning if the generated model layer is outdated.
39
+
40
+ See
41
+ * [User Guide](doc/user_guide/user-guide.md)
42
+ * [Developer Guide](doc/developer_guide/developer_guide.md)
43
+
@@ -0,0 +1,11 @@
1
+ # SaaS API for Python
2
+
3
+ API enabling Python applications connecting to Exasol database SaaS instances and using their SaaS services.
4
+
5
+ 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).
6
+
7
+ A GitHub action will check each morning if the generated model layer is outdated.
8
+
9
+ See
10
+ * [User Guide](doc/user_guide/user-guide.md)
11
+ * [Developer Guide](doc/developer_guide/developer_guide.md)
@@ -0,0 +1,32 @@
1
+ """
2
+ Package openapi contains the API generated from the JSON definition.
3
+ """
4
+
5
+ from dataclasses import dataclass
6
+ from typing import Final
7
+ from datetime import datetime, timedelta
8
+ from exasol.saas.client.openapi.models.status import Status
9
+
10
+
11
+ SAAS_HOST = "https://cloud.exasol.com"
12
+
13
+ PROMISING_STATES = [
14
+ Status.CREATING,
15
+ Status.RUNNING,
16
+ Status.STARTING,
17
+ Status.TOCREATE,
18
+ Status.TOSTART,
19
+ ]
20
+
21
+
22
+ class Limits:
23
+ """
24
+ Constants for Exasol SaaS databases.
25
+ """
26
+ MAX_DATABASE_NAME_LENGTH: Final[int] = 20
27
+ MAX_CLUSTER_NAME_LENGTH: Final[int] = 40
28
+ AUTOSTOP_MIN_IDLE_TIME: Final[timedelta] = timedelta(minutes=15)
29
+ AUTOSTOP_MAX_IDLE_TIME: Final[timedelta] = timedelta(minutes=10000)
30
+ AUTOSTOP_DEFAULT_IDLE_TIME: Final[timedelta] = timedelta(minutes=120)
31
+ # If deleting a database too early, then logging and accounting could be invalid.
32
+ MIN_DATABASE_LIFETIME: Final[timedelta] = timedelta(seconds=30)
@@ -0,0 +1,11 @@
1
+
2
+ """ A client library for accessing Exasol SaaS REST-API """
3
+ from .client import (
4
+ AuthenticatedClient,
5
+ Client,
6
+ )
7
+
8
+ __all__ = (
9
+ "AuthenticatedClient",
10
+ "Client",
11
+ )
@@ -0,0 +1 @@
1
+ """ Contains methods for accessing the API """
@@ -0,0 +1,209 @@
1
+ from http import HTTPStatus
2
+ from typing import (
3
+ Any,
4
+ Dict,
5
+ List,
6
+ Optional,
7
+ Union,
8
+ cast,
9
+ )
10
+
11
+ import httpx
12
+
13
+ from ... import errors
14
+ from ...client import (
15
+ AuthenticatedClient,
16
+ Client,
17
+ )
18
+ from ...models.cluster import Cluster
19
+ from ...models.create_cluster import CreateCluster
20
+ from ...types import (
21
+ UNSET,
22
+ Response,
23
+ )
24
+
25
+
26
+ def _get_kwargs(
27
+ account_id: str,
28
+ database_id: str,
29
+ *,
30
+ body: CreateCluster,
31
+
32
+ ) -> Dict[str, Any]:
33
+ headers: Dict[str, Any] = {}
34
+
35
+
36
+
37
+
38
+
39
+
40
+ _kwargs: Dict[str, Any] = {
41
+ "method": "post",
42
+ "url": "/api/v1/accounts/{account_id}/databases/{database_id}/clusters".format(account_id=account_id,database_id=database_id,),
43
+ }
44
+
45
+ _body = body.to_dict()
46
+
47
+
48
+ _kwargs["json"] = _body
49
+ headers["Content-Type"] = "application/json"
50
+
51
+ _kwargs["headers"] = headers
52
+ return _kwargs
53
+
54
+
55
+ def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Cluster]:
56
+ if response.status_code == HTTPStatus.OK:
57
+ response_200 = Cluster.from_dict(response.json())
58
+
59
+
60
+
61
+ return response_200
62
+ if client.raise_on_unexpected_status:
63
+ raise errors.UnexpectedStatus(response.status_code, response.content)
64
+ else:
65
+ return None
66
+
67
+
68
+ def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Cluster]:
69
+ return Response(
70
+ status_code=HTTPStatus(response.status_code),
71
+ content=response.content,
72
+ headers=response.headers,
73
+ parsed=_parse_response(client=client, response=response),
74
+ )
75
+
76
+
77
+ def sync_detailed(
78
+ account_id: str,
79
+ database_id: str,
80
+ *,
81
+ client: AuthenticatedClient,
82
+ body: CreateCluster,
83
+
84
+ ) -> Response[Cluster]:
85
+ """
86
+ Args:
87
+ account_id (str):
88
+ database_id (str):
89
+ body (CreateCluster):
90
+
91
+ Raises:
92
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
93
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
94
+
95
+ Returns:
96
+ Response[Cluster]
97
+ """
98
+
99
+
100
+ kwargs = _get_kwargs(
101
+ account_id=account_id,
102
+ database_id=database_id,
103
+ body=body,
104
+
105
+ )
106
+
107
+ response = client.get_httpx_client().request(
108
+ **kwargs,
109
+ )
110
+
111
+ return _build_response(client=client, response=response)
112
+
113
+ def sync(
114
+ account_id: str,
115
+ database_id: str,
116
+ *,
117
+ client: AuthenticatedClient,
118
+ body: CreateCluster,
119
+
120
+ ) -> Optional[Cluster]:
121
+ """
122
+ Args:
123
+ account_id (str):
124
+ database_id (str):
125
+ body (CreateCluster):
126
+
127
+ Raises:
128
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
129
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
130
+
131
+ Returns:
132
+ Cluster
133
+ """
134
+
135
+
136
+ return sync_detailed(
137
+ account_id=account_id,
138
+ database_id=database_id,
139
+ client=client,
140
+ body=body,
141
+
142
+ ).parsed
143
+
144
+ async def asyncio_detailed(
145
+ account_id: str,
146
+ database_id: str,
147
+ *,
148
+ client: AuthenticatedClient,
149
+ body: CreateCluster,
150
+
151
+ ) -> Response[Cluster]:
152
+ """
153
+ Args:
154
+ account_id (str):
155
+ database_id (str):
156
+ body (CreateCluster):
157
+
158
+ Raises:
159
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
160
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
161
+
162
+ Returns:
163
+ Response[Cluster]
164
+ """
165
+
166
+
167
+ kwargs = _get_kwargs(
168
+ account_id=account_id,
169
+ database_id=database_id,
170
+ body=body,
171
+
172
+ )
173
+
174
+ response = await client.get_async_httpx_client().request(
175
+ **kwargs
176
+ )
177
+
178
+ return _build_response(client=client, response=response)
179
+
180
+ async def asyncio(
181
+ account_id: str,
182
+ database_id: str,
183
+ *,
184
+ client: AuthenticatedClient,
185
+ body: CreateCluster,
186
+
187
+ ) -> Optional[Cluster]:
188
+ """
189
+ Args:
190
+ account_id (str):
191
+ database_id (str):
192
+ body (CreateCluster):
193
+
194
+ Raises:
195
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
196
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
197
+
198
+ Returns:
199
+ Cluster
200
+ """
201
+
202
+
203
+ return (await asyncio_detailed(
204
+ account_id=account_id,
205
+ database_id=database_id,
206
+ client=client,
207
+ body=body,
208
+
209
+ )).parsed
@@ -0,0 +1,135 @@
1
+ from http import HTTPStatus
2
+ from typing import (
3
+ Any,
4
+ Dict,
5
+ List,
6
+ Optional,
7
+ Union,
8
+ cast,
9
+ )
10
+
11
+ import httpx
12
+
13
+ from ... import errors
14
+ from ...client import (
15
+ AuthenticatedClient,
16
+ Client,
17
+ )
18
+ from ...types import (
19
+ UNSET,
20
+ Response,
21
+ )
22
+
23
+
24
+ def _get_kwargs(
25
+ account_id: str,
26
+ database_id: str,
27
+ cluster_id: str,
28
+
29
+ ) -> Dict[str, Any]:
30
+
31
+
32
+
33
+
34
+
35
+
36
+ _kwargs: Dict[str, Any] = {
37
+ "method": "delete",
38
+ "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,),
39
+ }
40
+
41
+
42
+ return _kwargs
43
+
44
+
45
+ def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
46
+ if response.status_code == HTTPStatus.NO_CONTENT:
47
+ return None
48
+ if client.raise_on_unexpected_status:
49
+ raise errors.UnexpectedStatus(response.status_code, response.content)
50
+ else:
51
+ return None
52
+
53
+
54
+ def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
55
+ return Response(
56
+ status_code=HTTPStatus(response.status_code),
57
+ content=response.content,
58
+ headers=response.headers,
59
+ parsed=_parse_response(client=client, response=response),
60
+ )
61
+
62
+
63
+ def sync_detailed(
64
+ account_id: str,
65
+ database_id: str,
66
+ cluster_id: str,
67
+ *,
68
+ client: AuthenticatedClient,
69
+
70
+ ) -> Response[Any]:
71
+ """
72
+ Args:
73
+ account_id (str):
74
+ database_id (str):
75
+ cluster_id (str):
76
+
77
+ Raises:
78
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
79
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
80
+
81
+ Returns:
82
+ Response[Any]
83
+ """
84
+
85
+
86
+ kwargs = _get_kwargs(
87
+ account_id=account_id,
88
+ database_id=database_id,
89
+ cluster_id=cluster_id,
90
+
91
+ )
92
+
93
+ response = client.get_httpx_client().request(
94
+ **kwargs,
95
+ )
96
+
97
+ return _build_response(client=client, response=response)
98
+
99
+
100
+ async def asyncio_detailed(
101
+ account_id: str,
102
+ database_id: str,
103
+ cluster_id: str,
104
+ *,
105
+ client: AuthenticatedClient,
106
+
107
+ ) -> Response[Any]:
108
+ """
109
+ Args:
110
+ account_id (str):
111
+ database_id (str):
112
+ cluster_id (str):
113
+
114
+ Raises:
115
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
116
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
117
+
118
+ Returns:
119
+ Response[Any]
120
+ """
121
+
122
+
123
+ kwargs = _get_kwargs(
124
+ account_id=account_id,
125
+ database_id=database_id,
126
+ cluster_id=cluster_id,
127
+
128
+ )
129
+
130
+ response = await client.get_async_httpx_client().request(
131
+ **kwargs
132
+ )
133
+
134
+ return _build_response(client=client, response=response)
135
+
@@ -0,0 +1,200 @@
1
+ from http import HTTPStatus
2
+ from typing import (
3
+ Any,
4
+ Dict,
5
+ List,
6
+ Optional,
7
+ Union,
8
+ cast,
9
+ )
10
+
11
+ import httpx
12
+
13
+ from ... import errors
14
+ from ...client import (
15
+ AuthenticatedClient,
16
+ Client,
17
+ )
18
+ from ...models.cluster import Cluster
19
+ from ...types import (
20
+ UNSET,
21
+ Response,
22
+ )
23
+
24
+
25
+ def _get_kwargs(
26
+ account_id: str,
27
+ database_id: str,
28
+ cluster_id: str,
29
+
30
+ ) -> Dict[str, Any]:
31
+
32
+
33
+
34
+
35
+
36
+
37
+ _kwargs: Dict[str, Any] = {
38
+ "method": "get",
39
+ "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,),
40
+ }
41
+
42
+
43
+ return _kwargs
44
+
45
+
46
+ def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Cluster]:
47
+ if response.status_code == HTTPStatus.OK:
48
+ response_200 = Cluster.from_dict(response.json())
49
+
50
+
51
+
52
+ return response_200
53
+ if client.raise_on_unexpected_status:
54
+ raise errors.UnexpectedStatus(response.status_code, response.content)
55
+ else:
56
+ return None
57
+
58
+
59
+ def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Cluster]:
60
+ return Response(
61
+ status_code=HTTPStatus(response.status_code),
62
+ content=response.content,
63
+ headers=response.headers,
64
+ parsed=_parse_response(client=client, response=response),
65
+ )
66
+
67
+
68
+ def sync_detailed(
69
+ account_id: str,
70
+ database_id: str,
71
+ cluster_id: str,
72
+ *,
73
+ client: AuthenticatedClient,
74
+
75
+ ) -> Response[Cluster]:
76
+ """
77
+ Args:
78
+ account_id (str):
79
+ database_id (str):
80
+ cluster_id (str):
81
+
82
+ Raises:
83
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
84
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
85
+
86
+ Returns:
87
+ Response[Cluster]
88
+ """
89
+
90
+
91
+ kwargs = _get_kwargs(
92
+ account_id=account_id,
93
+ database_id=database_id,
94
+ cluster_id=cluster_id,
95
+
96
+ )
97
+
98
+ response = client.get_httpx_client().request(
99
+ **kwargs,
100
+ )
101
+
102
+ return _build_response(client=client, response=response)
103
+
104
+ def sync(
105
+ account_id: str,
106
+ database_id: str,
107
+ cluster_id: str,
108
+ *,
109
+ client: AuthenticatedClient,
110
+
111
+ ) -> Optional[Cluster]:
112
+ """
113
+ Args:
114
+ account_id (str):
115
+ database_id (str):
116
+ cluster_id (str):
117
+
118
+ Raises:
119
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
120
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
121
+
122
+ Returns:
123
+ Cluster
124
+ """
125
+
126
+
127
+ return sync_detailed(
128
+ account_id=account_id,
129
+ database_id=database_id,
130
+ cluster_id=cluster_id,
131
+ client=client,
132
+
133
+ ).parsed
134
+
135
+ async def asyncio_detailed(
136
+ account_id: str,
137
+ database_id: str,
138
+ cluster_id: str,
139
+ *,
140
+ client: AuthenticatedClient,
141
+
142
+ ) -> Response[Cluster]:
143
+ """
144
+ Args:
145
+ account_id (str):
146
+ database_id (str):
147
+ cluster_id (str):
148
+
149
+ Raises:
150
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
151
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
152
+
153
+ Returns:
154
+ Response[Cluster]
155
+ """
156
+
157
+
158
+ kwargs = _get_kwargs(
159
+ account_id=account_id,
160
+ database_id=database_id,
161
+ cluster_id=cluster_id,
162
+
163
+ )
164
+
165
+ response = await client.get_async_httpx_client().request(
166
+ **kwargs
167
+ )
168
+
169
+ return _build_response(client=client, response=response)
170
+
171
+ async def asyncio(
172
+ account_id: str,
173
+ database_id: str,
174
+ cluster_id: str,
175
+ *,
176
+ client: AuthenticatedClient,
177
+
178
+ ) -> Optional[Cluster]:
179
+ """
180
+ Args:
181
+ account_id (str):
182
+ database_id (str):
183
+ cluster_id (str):
184
+
185
+ Raises:
186
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
187
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
188
+
189
+ Returns:
190
+ Cluster
191
+ """
192
+
193
+
194
+ return (await asyncio_detailed(
195
+ account_id=account_id,
196
+ database_id=database_id,
197
+ cluster_id=cluster_id,
198
+ client=client,
199
+
200
+ )).parsed