exasol-saas-api 0.3.0__py3-none-any.whl
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.
- exasol/saas/client/__init__.py +32 -0
- exasol/saas/client/openapi/__init__.py +11 -0
- exasol/saas/client/openapi/api/__init__.py +1 -0
- exasol/saas/client/openapi/api/clusters/__init__.py +0 -0
- exasol/saas/client/openapi/api/clusters/create_cluster.py +209 -0
- exasol/saas/client/openapi/api/clusters/delete_cluster.py +135 -0
- exasol/saas/client/openapi/api/clusters/get_cluster.py +200 -0
- exasol/saas/client/openapi/api/clusters/get_cluster_connection.py +200 -0
- exasol/saas/client/openapi/api/clusters/list_clusters.py +192 -0
- exasol/saas/client/openapi/api/clusters/scale_cluster.py +151 -0
- exasol/saas/client/openapi/api/clusters/start_cluster.py +135 -0
- exasol/saas/client/openapi/api/clusters/stop_cluster.py +135 -0
- exasol/saas/client/openapi/api/clusters/update_cluster.py +151 -0
- exasol/saas/client/openapi/api/databases/__init__.py +0 -0
- exasol/saas/client/openapi/api/databases/create_database.py +196 -0
- exasol/saas/client/openapi/api/databases/delete_database.py +128 -0
- exasol/saas/client/openapi/api/databases/get_database.py +187 -0
- exasol/saas/client/openapi/api/databases/list_databases.py +179 -0
- exasol/saas/client/openapi/api/databases/start_database.py +128 -0
- exasol/saas/client/openapi/api/databases/stop_database.py +128 -0
- exasol/saas/client/openapi/api/databases/update_database.py +144 -0
- exasol/saas/client/openapi/api/extensions/__init__.py +0 -0
- exasol/saas/client/openapi/api/extensions/create_extension_instance.py +235 -0
- exasol/saas/client/openapi/api/extensions/delete_extension_instance.py +149 -0
- exasol/saas/client/openapi/api/extensions/get_extension.py +213 -0
- exasol/saas/client/openapi/api/extensions/install_extension.py +142 -0
- exasol/saas/client/openapi/api/extensions/list_extension_instances.py +218 -0
- exasol/saas/client/openapi/api/extensions/list_extensions.py +192 -0
- exasol/saas/client/openapi/api/extensions/uninstall_extension.py +142 -0
- exasol/saas/client/openapi/api/files/__init__.py +0 -0
- exasol/saas/client/openapi/api/files/create_folder.py +135 -0
- exasol/saas/client/openapi/api/files/delete_file.py +135 -0
- exasol/saas/client/openapi/api/files/delete_folder.py +135 -0
- exasol/saas/client/openapi/api/files/download_file.py +200 -0
- exasol/saas/client/openapi/api/files/list_files.py +192 -0
- exasol/saas/client/openapi/api/files/upload_file.py +200 -0
- exasol/saas/client/openapi/api/platform/__init__.py +0 -0
- exasol/saas/client/openapi/api/platform/list_cluster_sizes.py +179 -0
- exasol/saas/client/openapi/api/platform/list_platforms.py +158 -0
- exasol/saas/client/openapi/api/platform/list_regions.py +179 -0
- exasol/saas/client/openapi/api/profile/__init__.py +0 -0
- exasol/saas/client/openapi/api/profile/update_profile.py +130 -0
- exasol/saas/client/openapi/api/security/__init__.py +0 -0
- exasol/saas/client/openapi/api/security/add_allowed_ip.py +196 -0
- exasol/saas/client/openapi/api/security/delete_allowed_ip.py +128 -0
- exasol/saas/client/openapi/api/security/get_allowed_ip.py +187 -0
- exasol/saas/client/openapi/api/security/list_allowed_i_ps.py +179 -0
- exasol/saas/client/openapi/api/security/update_allowed_ip.py +144 -0
- exasol/saas/client/openapi/api/usage/__init__.py +0 -0
- exasol/saas/client/openapi/api/usage/get_usage.py +216 -0
- exasol/saas/client/openapi/api/users/__init__.py +0 -0
- exasol/saas/client/openapi/api/users/delete_user.py +128 -0
- exasol/saas/client/openapi/api/users/get_user.py +187 -0
- exasol/saas/client/openapi/api/users/list_users.py +231 -0
- exasol/saas/client/openapi/api/users/patch_user.py +144 -0
- exasol/saas/client/openapi/client.py +277 -0
- exasol/saas/client/openapi/errors.py +14 -0
- exasol/saas/client/openapi/models/__init__.py +89 -0
- exasol/saas/client/openapi/models/allowed_ip.py +124 -0
- exasol/saas/client/openapi/models/api_error.py +123 -0
- exasol/saas/client/openapi/models/auto_stop.py +65 -0
- exasol/saas/client/openapi/models/cluster.py +172 -0
- exasol/saas/client/openapi/models/cluster_connection.py +102 -0
- exasol/saas/client/openapi/models/cluster_size.py +97 -0
- exasol/saas/client/openapi/models/connection_i_ps.py +77 -0
- exasol/saas/client/openapi/models/create_allowed_ip.py +65 -0
- exasol/saas/client/openapi/models/create_cluster.py +95 -0
- exasol/saas/client/openapi/models/create_database.py +117 -0
- exasol/saas/client/openapi/models/create_database_initial_cluster.py +95 -0
- exasol/saas/client/openapi/models/create_extension_instance.py +83 -0
- exasol/saas/client/openapi/models/database.py +212 -0
- exasol/saas/client/openapi/models/database_clusters.py +65 -0
- exasol/saas/client/openapi/models/database_integrations_item.py +94 -0
- exasol/saas/client/openapi/models/download_file.py +57 -0
- exasol/saas/client/openapi/models/extension.py +115 -0
- exasol/saas/client/openapi/models/extension_detail.py +103 -0
- exasol/saas/client/openapi/models/extension_instance.py +65 -0
- exasol/saas/client/openapi/models/extension_parameter_definitions.py +75 -0
- exasol/saas/client/openapi/models/extension_parameter_value.py +65 -0
- exasol/saas/client/openapi/models/extension_version.py +81 -0
- exasol/saas/client/openapi/models/file.py +124 -0
- exasol/saas/client/openapi/models/get_usage_type.py +9 -0
- exasol/saas/client/openapi/models/patch_user.py +97 -0
- exasol/saas/client/openapi/models/patch_user_databases.py +77 -0
- exasol/saas/client/openapi/models/platform.py +65 -0
- exasol/saas/client/openapi/models/region.py +81 -0
- exasol/saas/client/openapi/models/scale_cluster.py +57 -0
- exasol/saas/client/openapi/models/status.py +22 -0
- exasol/saas/client/openapi/models/update_allowed_ip.py +65 -0
- exasol/saas/client/openapi/models/update_cluster.py +87 -0
- exasol/saas/client/openapi/models/update_database.py +76 -0
- exasol/saas/client/openapi/models/update_profile.py +65 -0
- exasol/saas/client/openapi/models/upload_file.py +57 -0
- exasol/saas/client/openapi/models/usage.py +97 -0
- exasol/saas/client/openapi/models/usage_additional_property_item.py +109 -0
- exasol/saas/client/openapi/models/usage_cluster.py +110 -0
- exasol/saas/client/openapi/models/user.py +197 -0
- exasol/saas/client/openapi/models/user_database.py +65 -0
- exasol/saas/client/openapi/models/user_role.py +65 -0
- exasol/saas/client/openapi/models/user_status.py +10 -0
- exasol/saas/client/openapi/py.typed +1 -0
- exasol/saas/client/openapi/types.py +53 -0
- exasol_saas_api-0.3.0.dist-info/LICENSE +21 -0
- exasol_saas_api-0.3.0.dist-info/METADATA +43 -0
- exasol_saas_api-0.3.0.dist-info/RECORD +107 -0
- exasol_saas_api-0.3.0.dist-info/WHEEL +4 -0
- exasol_saas_api-0.3.0.dist-info/entry_points.txt +3 -0
|
@@ -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 @@
|
|
|
1
|
+
""" Contains methods for accessing the API """
|
|
File without changes
|
|
@@ -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
|