databricks-sdk 0.65.0__py3-none-any.whl → 0.66.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.
Potentially problematic release.
This version of databricks-sdk might be problematic. Click here for more details.
- databricks/sdk/__init__.py +89 -28
- databricks/sdk/credentials_provider.py +6 -5
- databricks/sdk/mixins/sharing.py +44 -0
- databricks/sdk/service/catalog.py +12 -6
- databricks/sdk/service/compute.py +11 -0
- databricks/sdk/service/dashboards.py +88 -16
- databricks/sdk/service/database.py +24 -38
- databricks/sdk/service/iam.py +2557 -492
- databricks/sdk/service/iamv2.py +643 -0
- databricks/sdk/service/jobs.py +22 -59
- databricks/sdk/service/ml.py +392 -0
- databricks/sdk/service/oauth2.py +3 -3
- databricks/sdk/service/pipelines.py +105 -0
- databricks/sdk/service/settingsv2.py +13 -65
- databricks/sdk/service/sharing.py +13 -1
- databricks/sdk/service/sql.py +15 -3
- databricks/sdk/service/tags.py +25 -6
- databricks/sdk/version.py +1 -1
- {databricks_sdk-0.65.0.dist-info → databricks_sdk-0.66.0.dist-info}/METADATA +1 -1
- {databricks_sdk-0.65.0.dist-info → databricks_sdk-0.66.0.dist-info}/RECORD +24 -22
- {databricks_sdk-0.65.0.dist-info → databricks_sdk-0.66.0.dist-info}/WHEEL +0 -0
- {databricks_sdk-0.65.0.dist-info → databricks_sdk-0.66.0.dist-info}/licenses/LICENSE +0 -0
- {databricks_sdk-0.65.0.dist-info → databricks_sdk-0.66.0.dist-info}/licenses/NOTICE +0 -0
- {databricks_sdk-0.65.0.dist-info → databricks_sdk-0.66.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,643 @@
|
|
|
1
|
+
# Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import logging
|
|
6
|
+
from dataclasses import dataclass
|
|
7
|
+
from enum import Enum
|
|
8
|
+
from typing import Any, Dict, List, Optional
|
|
9
|
+
|
|
10
|
+
from ._internal import _enum, _from_dict, _repeated_enum
|
|
11
|
+
|
|
12
|
+
_LOG = logging.getLogger("databricks.sdk")
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
# all definitions in this file are in alphabetical order
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@dataclass
|
|
19
|
+
class Group:
|
|
20
|
+
"""The details of a Group resource."""
|
|
21
|
+
|
|
22
|
+
account_id: Optional[str] = None
|
|
23
|
+
"""The parent account ID for group in Databricks."""
|
|
24
|
+
|
|
25
|
+
external_id: Optional[str] = None
|
|
26
|
+
"""ExternalId of the group in the customer's IdP."""
|
|
27
|
+
|
|
28
|
+
group_name: Optional[str] = None
|
|
29
|
+
"""Display name of the group."""
|
|
30
|
+
|
|
31
|
+
internal_id: Optional[int] = None
|
|
32
|
+
"""Internal group ID of the group in Databricks."""
|
|
33
|
+
|
|
34
|
+
def as_dict(self) -> dict:
|
|
35
|
+
"""Serializes the Group into a dictionary suitable for use as a JSON request body."""
|
|
36
|
+
body = {}
|
|
37
|
+
if self.account_id is not None:
|
|
38
|
+
body["account_id"] = self.account_id
|
|
39
|
+
if self.external_id is not None:
|
|
40
|
+
body["external_id"] = self.external_id
|
|
41
|
+
if self.group_name is not None:
|
|
42
|
+
body["group_name"] = self.group_name
|
|
43
|
+
if self.internal_id is not None:
|
|
44
|
+
body["internal_id"] = self.internal_id
|
|
45
|
+
return body
|
|
46
|
+
|
|
47
|
+
def as_shallow_dict(self) -> dict:
|
|
48
|
+
"""Serializes the Group into a shallow dictionary of its immediate attributes."""
|
|
49
|
+
body = {}
|
|
50
|
+
if self.account_id is not None:
|
|
51
|
+
body["account_id"] = self.account_id
|
|
52
|
+
if self.external_id is not None:
|
|
53
|
+
body["external_id"] = self.external_id
|
|
54
|
+
if self.group_name is not None:
|
|
55
|
+
body["group_name"] = self.group_name
|
|
56
|
+
if self.internal_id is not None:
|
|
57
|
+
body["internal_id"] = self.internal_id
|
|
58
|
+
return body
|
|
59
|
+
|
|
60
|
+
@classmethod
|
|
61
|
+
def from_dict(cls, d: Dict[str, Any]) -> Group:
|
|
62
|
+
"""Deserializes the Group from a dictionary."""
|
|
63
|
+
return cls(
|
|
64
|
+
account_id=d.get("account_id", None),
|
|
65
|
+
external_id=d.get("external_id", None),
|
|
66
|
+
group_name=d.get("group_name", None),
|
|
67
|
+
internal_id=d.get("internal_id", None),
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
class PrincipalType(Enum):
|
|
72
|
+
"""The type of the principal (user/sp/group)."""
|
|
73
|
+
|
|
74
|
+
GROUP = "GROUP"
|
|
75
|
+
SERVICE_PRINCIPAL = "SERVICE_PRINCIPAL"
|
|
76
|
+
USER = "USER"
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
@dataclass
|
|
80
|
+
class ResolveGroupResponse:
|
|
81
|
+
group: Optional[Group] = None
|
|
82
|
+
"""The group that was resolved."""
|
|
83
|
+
|
|
84
|
+
def as_dict(self) -> dict:
|
|
85
|
+
"""Serializes the ResolveGroupResponse into a dictionary suitable for use as a JSON request body."""
|
|
86
|
+
body = {}
|
|
87
|
+
if self.group:
|
|
88
|
+
body["group"] = self.group.as_dict()
|
|
89
|
+
return body
|
|
90
|
+
|
|
91
|
+
def as_shallow_dict(self) -> dict:
|
|
92
|
+
"""Serializes the ResolveGroupResponse into a shallow dictionary of its immediate attributes."""
|
|
93
|
+
body = {}
|
|
94
|
+
if self.group:
|
|
95
|
+
body["group"] = self.group
|
|
96
|
+
return body
|
|
97
|
+
|
|
98
|
+
@classmethod
|
|
99
|
+
def from_dict(cls, d: Dict[str, Any]) -> ResolveGroupResponse:
|
|
100
|
+
"""Deserializes the ResolveGroupResponse from a dictionary."""
|
|
101
|
+
return cls(group=_from_dict(d, "group", Group))
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
@dataclass
|
|
105
|
+
class ResolveServicePrincipalResponse:
|
|
106
|
+
service_principal: Optional[ServicePrincipal] = None
|
|
107
|
+
"""The service principal that was resolved."""
|
|
108
|
+
|
|
109
|
+
def as_dict(self) -> dict:
|
|
110
|
+
"""Serializes the ResolveServicePrincipalResponse into a dictionary suitable for use as a JSON request body."""
|
|
111
|
+
body = {}
|
|
112
|
+
if self.service_principal:
|
|
113
|
+
body["service_principal"] = self.service_principal.as_dict()
|
|
114
|
+
return body
|
|
115
|
+
|
|
116
|
+
def as_shallow_dict(self) -> dict:
|
|
117
|
+
"""Serializes the ResolveServicePrincipalResponse into a shallow dictionary of its immediate attributes."""
|
|
118
|
+
body = {}
|
|
119
|
+
if self.service_principal:
|
|
120
|
+
body["service_principal"] = self.service_principal
|
|
121
|
+
return body
|
|
122
|
+
|
|
123
|
+
@classmethod
|
|
124
|
+
def from_dict(cls, d: Dict[str, Any]) -> ResolveServicePrincipalResponse:
|
|
125
|
+
"""Deserializes the ResolveServicePrincipalResponse from a dictionary."""
|
|
126
|
+
return cls(service_principal=_from_dict(d, "service_principal", ServicePrincipal))
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
@dataclass
|
|
130
|
+
class ResolveUserResponse:
|
|
131
|
+
user: Optional[User] = None
|
|
132
|
+
"""The user that was resolved."""
|
|
133
|
+
|
|
134
|
+
def as_dict(self) -> dict:
|
|
135
|
+
"""Serializes the ResolveUserResponse into a dictionary suitable for use as a JSON request body."""
|
|
136
|
+
body = {}
|
|
137
|
+
if self.user:
|
|
138
|
+
body["user"] = self.user.as_dict()
|
|
139
|
+
return body
|
|
140
|
+
|
|
141
|
+
def as_shallow_dict(self) -> dict:
|
|
142
|
+
"""Serializes the ResolveUserResponse into a shallow dictionary of its immediate attributes."""
|
|
143
|
+
body = {}
|
|
144
|
+
if self.user:
|
|
145
|
+
body["user"] = self.user
|
|
146
|
+
return body
|
|
147
|
+
|
|
148
|
+
@classmethod
|
|
149
|
+
def from_dict(cls, d: Dict[str, Any]) -> ResolveUserResponse:
|
|
150
|
+
"""Deserializes the ResolveUserResponse from a dictionary."""
|
|
151
|
+
return cls(user=_from_dict(d, "user", User))
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
@dataclass
|
|
155
|
+
class ServicePrincipal:
|
|
156
|
+
"""The details of a ServicePrincipal resource."""
|
|
157
|
+
|
|
158
|
+
account_id: Optional[str] = None
|
|
159
|
+
"""The parent account ID for the service principal in Databricks."""
|
|
160
|
+
|
|
161
|
+
account_sp_status: Optional[State] = None
|
|
162
|
+
"""The activity status of a service principal in a Databricks account."""
|
|
163
|
+
|
|
164
|
+
application_id: Optional[str] = None
|
|
165
|
+
"""Application ID of the service principal."""
|
|
166
|
+
|
|
167
|
+
display_name: Optional[str] = None
|
|
168
|
+
"""Display name of the service principal."""
|
|
169
|
+
|
|
170
|
+
external_id: Optional[str] = None
|
|
171
|
+
"""ExternalId of the service principal in the customer's IdP."""
|
|
172
|
+
|
|
173
|
+
internal_id: Optional[int] = None
|
|
174
|
+
"""Internal service principal ID of the service principal in Databricks."""
|
|
175
|
+
|
|
176
|
+
def as_dict(self) -> dict:
|
|
177
|
+
"""Serializes the ServicePrincipal into a dictionary suitable for use as a JSON request body."""
|
|
178
|
+
body = {}
|
|
179
|
+
if self.account_id is not None:
|
|
180
|
+
body["account_id"] = self.account_id
|
|
181
|
+
if self.account_sp_status is not None:
|
|
182
|
+
body["account_sp_status"] = self.account_sp_status.value
|
|
183
|
+
if self.application_id is not None:
|
|
184
|
+
body["application_id"] = self.application_id
|
|
185
|
+
if self.display_name is not None:
|
|
186
|
+
body["display_name"] = self.display_name
|
|
187
|
+
if self.external_id is not None:
|
|
188
|
+
body["external_id"] = self.external_id
|
|
189
|
+
if self.internal_id is not None:
|
|
190
|
+
body["internal_id"] = self.internal_id
|
|
191
|
+
return body
|
|
192
|
+
|
|
193
|
+
def as_shallow_dict(self) -> dict:
|
|
194
|
+
"""Serializes the ServicePrincipal into a shallow dictionary of its immediate attributes."""
|
|
195
|
+
body = {}
|
|
196
|
+
if self.account_id is not None:
|
|
197
|
+
body["account_id"] = self.account_id
|
|
198
|
+
if self.account_sp_status is not None:
|
|
199
|
+
body["account_sp_status"] = self.account_sp_status
|
|
200
|
+
if self.application_id is not None:
|
|
201
|
+
body["application_id"] = self.application_id
|
|
202
|
+
if self.display_name is not None:
|
|
203
|
+
body["display_name"] = self.display_name
|
|
204
|
+
if self.external_id is not None:
|
|
205
|
+
body["external_id"] = self.external_id
|
|
206
|
+
if self.internal_id is not None:
|
|
207
|
+
body["internal_id"] = self.internal_id
|
|
208
|
+
return body
|
|
209
|
+
|
|
210
|
+
@classmethod
|
|
211
|
+
def from_dict(cls, d: Dict[str, Any]) -> ServicePrincipal:
|
|
212
|
+
"""Deserializes the ServicePrincipal from a dictionary."""
|
|
213
|
+
return cls(
|
|
214
|
+
account_id=d.get("account_id", None),
|
|
215
|
+
account_sp_status=_enum(d, "account_sp_status", State),
|
|
216
|
+
application_id=d.get("application_id", None),
|
|
217
|
+
display_name=d.get("display_name", None),
|
|
218
|
+
external_id=d.get("external_id", None),
|
|
219
|
+
internal_id=d.get("internal_id", None),
|
|
220
|
+
)
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
class State(Enum):
|
|
224
|
+
"""The activity status of a user or service principal in a Databricks account or workspace."""
|
|
225
|
+
|
|
226
|
+
ACTIVE = "ACTIVE"
|
|
227
|
+
INACTIVE = "INACTIVE"
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
@dataclass
|
|
231
|
+
class User:
|
|
232
|
+
"""The details of a User resource."""
|
|
233
|
+
|
|
234
|
+
username: str
|
|
235
|
+
"""Username/email of the user."""
|
|
236
|
+
|
|
237
|
+
account_id: Optional[str] = None
|
|
238
|
+
"""The accountId parent of the user in Databricks."""
|
|
239
|
+
|
|
240
|
+
account_user_status: Optional[State] = None
|
|
241
|
+
"""The activity status of a user in a Databricks account."""
|
|
242
|
+
|
|
243
|
+
external_id: Optional[str] = None
|
|
244
|
+
"""ExternalId of the user in the customer's IdP."""
|
|
245
|
+
|
|
246
|
+
internal_id: Optional[int] = None
|
|
247
|
+
"""Internal userId of the user in Databricks."""
|
|
248
|
+
|
|
249
|
+
name: Optional[UserName] = None
|
|
250
|
+
|
|
251
|
+
def as_dict(self) -> dict:
|
|
252
|
+
"""Serializes the User into a dictionary suitable for use as a JSON request body."""
|
|
253
|
+
body = {}
|
|
254
|
+
if self.account_id is not None:
|
|
255
|
+
body["account_id"] = self.account_id
|
|
256
|
+
if self.account_user_status is not None:
|
|
257
|
+
body["account_user_status"] = self.account_user_status.value
|
|
258
|
+
if self.external_id is not None:
|
|
259
|
+
body["external_id"] = self.external_id
|
|
260
|
+
if self.internal_id is not None:
|
|
261
|
+
body["internal_id"] = self.internal_id
|
|
262
|
+
if self.name:
|
|
263
|
+
body["name"] = self.name.as_dict()
|
|
264
|
+
if self.username is not None:
|
|
265
|
+
body["username"] = self.username
|
|
266
|
+
return body
|
|
267
|
+
|
|
268
|
+
def as_shallow_dict(self) -> dict:
|
|
269
|
+
"""Serializes the User into a shallow dictionary of its immediate attributes."""
|
|
270
|
+
body = {}
|
|
271
|
+
if self.account_id is not None:
|
|
272
|
+
body["account_id"] = self.account_id
|
|
273
|
+
if self.account_user_status is not None:
|
|
274
|
+
body["account_user_status"] = self.account_user_status
|
|
275
|
+
if self.external_id is not None:
|
|
276
|
+
body["external_id"] = self.external_id
|
|
277
|
+
if self.internal_id is not None:
|
|
278
|
+
body["internal_id"] = self.internal_id
|
|
279
|
+
if self.name:
|
|
280
|
+
body["name"] = self.name
|
|
281
|
+
if self.username is not None:
|
|
282
|
+
body["username"] = self.username
|
|
283
|
+
return body
|
|
284
|
+
|
|
285
|
+
@classmethod
|
|
286
|
+
def from_dict(cls, d: Dict[str, Any]) -> User:
|
|
287
|
+
"""Deserializes the User from a dictionary."""
|
|
288
|
+
return cls(
|
|
289
|
+
account_id=d.get("account_id", None),
|
|
290
|
+
account_user_status=_enum(d, "account_user_status", State),
|
|
291
|
+
external_id=d.get("external_id", None),
|
|
292
|
+
internal_id=d.get("internal_id", None),
|
|
293
|
+
name=_from_dict(d, "name", UserName),
|
|
294
|
+
username=d.get("username", None),
|
|
295
|
+
)
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
@dataclass
|
|
299
|
+
class UserName:
|
|
300
|
+
family_name: Optional[str] = None
|
|
301
|
+
|
|
302
|
+
given_name: Optional[str] = None
|
|
303
|
+
|
|
304
|
+
def as_dict(self) -> dict:
|
|
305
|
+
"""Serializes the UserName into a dictionary suitable for use as a JSON request body."""
|
|
306
|
+
body = {}
|
|
307
|
+
if self.family_name is not None:
|
|
308
|
+
body["family_name"] = self.family_name
|
|
309
|
+
if self.given_name is not None:
|
|
310
|
+
body["given_name"] = self.given_name
|
|
311
|
+
return body
|
|
312
|
+
|
|
313
|
+
def as_shallow_dict(self) -> dict:
|
|
314
|
+
"""Serializes the UserName into a shallow dictionary of its immediate attributes."""
|
|
315
|
+
body = {}
|
|
316
|
+
if self.family_name is not None:
|
|
317
|
+
body["family_name"] = self.family_name
|
|
318
|
+
if self.given_name is not None:
|
|
319
|
+
body["given_name"] = self.given_name
|
|
320
|
+
return body
|
|
321
|
+
|
|
322
|
+
@classmethod
|
|
323
|
+
def from_dict(cls, d: Dict[str, Any]) -> UserName:
|
|
324
|
+
"""Deserializes the UserName from a dictionary."""
|
|
325
|
+
return cls(family_name=d.get("family_name", None), given_name=d.get("given_name", None))
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
@dataclass
|
|
329
|
+
class WorkspaceAccessDetail:
|
|
330
|
+
"""The details of a principal's access to a workspace."""
|
|
331
|
+
|
|
332
|
+
access_type: Optional[WorkspaceAccessDetailAccessType] = None
|
|
333
|
+
|
|
334
|
+
account_id: Optional[str] = None
|
|
335
|
+
"""The account ID parent of the workspace where the principal has access."""
|
|
336
|
+
|
|
337
|
+
permissions: Optional[List[WorkspacePermission]] = None
|
|
338
|
+
"""The permissions granted to the principal in the workspace."""
|
|
339
|
+
|
|
340
|
+
principal_id: Optional[int] = None
|
|
341
|
+
"""The internal ID of the principal (user/sp/group) in Databricks."""
|
|
342
|
+
|
|
343
|
+
principal_type: Optional[PrincipalType] = None
|
|
344
|
+
|
|
345
|
+
status: Optional[State] = None
|
|
346
|
+
"""The activity status of the principal in the workspace. Not applicable for groups at the moment."""
|
|
347
|
+
|
|
348
|
+
workspace_id: Optional[int] = None
|
|
349
|
+
"""The workspace ID where the principal has access."""
|
|
350
|
+
|
|
351
|
+
def as_dict(self) -> dict:
|
|
352
|
+
"""Serializes the WorkspaceAccessDetail into a dictionary suitable for use as a JSON request body."""
|
|
353
|
+
body = {}
|
|
354
|
+
if self.access_type is not None:
|
|
355
|
+
body["access_type"] = self.access_type.value
|
|
356
|
+
if self.account_id is not None:
|
|
357
|
+
body["account_id"] = self.account_id
|
|
358
|
+
if self.permissions:
|
|
359
|
+
body["permissions"] = [v.value for v in self.permissions]
|
|
360
|
+
if self.principal_id is not None:
|
|
361
|
+
body["principal_id"] = self.principal_id
|
|
362
|
+
if self.principal_type is not None:
|
|
363
|
+
body["principal_type"] = self.principal_type.value
|
|
364
|
+
if self.status is not None:
|
|
365
|
+
body["status"] = self.status.value
|
|
366
|
+
if self.workspace_id is not None:
|
|
367
|
+
body["workspace_id"] = self.workspace_id
|
|
368
|
+
return body
|
|
369
|
+
|
|
370
|
+
def as_shallow_dict(self) -> dict:
|
|
371
|
+
"""Serializes the WorkspaceAccessDetail into a shallow dictionary of its immediate attributes."""
|
|
372
|
+
body = {}
|
|
373
|
+
if self.access_type is not None:
|
|
374
|
+
body["access_type"] = self.access_type
|
|
375
|
+
if self.account_id is not None:
|
|
376
|
+
body["account_id"] = self.account_id
|
|
377
|
+
if self.permissions:
|
|
378
|
+
body["permissions"] = self.permissions
|
|
379
|
+
if self.principal_id is not None:
|
|
380
|
+
body["principal_id"] = self.principal_id
|
|
381
|
+
if self.principal_type is not None:
|
|
382
|
+
body["principal_type"] = self.principal_type
|
|
383
|
+
if self.status is not None:
|
|
384
|
+
body["status"] = self.status
|
|
385
|
+
if self.workspace_id is not None:
|
|
386
|
+
body["workspace_id"] = self.workspace_id
|
|
387
|
+
return body
|
|
388
|
+
|
|
389
|
+
@classmethod
|
|
390
|
+
def from_dict(cls, d: Dict[str, Any]) -> WorkspaceAccessDetail:
|
|
391
|
+
"""Deserializes the WorkspaceAccessDetail from a dictionary."""
|
|
392
|
+
return cls(
|
|
393
|
+
access_type=_enum(d, "access_type", WorkspaceAccessDetailAccessType),
|
|
394
|
+
account_id=d.get("account_id", None),
|
|
395
|
+
permissions=_repeated_enum(d, "permissions", WorkspacePermission),
|
|
396
|
+
principal_id=d.get("principal_id", None),
|
|
397
|
+
principal_type=_enum(d, "principal_type", PrincipalType),
|
|
398
|
+
status=_enum(d, "status", State),
|
|
399
|
+
workspace_id=d.get("workspace_id", None),
|
|
400
|
+
)
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
class WorkspaceAccessDetailAccessType(Enum):
|
|
404
|
+
"""The type of access the principal has to the workspace."""
|
|
405
|
+
|
|
406
|
+
DIRECT = "DIRECT"
|
|
407
|
+
INDIRECT = "INDIRECT"
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
class WorkspaceAccessDetailView(Enum):
|
|
411
|
+
"""Controls what fields are returned in the GetWorkspaceAccessDetail response."""
|
|
412
|
+
|
|
413
|
+
BASIC = "BASIC"
|
|
414
|
+
FULL = "FULL"
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
class WorkspacePermission(Enum):
|
|
418
|
+
"""The type of permission a principal has to a workspace (admin/user)."""
|
|
419
|
+
|
|
420
|
+
ADMIN_PERMISSION = "ADMIN_PERMISSION"
|
|
421
|
+
USER_PERMISSION = "USER_PERMISSION"
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
class AccountIamV2API:
|
|
425
|
+
"""These APIs are used to manage identities and the workspace access of these identities in <Databricks>."""
|
|
426
|
+
|
|
427
|
+
def __init__(self, api_client):
|
|
428
|
+
self._api = api_client
|
|
429
|
+
|
|
430
|
+
def get_workspace_access_detail(
|
|
431
|
+
self, workspace_id: int, principal_id: int, *, view: Optional[WorkspaceAccessDetailView] = None
|
|
432
|
+
) -> WorkspaceAccessDetail:
|
|
433
|
+
"""Returns the access details for a principal in a workspace. Allows for checking access details for any
|
|
434
|
+
provisioned principal (user, service principal, or group) in a workspace. * Provisioned principal here
|
|
435
|
+
refers to one that has been synced into Databricks from the customer's IdP or added explicitly to
|
|
436
|
+
Databricks via SCIM/UI. Allows for passing in a "view" parameter to control what fields are returned
|
|
437
|
+
(BASIC by default or FULL).
|
|
438
|
+
|
|
439
|
+
:param workspace_id: int
|
|
440
|
+
Required. The workspace ID for which the access details are being requested.
|
|
441
|
+
:param principal_id: int
|
|
442
|
+
Required. The internal ID of the principal (user/sp/group) for which the access details are being
|
|
443
|
+
requested.
|
|
444
|
+
:param view: :class:`WorkspaceAccessDetailView` (optional)
|
|
445
|
+
Controls what fields are returned.
|
|
446
|
+
|
|
447
|
+
:returns: :class:`WorkspaceAccessDetail`
|
|
448
|
+
"""
|
|
449
|
+
|
|
450
|
+
query = {}
|
|
451
|
+
if view is not None:
|
|
452
|
+
query["view"] = view.value
|
|
453
|
+
headers = {
|
|
454
|
+
"Accept": "application/json",
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
res = self._api.do(
|
|
458
|
+
"GET",
|
|
459
|
+
f"/api/2.0/identity/accounts/{self._api.account_id}/workspaces/{workspace_id}/workspaceAccessDetails/{principal_id}",
|
|
460
|
+
query=query,
|
|
461
|
+
headers=headers,
|
|
462
|
+
)
|
|
463
|
+
return WorkspaceAccessDetail.from_dict(res)
|
|
464
|
+
|
|
465
|
+
def resolve_group(self, external_id: str) -> ResolveGroupResponse:
|
|
466
|
+
"""Resolves a group with the given external ID from the customer's IdP. If the group does not exist, it
|
|
467
|
+
will be created in the account. If the customer is not onboarded onto Automatic Identity Management
|
|
468
|
+
(AIM), this will return an error.
|
|
469
|
+
|
|
470
|
+
:param external_id: str
|
|
471
|
+
Required. The external ID of the group in the customer's IdP.
|
|
472
|
+
|
|
473
|
+
:returns: :class:`ResolveGroupResponse`
|
|
474
|
+
"""
|
|
475
|
+
body = {}
|
|
476
|
+
if external_id is not None:
|
|
477
|
+
body["external_id"] = external_id
|
|
478
|
+
headers = {
|
|
479
|
+
"Accept": "application/json",
|
|
480
|
+
"Content-Type": "application/json",
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
res = self._api.do(
|
|
484
|
+
"POST",
|
|
485
|
+
f"/api/2.0/identity/accounts/{self._api.account_id}/groups/resolveByExternalId",
|
|
486
|
+
body=body,
|
|
487
|
+
headers=headers,
|
|
488
|
+
)
|
|
489
|
+
return ResolveGroupResponse.from_dict(res)
|
|
490
|
+
|
|
491
|
+
def resolve_service_principal(self, external_id: str) -> ResolveServicePrincipalResponse:
|
|
492
|
+
"""Resolves an SP with the given external ID from the customer's IdP. If the SP does not exist, it will
|
|
493
|
+
be created. If the customer is not onboarded onto Automatic Identity Management (AIM), this will
|
|
494
|
+
return an error.
|
|
495
|
+
|
|
496
|
+
:param external_id: str
|
|
497
|
+
Required. The external ID of the service principal in the customer's IdP.
|
|
498
|
+
|
|
499
|
+
:returns: :class:`ResolveServicePrincipalResponse`
|
|
500
|
+
"""
|
|
501
|
+
body = {}
|
|
502
|
+
if external_id is not None:
|
|
503
|
+
body["external_id"] = external_id
|
|
504
|
+
headers = {
|
|
505
|
+
"Accept": "application/json",
|
|
506
|
+
"Content-Type": "application/json",
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
res = self._api.do(
|
|
510
|
+
"POST",
|
|
511
|
+
f"/api/2.0/identity/accounts/{self._api.account_id}/servicePrincipals/resolveByExternalId",
|
|
512
|
+
body=body,
|
|
513
|
+
headers=headers,
|
|
514
|
+
)
|
|
515
|
+
return ResolveServicePrincipalResponse.from_dict(res)
|
|
516
|
+
|
|
517
|
+
def resolve_user(self, external_id: str) -> ResolveUserResponse:
|
|
518
|
+
"""Resolves a user with the given external ID from the customer's IdP. If the user does not exist, it
|
|
519
|
+
will be created. If the customer is not onboarded onto Automatic Identity Management (AIM), this will
|
|
520
|
+
return an error.
|
|
521
|
+
|
|
522
|
+
:param external_id: str
|
|
523
|
+
Required. The external ID of the user in the customer's IdP.
|
|
524
|
+
|
|
525
|
+
:returns: :class:`ResolveUserResponse`
|
|
526
|
+
"""
|
|
527
|
+
body = {}
|
|
528
|
+
if external_id is not None:
|
|
529
|
+
body["external_id"] = external_id
|
|
530
|
+
headers = {
|
|
531
|
+
"Accept": "application/json",
|
|
532
|
+
"Content-Type": "application/json",
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
res = self._api.do(
|
|
536
|
+
"POST",
|
|
537
|
+
f"/api/2.0/identity/accounts/{self._api.account_id}/users/resolveByExternalId",
|
|
538
|
+
body=body,
|
|
539
|
+
headers=headers,
|
|
540
|
+
)
|
|
541
|
+
return ResolveUserResponse.from_dict(res)
|
|
542
|
+
|
|
543
|
+
|
|
544
|
+
class WorkspaceIamV2API:
|
|
545
|
+
"""These APIs are used to manage identities and the workspace access of these identities in <Databricks>."""
|
|
546
|
+
|
|
547
|
+
def __init__(self, api_client):
|
|
548
|
+
self._api = api_client
|
|
549
|
+
|
|
550
|
+
def get_workspace_access_detail_local(
|
|
551
|
+
self, principal_id: int, *, view: Optional[WorkspaceAccessDetailView] = None
|
|
552
|
+
) -> WorkspaceAccessDetail:
|
|
553
|
+
"""Returns the access details for a principal in the current workspace. Allows for checking access
|
|
554
|
+
details for any provisioned principal (user, service principal, or group) in the current workspace. *
|
|
555
|
+
Provisioned principal here refers to one that has been synced into Databricks from the customer's IdP
|
|
556
|
+
or added explicitly to Databricks via SCIM/UI. Allows for passing in a "view" parameter to control
|
|
557
|
+
what fields are returned (BASIC by default or FULL).
|
|
558
|
+
|
|
559
|
+
:param principal_id: int
|
|
560
|
+
Required. The internal ID of the principal (user/sp/group) for which the access details are being
|
|
561
|
+
requested.
|
|
562
|
+
:param view: :class:`WorkspaceAccessDetailView` (optional)
|
|
563
|
+
Controls what fields are returned.
|
|
564
|
+
|
|
565
|
+
:returns: :class:`WorkspaceAccessDetail`
|
|
566
|
+
"""
|
|
567
|
+
|
|
568
|
+
query = {}
|
|
569
|
+
if view is not None:
|
|
570
|
+
query["view"] = view.value
|
|
571
|
+
headers = {
|
|
572
|
+
"Accept": "application/json",
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
res = self._api.do(
|
|
576
|
+
"GET", f"/api/2.0/identity/workspaceAccessDetails/{principal_id}", query=query, headers=headers
|
|
577
|
+
)
|
|
578
|
+
return WorkspaceAccessDetail.from_dict(res)
|
|
579
|
+
|
|
580
|
+
def resolve_group_proxy(self, external_id: str) -> ResolveGroupResponse:
|
|
581
|
+
"""Resolves a group with the given external ID from the customer's IdP. If the group does not exist, it
|
|
582
|
+
will be created in the account. If the customer is not onboarded onto Automatic Identity Management
|
|
583
|
+
(AIM), this will return an error.
|
|
584
|
+
|
|
585
|
+
:param external_id: str
|
|
586
|
+
Required. The external ID of the group in the customer's IdP.
|
|
587
|
+
|
|
588
|
+
:returns: :class:`ResolveGroupResponse`
|
|
589
|
+
"""
|
|
590
|
+
body = {}
|
|
591
|
+
if external_id is not None:
|
|
592
|
+
body["external_id"] = external_id
|
|
593
|
+
headers = {
|
|
594
|
+
"Accept": "application/json",
|
|
595
|
+
"Content-Type": "application/json",
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
res = self._api.do("POST", "/api/2.0/identity/groups/resolveByExternalId", body=body, headers=headers)
|
|
599
|
+
return ResolveGroupResponse.from_dict(res)
|
|
600
|
+
|
|
601
|
+
def resolve_service_principal_proxy(self, external_id: str) -> ResolveServicePrincipalResponse:
|
|
602
|
+
"""Resolves an SP with the given external ID from the customer's IdP. If the SP does not exist, it will
|
|
603
|
+
be created. If the customer is not onboarded onto Automatic Identity Management (AIM), this will
|
|
604
|
+
return an error.
|
|
605
|
+
|
|
606
|
+
:param external_id: str
|
|
607
|
+
Required. The external ID of the service principal in the customer's IdP.
|
|
608
|
+
|
|
609
|
+
:returns: :class:`ResolveServicePrincipalResponse`
|
|
610
|
+
"""
|
|
611
|
+
body = {}
|
|
612
|
+
if external_id is not None:
|
|
613
|
+
body["external_id"] = external_id
|
|
614
|
+
headers = {
|
|
615
|
+
"Accept": "application/json",
|
|
616
|
+
"Content-Type": "application/json",
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
res = self._api.do(
|
|
620
|
+
"POST", "/api/2.0/identity/servicePrincipals/resolveByExternalId", body=body, headers=headers
|
|
621
|
+
)
|
|
622
|
+
return ResolveServicePrincipalResponse.from_dict(res)
|
|
623
|
+
|
|
624
|
+
def resolve_user_proxy(self, external_id: str) -> ResolveUserResponse:
|
|
625
|
+
"""Resolves a user with the given external ID from the customer's IdP. If the user does not exist, it
|
|
626
|
+
will be created. If the customer is not onboarded onto Automatic Identity Management (AIM), this will
|
|
627
|
+
return an error.
|
|
628
|
+
|
|
629
|
+
:param external_id: str
|
|
630
|
+
Required. The external ID of the user in the customer's IdP.
|
|
631
|
+
|
|
632
|
+
:returns: :class:`ResolveUserResponse`
|
|
633
|
+
"""
|
|
634
|
+
body = {}
|
|
635
|
+
if external_id is not None:
|
|
636
|
+
body["external_id"] = external_id
|
|
637
|
+
headers = {
|
|
638
|
+
"Accept": "application/json",
|
|
639
|
+
"Content-Type": "application/json",
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
res = self._api.do("POST", "/api/2.0/identity/users/resolveByExternalId", body=body, headers=headers)
|
|
643
|
+
return ResolveUserResponse.from_dict(res)
|