stackit-dremio 0.1.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.
- stackit/dremio/__init__.py +86 -0
- stackit/dremio/api/__init__.py +4 -0
- stackit/dremio/api/default_api.py +2642 -0
- stackit/dremio/api_client.py +649 -0
- stackit/dremio/api_response.py +22 -0
- stackit/dremio/configuration.py +163 -0
- stackit/dremio/exceptions.py +217 -0
- stackit/dremio/models/__init__.py +33 -0
- stackit/dremio/models/auth_parameters.py +83 -0
- stackit/dremio/models/authentication.py +106 -0
- stackit/dremio/models/azuread.py +101 -0
- stackit/dremio/models/create_dremio_instance_payload.py +113 -0
- stackit/dremio/models/create_dremio_user_payload.py +109 -0
- stackit/dremio/models/dremio_response.py +167 -0
- stackit/dremio/models/dremio_user_response.py +155 -0
- stackit/dremio/models/endpoints.py +88 -0
- stackit/dremio/models/error.py +83 -0
- stackit/dremio/models/list_dremio_users_response.py +103 -0
- stackit/dremio/models/list_dremios_response.py +103 -0
- stackit/dremio/models/oauth.py +141 -0
- stackit/dremio/models/oauth_jwt_claims.py +82 -0
- stackit/dremio/models/update_dremio_instance_payload.py +118 -0
- stackit/dremio/py.typed +0 -0
- stackit/dremio/rest.py +163 -0
- stackit_dremio-0.1.0.dist-info/METADATA +48 -0
- stackit_dremio-0.1.0.dist-info/RECORD +29 -0
- stackit_dremio-0.1.0.dist-info/WHEEL +4 -0
- stackit_dremio-0.1.0.dist-info/licenses/LICENSE.md +201 -0
- stackit_dremio-0.1.0.dist-info/licenses/NOTICE.txt +2 -0
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
STACKIT Dremio API
|
|
5
|
+
|
|
6
|
+
This API provides endpoints for managing Dremio instances and users.
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1beta.0.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
import sys
|
|
15
|
+
from typing import Dict, List, Optional, TypedDict
|
|
16
|
+
|
|
17
|
+
from typing_extensions import NotRequired
|
|
18
|
+
|
|
19
|
+
import os
|
|
20
|
+
|
|
21
|
+
ServerVariablesT = Dict[str, str]
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class HostSettingVariable(TypedDict):
|
|
25
|
+
description: str
|
|
26
|
+
default_value: str
|
|
27
|
+
enum_values: List[str]
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class HostSetting(TypedDict):
|
|
31
|
+
url: str
|
|
32
|
+
description: str
|
|
33
|
+
variables: NotRequired[Dict[str, HostSettingVariable]]
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class HostConfiguration:
|
|
37
|
+
def __init__(
|
|
38
|
+
self,
|
|
39
|
+
region=None,
|
|
40
|
+
server_index=None,
|
|
41
|
+
server_variables=None,
|
|
42
|
+
server_operation_index=None,
|
|
43
|
+
server_operation_variables=None,
|
|
44
|
+
ignore_operation_servers=False,
|
|
45
|
+
) -> None:
|
|
46
|
+
print(
|
|
47
|
+
"WARNING: STACKIT will move to a new way of specifying regions, where the region is provided\n",
|
|
48
|
+
"as a function argument instead of being set in the client configuration.\n"
|
|
49
|
+
"Once all services have migrated, the methods to specify the region in the client configuration "
|
|
50
|
+
"will be removed.",
|
|
51
|
+
file=sys.stderr,
|
|
52
|
+
)
|
|
53
|
+
"""Constructor
|
|
54
|
+
"""
|
|
55
|
+
self._base_path = "https://dremio.api.eu01.stackit.cloud"
|
|
56
|
+
"""Default Base url
|
|
57
|
+
"""
|
|
58
|
+
self.server_index = 0 if server_index is None else server_index
|
|
59
|
+
self.server_operation_index = server_operation_index or {}
|
|
60
|
+
"""Default server index
|
|
61
|
+
"""
|
|
62
|
+
self.server_variables = server_variables or {}
|
|
63
|
+
if region:
|
|
64
|
+
self.server_variables["region"] = "{}.".format(region)
|
|
65
|
+
self.server_operation_variables = server_operation_variables or {}
|
|
66
|
+
"""Default server variables
|
|
67
|
+
"""
|
|
68
|
+
self.ignore_operation_servers = ignore_operation_servers
|
|
69
|
+
"""Ignore operation servers
|
|
70
|
+
"""
|
|
71
|
+
|
|
72
|
+
def get_host_settings(self) -> List[HostSetting]:
|
|
73
|
+
"""Gets an array of host settings
|
|
74
|
+
|
|
75
|
+
:return: An array of host settings
|
|
76
|
+
"""
|
|
77
|
+
return [
|
|
78
|
+
{
|
|
79
|
+
"url": "https://dremio.api.{region}stackit.cloud",
|
|
80
|
+
"description": "No description provided",
|
|
81
|
+
"variables": {
|
|
82
|
+
"region": {
|
|
83
|
+
"description": "No description provided",
|
|
84
|
+
"default_value": "eu01.",
|
|
85
|
+
"enum_values": ["eu01."],
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
}
|
|
89
|
+
]
|
|
90
|
+
|
|
91
|
+
def get_host_from_settings(
|
|
92
|
+
self,
|
|
93
|
+
index: Optional[int],
|
|
94
|
+
variables: Optional[ServerVariablesT] = None,
|
|
95
|
+
servers: Optional[List[HostSetting]] = None,
|
|
96
|
+
) -> str:
|
|
97
|
+
"""Gets host URL based on the index and variables
|
|
98
|
+
:param index: array index of the host settings
|
|
99
|
+
:param variables: hash of variable and the corresponding value
|
|
100
|
+
:param servers: an array of host settings or None
|
|
101
|
+
:error: if a region is given for a global url
|
|
102
|
+
:return: URL based on host settings
|
|
103
|
+
"""
|
|
104
|
+
if index is None:
|
|
105
|
+
return self._base_path
|
|
106
|
+
|
|
107
|
+
variables = {} if variables is None else variables
|
|
108
|
+
servers = self.get_host_settings() if servers is None else servers
|
|
109
|
+
|
|
110
|
+
try:
|
|
111
|
+
server = servers[index]
|
|
112
|
+
except IndexError:
|
|
113
|
+
raise ValueError(
|
|
114
|
+
"Invalid index {0} when selecting the host settings. "
|
|
115
|
+
"Must be less than {1}".format(index, len(servers))
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
url = server["url"]
|
|
119
|
+
|
|
120
|
+
# check if environment variable was provided for region
|
|
121
|
+
# if nothing was set this is None
|
|
122
|
+
region_env = os.environ.get("STACKIT_REGION")
|
|
123
|
+
|
|
124
|
+
# go through variables and replace placeholders
|
|
125
|
+
for variable_name, variable in server.get("variables", {}).items():
|
|
126
|
+
# If a region is provided by the user for a global url
|
|
127
|
+
# return an error (except for providing via environment variable).
|
|
128
|
+
# The region is provided as a function argument instead of being set in the client configuration.
|
|
129
|
+
if (
|
|
130
|
+
variable_name == "region"
|
|
131
|
+
and (variable["default_value"] == "global" or variable["default_value"] == "")
|
|
132
|
+
and region_env is None
|
|
133
|
+
and variables.get(variable_name) is not None
|
|
134
|
+
):
|
|
135
|
+
raise ValueError(
|
|
136
|
+
"this API does not support setting a region in the client configuration, "
|
|
137
|
+
"please check if the region can be specified as a function parameter"
|
|
138
|
+
)
|
|
139
|
+
used_value = variables.get(variable_name, variable["default_value"])
|
|
140
|
+
|
|
141
|
+
if "enum_values" in variable and used_value not in variable["enum_values"]:
|
|
142
|
+
given_value = variables[variable_name].replace(".", "")
|
|
143
|
+
valid_values = [v.replace(".", "") for v in variable["enum_values"]]
|
|
144
|
+
raise ValueError(
|
|
145
|
+
"The variable `{0}` in the host URL has invalid value '{1}'. Must be '{2}'.".format(
|
|
146
|
+
variable_name, given_value, valid_values
|
|
147
|
+
)
|
|
148
|
+
)
|
|
149
|
+
|
|
150
|
+
url = url.replace("{" + variable_name + "}", used_value)
|
|
151
|
+
|
|
152
|
+
return url
|
|
153
|
+
|
|
154
|
+
@property
|
|
155
|
+
def host(self) -> str:
|
|
156
|
+
"""Return generated host."""
|
|
157
|
+
return self.get_host_from_settings(self.server_index, variables=self.server_variables)
|
|
158
|
+
|
|
159
|
+
@host.setter
|
|
160
|
+
def host(self, value: str) -> None:
|
|
161
|
+
"""Fix base path."""
|
|
162
|
+
self._base_path = value
|
|
163
|
+
self.server_index = None
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
STACKIT Dremio API
|
|
5
|
+
|
|
6
|
+
This API provides endpoints for managing Dremio instances and users.
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1beta.0.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
from typing import Any, Optional
|
|
15
|
+
|
|
16
|
+
from typing_extensions import Self
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class OpenApiException(Exception):
|
|
20
|
+
"""The base exception class for all OpenAPIExceptions"""
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class ApiTypeError(OpenApiException, TypeError):
|
|
24
|
+
def __init__(self, msg, path_to_item=None, valid_classes=None, key_type=None) -> None:
|
|
25
|
+
"""Raises an exception for TypeErrors
|
|
26
|
+
|
|
27
|
+
Args:
|
|
28
|
+
msg (str): the exception message
|
|
29
|
+
|
|
30
|
+
Keyword Args:
|
|
31
|
+
path_to_item (list): a list of keys an indices to get to the
|
|
32
|
+
current_item
|
|
33
|
+
None if unset
|
|
34
|
+
valid_classes (tuple): the primitive classes that current item
|
|
35
|
+
should be an instance of
|
|
36
|
+
None if unset
|
|
37
|
+
key_type (bool): False if our value is a value in a dict
|
|
38
|
+
True if it is a key in a dict
|
|
39
|
+
False if our item is an item in a list
|
|
40
|
+
None if unset
|
|
41
|
+
"""
|
|
42
|
+
self.path_to_item = path_to_item
|
|
43
|
+
self.valid_classes = valid_classes
|
|
44
|
+
self.key_type = key_type
|
|
45
|
+
full_msg = msg
|
|
46
|
+
if path_to_item:
|
|
47
|
+
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
|
48
|
+
super(ApiTypeError, self).__init__(full_msg)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class ApiValueError(OpenApiException, ValueError):
|
|
52
|
+
def __init__(self, msg, path_to_item=None) -> None:
|
|
53
|
+
"""
|
|
54
|
+
Args:
|
|
55
|
+
msg (str): the exception message
|
|
56
|
+
|
|
57
|
+
Keyword Args:
|
|
58
|
+
path_to_item (list) the path to the exception in the
|
|
59
|
+
received_data dict. None if unset
|
|
60
|
+
"""
|
|
61
|
+
|
|
62
|
+
self.path_to_item = path_to_item
|
|
63
|
+
full_msg = msg
|
|
64
|
+
if path_to_item:
|
|
65
|
+
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
|
66
|
+
super(ApiValueError, self).__init__(full_msg)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class ApiAttributeError(OpenApiException, AttributeError):
|
|
70
|
+
def __init__(self, msg, path_to_item=None) -> None:
|
|
71
|
+
"""
|
|
72
|
+
Raised when an attribute reference or assignment fails.
|
|
73
|
+
|
|
74
|
+
Args:
|
|
75
|
+
msg (str): the exception message
|
|
76
|
+
|
|
77
|
+
Keyword Args:
|
|
78
|
+
path_to_item (None/list) the path to the exception in the
|
|
79
|
+
received_data dict
|
|
80
|
+
"""
|
|
81
|
+
self.path_to_item = path_to_item
|
|
82
|
+
full_msg = msg
|
|
83
|
+
if path_to_item:
|
|
84
|
+
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
|
85
|
+
super(ApiAttributeError, self).__init__(full_msg)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
class ApiKeyError(OpenApiException, KeyError):
|
|
89
|
+
def __init__(self, msg, path_to_item=None) -> None:
|
|
90
|
+
"""
|
|
91
|
+
Args:
|
|
92
|
+
msg (str): the exception message
|
|
93
|
+
|
|
94
|
+
Keyword Args:
|
|
95
|
+
path_to_item (None/list) the path to the exception in the
|
|
96
|
+
received_data dict
|
|
97
|
+
"""
|
|
98
|
+
self.path_to_item = path_to_item
|
|
99
|
+
full_msg = msg
|
|
100
|
+
if path_to_item:
|
|
101
|
+
full_msg = "{0} at {1}".format(msg, render_path(path_to_item))
|
|
102
|
+
super(ApiKeyError, self).__init__(full_msg)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
class ApiException(OpenApiException):
|
|
106
|
+
|
|
107
|
+
def __init__(
|
|
108
|
+
self,
|
|
109
|
+
status=None,
|
|
110
|
+
reason=None,
|
|
111
|
+
http_resp=None,
|
|
112
|
+
*,
|
|
113
|
+
body: Optional[str] = None,
|
|
114
|
+
data: Optional[Any] = None,
|
|
115
|
+
) -> None:
|
|
116
|
+
self.status = status
|
|
117
|
+
self.reason = reason
|
|
118
|
+
self.body = body
|
|
119
|
+
self.data = data
|
|
120
|
+
self.headers = None
|
|
121
|
+
|
|
122
|
+
if http_resp:
|
|
123
|
+
if self.status is None:
|
|
124
|
+
self.status = http_resp.status
|
|
125
|
+
if self.reason is None:
|
|
126
|
+
self.reason = http_resp.reason
|
|
127
|
+
if self.body is None:
|
|
128
|
+
try:
|
|
129
|
+
self.body = http_resp.data.decode("utf-8")
|
|
130
|
+
except Exception: # noqa: S110
|
|
131
|
+
pass
|
|
132
|
+
self.headers = http_resp.headers
|
|
133
|
+
|
|
134
|
+
@classmethod
|
|
135
|
+
def from_response(
|
|
136
|
+
cls,
|
|
137
|
+
*,
|
|
138
|
+
http_resp,
|
|
139
|
+
body: Optional[str],
|
|
140
|
+
data: Optional[Any],
|
|
141
|
+
) -> Self:
|
|
142
|
+
if http_resp.status == 400:
|
|
143
|
+
raise BadRequestException(http_resp=http_resp, body=body, data=data)
|
|
144
|
+
|
|
145
|
+
if http_resp.status == 401:
|
|
146
|
+
raise UnauthorizedException(http_resp=http_resp, body=body, data=data)
|
|
147
|
+
|
|
148
|
+
if http_resp.status == 403:
|
|
149
|
+
raise ForbiddenException(http_resp=http_resp, body=body, data=data)
|
|
150
|
+
|
|
151
|
+
if http_resp.status == 404:
|
|
152
|
+
raise NotFoundException(http_resp=http_resp, body=body, data=data)
|
|
153
|
+
|
|
154
|
+
# Added new conditions for 409 and 422
|
|
155
|
+
if http_resp.status == 409:
|
|
156
|
+
raise ConflictException(http_resp=http_resp, body=body, data=data)
|
|
157
|
+
|
|
158
|
+
if http_resp.status == 422:
|
|
159
|
+
raise UnprocessableEntityException(http_resp=http_resp, body=body, data=data)
|
|
160
|
+
|
|
161
|
+
if 500 <= http_resp.status <= 599:
|
|
162
|
+
raise ServiceException(http_resp=http_resp, body=body, data=data)
|
|
163
|
+
raise ApiException(http_resp=http_resp, body=body, data=data)
|
|
164
|
+
|
|
165
|
+
def __str__(self):
|
|
166
|
+
"""Custom error messages for exception"""
|
|
167
|
+
error_message = "({0})\n" "Reason: {1}\n".format(self.status, self.reason)
|
|
168
|
+
if self.headers:
|
|
169
|
+
error_message += "HTTP response headers: {0}\n".format(self.headers)
|
|
170
|
+
|
|
171
|
+
if self.data or self.body:
|
|
172
|
+
error_message += "HTTP response body: {0}\n".format(self.data or self.body)
|
|
173
|
+
|
|
174
|
+
return error_message
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
class BadRequestException(ApiException):
|
|
178
|
+
pass
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
class NotFoundException(ApiException):
|
|
182
|
+
pass
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
class UnauthorizedException(ApiException):
|
|
186
|
+
pass
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
class ForbiddenException(ApiException):
|
|
190
|
+
pass
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
class ServiceException(ApiException):
|
|
194
|
+
pass
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
class ConflictException(ApiException):
|
|
198
|
+
"""Exception for HTTP 409 Conflict."""
|
|
199
|
+
|
|
200
|
+
pass
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
class UnprocessableEntityException(ApiException):
|
|
204
|
+
"""Exception for HTTP 422 Unprocessable Entity."""
|
|
205
|
+
|
|
206
|
+
pass
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
def render_path(path_to_item):
|
|
210
|
+
"""Returns a string representation of a path"""
|
|
211
|
+
result = ""
|
|
212
|
+
for pth in path_to_item:
|
|
213
|
+
if isinstance(pth, int):
|
|
214
|
+
result += "[{0}]".format(pth)
|
|
215
|
+
else:
|
|
216
|
+
result += "['{0}']".format(pth)
|
|
217
|
+
return result
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
# flake8: noqa
|
|
4
|
+
"""
|
|
5
|
+
STACKIT Dremio API
|
|
6
|
+
|
|
7
|
+
This API provides endpoints for managing Dremio instances and users.
|
|
8
|
+
|
|
9
|
+
The version of the OpenAPI document: 1beta.0.0
|
|
10
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
11
|
+
|
|
12
|
+
Do not edit the class manually.
|
|
13
|
+
""" # noqa: E501
|
|
14
|
+
|
|
15
|
+
# import models into model package
|
|
16
|
+
from stackit.dremio.models.auth_parameters import AuthParameters
|
|
17
|
+
from stackit.dremio.models.authentication import Authentication
|
|
18
|
+
from stackit.dremio.models.azuread import Azuread
|
|
19
|
+
from stackit.dremio.models.create_dremio_instance_payload import (
|
|
20
|
+
CreateDremioInstancePayload,
|
|
21
|
+
)
|
|
22
|
+
from stackit.dremio.models.create_dremio_user_payload import CreateDremioUserPayload
|
|
23
|
+
from stackit.dremio.models.dremio_response import DremioResponse
|
|
24
|
+
from stackit.dremio.models.dremio_user_response import DremioUserResponse
|
|
25
|
+
from stackit.dremio.models.endpoints import Endpoints
|
|
26
|
+
from stackit.dremio.models.error import Error
|
|
27
|
+
from stackit.dremio.models.list_dremio_users_response import ListDremioUsersResponse
|
|
28
|
+
from stackit.dremio.models.list_dremios_response import ListDremiosResponse
|
|
29
|
+
from stackit.dremio.models.oauth import Oauth
|
|
30
|
+
from stackit.dremio.models.oauth_jwt_claims import OauthJwtClaims
|
|
31
|
+
from stackit.dremio.models.update_dremio_instance_payload import (
|
|
32
|
+
UpdateDremioInstancePayload,
|
|
33
|
+
)
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
STACKIT Dremio API
|
|
5
|
+
|
|
6
|
+
This API provides endpoints for managing Dremio instances and users.
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1beta.0.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import json
|
|
17
|
+
import pprint
|
|
18
|
+
from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, StrictStr
|
|
21
|
+
from pydantic_core import to_jsonable_python
|
|
22
|
+
from typing_extensions import Self
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class AuthParameters(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
An additional parameter the Identity Provider requires.
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
|
|
30
|
+
name: StrictStr
|
|
31
|
+
value: StrictStr
|
|
32
|
+
__properties: ClassVar[List[str]] = ["name", "value"]
|
|
33
|
+
|
|
34
|
+
model_config = ConfigDict(
|
|
35
|
+
validate_by_name=True,
|
|
36
|
+
validate_by_alias=True,
|
|
37
|
+
validate_assignment=True,
|
|
38
|
+
protected_namespaces=(),
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
def to_str(self) -> str:
|
|
42
|
+
"""Returns the string representation of the model using alias"""
|
|
43
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
44
|
+
|
|
45
|
+
def to_json(self) -> str:
|
|
46
|
+
"""Returns the JSON representation of the model using alias"""
|
|
47
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
48
|
+
|
|
49
|
+
@classmethod
|
|
50
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
51
|
+
"""Create an instance of AuthParameters from a JSON string"""
|
|
52
|
+
return cls.from_dict(json.loads(json_str))
|
|
53
|
+
|
|
54
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
55
|
+
"""Return the dictionary representation of the model using alias.
|
|
56
|
+
|
|
57
|
+
This has the following differences from calling pydantic's
|
|
58
|
+
`self.model_dump(by_alias=True)`:
|
|
59
|
+
|
|
60
|
+
* `None` is only added to the output dict for nullable fields that
|
|
61
|
+
were set at model initialization. Other fields with value `None`
|
|
62
|
+
are ignored.
|
|
63
|
+
"""
|
|
64
|
+
excluded_fields: Set[str] = set([])
|
|
65
|
+
|
|
66
|
+
_dict = self.model_dump(
|
|
67
|
+
by_alias=True,
|
|
68
|
+
exclude=excluded_fields,
|
|
69
|
+
exclude_none=True,
|
|
70
|
+
)
|
|
71
|
+
return _dict
|
|
72
|
+
|
|
73
|
+
@classmethod
|
|
74
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
75
|
+
"""Create an instance of AuthParameters from a dict"""
|
|
76
|
+
if obj is None:
|
|
77
|
+
return None
|
|
78
|
+
|
|
79
|
+
if not isinstance(obj, dict):
|
|
80
|
+
return cls.model_validate(obj)
|
|
81
|
+
|
|
82
|
+
_obj = cls.model_validate({"name": obj.get("name"), "value": obj.get("value")})
|
|
83
|
+
return _obj
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
STACKIT Dremio API
|
|
5
|
+
|
|
6
|
+
This API provides endpoints for managing Dremio instances and users.
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1beta.0.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import json
|
|
17
|
+
import pprint
|
|
18
|
+
from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, StrictStr, field_validator
|
|
21
|
+
from pydantic_core import to_jsonable_python
|
|
22
|
+
from typing_extensions import Self
|
|
23
|
+
|
|
24
|
+
from stackit.dremio.models.azuread import Azuread
|
|
25
|
+
from stackit.dremio.models.oauth import Oauth
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class Authentication(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
Dremio instance authentication settings. A change here triggers a Dremio restart and will incur downtime.
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
|
|
33
|
+
azuread: Optional[Azuread] = None
|
|
34
|
+
oauth: Optional[Oauth] = None
|
|
35
|
+
type: StrictStr
|
|
36
|
+
__properties: ClassVar[List[str]] = ["azuread", "oauth", "type"]
|
|
37
|
+
|
|
38
|
+
@field_validator("type")
|
|
39
|
+
def type_validate_enum(cls, value):
|
|
40
|
+
"""Validates the enum"""
|
|
41
|
+
if value not in set(["local-only", "azuread", "oauth"]):
|
|
42
|
+
raise ValueError("must be one of enum values ('local-only', 'azuread', 'oauth')")
|
|
43
|
+
return value
|
|
44
|
+
|
|
45
|
+
model_config = ConfigDict(
|
|
46
|
+
validate_by_name=True,
|
|
47
|
+
validate_by_alias=True,
|
|
48
|
+
validate_assignment=True,
|
|
49
|
+
protected_namespaces=(),
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
def to_str(self) -> str:
|
|
53
|
+
"""Returns the string representation of the model using alias"""
|
|
54
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
55
|
+
|
|
56
|
+
def to_json(self) -> str:
|
|
57
|
+
"""Returns the JSON representation of the model using alias"""
|
|
58
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
59
|
+
|
|
60
|
+
@classmethod
|
|
61
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
62
|
+
"""Create an instance of Authentication from a JSON string"""
|
|
63
|
+
return cls.from_dict(json.loads(json_str))
|
|
64
|
+
|
|
65
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
66
|
+
"""Return the dictionary representation of the model using alias.
|
|
67
|
+
|
|
68
|
+
This has the following differences from calling pydantic's
|
|
69
|
+
`self.model_dump(by_alias=True)`:
|
|
70
|
+
|
|
71
|
+
* `None` is only added to the output dict for nullable fields that
|
|
72
|
+
were set at model initialization. Other fields with value `None`
|
|
73
|
+
are ignored.
|
|
74
|
+
"""
|
|
75
|
+
excluded_fields: Set[str] = set([])
|
|
76
|
+
|
|
77
|
+
_dict = self.model_dump(
|
|
78
|
+
by_alias=True,
|
|
79
|
+
exclude=excluded_fields,
|
|
80
|
+
exclude_none=True,
|
|
81
|
+
)
|
|
82
|
+
# override the default output from pydantic by calling `to_dict()` of azuread
|
|
83
|
+
if self.azuread:
|
|
84
|
+
_dict["azuread"] = self.azuread.to_dict()
|
|
85
|
+
# override the default output from pydantic by calling `to_dict()` of oauth
|
|
86
|
+
if self.oauth:
|
|
87
|
+
_dict["oauth"] = self.oauth.to_dict()
|
|
88
|
+
return _dict
|
|
89
|
+
|
|
90
|
+
@classmethod
|
|
91
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
92
|
+
"""Create an instance of Authentication from a dict"""
|
|
93
|
+
if obj is None:
|
|
94
|
+
return None
|
|
95
|
+
|
|
96
|
+
if not isinstance(obj, dict):
|
|
97
|
+
return cls.model_validate(obj)
|
|
98
|
+
|
|
99
|
+
_obj = cls.model_validate(
|
|
100
|
+
{
|
|
101
|
+
"azuread": Azuread.from_dict(obj["azuread"]) if obj.get("azuread") is not None else None,
|
|
102
|
+
"oauth": Oauth.from_dict(obj["oauth"]) if obj.get("oauth") is not None else None,
|
|
103
|
+
"type": obj.get("type"),
|
|
104
|
+
}
|
|
105
|
+
)
|
|
106
|
+
return _obj
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
STACKIT Dremio API
|
|
5
|
+
|
|
6
|
+
This API provides endpoints for managing Dremio instances and users.
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1beta.0.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import json
|
|
17
|
+
import pprint
|
|
18
|
+
from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
21
|
+
from pydantic_core import to_jsonable_python
|
|
22
|
+
from typing_extensions import Self
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class Azuread(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
Azure Active Directory authentication configuration.
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
|
|
30
|
+
authority_url: StrictStr = Field(description="The Azure AD authority URL.", alias="authorityUrl")
|
|
31
|
+
client_id: StrictStr = Field(description="The Azure AD client ID.", alias="clientId")
|
|
32
|
+
client_secret: Optional[StrictStr] = Field(
|
|
33
|
+
default=None, description="The Azure AD client secret.", alias="clientSecret"
|
|
34
|
+
)
|
|
35
|
+
redirect_url: Optional[StrictStr] = Field(
|
|
36
|
+
default=None, description="The Azure AD redirect URL.", alias="redirectUrl"
|
|
37
|
+
)
|
|
38
|
+
__properties: ClassVar[List[str]] = ["authorityUrl", "clientId", "clientSecret", "redirectUrl"]
|
|
39
|
+
|
|
40
|
+
model_config = ConfigDict(
|
|
41
|
+
validate_by_name=True,
|
|
42
|
+
validate_by_alias=True,
|
|
43
|
+
validate_assignment=True,
|
|
44
|
+
protected_namespaces=(),
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
def to_str(self) -> str:
|
|
48
|
+
"""Returns the string representation of the model using alias"""
|
|
49
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
50
|
+
|
|
51
|
+
def to_json(self) -> str:
|
|
52
|
+
"""Returns the JSON representation of the model using alias"""
|
|
53
|
+
return json.dumps(to_jsonable_python(self.to_dict()))
|
|
54
|
+
|
|
55
|
+
@classmethod
|
|
56
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
57
|
+
"""Create an instance of Azuread from a JSON string"""
|
|
58
|
+
return cls.from_dict(json.loads(json_str))
|
|
59
|
+
|
|
60
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
61
|
+
"""Return the dictionary representation of the model using alias.
|
|
62
|
+
|
|
63
|
+
This has the following differences from calling pydantic's
|
|
64
|
+
`self.model_dump(by_alias=True)`:
|
|
65
|
+
|
|
66
|
+
* `None` is only added to the output dict for nullable fields that
|
|
67
|
+
were set at model initialization. Other fields with value `None`
|
|
68
|
+
are ignored.
|
|
69
|
+
* OpenAPI `readOnly` fields are excluded.
|
|
70
|
+
"""
|
|
71
|
+
excluded_fields: Set[str] = set(
|
|
72
|
+
[
|
|
73
|
+
"redirect_url",
|
|
74
|
+
]
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
_dict = self.model_dump(
|
|
78
|
+
by_alias=True,
|
|
79
|
+
exclude=excluded_fields,
|
|
80
|
+
exclude_none=True,
|
|
81
|
+
)
|
|
82
|
+
return _dict
|
|
83
|
+
|
|
84
|
+
@classmethod
|
|
85
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
86
|
+
"""Create an instance of Azuread from a dict"""
|
|
87
|
+
if obj is None:
|
|
88
|
+
return None
|
|
89
|
+
|
|
90
|
+
if not isinstance(obj, dict):
|
|
91
|
+
return cls.model_validate(obj)
|
|
92
|
+
|
|
93
|
+
_obj = cls.model_validate(
|
|
94
|
+
{
|
|
95
|
+
"authorityUrl": obj.get("authorityUrl"),
|
|
96
|
+
"clientId": obj.get("clientId"),
|
|
97
|
+
"clientSecret": obj.get("clientSecret"),
|
|
98
|
+
"redirectUrl": obj.get("redirectUrl"),
|
|
99
|
+
}
|
|
100
|
+
)
|
|
101
|
+
return _obj
|