databricks-sdk 0.0.7__py3-none-any.whl → 0.1.1__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.
Potentially problematic release.
This version of databricks-sdk might be problematic. Click here for more details.
- databricks/sdk/__init__.py +121 -104
- databricks/sdk/core.py +76 -16
- databricks/sdk/dbutils.py +18 -17
- databricks/sdk/mixins/compute.py +6 -6
- databricks/sdk/mixins/dbfs.py +6 -6
- databricks/sdk/oauth.py +28 -14
- databricks/sdk/service/{unitycatalog.py → catalog.py} +375 -1146
- databricks/sdk/service/{clusters.py → compute.py} +2176 -61
- databricks/sdk/service/{dbfs.py → files.py} +6 -6
- databricks/sdk/service/{scim.py → iam.py} +567 -27
- databricks/sdk/service/jobs.py +44 -34
- databricks/sdk/service/{mlflow.py → ml.py} +976 -1071
- databricks/sdk/service/oauth2.py +3 -3
- databricks/sdk/service/pipelines.py +46 -30
- databricks/sdk/service/{deployment.py → provisioning.py} +47 -29
- databricks/sdk/service/settings.py +849 -0
- databricks/sdk/service/sharing.py +1176 -0
- databricks/sdk/service/sql.py +15 -15
- databricks/sdk/service/workspace.py +917 -22
- databricks/sdk/version.py +1 -1
- {databricks_sdk-0.0.7.dist-info → databricks_sdk-0.1.1.dist-info}/METADATA +3 -1
- databricks_sdk-0.1.1.dist-info/RECORD +37 -0
- databricks/sdk/service/clusterpolicies.py +0 -399
- databricks/sdk/service/commands.py +0 -478
- databricks/sdk/service/gitcredentials.py +0 -202
- databricks/sdk/service/globalinitscripts.py +0 -262
- databricks/sdk/service/instancepools.py +0 -757
- databricks/sdk/service/ipaccesslists.py +0 -340
- databricks/sdk/service/libraries.py +0 -282
- databricks/sdk/service/permissions.py +0 -470
- databricks/sdk/service/repos.py +0 -250
- databricks/sdk/service/secrets.py +0 -472
- databricks/sdk/service/tokenmanagement.py +0 -182
- databricks/sdk/service/tokens.py +0 -137
- databricks/sdk/service/workspaceconf.py +0 -50
- databricks_sdk-0.0.7.dist-info/RECORD +0 -48
- /databricks/sdk/service/{endpoints.py → serving.py} +0 -0
- {databricks_sdk-0.0.7.dist-info → databricks_sdk-0.1.1.dist-info}/LICENSE +0 -0
- {databricks_sdk-0.0.7.dist-info → databricks_sdk-0.1.1.dist-info}/NOTICE +0 -0
- {databricks_sdk-0.0.7.dist-info → databricks_sdk-0.1.1.dist-info}/WHEEL +0 -0
- {databricks_sdk-0.0.7.dist-info → databricks_sdk-0.1.1.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,849 @@
|
|
|
1
|
+
# Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
import logging
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
from enum import Enum
|
|
6
|
+
from typing import Dict, Iterator, List
|
|
7
|
+
|
|
8
|
+
from ._internal import _enum, _from_dict, _repeated
|
|
9
|
+
|
|
10
|
+
_LOG = logging.getLogger('databricks.sdk')
|
|
11
|
+
|
|
12
|
+
# all definitions in this file are in alphabetical order
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@dataclass
|
|
16
|
+
class CreateIpAccessList:
|
|
17
|
+
label: str
|
|
18
|
+
list_type: 'ListType'
|
|
19
|
+
ip_addresses: 'List[str]'
|
|
20
|
+
|
|
21
|
+
def as_dict(self) -> dict:
|
|
22
|
+
body = {}
|
|
23
|
+
if self.ip_addresses: body['ip_addresses'] = [v for v in self.ip_addresses]
|
|
24
|
+
if self.label: body['label'] = self.label
|
|
25
|
+
if self.list_type: body['list_type'] = self.list_type.value
|
|
26
|
+
return body
|
|
27
|
+
|
|
28
|
+
@classmethod
|
|
29
|
+
def from_dict(cls, d: Dict[str, any]) -> 'CreateIpAccessList':
|
|
30
|
+
return cls(ip_addresses=d.get('ip_addresses', None),
|
|
31
|
+
label=d.get('label', None),
|
|
32
|
+
list_type=_enum(d, 'list_type', ListType))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
@dataclass
|
|
36
|
+
class CreateIpAccessListResponse:
|
|
37
|
+
ip_access_list: 'IpAccessListInfo' = None
|
|
38
|
+
|
|
39
|
+
def as_dict(self) -> dict:
|
|
40
|
+
body = {}
|
|
41
|
+
if self.ip_access_list: body['ip_access_list'] = self.ip_access_list.as_dict()
|
|
42
|
+
return body
|
|
43
|
+
|
|
44
|
+
@classmethod
|
|
45
|
+
def from_dict(cls, d: Dict[str, any]) -> 'CreateIpAccessListResponse':
|
|
46
|
+
return cls(ip_access_list=_from_dict(d, 'ip_access_list', IpAccessListInfo))
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
@dataclass
|
|
50
|
+
class CreateOboTokenRequest:
|
|
51
|
+
application_id: str
|
|
52
|
+
lifetime_seconds: int
|
|
53
|
+
comment: str = None
|
|
54
|
+
|
|
55
|
+
def as_dict(self) -> dict:
|
|
56
|
+
body = {}
|
|
57
|
+
if self.application_id: body['application_id'] = self.application_id
|
|
58
|
+
if self.comment: body['comment'] = self.comment
|
|
59
|
+
if self.lifetime_seconds: body['lifetime_seconds'] = self.lifetime_seconds
|
|
60
|
+
return body
|
|
61
|
+
|
|
62
|
+
@classmethod
|
|
63
|
+
def from_dict(cls, d: Dict[str, any]) -> 'CreateOboTokenRequest':
|
|
64
|
+
return cls(application_id=d.get('application_id', None),
|
|
65
|
+
comment=d.get('comment', None),
|
|
66
|
+
lifetime_seconds=d.get('lifetime_seconds', None))
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
@dataclass
|
|
70
|
+
class CreateOboTokenResponse:
|
|
71
|
+
token_info: 'TokenInfo' = None
|
|
72
|
+
token_value: str = None
|
|
73
|
+
|
|
74
|
+
def as_dict(self) -> dict:
|
|
75
|
+
body = {}
|
|
76
|
+
if self.token_info: body['token_info'] = self.token_info.as_dict()
|
|
77
|
+
if self.token_value: body['token_value'] = self.token_value
|
|
78
|
+
return body
|
|
79
|
+
|
|
80
|
+
@classmethod
|
|
81
|
+
def from_dict(cls, d: Dict[str, any]) -> 'CreateOboTokenResponse':
|
|
82
|
+
return cls(token_info=_from_dict(d, 'token_info', TokenInfo), token_value=d.get('token_value', None))
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
@dataclass
|
|
86
|
+
class CreateTokenRequest:
|
|
87
|
+
comment: str = None
|
|
88
|
+
lifetime_seconds: int = None
|
|
89
|
+
|
|
90
|
+
def as_dict(self) -> dict:
|
|
91
|
+
body = {}
|
|
92
|
+
if self.comment: body['comment'] = self.comment
|
|
93
|
+
if self.lifetime_seconds: body['lifetime_seconds'] = self.lifetime_seconds
|
|
94
|
+
return body
|
|
95
|
+
|
|
96
|
+
@classmethod
|
|
97
|
+
def from_dict(cls, d: Dict[str, any]) -> 'CreateTokenRequest':
|
|
98
|
+
return cls(comment=d.get('comment', None), lifetime_seconds=d.get('lifetime_seconds', None))
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
@dataclass
|
|
102
|
+
class CreateTokenResponse:
|
|
103
|
+
token_info: 'PublicTokenInfo' = None
|
|
104
|
+
token_value: str = None
|
|
105
|
+
|
|
106
|
+
def as_dict(self) -> dict:
|
|
107
|
+
body = {}
|
|
108
|
+
if self.token_info: body['token_info'] = self.token_info.as_dict()
|
|
109
|
+
if self.token_value: body['token_value'] = self.token_value
|
|
110
|
+
return body
|
|
111
|
+
|
|
112
|
+
@classmethod
|
|
113
|
+
def from_dict(cls, d: Dict[str, any]) -> 'CreateTokenResponse':
|
|
114
|
+
return cls(token_info=_from_dict(d, 'token_info', PublicTokenInfo),
|
|
115
|
+
token_value=d.get('token_value', None))
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
@dataclass
|
|
119
|
+
class DeleteAccountIpAccessListRequest:
|
|
120
|
+
"""Delete access list"""
|
|
121
|
+
|
|
122
|
+
ip_access_list_id: str
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
@dataclass
|
|
126
|
+
class DeleteIpAccessListRequest:
|
|
127
|
+
"""Delete access list"""
|
|
128
|
+
|
|
129
|
+
ip_access_list_id: str
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
@dataclass
|
|
133
|
+
class DeleteTokenManagementRequest:
|
|
134
|
+
"""Delete a token"""
|
|
135
|
+
|
|
136
|
+
token_id: str
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
@dataclass
|
|
140
|
+
class FetchIpAccessListResponse:
|
|
141
|
+
ip_access_list: 'IpAccessListInfo' = None
|
|
142
|
+
|
|
143
|
+
def as_dict(self) -> dict:
|
|
144
|
+
body = {}
|
|
145
|
+
if self.ip_access_list: body['ip_access_list'] = self.ip_access_list.as_dict()
|
|
146
|
+
return body
|
|
147
|
+
|
|
148
|
+
@classmethod
|
|
149
|
+
def from_dict(cls, d: Dict[str, any]) -> 'FetchIpAccessListResponse':
|
|
150
|
+
return cls(ip_access_list=_from_dict(d, 'ip_access_list', IpAccessListInfo))
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
@dataclass
|
|
154
|
+
class GetAccountIpAccessListRequest:
|
|
155
|
+
"""Get IP access list"""
|
|
156
|
+
|
|
157
|
+
ip_access_list_id: str
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
@dataclass
|
|
161
|
+
class GetIpAccessListRequest:
|
|
162
|
+
"""Get access list"""
|
|
163
|
+
|
|
164
|
+
ip_access_list_id: str
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
@dataclass
|
|
168
|
+
class GetIpAccessListResponse:
|
|
169
|
+
ip_access_lists: 'List[IpAccessListInfo]' = None
|
|
170
|
+
|
|
171
|
+
def as_dict(self) -> dict:
|
|
172
|
+
body = {}
|
|
173
|
+
if self.ip_access_lists: body['ip_access_lists'] = [v.as_dict() for v in self.ip_access_lists]
|
|
174
|
+
return body
|
|
175
|
+
|
|
176
|
+
@classmethod
|
|
177
|
+
def from_dict(cls, d: Dict[str, any]) -> 'GetIpAccessListResponse':
|
|
178
|
+
return cls(ip_access_lists=_repeated(d, 'ip_access_lists', IpAccessListInfo))
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
@dataclass
|
|
182
|
+
class GetIpAccessListsResponse:
|
|
183
|
+
ip_access_lists: 'List[IpAccessListInfo]' = None
|
|
184
|
+
|
|
185
|
+
def as_dict(self) -> dict:
|
|
186
|
+
body = {}
|
|
187
|
+
if self.ip_access_lists: body['ip_access_lists'] = [v.as_dict() for v in self.ip_access_lists]
|
|
188
|
+
return body
|
|
189
|
+
|
|
190
|
+
@classmethod
|
|
191
|
+
def from_dict(cls, d: Dict[str, any]) -> 'GetIpAccessListsResponse':
|
|
192
|
+
return cls(ip_access_lists=_repeated(d, 'ip_access_lists', IpAccessListInfo))
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
@dataclass
|
|
196
|
+
class GetStatusRequest:
|
|
197
|
+
"""Check configuration status"""
|
|
198
|
+
|
|
199
|
+
keys: str
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
@dataclass
|
|
203
|
+
class GetTokenManagementRequest:
|
|
204
|
+
"""Get token info"""
|
|
205
|
+
|
|
206
|
+
token_id: str
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
@dataclass
|
|
210
|
+
class IpAccessListInfo:
|
|
211
|
+
address_count: int = None
|
|
212
|
+
created_at: int = None
|
|
213
|
+
created_by: int = None
|
|
214
|
+
enabled: bool = None
|
|
215
|
+
ip_addresses: 'List[str]' = None
|
|
216
|
+
label: str = None
|
|
217
|
+
list_id: str = None
|
|
218
|
+
list_type: 'ListType' = None
|
|
219
|
+
updated_at: int = None
|
|
220
|
+
updated_by: int = None
|
|
221
|
+
|
|
222
|
+
def as_dict(self) -> dict:
|
|
223
|
+
body = {}
|
|
224
|
+
if self.address_count: body['address_count'] = self.address_count
|
|
225
|
+
if self.created_at: body['created_at'] = self.created_at
|
|
226
|
+
if self.created_by: body['created_by'] = self.created_by
|
|
227
|
+
if self.enabled: body['enabled'] = self.enabled
|
|
228
|
+
if self.ip_addresses: body['ip_addresses'] = [v for v in self.ip_addresses]
|
|
229
|
+
if self.label: body['label'] = self.label
|
|
230
|
+
if self.list_id: body['list_id'] = self.list_id
|
|
231
|
+
if self.list_type: body['list_type'] = self.list_type.value
|
|
232
|
+
if self.updated_at: body['updated_at'] = self.updated_at
|
|
233
|
+
if self.updated_by: body['updated_by'] = self.updated_by
|
|
234
|
+
return body
|
|
235
|
+
|
|
236
|
+
@classmethod
|
|
237
|
+
def from_dict(cls, d: Dict[str, any]) -> 'IpAccessListInfo':
|
|
238
|
+
return cls(address_count=d.get('address_count', None),
|
|
239
|
+
created_at=d.get('created_at', None),
|
|
240
|
+
created_by=d.get('created_by', None),
|
|
241
|
+
enabled=d.get('enabled', None),
|
|
242
|
+
ip_addresses=d.get('ip_addresses', None),
|
|
243
|
+
label=d.get('label', None),
|
|
244
|
+
list_id=d.get('list_id', None),
|
|
245
|
+
list_type=_enum(d, 'list_type', ListType),
|
|
246
|
+
updated_at=d.get('updated_at', None),
|
|
247
|
+
updated_by=d.get('updated_by', None))
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
@dataclass
|
|
251
|
+
class ListTokenManagementRequest:
|
|
252
|
+
"""List all tokens"""
|
|
253
|
+
|
|
254
|
+
created_by_id: str = None
|
|
255
|
+
created_by_username: str = None
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
@dataclass
|
|
259
|
+
class ListTokensResponse:
|
|
260
|
+
token_infos: 'List[PublicTokenInfo]' = None
|
|
261
|
+
|
|
262
|
+
def as_dict(self) -> dict:
|
|
263
|
+
body = {}
|
|
264
|
+
if self.token_infos: body['token_infos'] = [v.as_dict() for v in self.token_infos]
|
|
265
|
+
return body
|
|
266
|
+
|
|
267
|
+
@classmethod
|
|
268
|
+
def from_dict(cls, d: Dict[str, any]) -> 'ListTokensResponse':
|
|
269
|
+
return cls(token_infos=_repeated(d, 'token_infos', PublicTokenInfo))
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
class ListType(Enum):
|
|
273
|
+
"""This describes an enum"""
|
|
274
|
+
|
|
275
|
+
ALLOW = 'ALLOW'
|
|
276
|
+
BLOCK = 'BLOCK'
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
@dataclass
|
|
280
|
+
class PublicTokenInfo:
|
|
281
|
+
comment: str = None
|
|
282
|
+
creation_time: int = None
|
|
283
|
+
expiry_time: int = None
|
|
284
|
+
token_id: str = None
|
|
285
|
+
|
|
286
|
+
def as_dict(self) -> dict:
|
|
287
|
+
body = {}
|
|
288
|
+
if self.comment: body['comment'] = self.comment
|
|
289
|
+
if self.creation_time: body['creation_time'] = self.creation_time
|
|
290
|
+
if self.expiry_time: body['expiry_time'] = self.expiry_time
|
|
291
|
+
if self.token_id: body['token_id'] = self.token_id
|
|
292
|
+
return body
|
|
293
|
+
|
|
294
|
+
@classmethod
|
|
295
|
+
def from_dict(cls, d: Dict[str, any]) -> 'PublicTokenInfo':
|
|
296
|
+
return cls(comment=d.get('comment', None),
|
|
297
|
+
creation_time=d.get('creation_time', None),
|
|
298
|
+
expiry_time=d.get('expiry_time', None),
|
|
299
|
+
token_id=d.get('token_id', None))
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
@dataclass
|
|
303
|
+
class ReplaceIpAccessList:
|
|
304
|
+
label: str
|
|
305
|
+
list_type: 'ListType'
|
|
306
|
+
ip_addresses: 'List[str]'
|
|
307
|
+
enabled: bool
|
|
308
|
+
ip_access_list_id: str
|
|
309
|
+
list_id: str = None
|
|
310
|
+
|
|
311
|
+
def as_dict(self) -> dict:
|
|
312
|
+
body = {}
|
|
313
|
+
if self.enabled: body['enabled'] = self.enabled
|
|
314
|
+
if self.ip_access_list_id: body['ip_access_list_id'] = self.ip_access_list_id
|
|
315
|
+
if self.ip_addresses: body['ip_addresses'] = [v for v in self.ip_addresses]
|
|
316
|
+
if self.label: body['label'] = self.label
|
|
317
|
+
if self.list_id: body['list_id'] = self.list_id
|
|
318
|
+
if self.list_type: body['list_type'] = self.list_type.value
|
|
319
|
+
return body
|
|
320
|
+
|
|
321
|
+
@classmethod
|
|
322
|
+
def from_dict(cls, d: Dict[str, any]) -> 'ReplaceIpAccessList':
|
|
323
|
+
return cls(enabled=d.get('enabled', None),
|
|
324
|
+
ip_access_list_id=d.get('ip_access_list_id', None),
|
|
325
|
+
ip_addresses=d.get('ip_addresses', None),
|
|
326
|
+
label=d.get('label', None),
|
|
327
|
+
list_id=d.get('list_id', None),
|
|
328
|
+
list_type=_enum(d, 'list_type', ListType))
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
@dataclass
|
|
332
|
+
class RevokeTokenRequest:
|
|
333
|
+
token_id: str
|
|
334
|
+
|
|
335
|
+
def as_dict(self) -> dict:
|
|
336
|
+
body = {}
|
|
337
|
+
if self.token_id: body['token_id'] = self.token_id
|
|
338
|
+
return body
|
|
339
|
+
|
|
340
|
+
@classmethod
|
|
341
|
+
def from_dict(cls, d: Dict[str, any]) -> 'RevokeTokenRequest':
|
|
342
|
+
return cls(token_id=d.get('token_id', None))
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
@dataclass
|
|
346
|
+
class TokenInfo:
|
|
347
|
+
comment: str = None
|
|
348
|
+
created_by_id: int = None
|
|
349
|
+
created_by_username: str = None
|
|
350
|
+
creation_time: int = None
|
|
351
|
+
expiry_time: int = None
|
|
352
|
+
owner_id: int = None
|
|
353
|
+
token_id: str = None
|
|
354
|
+
|
|
355
|
+
def as_dict(self) -> dict:
|
|
356
|
+
body = {}
|
|
357
|
+
if self.comment: body['comment'] = self.comment
|
|
358
|
+
if self.created_by_id: body['created_by_id'] = self.created_by_id
|
|
359
|
+
if self.created_by_username: body['created_by_username'] = self.created_by_username
|
|
360
|
+
if self.creation_time: body['creation_time'] = self.creation_time
|
|
361
|
+
if self.expiry_time: body['expiry_time'] = self.expiry_time
|
|
362
|
+
if self.owner_id: body['owner_id'] = self.owner_id
|
|
363
|
+
if self.token_id: body['token_id'] = self.token_id
|
|
364
|
+
return body
|
|
365
|
+
|
|
366
|
+
@classmethod
|
|
367
|
+
def from_dict(cls, d: Dict[str, any]) -> 'TokenInfo':
|
|
368
|
+
return cls(comment=d.get('comment', None),
|
|
369
|
+
created_by_id=d.get('created_by_id', None),
|
|
370
|
+
created_by_username=d.get('created_by_username', None),
|
|
371
|
+
creation_time=d.get('creation_time', None),
|
|
372
|
+
expiry_time=d.get('expiry_time', None),
|
|
373
|
+
owner_id=d.get('owner_id', None),
|
|
374
|
+
token_id=d.get('token_id', None))
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
@dataclass
|
|
378
|
+
class UpdateIpAccessList:
|
|
379
|
+
label: str
|
|
380
|
+
list_type: 'ListType'
|
|
381
|
+
ip_addresses: 'List[str]'
|
|
382
|
+
enabled: bool
|
|
383
|
+
ip_access_list_id: str
|
|
384
|
+
list_id: str = None
|
|
385
|
+
|
|
386
|
+
def as_dict(self) -> dict:
|
|
387
|
+
body = {}
|
|
388
|
+
if self.enabled: body['enabled'] = self.enabled
|
|
389
|
+
if self.ip_access_list_id: body['ip_access_list_id'] = self.ip_access_list_id
|
|
390
|
+
if self.ip_addresses: body['ip_addresses'] = [v for v in self.ip_addresses]
|
|
391
|
+
if self.label: body['label'] = self.label
|
|
392
|
+
if self.list_id: body['list_id'] = self.list_id
|
|
393
|
+
if self.list_type: body['list_type'] = self.list_type.value
|
|
394
|
+
return body
|
|
395
|
+
|
|
396
|
+
@classmethod
|
|
397
|
+
def from_dict(cls, d: Dict[str, any]) -> 'UpdateIpAccessList':
|
|
398
|
+
return cls(enabled=d.get('enabled', None),
|
|
399
|
+
ip_access_list_id=d.get('ip_access_list_id', None),
|
|
400
|
+
ip_addresses=d.get('ip_addresses', None),
|
|
401
|
+
label=d.get('label', None),
|
|
402
|
+
list_id=d.get('list_id', None),
|
|
403
|
+
list_type=_enum(d, 'list_type', ListType))
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
WorkspaceConf = Dict[str, str]
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
class AccountIpAccessListsAPI:
|
|
410
|
+
"""The Accounts IP Access List API enables account admins to configure IP access lists for access to the
|
|
411
|
+
account console.
|
|
412
|
+
|
|
413
|
+
Account IP Access Lists affect web application access and REST API access to the account console and
|
|
414
|
+
account APIs. If the feature is disabled for the account, all access is allowed for this account. There is
|
|
415
|
+
support for allow lists (inclusion) and block lists (exclusion).
|
|
416
|
+
|
|
417
|
+
When a connection is attempted: 1. **First, all block lists are checked.** If the connection IP address
|
|
418
|
+
matches any block list, the connection is rejected. 2. **If the connection was not rejected by block
|
|
419
|
+
lists**, the IP address is compared with the allow lists.
|
|
420
|
+
|
|
421
|
+
If there is at least one allow list for the account, the connection is allowed only if the IP address
|
|
422
|
+
matches an allow list. If there are no allow lists for the account, all IP addresses are allowed.
|
|
423
|
+
|
|
424
|
+
For all allow lists and block lists combined, the account supports a maximum of 1000 IP/CIDR values, where
|
|
425
|
+
one CIDR counts as a single value.
|
|
426
|
+
|
|
427
|
+
After changes to the account-level IP access lists, it can take a few minutes for changes to take effect."""
|
|
428
|
+
|
|
429
|
+
def __init__(self, api_client):
|
|
430
|
+
self._api = api_client
|
|
431
|
+
|
|
432
|
+
def create(self, label: str, list_type: ListType, ip_addresses: List[str],
|
|
433
|
+
**kwargs) -> CreateIpAccessListResponse:
|
|
434
|
+
"""Create access list.
|
|
435
|
+
|
|
436
|
+
Creates an IP access list for the account.
|
|
437
|
+
|
|
438
|
+
A list can be an allow list or a block list. See the top of this file for a description of how the
|
|
439
|
+
server treats allow lists and block lists at runtime.
|
|
440
|
+
|
|
441
|
+
When creating or updating an IP access list:
|
|
442
|
+
|
|
443
|
+
* For all allow lists and block lists combined, the API supports a maximum of 1000 IP/CIDR values,
|
|
444
|
+
where one CIDR counts as a single value. Attempts to exceed that number return error 400 with
|
|
445
|
+
`error_code` value `QUOTA_EXCEEDED`. * If the new list would block the calling user's current IP,
|
|
446
|
+
error 400 is returned with `error_code` value `INVALID_STATE`.
|
|
447
|
+
|
|
448
|
+
It can take a few minutes for the changes to take effect."""
|
|
449
|
+
request = kwargs.get('request', None)
|
|
450
|
+
if not request: # request is not given through keyed args
|
|
451
|
+
request = CreateIpAccessList(ip_addresses=ip_addresses, label=label, list_type=list_type)
|
|
452
|
+
body = request.as_dict()
|
|
453
|
+
|
|
454
|
+
json = self._api.do('POST',
|
|
455
|
+
f'/api/2.0/preview/accounts/{self._api.account_id}/ip-access-lists',
|
|
456
|
+
body=body)
|
|
457
|
+
return CreateIpAccessListResponse.from_dict(json)
|
|
458
|
+
|
|
459
|
+
def delete(self, ip_access_list_id: str, **kwargs):
|
|
460
|
+
"""Delete access list.
|
|
461
|
+
|
|
462
|
+
Deletes an IP access list, specified by its list ID."""
|
|
463
|
+
request = kwargs.get('request', None)
|
|
464
|
+
if not request: # request is not given through keyed args
|
|
465
|
+
request = DeleteAccountIpAccessListRequest(ip_access_list_id=ip_access_list_id)
|
|
466
|
+
|
|
467
|
+
self._api.do(
|
|
468
|
+
'DELETE',
|
|
469
|
+
f'/api/2.0/preview/accounts/{self._api.account_id}/ip-access-lists/{request.ip_access_list_id}')
|
|
470
|
+
|
|
471
|
+
def get(self, ip_access_list_id: str, **kwargs) -> GetIpAccessListResponse:
|
|
472
|
+
"""Get IP access list.
|
|
473
|
+
|
|
474
|
+
Gets an IP access list, specified by its list ID."""
|
|
475
|
+
request = kwargs.get('request', None)
|
|
476
|
+
if not request: # request is not given through keyed args
|
|
477
|
+
request = GetAccountIpAccessListRequest(ip_access_list_id=ip_access_list_id)
|
|
478
|
+
|
|
479
|
+
json = self._api.do(
|
|
480
|
+
'GET',
|
|
481
|
+
f'/api/2.0/preview/accounts/{self._api.account_id}/ip-access-lists/{request.ip_access_list_id}')
|
|
482
|
+
return GetIpAccessListResponse.from_dict(json)
|
|
483
|
+
|
|
484
|
+
def list(self) -> Iterator[IpAccessListInfo]:
|
|
485
|
+
"""Get access lists.
|
|
486
|
+
|
|
487
|
+
Gets all IP access lists for the specified account."""
|
|
488
|
+
|
|
489
|
+
json = self._api.do('GET', f'/api/2.0/preview/accounts/{self._api.account_id}/ip-access-lists')
|
|
490
|
+
return [IpAccessListInfo.from_dict(v) for v in json.get('ip_access_lists', [])]
|
|
491
|
+
|
|
492
|
+
def replace(self,
|
|
493
|
+
label: str,
|
|
494
|
+
list_type: ListType,
|
|
495
|
+
ip_addresses: List[str],
|
|
496
|
+
enabled: bool,
|
|
497
|
+
ip_access_list_id: str,
|
|
498
|
+
*,
|
|
499
|
+
list_id: str = None,
|
|
500
|
+
**kwargs):
|
|
501
|
+
"""Replace access list.
|
|
502
|
+
|
|
503
|
+
Replaces an IP access list, specified by its ID.
|
|
504
|
+
|
|
505
|
+
A list can include allow lists and block lists. See the top of this file for a description of how the
|
|
506
|
+
server treats allow lists and block lists at run time. When replacing an IP access list: * For all
|
|
507
|
+
allow lists and block lists combined, the API supports a maximum of 1000 IP/CIDR values, where one
|
|
508
|
+
CIDR counts as a single value. Attempts to exceed that number return error 400 with `error_code` value
|
|
509
|
+
`QUOTA_EXCEEDED`. * If the resulting list would block the calling user's current IP, error 400 is
|
|
510
|
+
returned with `error_code` value `INVALID_STATE`. It can take a few minutes for the changes to take
|
|
511
|
+
effect."""
|
|
512
|
+
request = kwargs.get('request', None)
|
|
513
|
+
if not request: # request is not given through keyed args
|
|
514
|
+
request = ReplaceIpAccessList(enabled=enabled,
|
|
515
|
+
ip_access_list_id=ip_access_list_id,
|
|
516
|
+
ip_addresses=ip_addresses,
|
|
517
|
+
label=label,
|
|
518
|
+
list_id=list_id,
|
|
519
|
+
list_type=list_type)
|
|
520
|
+
body = request.as_dict()
|
|
521
|
+
self._api.do(
|
|
522
|
+
'PUT',
|
|
523
|
+
f'/api/2.0/preview/accounts/{self._api.account_id}/ip-access-lists/{request.ip_access_list_id}',
|
|
524
|
+
body=body)
|
|
525
|
+
|
|
526
|
+
def update(self,
|
|
527
|
+
label: str,
|
|
528
|
+
list_type: ListType,
|
|
529
|
+
ip_addresses: List[str],
|
|
530
|
+
enabled: bool,
|
|
531
|
+
ip_access_list_id: str,
|
|
532
|
+
*,
|
|
533
|
+
list_id: str = None,
|
|
534
|
+
**kwargs):
|
|
535
|
+
"""Update access list.
|
|
536
|
+
|
|
537
|
+
Updates an existing IP access list, specified by its ID.
|
|
538
|
+
|
|
539
|
+
A list can include allow lists and block lists. See the top of this file for a description of how the
|
|
540
|
+
server treats allow lists and block lists at run time.
|
|
541
|
+
|
|
542
|
+
When updating an IP access list:
|
|
543
|
+
|
|
544
|
+
* For all allow lists and block lists combined, the API supports a maximum of 1000 IP/CIDR values,
|
|
545
|
+
where one CIDR counts as a single value. Attempts to exceed that number return error 400 with
|
|
546
|
+
`error_code` value `QUOTA_EXCEEDED`. * If the updated list would block the calling user's current IP,
|
|
547
|
+
error 400 is returned with `error_code` value `INVALID_STATE`.
|
|
548
|
+
|
|
549
|
+
It can take a few minutes for the changes to take effect."""
|
|
550
|
+
request = kwargs.get('request', None)
|
|
551
|
+
if not request: # request is not given through keyed args
|
|
552
|
+
request = UpdateIpAccessList(enabled=enabled,
|
|
553
|
+
ip_access_list_id=ip_access_list_id,
|
|
554
|
+
ip_addresses=ip_addresses,
|
|
555
|
+
label=label,
|
|
556
|
+
list_id=list_id,
|
|
557
|
+
list_type=list_type)
|
|
558
|
+
body = request.as_dict()
|
|
559
|
+
self._api.do(
|
|
560
|
+
'PATCH',
|
|
561
|
+
f'/api/2.0/preview/accounts/{self._api.account_id}/ip-access-lists/{request.ip_access_list_id}',
|
|
562
|
+
body=body)
|
|
563
|
+
|
|
564
|
+
|
|
565
|
+
class IpAccessListsAPI:
|
|
566
|
+
"""IP Access List enables admins to configure IP access lists.
|
|
567
|
+
|
|
568
|
+
IP access lists affect web application access and REST API access to this workspace only. If the feature
|
|
569
|
+
is disabled for a workspace, all access is allowed for this workspace. There is support for allow lists
|
|
570
|
+
(inclusion) and block lists (exclusion).
|
|
571
|
+
|
|
572
|
+
When a connection is attempted: 1. **First, all block lists are checked.** If the connection IP address
|
|
573
|
+
matches any block list, the connection is rejected. 2. **If the connection was not rejected by block
|
|
574
|
+
lists**, the IP address is compared with the allow lists.
|
|
575
|
+
|
|
576
|
+
If there is at least one allow list for the workspace, the connection is allowed only if the IP address
|
|
577
|
+
matches an allow list. If there are no allow lists for the workspace, all IP addresses are allowed.
|
|
578
|
+
|
|
579
|
+
For all allow lists and block lists combined, the workspace supports a maximum of 1000 IP/CIDR values,
|
|
580
|
+
where one CIDR counts as a single value.
|
|
581
|
+
|
|
582
|
+
After changes to the IP access list feature, it can take a few minutes for changes to take effect."""
|
|
583
|
+
|
|
584
|
+
def __init__(self, api_client):
|
|
585
|
+
self._api = api_client
|
|
586
|
+
|
|
587
|
+
def create(self, label: str, list_type: ListType, ip_addresses: List[str],
|
|
588
|
+
**kwargs) -> CreateIpAccessListResponse:
|
|
589
|
+
"""Create access list.
|
|
590
|
+
|
|
591
|
+
Creates an IP access list for this workspace.
|
|
592
|
+
|
|
593
|
+
A list can be an allow list or a block list. See the top of this file for a description of how the
|
|
594
|
+
server treats allow lists and block lists at runtime.
|
|
595
|
+
|
|
596
|
+
When creating or updating an IP access list:
|
|
597
|
+
|
|
598
|
+
* For all allow lists and block lists combined, the API supports a maximum of 1000 IP/CIDR values,
|
|
599
|
+
where one CIDR counts as a single value. Attempts to exceed that number return error 400 with
|
|
600
|
+
`error_code` value `QUOTA_EXCEEDED`. * If the new list would block the calling user's current IP,
|
|
601
|
+
error 400 is returned with `error_code` value `INVALID_STATE`.
|
|
602
|
+
|
|
603
|
+
It can take a few minutes for the changes to take effect. **Note**: Your new IP access list has no
|
|
604
|
+
effect until you enable the feature. See :method:workspaceconf/setStatus"""
|
|
605
|
+
request = kwargs.get('request', None)
|
|
606
|
+
if not request: # request is not given through keyed args
|
|
607
|
+
request = CreateIpAccessList(ip_addresses=ip_addresses, label=label, list_type=list_type)
|
|
608
|
+
body = request.as_dict()
|
|
609
|
+
|
|
610
|
+
json = self._api.do('POST', '/api/2.0/ip-access-lists', body=body)
|
|
611
|
+
return CreateIpAccessListResponse.from_dict(json)
|
|
612
|
+
|
|
613
|
+
def delete(self, ip_access_list_id: str, **kwargs):
|
|
614
|
+
"""Delete access list.
|
|
615
|
+
|
|
616
|
+
Deletes an IP access list, specified by its list ID."""
|
|
617
|
+
request = kwargs.get('request', None)
|
|
618
|
+
if not request: # request is not given through keyed args
|
|
619
|
+
request = DeleteIpAccessListRequest(ip_access_list_id=ip_access_list_id)
|
|
620
|
+
|
|
621
|
+
self._api.do('DELETE', f'/api/2.0/ip-access-lists/{request.ip_access_list_id}')
|
|
622
|
+
|
|
623
|
+
def get(self, ip_access_list_id: str, **kwargs) -> FetchIpAccessListResponse:
|
|
624
|
+
"""Get access list.
|
|
625
|
+
|
|
626
|
+
Gets an IP access list, specified by its list ID."""
|
|
627
|
+
request = kwargs.get('request', None)
|
|
628
|
+
if not request: # request is not given through keyed args
|
|
629
|
+
request = GetIpAccessListRequest(ip_access_list_id=ip_access_list_id)
|
|
630
|
+
|
|
631
|
+
json = self._api.do('GET', f'/api/2.0/ip-access-lists/{request.ip_access_list_id}')
|
|
632
|
+
return FetchIpAccessListResponse.from_dict(json)
|
|
633
|
+
|
|
634
|
+
def list(self) -> Iterator[IpAccessListInfo]:
|
|
635
|
+
"""Get access lists.
|
|
636
|
+
|
|
637
|
+
Gets all IP access lists for the specified workspace."""
|
|
638
|
+
|
|
639
|
+
json = self._api.do('GET', '/api/2.0/ip-access-lists')
|
|
640
|
+
return [IpAccessListInfo.from_dict(v) for v in json.get('ip_access_lists', [])]
|
|
641
|
+
|
|
642
|
+
def replace(self,
|
|
643
|
+
label: str,
|
|
644
|
+
list_type: ListType,
|
|
645
|
+
ip_addresses: List[str],
|
|
646
|
+
enabled: bool,
|
|
647
|
+
ip_access_list_id: str,
|
|
648
|
+
*,
|
|
649
|
+
list_id: str = None,
|
|
650
|
+
**kwargs):
|
|
651
|
+
"""Replace access list.
|
|
652
|
+
|
|
653
|
+
Replaces an IP access list, specified by its ID.
|
|
654
|
+
|
|
655
|
+
A list can include allow lists and block lists. See the top of this file for a description of how the
|
|
656
|
+
server treats allow lists and block lists at run time. When replacing an IP access list: * For all
|
|
657
|
+
allow lists and block lists combined, the API supports a maximum of 1000 IP/CIDR values, where one
|
|
658
|
+
CIDR counts as a single value. Attempts to exceed that number return error 400 with `error_code` value
|
|
659
|
+
`QUOTA_EXCEEDED`. * If the resulting list would block the calling user's current IP, error 400 is
|
|
660
|
+
returned with `error_code` value `INVALID_STATE`. It can take a few minutes for the changes to take
|
|
661
|
+
effect. Note that your resulting IP access list has no effect until you enable the feature. See
|
|
662
|
+
:method:workspaceconf/setStatus."""
|
|
663
|
+
request = kwargs.get('request', None)
|
|
664
|
+
if not request: # request is not given through keyed args
|
|
665
|
+
request = ReplaceIpAccessList(enabled=enabled,
|
|
666
|
+
ip_access_list_id=ip_access_list_id,
|
|
667
|
+
ip_addresses=ip_addresses,
|
|
668
|
+
label=label,
|
|
669
|
+
list_id=list_id,
|
|
670
|
+
list_type=list_type)
|
|
671
|
+
body = request.as_dict()
|
|
672
|
+
self._api.do('PUT', f'/api/2.0/ip-access-lists/{request.ip_access_list_id}', body=body)
|
|
673
|
+
|
|
674
|
+
def update(self,
|
|
675
|
+
label: str,
|
|
676
|
+
list_type: ListType,
|
|
677
|
+
ip_addresses: List[str],
|
|
678
|
+
enabled: bool,
|
|
679
|
+
ip_access_list_id: str,
|
|
680
|
+
*,
|
|
681
|
+
list_id: str = None,
|
|
682
|
+
**kwargs):
|
|
683
|
+
"""Update access list.
|
|
684
|
+
|
|
685
|
+
Updates an existing IP access list, specified by its ID.
|
|
686
|
+
|
|
687
|
+
A list can include allow lists and block lists. See the top of this file for a description of how the
|
|
688
|
+
server treats allow lists and block lists at run time.
|
|
689
|
+
|
|
690
|
+
When updating an IP access list:
|
|
691
|
+
|
|
692
|
+
* For all allow lists and block lists combined, the API supports a maximum of 1000 IP/CIDR values,
|
|
693
|
+
where one CIDR counts as a single value. Attempts to exceed that number return error 400 with
|
|
694
|
+
`error_code` value `QUOTA_EXCEEDED`. * If the updated list would block the calling user's current IP,
|
|
695
|
+
error 400 is returned with `error_code` value `INVALID_STATE`.
|
|
696
|
+
|
|
697
|
+
It can take a few minutes for the changes to take effect. Note that your resulting IP access list has
|
|
698
|
+
no effect until you enable the feature. See :method:workspaceconf/setStatus."""
|
|
699
|
+
request = kwargs.get('request', None)
|
|
700
|
+
if not request: # request is not given through keyed args
|
|
701
|
+
request = UpdateIpAccessList(enabled=enabled,
|
|
702
|
+
ip_access_list_id=ip_access_list_id,
|
|
703
|
+
ip_addresses=ip_addresses,
|
|
704
|
+
label=label,
|
|
705
|
+
list_id=list_id,
|
|
706
|
+
list_type=list_type)
|
|
707
|
+
body = request.as_dict()
|
|
708
|
+
self._api.do('PATCH', f'/api/2.0/ip-access-lists/{request.ip_access_list_id}', body=body)
|
|
709
|
+
|
|
710
|
+
|
|
711
|
+
class TokenManagementAPI:
|
|
712
|
+
"""Enables administrators to get all tokens and delete tokens for other users. Admins can either get every
|
|
713
|
+
token, get a specific token by ID, or get all tokens for a particular user."""
|
|
714
|
+
|
|
715
|
+
def __init__(self, api_client):
|
|
716
|
+
self._api = api_client
|
|
717
|
+
|
|
718
|
+
def create_obo_token(self,
|
|
719
|
+
application_id: str,
|
|
720
|
+
lifetime_seconds: int,
|
|
721
|
+
*,
|
|
722
|
+
comment: str = None,
|
|
723
|
+
**kwargs) -> CreateOboTokenResponse:
|
|
724
|
+
"""Create on-behalf token.
|
|
725
|
+
|
|
726
|
+
Creates a token on behalf of a service principal."""
|
|
727
|
+
request = kwargs.get('request', None)
|
|
728
|
+
if not request: # request is not given through keyed args
|
|
729
|
+
request = CreateOboTokenRequest(application_id=application_id,
|
|
730
|
+
comment=comment,
|
|
731
|
+
lifetime_seconds=lifetime_seconds)
|
|
732
|
+
body = request.as_dict()
|
|
733
|
+
|
|
734
|
+
json = self._api.do('POST', '/api/2.0/token-management/on-behalf-of/tokens', body=body)
|
|
735
|
+
return CreateOboTokenResponse.from_dict(json)
|
|
736
|
+
|
|
737
|
+
def delete(self, token_id: str, **kwargs):
|
|
738
|
+
"""Delete a token.
|
|
739
|
+
|
|
740
|
+
Deletes a token, specified by its ID."""
|
|
741
|
+
request = kwargs.get('request', None)
|
|
742
|
+
if not request: # request is not given through keyed args
|
|
743
|
+
request = DeleteTokenManagementRequest(token_id=token_id)
|
|
744
|
+
|
|
745
|
+
self._api.do('DELETE', f'/api/2.0/token-management/tokens/{request.token_id}')
|
|
746
|
+
|
|
747
|
+
def get(self, token_id: str, **kwargs) -> TokenInfo:
|
|
748
|
+
"""Get token info.
|
|
749
|
+
|
|
750
|
+
Gets information about a token, specified by its ID."""
|
|
751
|
+
request = kwargs.get('request', None)
|
|
752
|
+
if not request: # request is not given through keyed args
|
|
753
|
+
request = GetTokenManagementRequest(token_id=token_id)
|
|
754
|
+
|
|
755
|
+
json = self._api.do('GET', f'/api/2.0/token-management/tokens/{request.token_id}')
|
|
756
|
+
return TokenInfo.from_dict(json)
|
|
757
|
+
|
|
758
|
+
def list(self,
|
|
759
|
+
*,
|
|
760
|
+
created_by_id: str = None,
|
|
761
|
+
created_by_username: str = None,
|
|
762
|
+
**kwargs) -> Iterator[PublicTokenInfo]:
|
|
763
|
+
"""List all tokens.
|
|
764
|
+
|
|
765
|
+
Lists all tokens associated with the specified workspace or user."""
|
|
766
|
+
request = kwargs.get('request', None)
|
|
767
|
+
if not request: # request is not given through keyed args
|
|
768
|
+
request = ListTokenManagementRequest(created_by_id=created_by_id,
|
|
769
|
+
created_by_username=created_by_username)
|
|
770
|
+
|
|
771
|
+
query = {}
|
|
772
|
+
if created_by_id: query['created_by_id'] = request.created_by_id
|
|
773
|
+
if created_by_username: query['created_by_username'] = request.created_by_username
|
|
774
|
+
|
|
775
|
+
json = self._api.do('GET', '/api/2.0/token-management/tokens', query=query)
|
|
776
|
+
return [PublicTokenInfo.from_dict(v) for v in json.get('token_infos', [])]
|
|
777
|
+
|
|
778
|
+
|
|
779
|
+
class TokensAPI:
|
|
780
|
+
"""The Token API allows you to create, list, and revoke tokens that can be used to authenticate and access
|
|
781
|
+
Databricks REST APIs."""
|
|
782
|
+
|
|
783
|
+
def __init__(self, api_client):
|
|
784
|
+
self._api = api_client
|
|
785
|
+
|
|
786
|
+
def create(self, *, comment: str = None, lifetime_seconds: int = None, **kwargs) -> CreateTokenResponse:
|
|
787
|
+
"""Create a user token.
|
|
788
|
+
|
|
789
|
+
Creates and returns a token for a user. If this call is made through token authentication, it creates
|
|
790
|
+
a token with the same client ID as the authenticated token. If the user's token quota is exceeded,
|
|
791
|
+
this call returns an error **QUOTA_EXCEEDED**."""
|
|
792
|
+
request = kwargs.get('request', None)
|
|
793
|
+
if not request: # request is not given through keyed args
|
|
794
|
+
request = CreateTokenRequest(comment=comment, lifetime_seconds=lifetime_seconds)
|
|
795
|
+
body = request.as_dict()
|
|
796
|
+
|
|
797
|
+
json = self._api.do('POST', '/api/2.0/token/create', body=body)
|
|
798
|
+
return CreateTokenResponse.from_dict(json)
|
|
799
|
+
|
|
800
|
+
def delete(self, token_id: str, **kwargs):
|
|
801
|
+
"""Revoke token.
|
|
802
|
+
|
|
803
|
+
Revokes an access token.
|
|
804
|
+
|
|
805
|
+
If a token with the specified ID is not valid, this call returns an error **RESOURCE_DOES_NOT_EXIST**."""
|
|
806
|
+
request = kwargs.get('request', None)
|
|
807
|
+
if not request: # request is not given through keyed args
|
|
808
|
+
request = RevokeTokenRequest(token_id=token_id)
|
|
809
|
+
body = request.as_dict()
|
|
810
|
+
self._api.do('POST', '/api/2.0/token/delete', body=body)
|
|
811
|
+
|
|
812
|
+
def list(self) -> Iterator[PublicTokenInfo]:
|
|
813
|
+
"""List tokens.
|
|
814
|
+
|
|
815
|
+
Lists all the valid tokens for a user-workspace pair."""
|
|
816
|
+
|
|
817
|
+
json = self._api.do('GET', '/api/2.0/token/list')
|
|
818
|
+
return [PublicTokenInfo.from_dict(v) for v in json.get('token_infos', [])]
|
|
819
|
+
|
|
820
|
+
|
|
821
|
+
class WorkspaceConfAPI:
|
|
822
|
+
"""This API allows updating known workspace settings for advanced users."""
|
|
823
|
+
|
|
824
|
+
def __init__(self, api_client):
|
|
825
|
+
self._api = api_client
|
|
826
|
+
|
|
827
|
+
def get_status(self, keys: str, **kwargs) -> WorkspaceConf:
|
|
828
|
+
"""Check configuration status.
|
|
829
|
+
|
|
830
|
+
Gets the configuration status for a workspace."""
|
|
831
|
+
request = kwargs.get('request', None)
|
|
832
|
+
if not request: # request is not given through keyed args
|
|
833
|
+
request = GetStatusRequest(keys=keys)
|
|
834
|
+
|
|
835
|
+
query = {}
|
|
836
|
+
if keys: query['keys'] = request.keys
|
|
837
|
+
|
|
838
|
+
json = self._api.do('GET', '/api/2.0/workspace-conf', query=query)
|
|
839
|
+
return WorkspaceConf.from_dict(json)
|
|
840
|
+
|
|
841
|
+
def set_status(self, **kwargs):
|
|
842
|
+
"""Enable/disable features.
|
|
843
|
+
|
|
844
|
+
Sets the configuration status for a workspace, including enabling or disabling it."""
|
|
845
|
+
request = kwargs.get('request', None)
|
|
846
|
+
if not request: # request is not given through keyed args
|
|
847
|
+
request = Dict[str, str]()
|
|
848
|
+
|
|
849
|
+
self._api.do('PATCH', '/api/2.0/workspace-conf')
|