databricks-sdk 0.44.0__py3-none-any.whl → 0.45.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 +123 -115
- databricks/sdk/_base_client.py +112 -88
- databricks/sdk/_property.py +12 -7
- databricks/sdk/_widgets/__init__.py +13 -2
- databricks/sdk/_widgets/default_widgets_utils.py +21 -15
- databricks/sdk/_widgets/ipywidgets_utils.py +47 -24
- databricks/sdk/azure.py +8 -6
- databricks/sdk/casing.py +5 -5
- databricks/sdk/config.py +152 -99
- databricks/sdk/core.py +57 -47
- databricks/sdk/credentials_provider.py +360 -210
- databricks/sdk/data_plane.py +86 -3
- databricks/sdk/dbutils.py +123 -87
- databricks/sdk/environments.py +52 -35
- databricks/sdk/errors/base.py +61 -35
- databricks/sdk/errors/customizer.py +3 -3
- databricks/sdk/errors/deserializer.py +38 -25
- databricks/sdk/errors/details.py +417 -0
- databricks/sdk/errors/mapper.py +1 -1
- databricks/sdk/errors/overrides.py +27 -24
- databricks/sdk/errors/parser.py +26 -14
- databricks/sdk/errors/platform.py +10 -10
- databricks/sdk/errors/private_link.py +24 -24
- databricks/sdk/logger/round_trip_logger.py +28 -20
- databricks/sdk/mixins/compute.py +90 -60
- databricks/sdk/mixins/files.py +815 -145
- databricks/sdk/mixins/jobs.py +201 -20
- databricks/sdk/mixins/open_ai_client.py +26 -20
- databricks/sdk/mixins/workspace.py +45 -34
- databricks/sdk/oauth.py +372 -196
- databricks/sdk/retries.py +14 -12
- databricks/sdk/runtime/__init__.py +34 -17
- databricks/sdk/runtime/dbutils_stub.py +52 -39
- databricks/sdk/service/_internal.py +12 -7
- databricks/sdk/service/apps.py +618 -418
- databricks/sdk/service/billing.py +827 -604
- databricks/sdk/service/catalog.py +6552 -4474
- databricks/sdk/service/cleanrooms.py +550 -388
- databricks/sdk/service/compute.py +5241 -3531
- databricks/sdk/service/dashboards.py +1313 -923
- databricks/sdk/service/files.py +442 -309
- databricks/sdk/service/iam.py +2115 -1483
- databricks/sdk/service/jobs.py +4151 -2588
- databricks/sdk/service/marketplace.py +2210 -1517
- databricks/sdk/service/ml.py +3364 -2255
- databricks/sdk/service/oauth2.py +922 -584
- databricks/sdk/service/pipelines.py +1865 -1203
- databricks/sdk/service/provisioning.py +1435 -1029
- databricks/sdk/service/serving.py +2040 -1278
- databricks/sdk/service/settings.py +2846 -1929
- databricks/sdk/service/sharing.py +2201 -877
- databricks/sdk/service/sql.py +4650 -3103
- databricks/sdk/service/vectorsearch.py +816 -550
- databricks/sdk/service/workspace.py +1330 -906
- databricks/sdk/useragent.py +36 -22
- databricks/sdk/version.py +1 -1
- {databricks_sdk-0.44.0.dist-info → databricks_sdk-0.45.0.dist-info}/METADATA +31 -31
- databricks_sdk-0.45.0.dist-info/RECORD +70 -0
- {databricks_sdk-0.44.0.dist-info → databricks_sdk-0.45.0.dist-info}/WHEEL +1 -1
- databricks_sdk-0.44.0.dist-info/RECORD +0 -69
- {databricks_sdk-0.44.0.dist-info → databricks_sdk-0.45.0.dist-info}/LICENSE +0 -0
- {databricks_sdk-0.44.0.dist-info → databricks_sdk-0.45.0.dist-info}/NOTICE +0 -0
- {databricks_sdk-0.44.0.dist-info → databricks_sdk-0.45.0.dist-info}/top_level.txt +0 -0
|
@@ -5,11 +5,12 @@ from __future__ import annotations
|
|
|
5
5
|
import logging
|
|
6
6
|
from dataclasses import dataclass
|
|
7
7
|
from enum import Enum
|
|
8
|
-
from typing import Dict, Iterator, List, Optional
|
|
8
|
+
from typing import Any, Dict, Iterator, List, Optional
|
|
9
9
|
|
|
10
10
|
from ._internal import _enum, _from_dict, _repeated_dict
|
|
11
11
|
|
|
12
|
-
_LOG = logging.getLogger(
|
|
12
|
+
_LOG = logging.getLogger("databricks.sdk")
|
|
13
|
+
|
|
13
14
|
|
|
14
15
|
# all definitions in this file are in alphabetical order
|
|
15
16
|
|
|
@@ -25,28 +26,32 @@ class AclItem:
|
|
|
25
26
|
def as_dict(self) -> dict:
|
|
26
27
|
"""Serializes the AclItem into a dictionary suitable for use as a JSON request body."""
|
|
27
28
|
body = {}
|
|
28
|
-
if self.permission is not None:
|
|
29
|
-
|
|
29
|
+
if self.permission is not None:
|
|
30
|
+
body["permission"] = self.permission.value
|
|
31
|
+
if self.principal is not None:
|
|
32
|
+
body["principal"] = self.principal
|
|
30
33
|
return body
|
|
31
34
|
|
|
32
35
|
def as_shallow_dict(self) -> dict:
|
|
33
36
|
"""Serializes the AclItem into a shallow dictionary of its immediate attributes."""
|
|
34
37
|
body = {}
|
|
35
|
-
if self.permission is not None:
|
|
36
|
-
|
|
38
|
+
if self.permission is not None:
|
|
39
|
+
body["permission"] = self.permission
|
|
40
|
+
if self.principal is not None:
|
|
41
|
+
body["principal"] = self.principal
|
|
37
42
|
return body
|
|
38
43
|
|
|
39
44
|
@classmethod
|
|
40
|
-
def from_dict(cls, d: Dict[str,
|
|
45
|
+
def from_dict(cls, d: Dict[str, Any]) -> AclItem:
|
|
41
46
|
"""Deserializes the AclItem from a dictionary."""
|
|
42
|
-
return cls(permission=_enum(d,
|
|
47
|
+
return cls(permission=_enum(d, "permission", AclPermission), principal=d.get("principal", None))
|
|
43
48
|
|
|
44
49
|
|
|
45
50
|
class AclPermission(Enum):
|
|
46
51
|
|
|
47
|
-
MANAGE =
|
|
48
|
-
READ =
|
|
49
|
-
WRITE =
|
|
52
|
+
MANAGE = "MANAGE"
|
|
53
|
+
READ = "READ"
|
|
54
|
+
WRITE = "WRITE"
|
|
50
55
|
|
|
51
56
|
|
|
52
57
|
@dataclass
|
|
@@ -60,21 +65,25 @@ class AzureKeyVaultSecretScopeMetadata:
|
|
|
60
65
|
def as_dict(self) -> dict:
|
|
61
66
|
"""Serializes the AzureKeyVaultSecretScopeMetadata into a dictionary suitable for use as a JSON request body."""
|
|
62
67
|
body = {}
|
|
63
|
-
if self.dns_name is not None:
|
|
64
|
-
|
|
68
|
+
if self.dns_name is not None:
|
|
69
|
+
body["dns_name"] = self.dns_name
|
|
70
|
+
if self.resource_id is not None:
|
|
71
|
+
body["resource_id"] = self.resource_id
|
|
65
72
|
return body
|
|
66
73
|
|
|
67
74
|
def as_shallow_dict(self) -> dict:
|
|
68
75
|
"""Serializes the AzureKeyVaultSecretScopeMetadata into a shallow dictionary of its immediate attributes."""
|
|
69
76
|
body = {}
|
|
70
|
-
if self.dns_name is not None:
|
|
71
|
-
|
|
77
|
+
if self.dns_name is not None:
|
|
78
|
+
body["dns_name"] = self.dns_name
|
|
79
|
+
if self.resource_id is not None:
|
|
80
|
+
body["resource_id"] = self.resource_id
|
|
72
81
|
return body
|
|
73
82
|
|
|
74
83
|
@classmethod
|
|
75
|
-
def from_dict(cls, d: Dict[str,
|
|
84
|
+
def from_dict(cls, d: Dict[str, Any]) -> AzureKeyVaultSecretScopeMetadata:
|
|
76
85
|
"""Deserializes the AzureKeyVaultSecretScopeMetadata from a dictionary."""
|
|
77
|
-
return cls(dns_name=d.get(
|
|
86
|
+
return cls(dns_name=d.get("dns_name", None), resource_id=d.get("resource_id", None))
|
|
78
87
|
|
|
79
88
|
|
|
80
89
|
@dataclass
|
|
@@ -100,25 +109,33 @@ class CreateCredentialsRequest:
|
|
|
100
109
|
def as_dict(self) -> dict:
|
|
101
110
|
"""Serializes the CreateCredentialsRequest into a dictionary suitable for use as a JSON request body."""
|
|
102
111
|
body = {}
|
|
103
|
-
if self.git_provider is not None:
|
|
104
|
-
|
|
105
|
-
if self.
|
|
112
|
+
if self.git_provider is not None:
|
|
113
|
+
body["git_provider"] = self.git_provider
|
|
114
|
+
if self.git_username is not None:
|
|
115
|
+
body["git_username"] = self.git_username
|
|
116
|
+
if self.personal_access_token is not None:
|
|
117
|
+
body["personal_access_token"] = self.personal_access_token
|
|
106
118
|
return body
|
|
107
119
|
|
|
108
120
|
def as_shallow_dict(self) -> dict:
|
|
109
121
|
"""Serializes the CreateCredentialsRequest into a shallow dictionary of its immediate attributes."""
|
|
110
122
|
body = {}
|
|
111
|
-
if self.git_provider is not None:
|
|
112
|
-
|
|
113
|
-
if self.
|
|
123
|
+
if self.git_provider is not None:
|
|
124
|
+
body["git_provider"] = self.git_provider
|
|
125
|
+
if self.git_username is not None:
|
|
126
|
+
body["git_username"] = self.git_username
|
|
127
|
+
if self.personal_access_token is not None:
|
|
128
|
+
body["personal_access_token"] = self.personal_access_token
|
|
114
129
|
return body
|
|
115
130
|
|
|
116
131
|
@classmethod
|
|
117
|
-
def from_dict(cls, d: Dict[str,
|
|
132
|
+
def from_dict(cls, d: Dict[str, Any]) -> CreateCredentialsRequest:
|
|
118
133
|
"""Deserializes the CreateCredentialsRequest from a dictionary."""
|
|
119
|
-
return cls(
|
|
120
|
-
|
|
121
|
-
|
|
134
|
+
return cls(
|
|
135
|
+
git_provider=d.get("git_provider", None),
|
|
136
|
+
git_username=d.get("git_username", None),
|
|
137
|
+
personal_access_token=d.get("personal_access_token", None),
|
|
138
|
+
)
|
|
122
139
|
|
|
123
140
|
|
|
124
141
|
@dataclass
|
|
@@ -136,25 +153,33 @@ class CreateCredentialsResponse:
|
|
|
136
153
|
def as_dict(self) -> dict:
|
|
137
154
|
"""Serializes the CreateCredentialsResponse into a dictionary suitable for use as a JSON request body."""
|
|
138
155
|
body = {}
|
|
139
|
-
if self.credential_id is not None:
|
|
140
|
-
|
|
141
|
-
if self.
|
|
156
|
+
if self.credential_id is not None:
|
|
157
|
+
body["credential_id"] = self.credential_id
|
|
158
|
+
if self.git_provider is not None:
|
|
159
|
+
body["git_provider"] = self.git_provider
|
|
160
|
+
if self.git_username is not None:
|
|
161
|
+
body["git_username"] = self.git_username
|
|
142
162
|
return body
|
|
143
163
|
|
|
144
164
|
def as_shallow_dict(self) -> dict:
|
|
145
165
|
"""Serializes the CreateCredentialsResponse into a shallow dictionary of its immediate attributes."""
|
|
146
166
|
body = {}
|
|
147
|
-
if self.credential_id is not None:
|
|
148
|
-
|
|
149
|
-
if self.
|
|
167
|
+
if self.credential_id is not None:
|
|
168
|
+
body["credential_id"] = self.credential_id
|
|
169
|
+
if self.git_provider is not None:
|
|
170
|
+
body["git_provider"] = self.git_provider
|
|
171
|
+
if self.git_username is not None:
|
|
172
|
+
body["git_username"] = self.git_username
|
|
150
173
|
return body
|
|
151
174
|
|
|
152
175
|
@classmethod
|
|
153
|
-
def from_dict(cls, d: Dict[str,
|
|
176
|
+
def from_dict(cls, d: Dict[str, Any]) -> CreateCredentialsResponse:
|
|
154
177
|
"""Deserializes the CreateCredentialsResponse from a dictionary."""
|
|
155
|
-
return cls(
|
|
156
|
-
|
|
157
|
-
|
|
178
|
+
return cls(
|
|
179
|
+
credential_id=d.get("credential_id", None),
|
|
180
|
+
git_provider=d.get("git_provider", None),
|
|
181
|
+
git_username=d.get("git_username", None),
|
|
182
|
+
)
|
|
158
183
|
|
|
159
184
|
|
|
160
185
|
@dataclass
|
|
@@ -178,28 +203,38 @@ class CreateRepoRequest:
|
|
|
178
203
|
def as_dict(self) -> dict:
|
|
179
204
|
"""Serializes the CreateRepoRequest into a dictionary suitable for use as a JSON request body."""
|
|
180
205
|
body = {}
|
|
181
|
-
if self.path is not None:
|
|
182
|
-
|
|
183
|
-
if self.
|
|
184
|
-
|
|
206
|
+
if self.path is not None:
|
|
207
|
+
body["path"] = self.path
|
|
208
|
+
if self.provider is not None:
|
|
209
|
+
body["provider"] = self.provider
|
|
210
|
+
if self.sparse_checkout:
|
|
211
|
+
body["sparse_checkout"] = self.sparse_checkout.as_dict()
|
|
212
|
+
if self.url is not None:
|
|
213
|
+
body["url"] = self.url
|
|
185
214
|
return body
|
|
186
215
|
|
|
187
216
|
def as_shallow_dict(self) -> dict:
|
|
188
217
|
"""Serializes the CreateRepoRequest into a shallow dictionary of its immediate attributes."""
|
|
189
218
|
body = {}
|
|
190
|
-
if self.path is not None:
|
|
191
|
-
|
|
192
|
-
if self.
|
|
193
|
-
|
|
219
|
+
if self.path is not None:
|
|
220
|
+
body["path"] = self.path
|
|
221
|
+
if self.provider is not None:
|
|
222
|
+
body["provider"] = self.provider
|
|
223
|
+
if self.sparse_checkout:
|
|
224
|
+
body["sparse_checkout"] = self.sparse_checkout
|
|
225
|
+
if self.url is not None:
|
|
226
|
+
body["url"] = self.url
|
|
194
227
|
return body
|
|
195
228
|
|
|
196
229
|
@classmethod
|
|
197
|
-
def from_dict(cls, d: Dict[str,
|
|
230
|
+
def from_dict(cls, d: Dict[str, Any]) -> CreateRepoRequest:
|
|
198
231
|
"""Deserializes the CreateRepoRequest from a dictionary."""
|
|
199
|
-
return cls(
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
232
|
+
return cls(
|
|
233
|
+
path=d.get("path", None),
|
|
234
|
+
provider=d.get("provider", None),
|
|
235
|
+
sparse_checkout=_from_dict(d, "sparse_checkout", SparseCheckout),
|
|
236
|
+
url=d.get("url", None),
|
|
237
|
+
)
|
|
203
238
|
|
|
204
239
|
|
|
205
240
|
@dataclass
|
|
@@ -228,37 +263,53 @@ class CreateRepoResponse:
|
|
|
228
263
|
def as_dict(self) -> dict:
|
|
229
264
|
"""Serializes the CreateRepoResponse into a dictionary suitable for use as a JSON request body."""
|
|
230
265
|
body = {}
|
|
231
|
-
if self.branch is not None:
|
|
232
|
-
|
|
233
|
-
if self.
|
|
234
|
-
|
|
235
|
-
if self.
|
|
236
|
-
|
|
237
|
-
if self.
|
|
266
|
+
if self.branch is not None:
|
|
267
|
+
body["branch"] = self.branch
|
|
268
|
+
if self.head_commit_id is not None:
|
|
269
|
+
body["head_commit_id"] = self.head_commit_id
|
|
270
|
+
if self.id is not None:
|
|
271
|
+
body["id"] = self.id
|
|
272
|
+
if self.path is not None:
|
|
273
|
+
body["path"] = self.path
|
|
274
|
+
if self.provider is not None:
|
|
275
|
+
body["provider"] = self.provider
|
|
276
|
+
if self.sparse_checkout:
|
|
277
|
+
body["sparse_checkout"] = self.sparse_checkout.as_dict()
|
|
278
|
+
if self.url is not None:
|
|
279
|
+
body["url"] = self.url
|
|
238
280
|
return body
|
|
239
281
|
|
|
240
282
|
def as_shallow_dict(self) -> dict:
|
|
241
283
|
"""Serializes the CreateRepoResponse into a shallow dictionary of its immediate attributes."""
|
|
242
284
|
body = {}
|
|
243
|
-
if self.branch is not None:
|
|
244
|
-
|
|
245
|
-
if self.
|
|
246
|
-
|
|
247
|
-
if self.
|
|
248
|
-
|
|
249
|
-
if self.
|
|
285
|
+
if self.branch is not None:
|
|
286
|
+
body["branch"] = self.branch
|
|
287
|
+
if self.head_commit_id is not None:
|
|
288
|
+
body["head_commit_id"] = self.head_commit_id
|
|
289
|
+
if self.id is not None:
|
|
290
|
+
body["id"] = self.id
|
|
291
|
+
if self.path is not None:
|
|
292
|
+
body["path"] = self.path
|
|
293
|
+
if self.provider is not None:
|
|
294
|
+
body["provider"] = self.provider
|
|
295
|
+
if self.sparse_checkout:
|
|
296
|
+
body["sparse_checkout"] = self.sparse_checkout
|
|
297
|
+
if self.url is not None:
|
|
298
|
+
body["url"] = self.url
|
|
250
299
|
return body
|
|
251
300
|
|
|
252
301
|
@classmethod
|
|
253
|
-
def from_dict(cls, d: Dict[str,
|
|
302
|
+
def from_dict(cls, d: Dict[str, Any]) -> CreateRepoResponse:
|
|
254
303
|
"""Deserializes the CreateRepoResponse from a dictionary."""
|
|
255
|
-
return cls(
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
304
|
+
return cls(
|
|
305
|
+
branch=d.get("branch", None),
|
|
306
|
+
head_commit_id=d.get("head_commit_id", None),
|
|
307
|
+
id=d.get("id", None),
|
|
308
|
+
path=d.get("path", None),
|
|
309
|
+
provider=d.get("provider", None),
|
|
310
|
+
sparse_checkout=_from_dict(d, "sparse_checkout", SparseCheckout),
|
|
311
|
+
url=d.get("url", None),
|
|
312
|
+
)
|
|
262
313
|
|
|
263
314
|
|
|
264
315
|
@dataclass
|
|
@@ -278,36 +329,42 @@ class CreateScope:
|
|
|
278
329
|
def as_dict(self) -> dict:
|
|
279
330
|
"""Serializes the CreateScope into a dictionary suitable for use as a JSON request body."""
|
|
280
331
|
body = {}
|
|
281
|
-
if self.backend_azure_keyvault:
|
|
332
|
+
if self.backend_azure_keyvault:
|
|
333
|
+
body["backend_azure_keyvault"] = self.backend_azure_keyvault.as_dict()
|
|
282
334
|
if self.initial_manage_principal is not None:
|
|
283
|
-
body[
|
|
284
|
-
if self.scope is not None:
|
|
285
|
-
|
|
335
|
+
body["initial_manage_principal"] = self.initial_manage_principal
|
|
336
|
+
if self.scope is not None:
|
|
337
|
+
body["scope"] = self.scope
|
|
338
|
+
if self.scope_backend_type is not None:
|
|
339
|
+
body["scope_backend_type"] = self.scope_backend_type.value
|
|
286
340
|
return body
|
|
287
341
|
|
|
288
342
|
def as_shallow_dict(self) -> dict:
|
|
289
343
|
"""Serializes the CreateScope into a shallow dictionary of its immediate attributes."""
|
|
290
344
|
body = {}
|
|
291
|
-
if self.backend_azure_keyvault:
|
|
345
|
+
if self.backend_azure_keyvault:
|
|
346
|
+
body["backend_azure_keyvault"] = self.backend_azure_keyvault
|
|
292
347
|
if self.initial_manage_principal is not None:
|
|
293
|
-
body[
|
|
294
|
-
if self.scope is not None:
|
|
295
|
-
|
|
348
|
+
body["initial_manage_principal"] = self.initial_manage_principal
|
|
349
|
+
if self.scope is not None:
|
|
350
|
+
body["scope"] = self.scope
|
|
351
|
+
if self.scope_backend_type is not None:
|
|
352
|
+
body["scope_backend_type"] = self.scope_backend_type
|
|
296
353
|
return body
|
|
297
354
|
|
|
298
355
|
@classmethod
|
|
299
|
-
def from_dict(cls, d: Dict[str,
|
|
356
|
+
def from_dict(cls, d: Dict[str, Any]) -> CreateScope:
|
|
300
357
|
"""Deserializes the CreateScope from a dictionary."""
|
|
301
|
-
return cls(
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
358
|
+
return cls(
|
|
359
|
+
backend_azure_keyvault=_from_dict(d, "backend_azure_keyvault", AzureKeyVaultSecretScopeMetadata),
|
|
360
|
+
initial_manage_principal=d.get("initial_manage_principal", None),
|
|
361
|
+
scope=d.get("scope", None),
|
|
362
|
+
scope_backend_type=_enum(d, "scope_backend_type", ScopeBackendType),
|
|
363
|
+
)
|
|
306
364
|
|
|
307
365
|
|
|
308
366
|
@dataclass
|
|
309
367
|
class CreateScopeResponse:
|
|
310
|
-
|
|
311
368
|
def as_dict(self) -> dict:
|
|
312
369
|
"""Serializes the CreateScopeResponse into a dictionary suitable for use as a JSON request body."""
|
|
313
370
|
body = {}
|
|
@@ -319,7 +376,7 @@ class CreateScopeResponse:
|
|
|
319
376
|
return body
|
|
320
377
|
|
|
321
378
|
@classmethod
|
|
322
|
-
def from_dict(cls, d: Dict[str,
|
|
379
|
+
def from_dict(cls, d: Dict[str, Any]) -> CreateScopeResponse:
|
|
323
380
|
"""Deserializes the CreateScopeResponse from a dictionary."""
|
|
324
381
|
return cls()
|
|
325
382
|
|
|
@@ -339,25 +396,33 @@ class CredentialInfo:
|
|
|
339
396
|
def as_dict(self) -> dict:
|
|
340
397
|
"""Serializes the CredentialInfo into a dictionary suitable for use as a JSON request body."""
|
|
341
398
|
body = {}
|
|
342
|
-
if self.credential_id is not None:
|
|
343
|
-
|
|
344
|
-
if self.
|
|
399
|
+
if self.credential_id is not None:
|
|
400
|
+
body["credential_id"] = self.credential_id
|
|
401
|
+
if self.git_provider is not None:
|
|
402
|
+
body["git_provider"] = self.git_provider
|
|
403
|
+
if self.git_username is not None:
|
|
404
|
+
body["git_username"] = self.git_username
|
|
345
405
|
return body
|
|
346
406
|
|
|
347
407
|
def as_shallow_dict(self) -> dict:
|
|
348
408
|
"""Serializes the CredentialInfo into a shallow dictionary of its immediate attributes."""
|
|
349
409
|
body = {}
|
|
350
|
-
if self.credential_id is not None:
|
|
351
|
-
|
|
352
|
-
if self.
|
|
410
|
+
if self.credential_id is not None:
|
|
411
|
+
body["credential_id"] = self.credential_id
|
|
412
|
+
if self.git_provider is not None:
|
|
413
|
+
body["git_provider"] = self.git_provider
|
|
414
|
+
if self.git_username is not None:
|
|
415
|
+
body["git_username"] = self.git_username
|
|
353
416
|
return body
|
|
354
417
|
|
|
355
418
|
@classmethod
|
|
356
|
-
def from_dict(cls, d: Dict[str,
|
|
419
|
+
def from_dict(cls, d: Dict[str, Any]) -> CredentialInfo:
|
|
357
420
|
"""Deserializes the CredentialInfo from a dictionary."""
|
|
358
|
-
return cls(
|
|
359
|
-
|
|
360
|
-
|
|
421
|
+
return cls(
|
|
422
|
+
credential_id=d.get("credential_id", None),
|
|
423
|
+
git_provider=d.get("git_provider", None),
|
|
424
|
+
git_username=d.get("git_username", None),
|
|
425
|
+
)
|
|
361
426
|
|
|
362
427
|
|
|
363
428
|
@dataclass
|
|
@@ -373,21 +438,25 @@ class Delete:
|
|
|
373
438
|
def as_dict(self) -> dict:
|
|
374
439
|
"""Serializes the Delete into a dictionary suitable for use as a JSON request body."""
|
|
375
440
|
body = {}
|
|
376
|
-
if self.path is not None:
|
|
377
|
-
|
|
441
|
+
if self.path is not None:
|
|
442
|
+
body["path"] = self.path
|
|
443
|
+
if self.recursive is not None:
|
|
444
|
+
body["recursive"] = self.recursive
|
|
378
445
|
return body
|
|
379
446
|
|
|
380
447
|
def as_shallow_dict(self) -> dict:
|
|
381
448
|
"""Serializes the Delete into a shallow dictionary of its immediate attributes."""
|
|
382
449
|
body = {}
|
|
383
|
-
if self.path is not None:
|
|
384
|
-
|
|
450
|
+
if self.path is not None:
|
|
451
|
+
body["path"] = self.path
|
|
452
|
+
if self.recursive is not None:
|
|
453
|
+
body["recursive"] = self.recursive
|
|
385
454
|
return body
|
|
386
455
|
|
|
387
456
|
@classmethod
|
|
388
|
-
def from_dict(cls, d: Dict[str,
|
|
457
|
+
def from_dict(cls, d: Dict[str, Any]) -> Delete:
|
|
389
458
|
"""Deserializes the Delete from a dictionary."""
|
|
390
|
-
return cls(path=d.get(
|
|
459
|
+
return cls(path=d.get("path", None), recursive=d.get("recursive", None))
|
|
391
460
|
|
|
392
461
|
|
|
393
462
|
@dataclass
|
|
@@ -401,26 +470,29 @@ class DeleteAcl:
|
|
|
401
470
|
def as_dict(self) -> dict:
|
|
402
471
|
"""Serializes the DeleteAcl into a dictionary suitable for use as a JSON request body."""
|
|
403
472
|
body = {}
|
|
404
|
-
if self.principal is not None:
|
|
405
|
-
|
|
473
|
+
if self.principal is not None:
|
|
474
|
+
body["principal"] = self.principal
|
|
475
|
+
if self.scope is not None:
|
|
476
|
+
body["scope"] = self.scope
|
|
406
477
|
return body
|
|
407
478
|
|
|
408
479
|
def as_shallow_dict(self) -> dict:
|
|
409
480
|
"""Serializes the DeleteAcl into a shallow dictionary of its immediate attributes."""
|
|
410
481
|
body = {}
|
|
411
|
-
if self.principal is not None:
|
|
412
|
-
|
|
482
|
+
if self.principal is not None:
|
|
483
|
+
body["principal"] = self.principal
|
|
484
|
+
if self.scope is not None:
|
|
485
|
+
body["scope"] = self.scope
|
|
413
486
|
return body
|
|
414
487
|
|
|
415
488
|
@classmethod
|
|
416
|
-
def from_dict(cls, d: Dict[str,
|
|
489
|
+
def from_dict(cls, d: Dict[str, Any]) -> DeleteAcl:
|
|
417
490
|
"""Deserializes the DeleteAcl from a dictionary."""
|
|
418
|
-
return cls(principal=d.get(
|
|
491
|
+
return cls(principal=d.get("principal", None), scope=d.get("scope", None))
|
|
419
492
|
|
|
420
493
|
|
|
421
494
|
@dataclass
|
|
422
495
|
class DeleteAclResponse:
|
|
423
|
-
|
|
424
496
|
def as_dict(self) -> dict:
|
|
425
497
|
"""Serializes the DeleteAclResponse into a dictionary suitable for use as a JSON request body."""
|
|
426
498
|
body = {}
|
|
@@ -432,14 +504,13 @@ class DeleteAclResponse:
|
|
|
432
504
|
return body
|
|
433
505
|
|
|
434
506
|
@classmethod
|
|
435
|
-
def from_dict(cls, d: Dict[str,
|
|
507
|
+
def from_dict(cls, d: Dict[str, Any]) -> DeleteAclResponse:
|
|
436
508
|
"""Deserializes the DeleteAclResponse from a dictionary."""
|
|
437
509
|
return cls()
|
|
438
510
|
|
|
439
511
|
|
|
440
512
|
@dataclass
|
|
441
513
|
class DeleteCredentialsResponse:
|
|
442
|
-
|
|
443
514
|
def as_dict(self) -> dict:
|
|
444
515
|
"""Serializes the DeleteCredentialsResponse into a dictionary suitable for use as a JSON request body."""
|
|
445
516
|
body = {}
|
|
@@ -451,14 +522,13 @@ class DeleteCredentialsResponse:
|
|
|
451
522
|
return body
|
|
452
523
|
|
|
453
524
|
@classmethod
|
|
454
|
-
def from_dict(cls, d: Dict[str,
|
|
525
|
+
def from_dict(cls, d: Dict[str, Any]) -> DeleteCredentialsResponse:
|
|
455
526
|
"""Deserializes the DeleteCredentialsResponse from a dictionary."""
|
|
456
527
|
return cls()
|
|
457
528
|
|
|
458
529
|
|
|
459
530
|
@dataclass
|
|
460
531
|
class DeleteRepoResponse:
|
|
461
|
-
|
|
462
532
|
def as_dict(self) -> dict:
|
|
463
533
|
"""Serializes the DeleteRepoResponse into a dictionary suitable for use as a JSON request body."""
|
|
464
534
|
body = {}
|
|
@@ -470,14 +540,13 @@ class DeleteRepoResponse:
|
|
|
470
540
|
return body
|
|
471
541
|
|
|
472
542
|
@classmethod
|
|
473
|
-
def from_dict(cls, d: Dict[str,
|
|
543
|
+
def from_dict(cls, d: Dict[str, Any]) -> DeleteRepoResponse:
|
|
474
544
|
"""Deserializes the DeleteRepoResponse from a dictionary."""
|
|
475
545
|
return cls()
|
|
476
546
|
|
|
477
547
|
|
|
478
548
|
@dataclass
|
|
479
549
|
class DeleteResponse:
|
|
480
|
-
|
|
481
550
|
def as_dict(self) -> dict:
|
|
482
551
|
"""Serializes the DeleteResponse into a dictionary suitable for use as a JSON request body."""
|
|
483
552
|
body = {}
|
|
@@ -489,7 +558,7 @@ class DeleteResponse:
|
|
|
489
558
|
return body
|
|
490
559
|
|
|
491
560
|
@classmethod
|
|
492
|
-
def from_dict(cls, d: Dict[str,
|
|
561
|
+
def from_dict(cls, d: Dict[str, Any]) -> DeleteResponse:
|
|
493
562
|
"""Deserializes the DeleteResponse from a dictionary."""
|
|
494
563
|
return cls()
|
|
495
564
|
|
|
@@ -502,24 +571,25 @@ class DeleteScope:
|
|
|
502
571
|
def as_dict(self) -> dict:
|
|
503
572
|
"""Serializes the DeleteScope into a dictionary suitable for use as a JSON request body."""
|
|
504
573
|
body = {}
|
|
505
|
-
if self.scope is not None:
|
|
574
|
+
if self.scope is not None:
|
|
575
|
+
body["scope"] = self.scope
|
|
506
576
|
return body
|
|
507
577
|
|
|
508
578
|
def as_shallow_dict(self) -> dict:
|
|
509
579
|
"""Serializes the DeleteScope into a shallow dictionary of its immediate attributes."""
|
|
510
580
|
body = {}
|
|
511
|
-
if self.scope is not None:
|
|
581
|
+
if self.scope is not None:
|
|
582
|
+
body["scope"] = self.scope
|
|
512
583
|
return body
|
|
513
584
|
|
|
514
585
|
@classmethod
|
|
515
|
-
def from_dict(cls, d: Dict[str,
|
|
586
|
+
def from_dict(cls, d: Dict[str, Any]) -> DeleteScope:
|
|
516
587
|
"""Deserializes the DeleteScope from a dictionary."""
|
|
517
|
-
return cls(scope=d.get(
|
|
588
|
+
return cls(scope=d.get("scope", None))
|
|
518
589
|
|
|
519
590
|
|
|
520
591
|
@dataclass
|
|
521
592
|
class DeleteScopeResponse:
|
|
522
|
-
|
|
523
593
|
def as_dict(self) -> dict:
|
|
524
594
|
"""Serializes the DeleteScopeResponse into a dictionary suitable for use as a JSON request body."""
|
|
525
595
|
body = {}
|
|
@@ -531,7 +601,7 @@ class DeleteScopeResponse:
|
|
|
531
601
|
return body
|
|
532
602
|
|
|
533
603
|
@classmethod
|
|
534
|
-
def from_dict(cls, d: Dict[str,
|
|
604
|
+
def from_dict(cls, d: Dict[str, Any]) -> DeleteScopeResponse:
|
|
535
605
|
"""Deserializes the DeleteScopeResponse from a dictionary."""
|
|
536
606
|
return cls()
|
|
537
607
|
|
|
@@ -547,26 +617,29 @@ class DeleteSecret:
|
|
|
547
617
|
def as_dict(self) -> dict:
|
|
548
618
|
"""Serializes the DeleteSecret into a dictionary suitable for use as a JSON request body."""
|
|
549
619
|
body = {}
|
|
550
|
-
if self.key is not None:
|
|
551
|
-
|
|
620
|
+
if self.key is not None:
|
|
621
|
+
body["key"] = self.key
|
|
622
|
+
if self.scope is not None:
|
|
623
|
+
body["scope"] = self.scope
|
|
552
624
|
return body
|
|
553
625
|
|
|
554
626
|
def as_shallow_dict(self) -> dict:
|
|
555
627
|
"""Serializes the DeleteSecret into a shallow dictionary of its immediate attributes."""
|
|
556
628
|
body = {}
|
|
557
|
-
if self.key is not None:
|
|
558
|
-
|
|
629
|
+
if self.key is not None:
|
|
630
|
+
body["key"] = self.key
|
|
631
|
+
if self.scope is not None:
|
|
632
|
+
body["scope"] = self.scope
|
|
559
633
|
return body
|
|
560
634
|
|
|
561
635
|
@classmethod
|
|
562
|
-
def from_dict(cls, d: Dict[str,
|
|
636
|
+
def from_dict(cls, d: Dict[str, Any]) -> DeleteSecret:
|
|
563
637
|
"""Deserializes the DeleteSecret from a dictionary."""
|
|
564
|
-
return cls(key=d.get(
|
|
638
|
+
return cls(key=d.get("key", None), scope=d.get("scope", None))
|
|
565
639
|
|
|
566
640
|
|
|
567
641
|
@dataclass
|
|
568
642
|
class DeleteSecretResponse:
|
|
569
|
-
|
|
570
643
|
def as_dict(self) -> dict:
|
|
571
644
|
"""Serializes the DeleteSecretResponse into a dictionary suitable for use as a JSON request body."""
|
|
572
645
|
body = {}
|
|
@@ -578,23 +651,28 @@ class DeleteSecretResponse:
|
|
|
578
651
|
return body
|
|
579
652
|
|
|
580
653
|
@classmethod
|
|
581
|
-
def from_dict(cls, d: Dict[str,
|
|
654
|
+
def from_dict(cls, d: Dict[str, Any]) -> DeleteSecretResponse:
|
|
582
655
|
"""Deserializes the DeleteSecretResponse from a dictionary."""
|
|
583
656
|
return cls()
|
|
584
657
|
|
|
585
658
|
|
|
586
659
|
class ExportFormat(Enum):
|
|
660
|
+
"""The format for workspace import and export."""
|
|
587
661
|
|
|
588
|
-
AUTO =
|
|
589
|
-
DBC =
|
|
590
|
-
HTML =
|
|
591
|
-
JUPYTER =
|
|
592
|
-
|
|
593
|
-
|
|
662
|
+
AUTO = "AUTO"
|
|
663
|
+
DBC = "DBC"
|
|
664
|
+
HTML = "HTML"
|
|
665
|
+
JUPYTER = "JUPYTER"
|
|
666
|
+
RAW = "RAW"
|
|
667
|
+
R_MARKDOWN = "R_MARKDOWN"
|
|
668
|
+
SOURCE = "SOURCE"
|
|
594
669
|
|
|
595
670
|
|
|
596
671
|
@dataclass
|
|
597
672
|
class ExportResponse:
|
|
673
|
+
"""The request field `direct_download` determines whether a JSON response or binary contents are
|
|
674
|
+
returned by this endpoint."""
|
|
675
|
+
|
|
598
676
|
content: Optional[str] = None
|
|
599
677
|
"""The base64-encoded content. If the limit (10MB) is exceeded, exception with error code
|
|
600
678
|
**MAX_NOTEBOOK_SIZE_EXCEEDED** is thrown."""
|
|
@@ -605,21 +683,25 @@ class ExportResponse:
|
|
|
605
683
|
def as_dict(self) -> dict:
|
|
606
684
|
"""Serializes the ExportResponse into a dictionary suitable for use as a JSON request body."""
|
|
607
685
|
body = {}
|
|
608
|
-
if self.content is not None:
|
|
609
|
-
|
|
686
|
+
if self.content is not None:
|
|
687
|
+
body["content"] = self.content
|
|
688
|
+
if self.file_type is not None:
|
|
689
|
+
body["file_type"] = self.file_type
|
|
610
690
|
return body
|
|
611
691
|
|
|
612
692
|
def as_shallow_dict(self) -> dict:
|
|
613
693
|
"""Serializes the ExportResponse into a shallow dictionary of its immediate attributes."""
|
|
614
694
|
body = {}
|
|
615
|
-
if self.content is not None:
|
|
616
|
-
|
|
695
|
+
if self.content is not None:
|
|
696
|
+
body["content"] = self.content
|
|
697
|
+
if self.file_type is not None:
|
|
698
|
+
body["file_type"] = self.file_type
|
|
617
699
|
return body
|
|
618
700
|
|
|
619
701
|
@classmethod
|
|
620
|
-
def from_dict(cls, d: Dict[str,
|
|
702
|
+
def from_dict(cls, d: Dict[str, Any]) -> ExportResponse:
|
|
621
703
|
"""Deserializes the ExportResponse from a dictionary."""
|
|
622
|
-
return cls(content=d.get(
|
|
704
|
+
return cls(content=d.get("content", None), file_type=d.get("file_type", None))
|
|
623
705
|
|
|
624
706
|
|
|
625
707
|
@dataclass
|
|
@@ -637,25 +719,33 @@ class GetCredentialsResponse:
|
|
|
637
719
|
def as_dict(self) -> dict:
|
|
638
720
|
"""Serializes the GetCredentialsResponse into a dictionary suitable for use as a JSON request body."""
|
|
639
721
|
body = {}
|
|
640
|
-
if self.credential_id is not None:
|
|
641
|
-
|
|
642
|
-
if self.
|
|
722
|
+
if self.credential_id is not None:
|
|
723
|
+
body["credential_id"] = self.credential_id
|
|
724
|
+
if self.git_provider is not None:
|
|
725
|
+
body["git_provider"] = self.git_provider
|
|
726
|
+
if self.git_username is not None:
|
|
727
|
+
body["git_username"] = self.git_username
|
|
643
728
|
return body
|
|
644
729
|
|
|
645
730
|
def as_shallow_dict(self) -> dict:
|
|
646
731
|
"""Serializes the GetCredentialsResponse into a shallow dictionary of its immediate attributes."""
|
|
647
732
|
body = {}
|
|
648
|
-
if self.credential_id is not None:
|
|
649
|
-
|
|
650
|
-
if self.
|
|
733
|
+
if self.credential_id is not None:
|
|
734
|
+
body["credential_id"] = self.credential_id
|
|
735
|
+
if self.git_provider is not None:
|
|
736
|
+
body["git_provider"] = self.git_provider
|
|
737
|
+
if self.git_username is not None:
|
|
738
|
+
body["git_username"] = self.git_username
|
|
651
739
|
return body
|
|
652
740
|
|
|
653
741
|
@classmethod
|
|
654
|
-
def from_dict(cls, d: Dict[str,
|
|
742
|
+
def from_dict(cls, d: Dict[str, Any]) -> GetCredentialsResponse:
|
|
655
743
|
"""Deserializes the GetCredentialsResponse from a dictionary."""
|
|
656
|
-
return cls(
|
|
657
|
-
|
|
658
|
-
|
|
744
|
+
return cls(
|
|
745
|
+
credential_id=d.get("credential_id", None),
|
|
746
|
+
git_provider=d.get("git_provider", None),
|
|
747
|
+
git_username=d.get("git_username", None),
|
|
748
|
+
)
|
|
659
749
|
|
|
660
750
|
|
|
661
751
|
@dataclass
|
|
@@ -666,19 +756,21 @@ class GetRepoPermissionLevelsResponse:
|
|
|
666
756
|
def as_dict(self) -> dict:
|
|
667
757
|
"""Serializes the GetRepoPermissionLevelsResponse into a dictionary suitable for use as a JSON request body."""
|
|
668
758
|
body = {}
|
|
669
|
-
if self.permission_levels:
|
|
759
|
+
if self.permission_levels:
|
|
760
|
+
body["permission_levels"] = [v.as_dict() for v in self.permission_levels]
|
|
670
761
|
return body
|
|
671
762
|
|
|
672
763
|
def as_shallow_dict(self) -> dict:
|
|
673
764
|
"""Serializes the GetRepoPermissionLevelsResponse into a shallow dictionary of its immediate attributes."""
|
|
674
765
|
body = {}
|
|
675
|
-
if self.permission_levels:
|
|
766
|
+
if self.permission_levels:
|
|
767
|
+
body["permission_levels"] = self.permission_levels
|
|
676
768
|
return body
|
|
677
769
|
|
|
678
770
|
@classmethod
|
|
679
|
-
def from_dict(cls, d: Dict[str,
|
|
771
|
+
def from_dict(cls, d: Dict[str, Any]) -> GetRepoPermissionLevelsResponse:
|
|
680
772
|
"""Deserializes the GetRepoPermissionLevelsResponse from a dictionary."""
|
|
681
|
-
return cls(permission_levels=_repeated_dict(d,
|
|
773
|
+
return cls(permission_levels=_repeated_dict(d, "permission_levels", RepoPermissionsDescription))
|
|
682
774
|
|
|
683
775
|
|
|
684
776
|
@dataclass
|
|
@@ -707,37 +799,53 @@ class GetRepoResponse:
|
|
|
707
799
|
def as_dict(self) -> dict:
|
|
708
800
|
"""Serializes the GetRepoResponse into a dictionary suitable for use as a JSON request body."""
|
|
709
801
|
body = {}
|
|
710
|
-
if self.branch is not None:
|
|
711
|
-
|
|
712
|
-
if self.
|
|
713
|
-
|
|
714
|
-
if self.
|
|
715
|
-
|
|
716
|
-
if self.
|
|
802
|
+
if self.branch is not None:
|
|
803
|
+
body["branch"] = self.branch
|
|
804
|
+
if self.head_commit_id is not None:
|
|
805
|
+
body["head_commit_id"] = self.head_commit_id
|
|
806
|
+
if self.id is not None:
|
|
807
|
+
body["id"] = self.id
|
|
808
|
+
if self.path is not None:
|
|
809
|
+
body["path"] = self.path
|
|
810
|
+
if self.provider is not None:
|
|
811
|
+
body["provider"] = self.provider
|
|
812
|
+
if self.sparse_checkout:
|
|
813
|
+
body["sparse_checkout"] = self.sparse_checkout.as_dict()
|
|
814
|
+
if self.url is not None:
|
|
815
|
+
body["url"] = self.url
|
|
717
816
|
return body
|
|
718
817
|
|
|
719
818
|
def as_shallow_dict(self) -> dict:
|
|
720
819
|
"""Serializes the GetRepoResponse into a shallow dictionary of its immediate attributes."""
|
|
721
820
|
body = {}
|
|
722
|
-
if self.branch is not None:
|
|
723
|
-
|
|
724
|
-
if self.
|
|
725
|
-
|
|
726
|
-
if self.
|
|
727
|
-
|
|
728
|
-
if self.
|
|
821
|
+
if self.branch is not None:
|
|
822
|
+
body["branch"] = self.branch
|
|
823
|
+
if self.head_commit_id is not None:
|
|
824
|
+
body["head_commit_id"] = self.head_commit_id
|
|
825
|
+
if self.id is not None:
|
|
826
|
+
body["id"] = self.id
|
|
827
|
+
if self.path is not None:
|
|
828
|
+
body["path"] = self.path
|
|
829
|
+
if self.provider is not None:
|
|
830
|
+
body["provider"] = self.provider
|
|
831
|
+
if self.sparse_checkout:
|
|
832
|
+
body["sparse_checkout"] = self.sparse_checkout
|
|
833
|
+
if self.url is not None:
|
|
834
|
+
body["url"] = self.url
|
|
729
835
|
return body
|
|
730
836
|
|
|
731
837
|
@classmethod
|
|
732
|
-
def from_dict(cls, d: Dict[str,
|
|
838
|
+
def from_dict(cls, d: Dict[str, Any]) -> GetRepoResponse:
|
|
733
839
|
"""Deserializes the GetRepoResponse from a dictionary."""
|
|
734
|
-
return cls(
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
840
|
+
return cls(
|
|
841
|
+
branch=d.get("branch", None),
|
|
842
|
+
head_commit_id=d.get("head_commit_id", None),
|
|
843
|
+
id=d.get("id", None),
|
|
844
|
+
path=d.get("path", None),
|
|
845
|
+
provider=d.get("provider", None),
|
|
846
|
+
sparse_checkout=_from_dict(d, "sparse_checkout", SparseCheckout),
|
|
847
|
+
url=d.get("url", None),
|
|
848
|
+
)
|
|
741
849
|
|
|
742
850
|
|
|
743
851
|
@dataclass
|
|
@@ -751,21 +859,25 @@ class GetSecretResponse:
|
|
|
751
859
|
def as_dict(self) -> dict:
|
|
752
860
|
"""Serializes the GetSecretResponse into a dictionary suitable for use as a JSON request body."""
|
|
753
861
|
body = {}
|
|
754
|
-
if self.key is not None:
|
|
755
|
-
|
|
862
|
+
if self.key is not None:
|
|
863
|
+
body["key"] = self.key
|
|
864
|
+
if self.value is not None:
|
|
865
|
+
body["value"] = self.value
|
|
756
866
|
return body
|
|
757
867
|
|
|
758
868
|
def as_shallow_dict(self) -> dict:
|
|
759
869
|
"""Serializes the GetSecretResponse into a shallow dictionary of its immediate attributes."""
|
|
760
870
|
body = {}
|
|
761
|
-
if self.key is not None:
|
|
762
|
-
|
|
871
|
+
if self.key is not None:
|
|
872
|
+
body["key"] = self.key
|
|
873
|
+
if self.value is not None:
|
|
874
|
+
body["value"] = self.value
|
|
763
875
|
return body
|
|
764
876
|
|
|
765
877
|
@classmethod
|
|
766
|
-
def from_dict(cls, d: Dict[str,
|
|
878
|
+
def from_dict(cls, d: Dict[str, Any]) -> GetSecretResponse:
|
|
767
879
|
"""Deserializes the GetSecretResponse from a dictionary."""
|
|
768
|
-
return cls(key=d.get(
|
|
880
|
+
return cls(key=d.get("key", None), value=d.get("value", None))
|
|
769
881
|
|
|
770
882
|
|
|
771
883
|
@dataclass
|
|
@@ -776,20 +888,21 @@ class GetWorkspaceObjectPermissionLevelsResponse:
|
|
|
776
888
|
def as_dict(self) -> dict:
|
|
777
889
|
"""Serializes the GetWorkspaceObjectPermissionLevelsResponse into a dictionary suitable for use as a JSON request body."""
|
|
778
890
|
body = {}
|
|
779
|
-
if self.permission_levels:
|
|
891
|
+
if self.permission_levels:
|
|
892
|
+
body["permission_levels"] = [v.as_dict() for v in self.permission_levels]
|
|
780
893
|
return body
|
|
781
894
|
|
|
782
895
|
def as_shallow_dict(self) -> dict:
|
|
783
896
|
"""Serializes the GetWorkspaceObjectPermissionLevelsResponse into a shallow dictionary of its immediate attributes."""
|
|
784
897
|
body = {}
|
|
785
|
-
if self.permission_levels:
|
|
898
|
+
if self.permission_levels:
|
|
899
|
+
body["permission_levels"] = self.permission_levels
|
|
786
900
|
return body
|
|
787
901
|
|
|
788
902
|
@classmethod
|
|
789
|
-
def from_dict(cls, d: Dict[str,
|
|
903
|
+
def from_dict(cls, d: Dict[str, Any]) -> GetWorkspaceObjectPermissionLevelsResponse:
|
|
790
904
|
"""Deserializes the GetWorkspaceObjectPermissionLevelsResponse from a dictionary."""
|
|
791
|
-
return cls(
|
|
792
|
-
permission_levels=_repeated_dict(d, 'permission_levels', WorkspaceObjectPermissionsDescription))
|
|
905
|
+
return cls(permission_levels=_repeated_dict(d, "permission_levels", WorkspaceObjectPermissionsDescription))
|
|
793
906
|
|
|
794
907
|
|
|
795
908
|
@dataclass
|
|
@@ -827,58 +940,59 @@ class Import:
|
|
|
827
940
|
def as_dict(self) -> dict:
|
|
828
941
|
"""Serializes the Import into a dictionary suitable for use as a JSON request body."""
|
|
829
942
|
body = {}
|
|
830
|
-
if self.content is not None:
|
|
831
|
-
|
|
832
|
-
if self.
|
|
833
|
-
|
|
834
|
-
if self.
|
|
943
|
+
if self.content is not None:
|
|
944
|
+
body["content"] = self.content
|
|
945
|
+
if self.format is not None:
|
|
946
|
+
body["format"] = self.format.value
|
|
947
|
+
if self.language is not None:
|
|
948
|
+
body["language"] = self.language.value
|
|
949
|
+
if self.overwrite is not None:
|
|
950
|
+
body["overwrite"] = self.overwrite
|
|
951
|
+
if self.path is not None:
|
|
952
|
+
body["path"] = self.path
|
|
835
953
|
return body
|
|
836
954
|
|
|
837
955
|
def as_shallow_dict(self) -> dict:
|
|
838
956
|
"""Serializes the Import into a shallow dictionary of its immediate attributes."""
|
|
839
957
|
body = {}
|
|
840
|
-
if self.content is not None:
|
|
841
|
-
|
|
842
|
-
if self.
|
|
843
|
-
|
|
844
|
-
if self.
|
|
958
|
+
if self.content is not None:
|
|
959
|
+
body["content"] = self.content
|
|
960
|
+
if self.format is not None:
|
|
961
|
+
body["format"] = self.format
|
|
962
|
+
if self.language is not None:
|
|
963
|
+
body["language"] = self.language
|
|
964
|
+
if self.overwrite is not None:
|
|
965
|
+
body["overwrite"] = self.overwrite
|
|
966
|
+
if self.path is not None:
|
|
967
|
+
body["path"] = self.path
|
|
845
968
|
return body
|
|
846
969
|
|
|
847
970
|
@classmethod
|
|
848
|
-
def from_dict(cls, d: Dict[str,
|
|
971
|
+
def from_dict(cls, d: Dict[str, Any]) -> Import:
|
|
849
972
|
"""Deserializes the Import from a dictionary."""
|
|
850
|
-
return cls(
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
973
|
+
return cls(
|
|
974
|
+
content=d.get("content", None),
|
|
975
|
+
format=_enum(d, "format", ImportFormat),
|
|
976
|
+
language=_enum(d, "language", Language),
|
|
977
|
+
overwrite=d.get("overwrite", None),
|
|
978
|
+
path=d.get("path", None),
|
|
979
|
+
)
|
|
855
980
|
|
|
856
981
|
|
|
857
982
|
class ImportFormat(Enum):
|
|
858
|
-
"""
|
|
859
|
-
|
|
860
|
-
The value is case sensitive.
|
|
861
|
-
|
|
862
|
-
- `AUTO`: The item is imported depending on an analysis of the item's extension and the header
|
|
863
|
-
content provided in the request. If the item is imported as a notebook, then the item's
|
|
864
|
-
extension is automatically removed. - `SOURCE`: The notebook or directory is imported as source
|
|
865
|
-
code. - `HTML`: The notebook is imported as an HTML file. - `JUPYTER`: The notebook is imported
|
|
866
|
-
as a Jupyter/IPython Notebook file. - `DBC`: The notebook is imported in Databricks archive
|
|
867
|
-
format. Required for directories. - `R_MARKDOWN`: The notebook is imported from R Markdown
|
|
868
|
-
format."""
|
|
983
|
+
"""The format for workspace import and export."""
|
|
869
984
|
|
|
870
|
-
AUTO =
|
|
871
|
-
DBC =
|
|
872
|
-
HTML =
|
|
873
|
-
JUPYTER =
|
|
874
|
-
RAW =
|
|
875
|
-
R_MARKDOWN =
|
|
876
|
-
SOURCE =
|
|
985
|
+
AUTO = "AUTO"
|
|
986
|
+
DBC = "DBC"
|
|
987
|
+
HTML = "HTML"
|
|
988
|
+
JUPYTER = "JUPYTER"
|
|
989
|
+
RAW = "RAW"
|
|
990
|
+
R_MARKDOWN = "R_MARKDOWN"
|
|
991
|
+
SOURCE = "SOURCE"
|
|
877
992
|
|
|
878
993
|
|
|
879
994
|
@dataclass
|
|
880
995
|
class ImportResponse:
|
|
881
|
-
|
|
882
996
|
def as_dict(self) -> dict:
|
|
883
997
|
"""Serializes the ImportResponse into a dictionary suitable for use as a JSON request body."""
|
|
884
998
|
body = {}
|
|
@@ -890,18 +1004,18 @@ class ImportResponse:
|
|
|
890
1004
|
return body
|
|
891
1005
|
|
|
892
1006
|
@classmethod
|
|
893
|
-
def from_dict(cls, d: Dict[str,
|
|
1007
|
+
def from_dict(cls, d: Dict[str, Any]) -> ImportResponse:
|
|
894
1008
|
"""Deserializes the ImportResponse from a dictionary."""
|
|
895
1009
|
return cls()
|
|
896
1010
|
|
|
897
1011
|
|
|
898
1012
|
class Language(Enum):
|
|
899
|
-
"""The language of
|
|
1013
|
+
"""The language of notebook."""
|
|
900
1014
|
|
|
901
|
-
PYTHON =
|
|
902
|
-
R =
|
|
903
|
-
SCALA =
|
|
904
|
-
SQL =
|
|
1015
|
+
PYTHON = "PYTHON"
|
|
1016
|
+
R = "R"
|
|
1017
|
+
SCALA = "SCALA"
|
|
1018
|
+
SQL = "SQL"
|
|
905
1019
|
|
|
906
1020
|
|
|
907
1021
|
@dataclass
|
|
@@ -912,19 +1026,21 @@ class ListAclsResponse:
|
|
|
912
1026
|
def as_dict(self) -> dict:
|
|
913
1027
|
"""Serializes the ListAclsResponse into a dictionary suitable for use as a JSON request body."""
|
|
914
1028
|
body = {}
|
|
915
|
-
if self.items:
|
|
1029
|
+
if self.items:
|
|
1030
|
+
body["items"] = [v.as_dict() for v in self.items]
|
|
916
1031
|
return body
|
|
917
1032
|
|
|
918
1033
|
def as_shallow_dict(self) -> dict:
|
|
919
1034
|
"""Serializes the ListAclsResponse into a shallow dictionary of its immediate attributes."""
|
|
920
1035
|
body = {}
|
|
921
|
-
if self.items:
|
|
1036
|
+
if self.items:
|
|
1037
|
+
body["items"] = self.items
|
|
922
1038
|
return body
|
|
923
1039
|
|
|
924
1040
|
@classmethod
|
|
925
|
-
def from_dict(cls, d: Dict[str,
|
|
1041
|
+
def from_dict(cls, d: Dict[str, Any]) -> ListAclsResponse:
|
|
926
1042
|
"""Deserializes the ListAclsResponse from a dictionary."""
|
|
927
|
-
return cls(items=_repeated_dict(d,
|
|
1043
|
+
return cls(items=_repeated_dict(d, "items", AclItem))
|
|
928
1044
|
|
|
929
1045
|
|
|
930
1046
|
@dataclass
|
|
@@ -935,19 +1051,21 @@ class ListCredentialsResponse:
|
|
|
935
1051
|
def as_dict(self) -> dict:
|
|
936
1052
|
"""Serializes the ListCredentialsResponse into a dictionary suitable for use as a JSON request body."""
|
|
937
1053
|
body = {}
|
|
938
|
-
if self.credentials:
|
|
1054
|
+
if self.credentials:
|
|
1055
|
+
body["credentials"] = [v.as_dict() for v in self.credentials]
|
|
939
1056
|
return body
|
|
940
1057
|
|
|
941
1058
|
def as_shallow_dict(self) -> dict:
|
|
942
1059
|
"""Serializes the ListCredentialsResponse into a shallow dictionary of its immediate attributes."""
|
|
943
1060
|
body = {}
|
|
944
|
-
if self.credentials:
|
|
1061
|
+
if self.credentials:
|
|
1062
|
+
body["credentials"] = self.credentials
|
|
945
1063
|
return body
|
|
946
1064
|
|
|
947
1065
|
@classmethod
|
|
948
|
-
def from_dict(cls, d: Dict[str,
|
|
1066
|
+
def from_dict(cls, d: Dict[str, Any]) -> ListCredentialsResponse:
|
|
949
1067
|
"""Deserializes the ListCredentialsResponse from a dictionary."""
|
|
950
|
-
return cls(credentials=_repeated_dict(d,
|
|
1068
|
+
return cls(credentials=_repeated_dict(d, "credentials", CredentialInfo))
|
|
951
1069
|
|
|
952
1070
|
|
|
953
1071
|
@dataclass
|
|
@@ -962,21 +1080,25 @@ class ListReposResponse:
|
|
|
962
1080
|
def as_dict(self) -> dict:
|
|
963
1081
|
"""Serializes the ListReposResponse into a dictionary suitable for use as a JSON request body."""
|
|
964
1082
|
body = {}
|
|
965
|
-
if self.next_page_token is not None:
|
|
966
|
-
|
|
1083
|
+
if self.next_page_token is not None:
|
|
1084
|
+
body["next_page_token"] = self.next_page_token
|
|
1085
|
+
if self.repos:
|
|
1086
|
+
body["repos"] = [v.as_dict() for v in self.repos]
|
|
967
1087
|
return body
|
|
968
1088
|
|
|
969
1089
|
def as_shallow_dict(self) -> dict:
|
|
970
1090
|
"""Serializes the ListReposResponse into a shallow dictionary of its immediate attributes."""
|
|
971
1091
|
body = {}
|
|
972
|
-
if self.next_page_token is not None:
|
|
973
|
-
|
|
1092
|
+
if self.next_page_token is not None:
|
|
1093
|
+
body["next_page_token"] = self.next_page_token
|
|
1094
|
+
if self.repos:
|
|
1095
|
+
body["repos"] = self.repos
|
|
974
1096
|
return body
|
|
975
1097
|
|
|
976
1098
|
@classmethod
|
|
977
|
-
def from_dict(cls, d: Dict[str,
|
|
1099
|
+
def from_dict(cls, d: Dict[str, Any]) -> ListReposResponse:
|
|
978
1100
|
"""Deserializes the ListReposResponse from a dictionary."""
|
|
979
|
-
return cls(next_page_token=d.get(
|
|
1101
|
+
return cls(next_page_token=d.get("next_page_token", None), repos=_repeated_dict(d, "repos", RepoInfo))
|
|
980
1102
|
|
|
981
1103
|
|
|
982
1104
|
@dataclass
|
|
@@ -987,19 +1109,21 @@ class ListResponse:
|
|
|
987
1109
|
def as_dict(self) -> dict:
|
|
988
1110
|
"""Serializes the ListResponse into a dictionary suitable for use as a JSON request body."""
|
|
989
1111
|
body = {}
|
|
990
|
-
if self.objects:
|
|
1112
|
+
if self.objects:
|
|
1113
|
+
body["objects"] = [v.as_dict() for v in self.objects]
|
|
991
1114
|
return body
|
|
992
1115
|
|
|
993
1116
|
def as_shallow_dict(self) -> dict:
|
|
994
1117
|
"""Serializes the ListResponse into a shallow dictionary of its immediate attributes."""
|
|
995
1118
|
body = {}
|
|
996
|
-
if self.objects:
|
|
1119
|
+
if self.objects:
|
|
1120
|
+
body["objects"] = self.objects
|
|
997
1121
|
return body
|
|
998
1122
|
|
|
999
1123
|
@classmethod
|
|
1000
|
-
def from_dict(cls, d: Dict[str,
|
|
1124
|
+
def from_dict(cls, d: Dict[str, Any]) -> ListResponse:
|
|
1001
1125
|
"""Deserializes the ListResponse from a dictionary."""
|
|
1002
|
-
return cls(objects=_repeated_dict(d,
|
|
1126
|
+
return cls(objects=_repeated_dict(d, "objects", ObjectInfo))
|
|
1003
1127
|
|
|
1004
1128
|
|
|
1005
1129
|
@dataclass
|
|
@@ -1010,19 +1134,21 @@ class ListScopesResponse:
|
|
|
1010
1134
|
def as_dict(self) -> dict:
|
|
1011
1135
|
"""Serializes the ListScopesResponse into a dictionary suitable for use as a JSON request body."""
|
|
1012
1136
|
body = {}
|
|
1013
|
-
if self.scopes:
|
|
1137
|
+
if self.scopes:
|
|
1138
|
+
body["scopes"] = [v.as_dict() for v in self.scopes]
|
|
1014
1139
|
return body
|
|
1015
1140
|
|
|
1016
1141
|
def as_shallow_dict(self) -> dict:
|
|
1017
1142
|
"""Serializes the ListScopesResponse into a shallow dictionary of its immediate attributes."""
|
|
1018
1143
|
body = {}
|
|
1019
|
-
if self.scopes:
|
|
1144
|
+
if self.scopes:
|
|
1145
|
+
body["scopes"] = self.scopes
|
|
1020
1146
|
return body
|
|
1021
1147
|
|
|
1022
1148
|
@classmethod
|
|
1023
|
-
def from_dict(cls, d: Dict[str,
|
|
1149
|
+
def from_dict(cls, d: Dict[str, Any]) -> ListScopesResponse:
|
|
1024
1150
|
"""Deserializes the ListScopesResponse from a dictionary."""
|
|
1025
|
-
return cls(scopes=_repeated_dict(d,
|
|
1151
|
+
return cls(scopes=_repeated_dict(d, "scopes", SecretScope))
|
|
1026
1152
|
|
|
1027
1153
|
|
|
1028
1154
|
@dataclass
|
|
@@ -1033,19 +1159,21 @@ class ListSecretsResponse:
|
|
|
1033
1159
|
def as_dict(self) -> dict:
|
|
1034
1160
|
"""Serializes the ListSecretsResponse into a dictionary suitable for use as a JSON request body."""
|
|
1035
1161
|
body = {}
|
|
1036
|
-
if self.secrets:
|
|
1162
|
+
if self.secrets:
|
|
1163
|
+
body["secrets"] = [v.as_dict() for v in self.secrets]
|
|
1037
1164
|
return body
|
|
1038
1165
|
|
|
1039
1166
|
def as_shallow_dict(self) -> dict:
|
|
1040
1167
|
"""Serializes the ListSecretsResponse into a shallow dictionary of its immediate attributes."""
|
|
1041
1168
|
body = {}
|
|
1042
|
-
if self.secrets:
|
|
1169
|
+
if self.secrets:
|
|
1170
|
+
body["secrets"] = self.secrets
|
|
1043
1171
|
return body
|
|
1044
1172
|
|
|
1045
1173
|
@classmethod
|
|
1046
|
-
def from_dict(cls, d: Dict[str,
|
|
1174
|
+
def from_dict(cls, d: Dict[str, Any]) -> ListSecretsResponse:
|
|
1047
1175
|
"""Deserializes the ListSecretsResponse from a dictionary."""
|
|
1048
|
-
return cls(secrets=_repeated_dict(d,
|
|
1176
|
+
return cls(secrets=_repeated_dict(d, "secrets", SecretMetadata))
|
|
1049
1177
|
|
|
1050
1178
|
|
|
1051
1179
|
@dataclass
|
|
@@ -1057,24 +1185,25 @@ class Mkdirs:
|
|
|
1057
1185
|
def as_dict(self) -> dict:
|
|
1058
1186
|
"""Serializes the Mkdirs into a dictionary suitable for use as a JSON request body."""
|
|
1059
1187
|
body = {}
|
|
1060
|
-
if self.path is not None:
|
|
1188
|
+
if self.path is not None:
|
|
1189
|
+
body["path"] = self.path
|
|
1061
1190
|
return body
|
|
1062
1191
|
|
|
1063
1192
|
def as_shallow_dict(self) -> dict:
|
|
1064
1193
|
"""Serializes the Mkdirs into a shallow dictionary of its immediate attributes."""
|
|
1065
1194
|
body = {}
|
|
1066
|
-
if self.path is not None:
|
|
1195
|
+
if self.path is not None:
|
|
1196
|
+
body["path"] = self.path
|
|
1067
1197
|
return body
|
|
1068
1198
|
|
|
1069
1199
|
@classmethod
|
|
1070
|
-
def from_dict(cls, d: Dict[str,
|
|
1200
|
+
def from_dict(cls, d: Dict[str, Any]) -> Mkdirs:
|
|
1071
1201
|
"""Deserializes the Mkdirs from a dictionary."""
|
|
1072
|
-
return cls(path=d.get(
|
|
1202
|
+
return cls(path=d.get("path", None))
|
|
1073
1203
|
|
|
1074
1204
|
|
|
1075
1205
|
@dataclass
|
|
1076
1206
|
class MkdirsResponse:
|
|
1077
|
-
|
|
1078
1207
|
def as_dict(self) -> dict:
|
|
1079
1208
|
"""Serializes the MkdirsResponse into a dictionary suitable for use as a JSON request body."""
|
|
1080
1209
|
body = {}
|
|
@@ -1086,18 +1215,20 @@ class MkdirsResponse:
|
|
|
1086
1215
|
return body
|
|
1087
1216
|
|
|
1088
1217
|
@classmethod
|
|
1089
|
-
def from_dict(cls, d: Dict[str,
|
|
1218
|
+
def from_dict(cls, d: Dict[str, Any]) -> MkdirsResponse:
|
|
1090
1219
|
"""Deserializes the MkdirsResponse from a dictionary."""
|
|
1091
1220
|
return cls()
|
|
1092
1221
|
|
|
1093
1222
|
|
|
1094
1223
|
@dataclass
|
|
1095
1224
|
class ObjectInfo:
|
|
1225
|
+
"""The information of the object in workspace. It will be returned by ``list`` and ``get-status``."""
|
|
1226
|
+
|
|
1096
1227
|
created_at: Optional[int] = None
|
|
1097
1228
|
"""Only applicable to files. The creation UTC timestamp."""
|
|
1098
1229
|
|
|
1099
1230
|
language: Optional[Language] = None
|
|
1100
|
-
"""The language of the object. This value is set only if the object type is
|
|
1231
|
+
"""The language of the object. This value is set only if the object type is ``NOTEBOOK``."""
|
|
1101
1232
|
|
|
1102
1233
|
modified_at: Optional[int] = None
|
|
1103
1234
|
"""Only applicable to files, the last modified UTC timestamp."""
|
|
@@ -1124,55 +1255,69 @@ class ObjectInfo:
|
|
|
1124
1255
|
def as_dict(self) -> dict:
|
|
1125
1256
|
"""Serializes the ObjectInfo into a dictionary suitable for use as a JSON request body."""
|
|
1126
1257
|
body = {}
|
|
1127
|
-
if self.created_at is not None:
|
|
1128
|
-
|
|
1129
|
-
if self.
|
|
1130
|
-
|
|
1131
|
-
if self.
|
|
1132
|
-
|
|
1133
|
-
if self.
|
|
1134
|
-
|
|
1258
|
+
if self.created_at is not None:
|
|
1259
|
+
body["created_at"] = self.created_at
|
|
1260
|
+
if self.language is not None:
|
|
1261
|
+
body["language"] = self.language.value
|
|
1262
|
+
if self.modified_at is not None:
|
|
1263
|
+
body["modified_at"] = self.modified_at
|
|
1264
|
+
if self.object_id is not None:
|
|
1265
|
+
body["object_id"] = self.object_id
|
|
1266
|
+
if self.object_type is not None:
|
|
1267
|
+
body["object_type"] = self.object_type.value
|
|
1268
|
+
if self.path is not None:
|
|
1269
|
+
body["path"] = self.path
|
|
1270
|
+
if self.resource_id is not None:
|
|
1271
|
+
body["resource_id"] = self.resource_id
|
|
1272
|
+
if self.size is not None:
|
|
1273
|
+
body["size"] = self.size
|
|
1135
1274
|
return body
|
|
1136
1275
|
|
|
1137
1276
|
def as_shallow_dict(self) -> dict:
|
|
1138
1277
|
"""Serializes the ObjectInfo into a shallow dictionary of its immediate attributes."""
|
|
1139
1278
|
body = {}
|
|
1140
|
-
if self.created_at is not None:
|
|
1141
|
-
|
|
1142
|
-
if self.
|
|
1143
|
-
|
|
1144
|
-
if self.
|
|
1145
|
-
|
|
1146
|
-
if self.
|
|
1147
|
-
|
|
1279
|
+
if self.created_at is not None:
|
|
1280
|
+
body["created_at"] = self.created_at
|
|
1281
|
+
if self.language is not None:
|
|
1282
|
+
body["language"] = self.language
|
|
1283
|
+
if self.modified_at is not None:
|
|
1284
|
+
body["modified_at"] = self.modified_at
|
|
1285
|
+
if self.object_id is not None:
|
|
1286
|
+
body["object_id"] = self.object_id
|
|
1287
|
+
if self.object_type is not None:
|
|
1288
|
+
body["object_type"] = self.object_type
|
|
1289
|
+
if self.path is not None:
|
|
1290
|
+
body["path"] = self.path
|
|
1291
|
+
if self.resource_id is not None:
|
|
1292
|
+
body["resource_id"] = self.resource_id
|
|
1293
|
+
if self.size is not None:
|
|
1294
|
+
body["size"] = self.size
|
|
1148
1295
|
return body
|
|
1149
1296
|
|
|
1150
1297
|
@classmethod
|
|
1151
|
-
def from_dict(cls, d: Dict[str,
|
|
1298
|
+
def from_dict(cls, d: Dict[str, Any]) -> ObjectInfo:
|
|
1152
1299
|
"""Deserializes the ObjectInfo from a dictionary."""
|
|
1153
|
-
return cls(
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1300
|
+
return cls(
|
|
1301
|
+
created_at=d.get("created_at", None),
|
|
1302
|
+
language=_enum(d, "language", Language),
|
|
1303
|
+
modified_at=d.get("modified_at", None),
|
|
1304
|
+
object_id=d.get("object_id", None),
|
|
1305
|
+
object_type=_enum(d, "object_type", ObjectType),
|
|
1306
|
+
path=d.get("path", None),
|
|
1307
|
+
resource_id=d.get("resource_id", None),
|
|
1308
|
+
size=d.get("size", None),
|
|
1309
|
+
)
|
|
1161
1310
|
|
|
1162
1311
|
|
|
1163
1312
|
class ObjectType(Enum):
|
|
1164
|
-
"""The type of the object in workspace.
|
|
1165
|
-
|
|
1166
|
-
- `NOTEBOOK`: document that contains runnable code, visualizations, and explanatory text. -
|
|
1167
|
-
`DIRECTORY`: directory - `LIBRARY`: library - `FILE`: file - `REPO`: repository - `DASHBOARD`:
|
|
1168
|
-
Lakeview dashboard"""
|
|
1313
|
+
"""The type of the object in workspace."""
|
|
1169
1314
|
|
|
1170
|
-
DASHBOARD =
|
|
1171
|
-
DIRECTORY =
|
|
1172
|
-
FILE =
|
|
1173
|
-
LIBRARY =
|
|
1174
|
-
NOTEBOOK =
|
|
1175
|
-
REPO =
|
|
1315
|
+
DASHBOARD = "DASHBOARD"
|
|
1316
|
+
DIRECTORY = "DIRECTORY"
|
|
1317
|
+
FILE = "FILE"
|
|
1318
|
+
LIBRARY = "LIBRARY"
|
|
1319
|
+
NOTEBOOK = "NOTEBOOK"
|
|
1320
|
+
REPO = "REPO"
|
|
1176
1321
|
|
|
1177
1322
|
|
|
1178
1323
|
@dataclass
|
|
@@ -1189,30 +1334,37 @@ class PutAcl:
|
|
|
1189
1334
|
def as_dict(self) -> dict:
|
|
1190
1335
|
"""Serializes the PutAcl into a dictionary suitable for use as a JSON request body."""
|
|
1191
1336
|
body = {}
|
|
1192
|
-
if self.permission is not None:
|
|
1193
|
-
|
|
1194
|
-
if self.
|
|
1337
|
+
if self.permission is not None:
|
|
1338
|
+
body["permission"] = self.permission.value
|
|
1339
|
+
if self.principal is not None:
|
|
1340
|
+
body["principal"] = self.principal
|
|
1341
|
+
if self.scope is not None:
|
|
1342
|
+
body["scope"] = self.scope
|
|
1195
1343
|
return body
|
|
1196
1344
|
|
|
1197
1345
|
def as_shallow_dict(self) -> dict:
|
|
1198
1346
|
"""Serializes the PutAcl into a shallow dictionary of its immediate attributes."""
|
|
1199
1347
|
body = {}
|
|
1200
|
-
if self.permission is not None:
|
|
1201
|
-
|
|
1202
|
-
if self.
|
|
1348
|
+
if self.permission is not None:
|
|
1349
|
+
body["permission"] = self.permission
|
|
1350
|
+
if self.principal is not None:
|
|
1351
|
+
body["principal"] = self.principal
|
|
1352
|
+
if self.scope is not None:
|
|
1353
|
+
body["scope"] = self.scope
|
|
1203
1354
|
return body
|
|
1204
1355
|
|
|
1205
1356
|
@classmethod
|
|
1206
|
-
def from_dict(cls, d: Dict[str,
|
|
1357
|
+
def from_dict(cls, d: Dict[str, Any]) -> PutAcl:
|
|
1207
1358
|
"""Deserializes the PutAcl from a dictionary."""
|
|
1208
|
-
return cls(
|
|
1209
|
-
|
|
1210
|
-
|
|
1359
|
+
return cls(
|
|
1360
|
+
permission=_enum(d, "permission", AclPermission),
|
|
1361
|
+
principal=d.get("principal", None),
|
|
1362
|
+
scope=d.get("scope", None),
|
|
1363
|
+
)
|
|
1211
1364
|
|
|
1212
1365
|
|
|
1213
1366
|
@dataclass
|
|
1214
1367
|
class PutAclResponse:
|
|
1215
|
-
|
|
1216
1368
|
def as_dict(self) -> dict:
|
|
1217
1369
|
"""Serializes the PutAclResponse into a dictionary suitable for use as a JSON request body."""
|
|
1218
1370
|
body = {}
|
|
@@ -1224,7 +1376,7 @@ class PutAclResponse:
|
|
|
1224
1376
|
return body
|
|
1225
1377
|
|
|
1226
1378
|
@classmethod
|
|
1227
|
-
def from_dict(cls, d: Dict[str,
|
|
1379
|
+
def from_dict(cls, d: Dict[str, Any]) -> PutAclResponse:
|
|
1228
1380
|
"""Deserializes the PutAclResponse from a dictionary."""
|
|
1229
1381
|
return cls()
|
|
1230
1382
|
|
|
@@ -1246,33 +1398,42 @@ class PutSecret:
|
|
|
1246
1398
|
def as_dict(self) -> dict:
|
|
1247
1399
|
"""Serializes the PutSecret into a dictionary suitable for use as a JSON request body."""
|
|
1248
1400
|
body = {}
|
|
1249
|
-
if self.bytes_value is not None:
|
|
1250
|
-
|
|
1251
|
-
if self.
|
|
1252
|
-
|
|
1401
|
+
if self.bytes_value is not None:
|
|
1402
|
+
body["bytes_value"] = self.bytes_value
|
|
1403
|
+
if self.key is not None:
|
|
1404
|
+
body["key"] = self.key
|
|
1405
|
+
if self.scope is not None:
|
|
1406
|
+
body["scope"] = self.scope
|
|
1407
|
+
if self.string_value is not None:
|
|
1408
|
+
body["string_value"] = self.string_value
|
|
1253
1409
|
return body
|
|
1254
1410
|
|
|
1255
1411
|
def as_shallow_dict(self) -> dict:
|
|
1256
1412
|
"""Serializes the PutSecret into a shallow dictionary of its immediate attributes."""
|
|
1257
1413
|
body = {}
|
|
1258
|
-
if self.bytes_value is not None:
|
|
1259
|
-
|
|
1260
|
-
if self.
|
|
1261
|
-
|
|
1414
|
+
if self.bytes_value is not None:
|
|
1415
|
+
body["bytes_value"] = self.bytes_value
|
|
1416
|
+
if self.key is not None:
|
|
1417
|
+
body["key"] = self.key
|
|
1418
|
+
if self.scope is not None:
|
|
1419
|
+
body["scope"] = self.scope
|
|
1420
|
+
if self.string_value is not None:
|
|
1421
|
+
body["string_value"] = self.string_value
|
|
1262
1422
|
return body
|
|
1263
1423
|
|
|
1264
1424
|
@classmethod
|
|
1265
|
-
def from_dict(cls, d: Dict[str,
|
|
1425
|
+
def from_dict(cls, d: Dict[str, Any]) -> PutSecret:
|
|
1266
1426
|
"""Deserializes the PutSecret from a dictionary."""
|
|
1267
|
-
return cls(
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1427
|
+
return cls(
|
|
1428
|
+
bytes_value=d.get("bytes_value", None),
|
|
1429
|
+
key=d.get("key", None),
|
|
1430
|
+
scope=d.get("scope", None),
|
|
1431
|
+
string_value=d.get("string_value", None),
|
|
1432
|
+
)
|
|
1271
1433
|
|
|
1272
1434
|
|
|
1273
1435
|
@dataclass
|
|
1274
1436
|
class PutSecretResponse:
|
|
1275
|
-
|
|
1276
1437
|
def as_dict(self) -> dict:
|
|
1277
1438
|
"""Serializes the PutSecretResponse into a dictionary suitable for use as a JSON request body."""
|
|
1278
1439
|
body = {}
|
|
@@ -1284,7 +1445,7 @@ class PutSecretResponse:
|
|
|
1284
1445
|
return body
|
|
1285
1446
|
|
|
1286
1447
|
@classmethod
|
|
1287
|
-
def from_dict(cls, d: Dict[str,
|
|
1448
|
+
def from_dict(cls, d: Dict[str, Any]) -> PutSecretResponse:
|
|
1288
1449
|
"""Deserializes the PutSecretResponse from a dictionary."""
|
|
1289
1450
|
return cls()
|
|
1290
1451
|
|
|
@@ -1306,30 +1467,38 @@ class RepoAccessControlRequest:
|
|
|
1306
1467
|
def as_dict(self) -> dict:
|
|
1307
1468
|
"""Serializes the RepoAccessControlRequest into a dictionary suitable for use as a JSON request body."""
|
|
1308
1469
|
body = {}
|
|
1309
|
-
if self.group_name is not None:
|
|
1310
|
-
|
|
1470
|
+
if self.group_name is not None:
|
|
1471
|
+
body["group_name"] = self.group_name
|
|
1472
|
+
if self.permission_level is not None:
|
|
1473
|
+
body["permission_level"] = self.permission_level.value
|
|
1311
1474
|
if self.service_principal_name is not None:
|
|
1312
|
-
body[
|
|
1313
|
-
if self.user_name is not None:
|
|
1475
|
+
body["service_principal_name"] = self.service_principal_name
|
|
1476
|
+
if self.user_name is not None:
|
|
1477
|
+
body["user_name"] = self.user_name
|
|
1314
1478
|
return body
|
|
1315
1479
|
|
|
1316
1480
|
def as_shallow_dict(self) -> dict:
|
|
1317
1481
|
"""Serializes the RepoAccessControlRequest into a shallow dictionary of its immediate attributes."""
|
|
1318
1482
|
body = {}
|
|
1319
|
-
if self.group_name is not None:
|
|
1320
|
-
|
|
1483
|
+
if self.group_name is not None:
|
|
1484
|
+
body["group_name"] = self.group_name
|
|
1485
|
+
if self.permission_level is not None:
|
|
1486
|
+
body["permission_level"] = self.permission_level
|
|
1321
1487
|
if self.service_principal_name is not None:
|
|
1322
|
-
body[
|
|
1323
|
-
if self.user_name is not None:
|
|
1488
|
+
body["service_principal_name"] = self.service_principal_name
|
|
1489
|
+
if self.user_name is not None:
|
|
1490
|
+
body["user_name"] = self.user_name
|
|
1324
1491
|
return body
|
|
1325
1492
|
|
|
1326
1493
|
@classmethod
|
|
1327
|
-
def from_dict(cls, d: Dict[str,
|
|
1494
|
+
def from_dict(cls, d: Dict[str, Any]) -> RepoAccessControlRequest:
|
|
1328
1495
|
"""Deserializes the RepoAccessControlRequest from a dictionary."""
|
|
1329
|
-
return cls(
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1496
|
+
return cls(
|
|
1497
|
+
group_name=d.get("group_name", None),
|
|
1498
|
+
permission_level=_enum(d, "permission_level", RepoPermissionLevel),
|
|
1499
|
+
service_principal_name=d.get("service_principal_name", None),
|
|
1500
|
+
user_name=d.get("user_name", None),
|
|
1501
|
+
)
|
|
1333
1502
|
|
|
1334
1503
|
|
|
1335
1504
|
@dataclass
|
|
@@ -1352,33 +1521,43 @@ class RepoAccessControlResponse:
|
|
|
1352
1521
|
def as_dict(self) -> dict:
|
|
1353
1522
|
"""Serializes the RepoAccessControlResponse into a dictionary suitable for use as a JSON request body."""
|
|
1354
1523
|
body = {}
|
|
1355
|
-
if self.all_permissions:
|
|
1356
|
-
|
|
1357
|
-
if self.
|
|
1524
|
+
if self.all_permissions:
|
|
1525
|
+
body["all_permissions"] = [v.as_dict() for v in self.all_permissions]
|
|
1526
|
+
if self.display_name is not None:
|
|
1527
|
+
body["display_name"] = self.display_name
|
|
1528
|
+
if self.group_name is not None:
|
|
1529
|
+
body["group_name"] = self.group_name
|
|
1358
1530
|
if self.service_principal_name is not None:
|
|
1359
|
-
body[
|
|
1360
|
-
if self.user_name is not None:
|
|
1531
|
+
body["service_principal_name"] = self.service_principal_name
|
|
1532
|
+
if self.user_name is not None:
|
|
1533
|
+
body["user_name"] = self.user_name
|
|
1361
1534
|
return body
|
|
1362
1535
|
|
|
1363
1536
|
def as_shallow_dict(self) -> dict:
|
|
1364
1537
|
"""Serializes the RepoAccessControlResponse into a shallow dictionary of its immediate attributes."""
|
|
1365
1538
|
body = {}
|
|
1366
|
-
if self.all_permissions:
|
|
1367
|
-
|
|
1368
|
-
if self.
|
|
1539
|
+
if self.all_permissions:
|
|
1540
|
+
body["all_permissions"] = self.all_permissions
|
|
1541
|
+
if self.display_name is not None:
|
|
1542
|
+
body["display_name"] = self.display_name
|
|
1543
|
+
if self.group_name is not None:
|
|
1544
|
+
body["group_name"] = self.group_name
|
|
1369
1545
|
if self.service_principal_name is not None:
|
|
1370
|
-
body[
|
|
1371
|
-
if self.user_name is not None:
|
|
1546
|
+
body["service_principal_name"] = self.service_principal_name
|
|
1547
|
+
if self.user_name is not None:
|
|
1548
|
+
body["user_name"] = self.user_name
|
|
1372
1549
|
return body
|
|
1373
1550
|
|
|
1374
1551
|
@classmethod
|
|
1375
|
-
def from_dict(cls, d: Dict[str,
|
|
1552
|
+
def from_dict(cls, d: Dict[str, Any]) -> RepoAccessControlResponse:
|
|
1376
1553
|
"""Deserializes the RepoAccessControlResponse from a dictionary."""
|
|
1377
|
-
return cls(
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1554
|
+
return cls(
|
|
1555
|
+
all_permissions=_repeated_dict(d, "all_permissions", RepoPermission),
|
|
1556
|
+
display_name=d.get("display_name", None),
|
|
1557
|
+
group_name=d.get("group_name", None),
|
|
1558
|
+
service_principal_name=d.get("service_principal_name", None),
|
|
1559
|
+
user_name=d.get("user_name", None),
|
|
1560
|
+
)
|
|
1382
1561
|
|
|
1383
1562
|
|
|
1384
1563
|
@dataclass
|
|
@@ -1409,37 +1588,53 @@ class RepoInfo:
|
|
|
1409
1588
|
def as_dict(self) -> dict:
|
|
1410
1589
|
"""Serializes the RepoInfo into a dictionary suitable for use as a JSON request body."""
|
|
1411
1590
|
body = {}
|
|
1412
|
-
if self.branch is not None:
|
|
1413
|
-
|
|
1414
|
-
if self.
|
|
1415
|
-
|
|
1416
|
-
if self.
|
|
1417
|
-
|
|
1418
|
-
if self.
|
|
1591
|
+
if self.branch is not None:
|
|
1592
|
+
body["branch"] = self.branch
|
|
1593
|
+
if self.head_commit_id is not None:
|
|
1594
|
+
body["head_commit_id"] = self.head_commit_id
|
|
1595
|
+
if self.id is not None:
|
|
1596
|
+
body["id"] = self.id
|
|
1597
|
+
if self.path is not None:
|
|
1598
|
+
body["path"] = self.path
|
|
1599
|
+
if self.provider is not None:
|
|
1600
|
+
body["provider"] = self.provider
|
|
1601
|
+
if self.sparse_checkout:
|
|
1602
|
+
body["sparse_checkout"] = self.sparse_checkout.as_dict()
|
|
1603
|
+
if self.url is not None:
|
|
1604
|
+
body["url"] = self.url
|
|
1419
1605
|
return body
|
|
1420
1606
|
|
|
1421
1607
|
def as_shallow_dict(self) -> dict:
|
|
1422
1608
|
"""Serializes the RepoInfo into a shallow dictionary of its immediate attributes."""
|
|
1423
1609
|
body = {}
|
|
1424
|
-
if self.branch is not None:
|
|
1425
|
-
|
|
1426
|
-
if self.
|
|
1427
|
-
|
|
1428
|
-
if self.
|
|
1429
|
-
|
|
1430
|
-
if self.
|
|
1610
|
+
if self.branch is not None:
|
|
1611
|
+
body["branch"] = self.branch
|
|
1612
|
+
if self.head_commit_id is not None:
|
|
1613
|
+
body["head_commit_id"] = self.head_commit_id
|
|
1614
|
+
if self.id is not None:
|
|
1615
|
+
body["id"] = self.id
|
|
1616
|
+
if self.path is not None:
|
|
1617
|
+
body["path"] = self.path
|
|
1618
|
+
if self.provider is not None:
|
|
1619
|
+
body["provider"] = self.provider
|
|
1620
|
+
if self.sparse_checkout:
|
|
1621
|
+
body["sparse_checkout"] = self.sparse_checkout
|
|
1622
|
+
if self.url is not None:
|
|
1623
|
+
body["url"] = self.url
|
|
1431
1624
|
return body
|
|
1432
1625
|
|
|
1433
1626
|
@classmethod
|
|
1434
|
-
def from_dict(cls, d: Dict[str,
|
|
1627
|
+
def from_dict(cls, d: Dict[str, Any]) -> RepoInfo:
|
|
1435
1628
|
"""Deserializes the RepoInfo from a dictionary."""
|
|
1436
|
-
return cls(
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1629
|
+
return cls(
|
|
1630
|
+
branch=d.get("branch", None),
|
|
1631
|
+
head_commit_id=d.get("head_commit_id", None),
|
|
1632
|
+
id=d.get("id", None),
|
|
1633
|
+
path=d.get("path", None),
|
|
1634
|
+
provider=d.get("provider", None),
|
|
1635
|
+
sparse_checkout=_from_dict(d, "sparse_checkout", SparseCheckout),
|
|
1636
|
+
url=d.get("url", None),
|
|
1637
|
+
)
|
|
1443
1638
|
|
|
1444
1639
|
|
|
1445
1640
|
@dataclass
|
|
@@ -1454,34 +1649,42 @@ class RepoPermission:
|
|
|
1454
1649
|
def as_dict(self) -> dict:
|
|
1455
1650
|
"""Serializes the RepoPermission into a dictionary suitable for use as a JSON request body."""
|
|
1456
1651
|
body = {}
|
|
1457
|
-
if self.inherited is not None:
|
|
1458
|
-
|
|
1459
|
-
if self.
|
|
1652
|
+
if self.inherited is not None:
|
|
1653
|
+
body["inherited"] = self.inherited
|
|
1654
|
+
if self.inherited_from_object:
|
|
1655
|
+
body["inherited_from_object"] = [v for v in self.inherited_from_object]
|
|
1656
|
+
if self.permission_level is not None:
|
|
1657
|
+
body["permission_level"] = self.permission_level.value
|
|
1460
1658
|
return body
|
|
1461
1659
|
|
|
1462
1660
|
def as_shallow_dict(self) -> dict:
|
|
1463
1661
|
"""Serializes the RepoPermission into a shallow dictionary of its immediate attributes."""
|
|
1464
1662
|
body = {}
|
|
1465
|
-
if self.inherited is not None:
|
|
1466
|
-
|
|
1467
|
-
if self.
|
|
1663
|
+
if self.inherited is not None:
|
|
1664
|
+
body["inherited"] = self.inherited
|
|
1665
|
+
if self.inherited_from_object:
|
|
1666
|
+
body["inherited_from_object"] = self.inherited_from_object
|
|
1667
|
+
if self.permission_level is not None:
|
|
1668
|
+
body["permission_level"] = self.permission_level
|
|
1468
1669
|
return body
|
|
1469
1670
|
|
|
1470
1671
|
@classmethod
|
|
1471
|
-
def from_dict(cls, d: Dict[str,
|
|
1672
|
+
def from_dict(cls, d: Dict[str, Any]) -> RepoPermission:
|
|
1472
1673
|
"""Deserializes the RepoPermission from a dictionary."""
|
|
1473
|
-
return cls(
|
|
1474
|
-
|
|
1475
|
-
|
|
1674
|
+
return cls(
|
|
1675
|
+
inherited=d.get("inherited", None),
|
|
1676
|
+
inherited_from_object=d.get("inherited_from_object", None),
|
|
1677
|
+
permission_level=_enum(d, "permission_level", RepoPermissionLevel),
|
|
1678
|
+
)
|
|
1476
1679
|
|
|
1477
1680
|
|
|
1478
1681
|
class RepoPermissionLevel(Enum):
|
|
1479
1682
|
"""Permission level"""
|
|
1480
1683
|
|
|
1481
|
-
CAN_EDIT =
|
|
1482
|
-
CAN_MANAGE =
|
|
1483
|
-
CAN_READ =
|
|
1484
|
-
CAN_RUN =
|
|
1684
|
+
CAN_EDIT = "CAN_EDIT"
|
|
1685
|
+
CAN_MANAGE = "CAN_MANAGE"
|
|
1686
|
+
CAN_READ = "CAN_READ"
|
|
1687
|
+
CAN_RUN = "CAN_RUN"
|
|
1485
1688
|
|
|
1486
1689
|
|
|
1487
1690
|
@dataclass
|
|
@@ -1496,25 +1699,32 @@ class RepoPermissions:
|
|
|
1496
1699
|
"""Serializes the RepoPermissions into a dictionary suitable for use as a JSON request body."""
|
|
1497
1700
|
body = {}
|
|
1498
1701
|
if self.access_control_list:
|
|
1499
|
-
body[
|
|
1500
|
-
if self.object_id is not None:
|
|
1501
|
-
|
|
1702
|
+
body["access_control_list"] = [v.as_dict() for v in self.access_control_list]
|
|
1703
|
+
if self.object_id is not None:
|
|
1704
|
+
body["object_id"] = self.object_id
|
|
1705
|
+
if self.object_type is not None:
|
|
1706
|
+
body["object_type"] = self.object_type
|
|
1502
1707
|
return body
|
|
1503
1708
|
|
|
1504
1709
|
def as_shallow_dict(self) -> dict:
|
|
1505
1710
|
"""Serializes the RepoPermissions into a shallow dictionary of its immediate attributes."""
|
|
1506
1711
|
body = {}
|
|
1507
|
-
if self.access_control_list:
|
|
1508
|
-
|
|
1509
|
-
if self.
|
|
1712
|
+
if self.access_control_list:
|
|
1713
|
+
body["access_control_list"] = self.access_control_list
|
|
1714
|
+
if self.object_id is not None:
|
|
1715
|
+
body["object_id"] = self.object_id
|
|
1716
|
+
if self.object_type is not None:
|
|
1717
|
+
body["object_type"] = self.object_type
|
|
1510
1718
|
return body
|
|
1511
1719
|
|
|
1512
1720
|
@classmethod
|
|
1513
|
-
def from_dict(cls, d: Dict[str,
|
|
1721
|
+
def from_dict(cls, d: Dict[str, Any]) -> RepoPermissions:
|
|
1514
1722
|
"""Deserializes the RepoPermissions from a dictionary."""
|
|
1515
|
-
return cls(
|
|
1516
|
-
|
|
1517
|
-
|
|
1723
|
+
return cls(
|
|
1724
|
+
access_control_list=_repeated_dict(d, "access_control_list", RepoAccessControlResponse),
|
|
1725
|
+
object_id=d.get("object_id", None),
|
|
1726
|
+
object_type=d.get("object_type", None),
|
|
1727
|
+
)
|
|
1518
1728
|
|
|
1519
1729
|
|
|
1520
1730
|
@dataclass
|
|
@@ -1527,22 +1737,27 @@ class RepoPermissionsDescription:
|
|
|
1527
1737
|
def as_dict(self) -> dict:
|
|
1528
1738
|
"""Serializes the RepoPermissionsDescription into a dictionary suitable for use as a JSON request body."""
|
|
1529
1739
|
body = {}
|
|
1530
|
-
if self.description is not None:
|
|
1531
|
-
|
|
1740
|
+
if self.description is not None:
|
|
1741
|
+
body["description"] = self.description
|
|
1742
|
+
if self.permission_level is not None:
|
|
1743
|
+
body["permission_level"] = self.permission_level.value
|
|
1532
1744
|
return body
|
|
1533
1745
|
|
|
1534
1746
|
def as_shallow_dict(self) -> dict:
|
|
1535
1747
|
"""Serializes the RepoPermissionsDescription into a shallow dictionary of its immediate attributes."""
|
|
1536
1748
|
body = {}
|
|
1537
|
-
if self.description is not None:
|
|
1538
|
-
|
|
1749
|
+
if self.description is not None:
|
|
1750
|
+
body["description"] = self.description
|
|
1751
|
+
if self.permission_level is not None:
|
|
1752
|
+
body["permission_level"] = self.permission_level
|
|
1539
1753
|
return body
|
|
1540
1754
|
|
|
1541
1755
|
@classmethod
|
|
1542
|
-
def from_dict(cls, d: Dict[str,
|
|
1756
|
+
def from_dict(cls, d: Dict[str, Any]) -> RepoPermissionsDescription:
|
|
1543
1757
|
"""Deserializes the RepoPermissionsDescription from a dictionary."""
|
|
1544
|
-
return cls(
|
|
1545
|
-
|
|
1758
|
+
return cls(
|
|
1759
|
+
description=d.get("description", None), permission_level=_enum(d, "permission_level", RepoPermissionLevel)
|
|
1760
|
+
)
|
|
1546
1761
|
|
|
1547
1762
|
|
|
1548
1763
|
@dataclass
|
|
@@ -1556,28 +1771,33 @@ class RepoPermissionsRequest:
|
|
|
1556
1771
|
"""Serializes the RepoPermissionsRequest into a dictionary suitable for use as a JSON request body."""
|
|
1557
1772
|
body = {}
|
|
1558
1773
|
if self.access_control_list:
|
|
1559
|
-
body[
|
|
1560
|
-
if self.repo_id is not None:
|
|
1774
|
+
body["access_control_list"] = [v.as_dict() for v in self.access_control_list]
|
|
1775
|
+
if self.repo_id is not None:
|
|
1776
|
+
body["repo_id"] = self.repo_id
|
|
1561
1777
|
return body
|
|
1562
1778
|
|
|
1563
1779
|
def as_shallow_dict(self) -> dict:
|
|
1564
1780
|
"""Serializes the RepoPermissionsRequest into a shallow dictionary of its immediate attributes."""
|
|
1565
1781
|
body = {}
|
|
1566
|
-
if self.access_control_list:
|
|
1567
|
-
|
|
1782
|
+
if self.access_control_list:
|
|
1783
|
+
body["access_control_list"] = self.access_control_list
|
|
1784
|
+
if self.repo_id is not None:
|
|
1785
|
+
body["repo_id"] = self.repo_id
|
|
1568
1786
|
return body
|
|
1569
1787
|
|
|
1570
1788
|
@classmethod
|
|
1571
|
-
def from_dict(cls, d: Dict[str,
|
|
1789
|
+
def from_dict(cls, d: Dict[str, Any]) -> RepoPermissionsRequest:
|
|
1572
1790
|
"""Deserializes the RepoPermissionsRequest from a dictionary."""
|
|
1573
|
-
return cls(
|
|
1574
|
-
|
|
1791
|
+
return cls(
|
|
1792
|
+
access_control_list=_repeated_dict(d, "access_control_list", RepoAccessControlRequest),
|
|
1793
|
+
repo_id=d.get("repo_id", None),
|
|
1794
|
+
)
|
|
1575
1795
|
|
|
1576
1796
|
|
|
1577
1797
|
class ScopeBackendType(Enum):
|
|
1578
1798
|
|
|
1579
|
-
AZURE_KEYVAULT =
|
|
1580
|
-
DATABRICKS =
|
|
1799
|
+
AZURE_KEYVAULT = "AZURE_KEYVAULT"
|
|
1800
|
+
DATABRICKS = "DATABRICKS"
|
|
1581
1801
|
|
|
1582
1802
|
|
|
1583
1803
|
@dataclass
|
|
@@ -1591,23 +1811,25 @@ class SecretMetadata:
|
|
|
1591
1811
|
def as_dict(self) -> dict:
|
|
1592
1812
|
"""Serializes the SecretMetadata into a dictionary suitable for use as a JSON request body."""
|
|
1593
1813
|
body = {}
|
|
1594
|
-
if self.key is not None:
|
|
1814
|
+
if self.key is not None:
|
|
1815
|
+
body["key"] = self.key
|
|
1595
1816
|
if self.last_updated_timestamp is not None:
|
|
1596
|
-
body[
|
|
1817
|
+
body["last_updated_timestamp"] = self.last_updated_timestamp
|
|
1597
1818
|
return body
|
|
1598
1819
|
|
|
1599
1820
|
def as_shallow_dict(self) -> dict:
|
|
1600
1821
|
"""Serializes the SecretMetadata into a shallow dictionary of its immediate attributes."""
|
|
1601
1822
|
body = {}
|
|
1602
|
-
if self.key is not None:
|
|
1823
|
+
if self.key is not None:
|
|
1824
|
+
body["key"] = self.key
|
|
1603
1825
|
if self.last_updated_timestamp is not None:
|
|
1604
|
-
body[
|
|
1826
|
+
body["last_updated_timestamp"] = self.last_updated_timestamp
|
|
1605
1827
|
return body
|
|
1606
1828
|
|
|
1607
1829
|
@classmethod
|
|
1608
|
-
def from_dict(cls, d: Dict[str,
|
|
1830
|
+
def from_dict(cls, d: Dict[str, Any]) -> SecretMetadata:
|
|
1609
1831
|
"""Deserializes the SecretMetadata from a dictionary."""
|
|
1610
|
-
return cls(key=d.get(
|
|
1832
|
+
return cls(key=d.get("key", None), last_updated_timestamp=d.get("last_updated_timestamp", None))
|
|
1611
1833
|
|
|
1612
1834
|
|
|
1613
1835
|
@dataclass
|
|
@@ -1624,25 +1846,33 @@ class SecretScope:
|
|
|
1624
1846
|
def as_dict(self) -> dict:
|
|
1625
1847
|
"""Serializes the SecretScope into a dictionary suitable for use as a JSON request body."""
|
|
1626
1848
|
body = {}
|
|
1627
|
-
if self.backend_type is not None:
|
|
1628
|
-
|
|
1629
|
-
if self.
|
|
1849
|
+
if self.backend_type is not None:
|
|
1850
|
+
body["backend_type"] = self.backend_type.value
|
|
1851
|
+
if self.keyvault_metadata:
|
|
1852
|
+
body["keyvault_metadata"] = self.keyvault_metadata.as_dict()
|
|
1853
|
+
if self.name is not None:
|
|
1854
|
+
body["name"] = self.name
|
|
1630
1855
|
return body
|
|
1631
1856
|
|
|
1632
1857
|
def as_shallow_dict(self) -> dict:
|
|
1633
1858
|
"""Serializes the SecretScope into a shallow dictionary of its immediate attributes."""
|
|
1634
1859
|
body = {}
|
|
1635
|
-
if self.backend_type is not None:
|
|
1636
|
-
|
|
1637
|
-
if self.
|
|
1860
|
+
if self.backend_type is not None:
|
|
1861
|
+
body["backend_type"] = self.backend_type
|
|
1862
|
+
if self.keyvault_metadata:
|
|
1863
|
+
body["keyvault_metadata"] = self.keyvault_metadata
|
|
1864
|
+
if self.name is not None:
|
|
1865
|
+
body["name"] = self.name
|
|
1638
1866
|
return body
|
|
1639
1867
|
|
|
1640
1868
|
@classmethod
|
|
1641
|
-
def from_dict(cls, d: Dict[str,
|
|
1869
|
+
def from_dict(cls, d: Dict[str, Any]) -> SecretScope:
|
|
1642
1870
|
"""Deserializes the SecretScope from a dictionary."""
|
|
1643
|
-
return cls(
|
|
1644
|
-
|
|
1645
|
-
|
|
1871
|
+
return cls(
|
|
1872
|
+
backend_type=_enum(d, "backend_type", ScopeBackendType),
|
|
1873
|
+
keyvault_metadata=_from_dict(d, "keyvault_metadata", AzureKeyVaultSecretScopeMetadata),
|
|
1874
|
+
name=d.get("name", None),
|
|
1875
|
+
)
|
|
1646
1876
|
|
|
1647
1877
|
|
|
1648
1878
|
@dataclass
|
|
@@ -1657,19 +1887,21 @@ class SparseCheckout:
|
|
|
1657
1887
|
def as_dict(self) -> dict:
|
|
1658
1888
|
"""Serializes the SparseCheckout into a dictionary suitable for use as a JSON request body."""
|
|
1659
1889
|
body = {}
|
|
1660
|
-
if self.patterns:
|
|
1890
|
+
if self.patterns:
|
|
1891
|
+
body["patterns"] = [v for v in self.patterns]
|
|
1661
1892
|
return body
|
|
1662
1893
|
|
|
1663
1894
|
def as_shallow_dict(self) -> dict:
|
|
1664
1895
|
"""Serializes the SparseCheckout into a shallow dictionary of its immediate attributes."""
|
|
1665
1896
|
body = {}
|
|
1666
|
-
if self.patterns:
|
|
1897
|
+
if self.patterns:
|
|
1898
|
+
body["patterns"] = self.patterns
|
|
1667
1899
|
return body
|
|
1668
1900
|
|
|
1669
1901
|
@classmethod
|
|
1670
|
-
def from_dict(cls, d: Dict[str,
|
|
1902
|
+
def from_dict(cls, d: Dict[str, Any]) -> SparseCheckout:
|
|
1671
1903
|
"""Deserializes the SparseCheckout from a dictionary."""
|
|
1672
|
-
return cls(patterns=d.get(
|
|
1904
|
+
return cls(patterns=d.get("patterns", None))
|
|
1673
1905
|
|
|
1674
1906
|
|
|
1675
1907
|
@dataclass
|
|
@@ -1684,19 +1916,21 @@ class SparseCheckoutUpdate:
|
|
|
1684
1916
|
def as_dict(self) -> dict:
|
|
1685
1917
|
"""Serializes the SparseCheckoutUpdate into a dictionary suitable for use as a JSON request body."""
|
|
1686
1918
|
body = {}
|
|
1687
|
-
if self.patterns:
|
|
1919
|
+
if self.patterns:
|
|
1920
|
+
body["patterns"] = [v for v in self.patterns]
|
|
1688
1921
|
return body
|
|
1689
1922
|
|
|
1690
1923
|
def as_shallow_dict(self) -> dict:
|
|
1691
1924
|
"""Serializes the SparseCheckoutUpdate into a shallow dictionary of its immediate attributes."""
|
|
1692
1925
|
body = {}
|
|
1693
|
-
if self.patterns:
|
|
1926
|
+
if self.patterns:
|
|
1927
|
+
body["patterns"] = self.patterns
|
|
1694
1928
|
return body
|
|
1695
1929
|
|
|
1696
1930
|
@classmethod
|
|
1697
|
-
def from_dict(cls, d: Dict[str,
|
|
1931
|
+
def from_dict(cls, d: Dict[str, Any]) -> SparseCheckoutUpdate:
|
|
1698
1932
|
"""Deserializes the SparseCheckoutUpdate from a dictionary."""
|
|
1699
|
-
return cls(patterns=d.get(
|
|
1933
|
+
return cls(patterns=d.get("patterns", None))
|
|
1700
1934
|
|
|
1701
1935
|
|
|
1702
1936
|
@dataclass
|
|
@@ -1725,33 +1959,42 @@ class UpdateCredentialsRequest:
|
|
|
1725
1959
|
def as_dict(self) -> dict:
|
|
1726
1960
|
"""Serializes the UpdateCredentialsRequest into a dictionary suitable for use as a JSON request body."""
|
|
1727
1961
|
body = {}
|
|
1728
|
-
if self.credential_id is not None:
|
|
1729
|
-
|
|
1730
|
-
if self.
|
|
1731
|
-
|
|
1962
|
+
if self.credential_id is not None:
|
|
1963
|
+
body["credential_id"] = self.credential_id
|
|
1964
|
+
if self.git_provider is not None:
|
|
1965
|
+
body["git_provider"] = self.git_provider
|
|
1966
|
+
if self.git_username is not None:
|
|
1967
|
+
body["git_username"] = self.git_username
|
|
1968
|
+
if self.personal_access_token is not None:
|
|
1969
|
+
body["personal_access_token"] = self.personal_access_token
|
|
1732
1970
|
return body
|
|
1733
1971
|
|
|
1734
1972
|
def as_shallow_dict(self) -> dict:
|
|
1735
1973
|
"""Serializes the UpdateCredentialsRequest into a shallow dictionary of its immediate attributes."""
|
|
1736
1974
|
body = {}
|
|
1737
|
-
if self.credential_id is not None:
|
|
1738
|
-
|
|
1739
|
-
if self.
|
|
1740
|
-
|
|
1975
|
+
if self.credential_id is not None:
|
|
1976
|
+
body["credential_id"] = self.credential_id
|
|
1977
|
+
if self.git_provider is not None:
|
|
1978
|
+
body["git_provider"] = self.git_provider
|
|
1979
|
+
if self.git_username is not None:
|
|
1980
|
+
body["git_username"] = self.git_username
|
|
1981
|
+
if self.personal_access_token is not None:
|
|
1982
|
+
body["personal_access_token"] = self.personal_access_token
|
|
1741
1983
|
return body
|
|
1742
1984
|
|
|
1743
1985
|
@classmethod
|
|
1744
|
-
def from_dict(cls, d: Dict[str,
|
|
1986
|
+
def from_dict(cls, d: Dict[str, Any]) -> UpdateCredentialsRequest:
|
|
1745
1987
|
"""Deserializes the UpdateCredentialsRequest from a dictionary."""
|
|
1746
|
-
return cls(
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1988
|
+
return cls(
|
|
1989
|
+
credential_id=d.get("credential_id", None),
|
|
1990
|
+
git_provider=d.get("git_provider", None),
|
|
1991
|
+
git_username=d.get("git_username", None),
|
|
1992
|
+
personal_access_token=d.get("personal_access_token", None),
|
|
1993
|
+
)
|
|
1750
1994
|
|
|
1751
1995
|
|
|
1752
1996
|
@dataclass
|
|
1753
1997
|
class UpdateCredentialsResponse:
|
|
1754
|
-
|
|
1755
1998
|
def as_dict(self) -> dict:
|
|
1756
1999
|
"""Serializes the UpdateCredentialsResponse into a dictionary suitable for use as a JSON request body."""
|
|
1757
2000
|
body = {}
|
|
@@ -1763,7 +2006,7 @@ class UpdateCredentialsResponse:
|
|
|
1763
2006
|
return body
|
|
1764
2007
|
|
|
1765
2008
|
@classmethod
|
|
1766
|
-
def from_dict(cls, d: Dict[str,
|
|
2009
|
+
def from_dict(cls, d: Dict[str, Any]) -> UpdateCredentialsResponse:
|
|
1767
2010
|
"""Deserializes the UpdateCredentialsResponse from a dictionary."""
|
|
1768
2011
|
return cls()
|
|
1769
2012
|
|
|
@@ -1788,33 +2031,42 @@ class UpdateRepoRequest:
|
|
|
1788
2031
|
def as_dict(self) -> dict:
|
|
1789
2032
|
"""Serializes the UpdateRepoRequest into a dictionary suitable for use as a JSON request body."""
|
|
1790
2033
|
body = {}
|
|
1791
|
-
if self.branch is not None:
|
|
1792
|
-
|
|
1793
|
-
if self.
|
|
1794
|
-
|
|
2034
|
+
if self.branch is not None:
|
|
2035
|
+
body["branch"] = self.branch
|
|
2036
|
+
if self.repo_id is not None:
|
|
2037
|
+
body["repo_id"] = self.repo_id
|
|
2038
|
+
if self.sparse_checkout:
|
|
2039
|
+
body["sparse_checkout"] = self.sparse_checkout.as_dict()
|
|
2040
|
+
if self.tag is not None:
|
|
2041
|
+
body["tag"] = self.tag
|
|
1795
2042
|
return body
|
|
1796
2043
|
|
|
1797
2044
|
def as_shallow_dict(self) -> dict:
|
|
1798
2045
|
"""Serializes the UpdateRepoRequest into a shallow dictionary of its immediate attributes."""
|
|
1799
2046
|
body = {}
|
|
1800
|
-
if self.branch is not None:
|
|
1801
|
-
|
|
1802
|
-
if self.
|
|
1803
|
-
|
|
2047
|
+
if self.branch is not None:
|
|
2048
|
+
body["branch"] = self.branch
|
|
2049
|
+
if self.repo_id is not None:
|
|
2050
|
+
body["repo_id"] = self.repo_id
|
|
2051
|
+
if self.sparse_checkout:
|
|
2052
|
+
body["sparse_checkout"] = self.sparse_checkout
|
|
2053
|
+
if self.tag is not None:
|
|
2054
|
+
body["tag"] = self.tag
|
|
1804
2055
|
return body
|
|
1805
2056
|
|
|
1806
2057
|
@classmethod
|
|
1807
|
-
def from_dict(cls, d: Dict[str,
|
|
2058
|
+
def from_dict(cls, d: Dict[str, Any]) -> UpdateRepoRequest:
|
|
1808
2059
|
"""Deserializes the UpdateRepoRequest from a dictionary."""
|
|
1809
|
-
return cls(
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
2060
|
+
return cls(
|
|
2061
|
+
branch=d.get("branch", None),
|
|
2062
|
+
repo_id=d.get("repo_id", None),
|
|
2063
|
+
sparse_checkout=_from_dict(d, "sparse_checkout", SparseCheckoutUpdate),
|
|
2064
|
+
tag=d.get("tag", None),
|
|
2065
|
+
)
|
|
1813
2066
|
|
|
1814
2067
|
|
|
1815
2068
|
@dataclass
|
|
1816
2069
|
class UpdateRepoResponse:
|
|
1817
|
-
|
|
1818
2070
|
def as_dict(self) -> dict:
|
|
1819
2071
|
"""Serializes the UpdateRepoResponse into a dictionary suitable for use as a JSON request body."""
|
|
1820
2072
|
body = {}
|
|
@@ -1826,7 +2078,7 @@ class UpdateRepoResponse:
|
|
|
1826
2078
|
return body
|
|
1827
2079
|
|
|
1828
2080
|
@classmethod
|
|
1829
|
-
def from_dict(cls, d: Dict[str,
|
|
2081
|
+
def from_dict(cls, d: Dict[str, Any]) -> UpdateRepoResponse:
|
|
1830
2082
|
"""Deserializes the UpdateRepoResponse from a dictionary."""
|
|
1831
2083
|
return cls()
|
|
1832
2084
|
|
|
@@ -1848,30 +2100,38 @@ class WorkspaceObjectAccessControlRequest:
|
|
|
1848
2100
|
def as_dict(self) -> dict:
|
|
1849
2101
|
"""Serializes the WorkspaceObjectAccessControlRequest into a dictionary suitable for use as a JSON request body."""
|
|
1850
2102
|
body = {}
|
|
1851
|
-
if self.group_name is not None:
|
|
1852
|
-
|
|
2103
|
+
if self.group_name is not None:
|
|
2104
|
+
body["group_name"] = self.group_name
|
|
2105
|
+
if self.permission_level is not None:
|
|
2106
|
+
body["permission_level"] = self.permission_level.value
|
|
1853
2107
|
if self.service_principal_name is not None:
|
|
1854
|
-
body[
|
|
1855
|
-
if self.user_name is not None:
|
|
2108
|
+
body["service_principal_name"] = self.service_principal_name
|
|
2109
|
+
if self.user_name is not None:
|
|
2110
|
+
body["user_name"] = self.user_name
|
|
1856
2111
|
return body
|
|
1857
2112
|
|
|
1858
2113
|
def as_shallow_dict(self) -> dict:
|
|
1859
2114
|
"""Serializes the WorkspaceObjectAccessControlRequest into a shallow dictionary of its immediate attributes."""
|
|
1860
2115
|
body = {}
|
|
1861
|
-
if self.group_name is not None:
|
|
1862
|
-
|
|
2116
|
+
if self.group_name is not None:
|
|
2117
|
+
body["group_name"] = self.group_name
|
|
2118
|
+
if self.permission_level is not None:
|
|
2119
|
+
body["permission_level"] = self.permission_level
|
|
1863
2120
|
if self.service_principal_name is not None:
|
|
1864
|
-
body[
|
|
1865
|
-
if self.user_name is not None:
|
|
2121
|
+
body["service_principal_name"] = self.service_principal_name
|
|
2122
|
+
if self.user_name is not None:
|
|
2123
|
+
body["user_name"] = self.user_name
|
|
1866
2124
|
return body
|
|
1867
2125
|
|
|
1868
2126
|
@classmethod
|
|
1869
|
-
def from_dict(cls, d: Dict[str,
|
|
2127
|
+
def from_dict(cls, d: Dict[str, Any]) -> WorkspaceObjectAccessControlRequest:
|
|
1870
2128
|
"""Deserializes the WorkspaceObjectAccessControlRequest from a dictionary."""
|
|
1871
|
-
return cls(
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
2129
|
+
return cls(
|
|
2130
|
+
group_name=d.get("group_name", None),
|
|
2131
|
+
permission_level=_enum(d, "permission_level", WorkspaceObjectPermissionLevel),
|
|
2132
|
+
service_principal_name=d.get("service_principal_name", None),
|
|
2133
|
+
user_name=d.get("user_name", None),
|
|
2134
|
+
)
|
|
1875
2135
|
|
|
1876
2136
|
|
|
1877
2137
|
@dataclass
|
|
@@ -1894,33 +2154,43 @@ class WorkspaceObjectAccessControlResponse:
|
|
|
1894
2154
|
def as_dict(self) -> dict:
|
|
1895
2155
|
"""Serializes the WorkspaceObjectAccessControlResponse into a dictionary suitable for use as a JSON request body."""
|
|
1896
2156
|
body = {}
|
|
1897
|
-
if self.all_permissions:
|
|
1898
|
-
|
|
1899
|
-
if self.
|
|
2157
|
+
if self.all_permissions:
|
|
2158
|
+
body["all_permissions"] = [v.as_dict() for v in self.all_permissions]
|
|
2159
|
+
if self.display_name is not None:
|
|
2160
|
+
body["display_name"] = self.display_name
|
|
2161
|
+
if self.group_name is not None:
|
|
2162
|
+
body["group_name"] = self.group_name
|
|
1900
2163
|
if self.service_principal_name is not None:
|
|
1901
|
-
body[
|
|
1902
|
-
if self.user_name is not None:
|
|
2164
|
+
body["service_principal_name"] = self.service_principal_name
|
|
2165
|
+
if self.user_name is not None:
|
|
2166
|
+
body["user_name"] = self.user_name
|
|
1903
2167
|
return body
|
|
1904
2168
|
|
|
1905
2169
|
def as_shallow_dict(self) -> dict:
|
|
1906
2170
|
"""Serializes the WorkspaceObjectAccessControlResponse into a shallow dictionary of its immediate attributes."""
|
|
1907
2171
|
body = {}
|
|
1908
|
-
if self.all_permissions:
|
|
1909
|
-
|
|
1910
|
-
if self.
|
|
2172
|
+
if self.all_permissions:
|
|
2173
|
+
body["all_permissions"] = self.all_permissions
|
|
2174
|
+
if self.display_name is not None:
|
|
2175
|
+
body["display_name"] = self.display_name
|
|
2176
|
+
if self.group_name is not None:
|
|
2177
|
+
body["group_name"] = self.group_name
|
|
1911
2178
|
if self.service_principal_name is not None:
|
|
1912
|
-
body[
|
|
1913
|
-
if self.user_name is not None:
|
|
2179
|
+
body["service_principal_name"] = self.service_principal_name
|
|
2180
|
+
if self.user_name is not None:
|
|
2181
|
+
body["user_name"] = self.user_name
|
|
1914
2182
|
return body
|
|
1915
2183
|
|
|
1916
2184
|
@classmethod
|
|
1917
|
-
def from_dict(cls, d: Dict[str,
|
|
2185
|
+
def from_dict(cls, d: Dict[str, Any]) -> WorkspaceObjectAccessControlResponse:
|
|
1918
2186
|
"""Deserializes the WorkspaceObjectAccessControlResponse from a dictionary."""
|
|
1919
|
-
return cls(
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
2187
|
+
return cls(
|
|
2188
|
+
all_permissions=_repeated_dict(d, "all_permissions", WorkspaceObjectPermission),
|
|
2189
|
+
display_name=d.get("display_name", None),
|
|
2190
|
+
group_name=d.get("group_name", None),
|
|
2191
|
+
service_principal_name=d.get("service_principal_name", None),
|
|
2192
|
+
user_name=d.get("user_name", None),
|
|
2193
|
+
)
|
|
1924
2194
|
|
|
1925
2195
|
|
|
1926
2196
|
@dataclass
|
|
@@ -1935,34 +2205,42 @@ class WorkspaceObjectPermission:
|
|
|
1935
2205
|
def as_dict(self) -> dict:
|
|
1936
2206
|
"""Serializes the WorkspaceObjectPermission into a dictionary suitable for use as a JSON request body."""
|
|
1937
2207
|
body = {}
|
|
1938
|
-
if self.inherited is not None:
|
|
1939
|
-
|
|
1940
|
-
if self.
|
|
2208
|
+
if self.inherited is not None:
|
|
2209
|
+
body["inherited"] = self.inherited
|
|
2210
|
+
if self.inherited_from_object:
|
|
2211
|
+
body["inherited_from_object"] = [v for v in self.inherited_from_object]
|
|
2212
|
+
if self.permission_level is not None:
|
|
2213
|
+
body["permission_level"] = self.permission_level.value
|
|
1941
2214
|
return body
|
|
1942
2215
|
|
|
1943
2216
|
def as_shallow_dict(self) -> dict:
|
|
1944
2217
|
"""Serializes the WorkspaceObjectPermission into a shallow dictionary of its immediate attributes."""
|
|
1945
2218
|
body = {}
|
|
1946
|
-
if self.inherited is not None:
|
|
1947
|
-
|
|
1948
|
-
if self.
|
|
2219
|
+
if self.inherited is not None:
|
|
2220
|
+
body["inherited"] = self.inherited
|
|
2221
|
+
if self.inherited_from_object:
|
|
2222
|
+
body["inherited_from_object"] = self.inherited_from_object
|
|
2223
|
+
if self.permission_level is not None:
|
|
2224
|
+
body["permission_level"] = self.permission_level
|
|
1949
2225
|
return body
|
|
1950
2226
|
|
|
1951
2227
|
@classmethod
|
|
1952
|
-
def from_dict(cls, d: Dict[str,
|
|
2228
|
+
def from_dict(cls, d: Dict[str, Any]) -> WorkspaceObjectPermission:
|
|
1953
2229
|
"""Deserializes the WorkspaceObjectPermission from a dictionary."""
|
|
1954
|
-
return cls(
|
|
1955
|
-
|
|
1956
|
-
|
|
2230
|
+
return cls(
|
|
2231
|
+
inherited=d.get("inherited", None),
|
|
2232
|
+
inherited_from_object=d.get("inherited_from_object", None),
|
|
2233
|
+
permission_level=_enum(d, "permission_level", WorkspaceObjectPermissionLevel),
|
|
2234
|
+
)
|
|
1957
2235
|
|
|
1958
2236
|
|
|
1959
2237
|
class WorkspaceObjectPermissionLevel(Enum):
|
|
1960
2238
|
"""Permission level"""
|
|
1961
2239
|
|
|
1962
|
-
CAN_EDIT =
|
|
1963
|
-
CAN_MANAGE =
|
|
1964
|
-
CAN_READ =
|
|
1965
|
-
CAN_RUN =
|
|
2240
|
+
CAN_EDIT = "CAN_EDIT"
|
|
2241
|
+
CAN_MANAGE = "CAN_MANAGE"
|
|
2242
|
+
CAN_READ = "CAN_READ"
|
|
2243
|
+
CAN_RUN = "CAN_RUN"
|
|
1966
2244
|
|
|
1967
2245
|
|
|
1968
2246
|
@dataclass
|
|
@@ -1977,26 +2255,32 @@ class WorkspaceObjectPermissions:
|
|
|
1977
2255
|
"""Serializes the WorkspaceObjectPermissions into a dictionary suitable for use as a JSON request body."""
|
|
1978
2256
|
body = {}
|
|
1979
2257
|
if self.access_control_list:
|
|
1980
|
-
body[
|
|
1981
|
-
if self.object_id is not None:
|
|
1982
|
-
|
|
2258
|
+
body["access_control_list"] = [v.as_dict() for v in self.access_control_list]
|
|
2259
|
+
if self.object_id is not None:
|
|
2260
|
+
body["object_id"] = self.object_id
|
|
2261
|
+
if self.object_type is not None:
|
|
2262
|
+
body["object_type"] = self.object_type
|
|
1983
2263
|
return body
|
|
1984
2264
|
|
|
1985
2265
|
def as_shallow_dict(self) -> dict:
|
|
1986
2266
|
"""Serializes the WorkspaceObjectPermissions into a shallow dictionary of its immediate attributes."""
|
|
1987
2267
|
body = {}
|
|
1988
|
-
if self.access_control_list:
|
|
1989
|
-
|
|
1990
|
-
if self.
|
|
2268
|
+
if self.access_control_list:
|
|
2269
|
+
body["access_control_list"] = self.access_control_list
|
|
2270
|
+
if self.object_id is not None:
|
|
2271
|
+
body["object_id"] = self.object_id
|
|
2272
|
+
if self.object_type is not None:
|
|
2273
|
+
body["object_type"] = self.object_type
|
|
1991
2274
|
return body
|
|
1992
2275
|
|
|
1993
2276
|
@classmethod
|
|
1994
|
-
def from_dict(cls, d: Dict[str,
|
|
2277
|
+
def from_dict(cls, d: Dict[str, Any]) -> WorkspaceObjectPermissions:
|
|
1995
2278
|
"""Deserializes the WorkspaceObjectPermissions from a dictionary."""
|
|
1996
|
-
return cls(
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2279
|
+
return cls(
|
|
2280
|
+
access_control_list=_repeated_dict(d, "access_control_list", WorkspaceObjectAccessControlResponse),
|
|
2281
|
+
object_id=d.get("object_id", None),
|
|
2282
|
+
object_type=d.get("object_type", None),
|
|
2283
|
+
)
|
|
2000
2284
|
|
|
2001
2285
|
|
|
2002
2286
|
@dataclass
|
|
@@ -2009,22 +2293,28 @@ class WorkspaceObjectPermissionsDescription:
|
|
|
2009
2293
|
def as_dict(self) -> dict:
|
|
2010
2294
|
"""Serializes the WorkspaceObjectPermissionsDescription into a dictionary suitable for use as a JSON request body."""
|
|
2011
2295
|
body = {}
|
|
2012
|
-
if self.description is not None:
|
|
2013
|
-
|
|
2296
|
+
if self.description is not None:
|
|
2297
|
+
body["description"] = self.description
|
|
2298
|
+
if self.permission_level is not None:
|
|
2299
|
+
body["permission_level"] = self.permission_level.value
|
|
2014
2300
|
return body
|
|
2015
2301
|
|
|
2016
2302
|
def as_shallow_dict(self) -> dict:
|
|
2017
2303
|
"""Serializes the WorkspaceObjectPermissionsDescription into a shallow dictionary of its immediate attributes."""
|
|
2018
2304
|
body = {}
|
|
2019
|
-
if self.description is not None:
|
|
2020
|
-
|
|
2305
|
+
if self.description is not None:
|
|
2306
|
+
body["description"] = self.description
|
|
2307
|
+
if self.permission_level is not None:
|
|
2308
|
+
body["permission_level"] = self.permission_level
|
|
2021
2309
|
return body
|
|
2022
2310
|
|
|
2023
2311
|
@classmethod
|
|
2024
|
-
def from_dict(cls, d: Dict[str,
|
|
2312
|
+
def from_dict(cls, d: Dict[str, Any]) -> WorkspaceObjectPermissionsDescription:
|
|
2025
2313
|
"""Deserializes the WorkspaceObjectPermissionsDescription from a dictionary."""
|
|
2026
|
-
return cls(
|
|
2027
|
-
|
|
2314
|
+
return cls(
|
|
2315
|
+
description=d.get("description", None),
|
|
2316
|
+
permission_level=_enum(d, "permission_level", WorkspaceObjectPermissionLevel),
|
|
2317
|
+
)
|
|
2028
2318
|
|
|
2029
2319
|
|
|
2030
2320
|
@dataclass
|
|
@@ -2041,49 +2331,53 @@ class WorkspaceObjectPermissionsRequest:
|
|
|
2041
2331
|
"""Serializes the WorkspaceObjectPermissionsRequest into a dictionary suitable for use as a JSON request body."""
|
|
2042
2332
|
body = {}
|
|
2043
2333
|
if self.access_control_list:
|
|
2044
|
-
body[
|
|
2045
|
-
if self.workspace_object_id is not None:
|
|
2046
|
-
|
|
2334
|
+
body["access_control_list"] = [v.as_dict() for v in self.access_control_list]
|
|
2335
|
+
if self.workspace_object_id is not None:
|
|
2336
|
+
body["workspace_object_id"] = self.workspace_object_id
|
|
2337
|
+
if self.workspace_object_type is not None:
|
|
2338
|
+
body["workspace_object_type"] = self.workspace_object_type
|
|
2047
2339
|
return body
|
|
2048
2340
|
|
|
2049
2341
|
def as_shallow_dict(self) -> dict:
|
|
2050
2342
|
"""Serializes the WorkspaceObjectPermissionsRequest into a shallow dictionary of its immediate attributes."""
|
|
2051
2343
|
body = {}
|
|
2052
|
-
if self.access_control_list:
|
|
2053
|
-
|
|
2054
|
-
if self.
|
|
2344
|
+
if self.access_control_list:
|
|
2345
|
+
body["access_control_list"] = self.access_control_list
|
|
2346
|
+
if self.workspace_object_id is not None:
|
|
2347
|
+
body["workspace_object_id"] = self.workspace_object_id
|
|
2348
|
+
if self.workspace_object_type is not None:
|
|
2349
|
+
body["workspace_object_type"] = self.workspace_object_type
|
|
2055
2350
|
return body
|
|
2056
2351
|
|
|
2057
2352
|
@classmethod
|
|
2058
|
-
def from_dict(cls, d: Dict[str,
|
|
2353
|
+
def from_dict(cls, d: Dict[str, Any]) -> WorkspaceObjectPermissionsRequest:
|
|
2059
2354
|
"""Deserializes the WorkspaceObjectPermissionsRequest from a dictionary."""
|
|
2060
|
-
return cls(
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2355
|
+
return cls(
|
|
2356
|
+
access_control_list=_repeated_dict(d, "access_control_list", WorkspaceObjectAccessControlRequest),
|
|
2357
|
+
workspace_object_id=d.get("workspace_object_id", None),
|
|
2358
|
+
workspace_object_type=d.get("workspace_object_type", None),
|
|
2359
|
+
)
|
|
2064
2360
|
|
|
2065
2361
|
|
|
2066
2362
|
class GitCredentialsAPI:
|
|
2067
2363
|
"""Registers personal access token for Databricks to do operations on behalf of the user.
|
|
2068
|
-
|
|
2364
|
+
|
|
2069
2365
|
See [more info].
|
|
2070
|
-
|
|
2366
|
+
|
|
2071
2367
|
[more info]: https://docs.databricks.com/repos/get-access-tokens-from-git-provider.html"""
|
|
2072
2368
|
|
|
2073
2369
|
def __init__(self, api_client):
|
|
2074
2370
|
self._api = api_client
|
|
2075
2371
|
|
|
2076
|
-
def create(
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
git_username: Optional[str] = None,
|
|
2080
|
-
personal_access_token: Optional[str] = None) -> CreateCredentialsResponse:
|
|
2372
|
+
def create(
|
|
2373
|
+
self, git_provider: str, *, git_username: Optional[str] = None, personal_access_token: Optional[str] = None
|
|
2374
|
+
) -> CreateCredentialsResponse:
|
|
2081
2375
|
"""Create a credential entry.
|
|
2082
|
-
|
|
2376
|
+
|
|
2083
2377
|
Creates a Git credential entry for the user. Only one Git credential per user is supported, so any
|
|
2084
2378
|
attempts to create credentials if an entry already exists will fail. Use the PATCH endpoint to update
|
|
2085
2379
|
existing credentials, or the DELETE endpoint to delete existing credentials.
|
|
2086
|
-
|
|
2380
|
+
|
|
2087
2381
|
:param git_provider: str
|
|
2088
2382
|
Git provider. This field is case-insensitive. The available Git providers are `gitHub`,
|
|
2089
2383
|
`bitbucketCloud`, `gitLab`, `azureDevOpsServices`, `gitHubEnterprise`, `bitbucketServer`,
|
|
@@ -2097,75 +2391,89 @@ class GitCredentialsAPI:
|
|
|
2097
2391
|
:param personal_access_token: str (optional)
|
|
2098
2392
|
The personal access token used to authenticate to the corresponding Git provider. For certain
|
|
2099
2393
|
providers, support may exist for other types of scoped access tokens. [Learn more].
|
|
2100
|
-
|
|
2394
|
+
|
|
2101
2395
|
[Learn more]: https://docs.databricks.com/repos/get-access-tokens-from-git-provider.html
|
|
2102
|
-
|
|
2396
|
+
|
|
2103
2397
|
:returns: :class:`CreateCredentialsResponse`
|
|
2104
2398
|
"""
|
|
2105
2399
|
body = {}
|
|
2106
|
-
if git_provider is not None:
|
|
2107
|
-
|
|
2108
|
-
if
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2400
|
+
if git_provider is not None:
|
|
2401
|
+
body["git_provider"] = git_provider
|
|
2402
|
+
if git_username is not None:
|
|
2403
|
+
body["git_username"] = git_username
|
|
2404
|
+
if personal_access_token is not None:
|
|
2405
|
+
body["personal_access_token"] = personal_access_token
|
|
2406
|
+
headers = {
|
|
2407
|
+
"Accept": "application/json",
|
|
2408
|
+
"Content-Type": "application/json",
|
|
2409
|
+
}
|
|
2410
|
+
|
|
2411
|
+
res = self._api.do("POST", "/api/2.0/git-credentials", body=body, headers=headers)
|
|
2112
2412
|
return CreateCredentialsResponse.from_dict(res)
|
|
2113
2413
|
|
|
2114
2414
|
def delete(self, credential_id: int):
|
|
2115
2415
|
"""Delete a credential.
|
|
2116
|
-
|
|
2416
|
+
|
|
2117
2417
|
Deletes the specified Git credential.
|
|
2118
|
-
|
|
2418
|
+
|
|
2119
2419
|
:param credential_id: int
|
|
2120
2420
|
The ID for the corresponding credential to access.
|
|
2121
|
-
|
|
2122
|
-
|
|
2421
|
+
|
|
2422
|
+
|
|
2123
2423
|
"""
|
|
2124
2424
|
|
|
2125
|
-
headers = {
|
|
2425
|
+
headers = {
|
|
2426
|
+
"Accept": "application/json",
|
|
2427
|
+
}
|
|
2126
2428
|
|
|
2127
|
-
self._api.do(
|
|
2429
|
+
self._api.do("DELETE", f"/api/2.0/git-credentials/{credential_id}", headers=headers)
|
|
2128
2430
|
|
|
2129
2431
|
def get(self, credential_id: int) -> GetCredentialsResponse:
|
|
2130
2432
|
"""Get a credential entry.
|
|
2131
|
-
|
|
2433
|
+
|
|
2132
2434
|
Gets the Git credential with the specified credential ID.
|
|
2133
|
-
|
|
2435
|
+
|
|
2134
2436
|
:param credential_id: int
|
|
2135
2437
|
The ID for the corresponding credential to access.
|
|
2136
|
-
|
|
2438
|
+
|
|
2137
2439
|
:returns: :class:`GetCredentialsResponse`
|
|
2138
2440
|
"""
|
|
2139
2441
|
|
|
2140
|
-
headers = {
|
|
2442
|
+
headers = {
|
|
2443
|
+
"Accept": "application/json",
|
|
2444
|
+
}
|
|
2141
2445
|
|
|
2142
|
-
res = self._api.do(
|
|
2446
|
+
res = self._api.do("GET", f"/api/2.0/git-credentials/{credential_id}", headers=headers)
|
|
2143
2447
|
return GetCredentialsResponse.from_dict(res)
|
|
2144
2448
|
|
|
2145
2449
|
def list(self) -> Iterator[CredentialInfo]:
|
|
2146
2450
|
"""Get Git credentials.
|
|
2147
|
-
|
|
2451
|
+
|
|
2148
2452
|
Lists the calling user's Git credentials. One credential per user is supported.
|
|
2149
|
-
|
|
2453
|
+
|
|
2150
2454
|
:returns: Iterator over :class:`CredentialInfo`
|
|
2151
2455
|
"""
|
|
2152
2456
|
|
|
2153
|
-
headers = {
|
|
2457
|
+
headers = {
|
|
2458
|
+
"Accept": "application/json",
|
|
2459
|
+
}
|
|
2154
2460
|
|
|
2155
|
-
json = self._api.do(
|
|
2461
|
+
json = self._api.do("GET", "/api/2.0/git-credentials", headers=headers)
|
|
2156
2462
|
parsed = ListCredentialsResponse.from_dict(json).credentials
|
|
2157
2463
|
return parsed if parsed is not None else []
|
|
2158
2464
|
|
|
2159
|
-
def update(
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2465
|
+
def update(
|
|
2466
|
+
self,
|
|
2467
|
+
credential_id: int,
|
|
2468
|
+
git_provider: str,
|
|
2469
|
+
*,
|
|
2470
|
+
git_username: Optional[str] = None,
|
|
2471
|
+
personal_access_token: Optional[str] = None,
|
|
2472
|
+
):
|
|
2165
2473
|
"""Update a credential.
|
|
2166
|
-
|
|
2474
|
+
|
|
2167
2475
|
Updates the specified Git credential.
|
|
2168
|
-
|
|
2476
|
+
|
|
2169
2477
|
:param credential_id: int
|
|
2170
2478
|
The ID for the corresponding credential to access.
|
|
2171
2479
|
:param git_provider: str
|
|
@@ -2181,45 +2489,48 @@ class GitCredentialsAPI:
|
|
|
2181
2489
|
:param personal_access_token: str (optional)
|
|
2182
2490
|
The personal access token used to authenticate to the corresponding Git provider. For certain
|
|
2183
2491
|
providers, support may exist for other types of scoped access tokens. [Learn more].
|
|
2184
|
-
|
|
2492
|
+
|
|
2185
2493
|
[Learn more]: https://docs.databricks.com/repos/get-access-tokens-from-git-provider.html
|
|
2186
|
-
|
|
2187
|
-
|
|
2494
|
+
|
|
2495
|
+
|
|
2188
2496
|
"""
|
|
2189
2497
|
body = {}
|
|
2190
|
-
if git_provider is not None:
|
|
2191
|
-
|
|
2192
|
-
if
|
|
2193
|
-
|
|
2498
|
+
if git_provider is not None:
|
|
2499
|
+
body["git_provider"] = git_provider
|
|
2500
|
+
if git_username is not None:
|
|
2501
|
+
body["git_username"] = git_username
|
|
2502
|
+
if personal_access_token is not None:
|
|
2503
|
+
body["personal_access_token"] = personal_access_token
|
|
2504
|
+
headers = {
|
|
2505
|
+
"Accept": "application/json",
|
|
2506
|
+
"Content-Type": "application/json",
|
|
2507
|
+
}
|
|
2194
2508
|
|
|
2195
|
-
self._api.do(
|
|
2509
|
+
self._api.do("PATCH", f"/api/2.0/git-credentials/{credential_id}", body=body, headers=headers)
|
|
2196
2510
|
|
|
2197
2511
|
|
|
2198
2512
|
class ReposAPI:
|
|
2199
2513
|
"""The Repos API allows users to manage their git repos. Users can use the API to access all repos that they
|
|
2200
2514
|
have manage permissions on.
|
|
2201
|
-
|
|
2515
|
+
|
|
2202
2516
|
Databricks Repos is a visual Git client in Databricks. It supports common Git operations such a cloning a
|
|
2203
2517
|
repository, committing and pushing, pulling, branch management, and visual comparison of diffs when
|
|
2204
2518
|
committing.
|
|
2205
|
-
|
|
2519
|
+
|
|
2206
2520
|
Within Repos you can develop code in notebooks or other files and follow data science and engineering code
|
|
2207
2521
|
development best practices using Git for version control, collaboration, and CI/CD."""
|
|
2208
2522
|
|
|
2209
2523
|
def __init__(self, api_client):
|
|
2210
2524
|
self._api = api_client
|
|
2211
2525
|
|
|
2212
|
-
def create(
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
*,
|
|
2216
|
-
path: Optional[str] = None,
|
|
2217
|
-
sparse_checkout: Optional[SparseCheckout] = None) -> CreateRepoResponse:
|
|
2526
|
+
def create(
|
|
2527
|
+
self, url: str, provider: str, *, path: Optional[str] = None, sparse_checkout: Optional[SparseCheckout] = None
|
|
2528
|
+
) -> CreateRepoResponse:
|
|
2218
2529
|
"""Create a repo.
|
|
2219
|
-
|
|
2530
|
+
|
|
2220
2531
|
Creates a repo in the workspace and links it to the remote Git repo specified. Note that repos created
|
|
2221
2532
|
programmatically must be linked to a remote Git repo, unlike repos created in the browser.
|
|
2222
|
-
|
|
2533
|
+
|
|
2223
2534
|
:param url: str
|
|
2224
2535
|
URL of the Git repository to be linked.
|
|
2225
2536
|
:param provider: str
|
|
@@ -2232,91 +2543,103 @@ class ReposAPI:
|
|
|
2232
2543
|
:param sparse_checkout: :class:`SparseCheckout` (optional)
|
|
2233
2544
|
If specified, the repo will be created with sparse checkout enabled. You cannot enable/disable
|
|
2234
2545
|
sparse checkout after the repo is created.
|
|
2235
|
-
|
|
2546
|
+
|
|
2236
2547
|
:returns: :class:`CreateRepoResponse`
|
|
2237
2548
|
"""
|
|
2238
2549
|
body = {}
|
|
2239
|
-
if path is not None:
|
|
2240
|
-
|
|
2241
|
-
if
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2550
|
+
if path is not None:
|
|
2551
|
+
body["path"] = path
|
|
2552
|
+
if provider is not None:
|
|
2553
|
+
body["provider"] = provider
|
|
2554
|
+
if sparse_checkout is not None:
|
|
2555
|
+
body["sparse_checkout"] = sparse_checkout.as_dict()
|
|
2556
|
+
if url is not None:
|
|
2557
|
+
body["url"] = url
|
|
2558
|
+
headers = {
|
|
2559
|
+
"Accept": "application/json",
|
|
2560
|
+
"Content-Type": "application/json",
|
|
2561
|
+
}
|
|
2562
|
+
|
|
2563
|
+
res = self._api.do("POST", "/api/2.0/repos", body=body, headers=headers)
|
|
2246
2564
|
return CreateRepoResponse.from_dict(res)
|
|
2247
2565
|
|
|
2248
2566
|
def delete(self, repo_id: int):
|
|
2249
2567
|
"""Delete a repo.
|
|
2250
|
-
|
|
2568
|
+
|
|
2251
2569
|
Deletes the specified repo.
|
|
2252
|
-
|
|
2570
|
+
|
|
2253
2571
|
:param repo_id: int
|
|
2254
2572
|
The ID for the corresponding repo to delete.
|
|
2255
|
-
|
|
2256
|
-
|
|
2573
|
+
|
|
2574
|
+
|
|
2257
2575
|
"""
|
|
2258
2576
|
|
|
2259
|
-
headers = {
|
|
2577
|
+
headers = {
|
|
2578
|
+
"Accept": "application/json",
|
|
2579
|
+
}
|
|
2260
2580
|
|
|
2261
|
-
self._api.do(
|
|
2581
|
+
self._api.do("DELETE", f"/api/2.0/repos/{repo_id}", headers=headers)
|
|
2262
2582
|
|
|
2263
2583
|
def get(self, repo_id: int) -> GetRepoResponse:
|
|
2264
2584
|
"""Get a repo.
|
|
2265
|
-
|
|
2585
|
+
|
|
2266
2586
|
Returns the repo with the given repo ID.
|
|
2267
|
-
|
|
2587
|
+
|
|
2268
2588
|
:param repo_id: int
|
|
2269
2589
|
ID of the Git folder (repo) object in the workspace.
|
|
2270
|
-
|
|
2590
|
+
|
|
2271
2591
|
:returns: :class:`GetRepoResponse`
|
|
2272
2592
|
"""
|
|
2273
2593
|
|
|
2274
|
-
headers = {
|
|
2594
|
+
headers = {
|
|
2595
|
+
"Accept": "application/json",
|
|
2596
|
+
}
|
|
2275
2597
|
|
|
2276
|
-
res = self._api.do(
|
|
2598
|
+
res = self._api.do("GET", f"/api/2.0/repos/{repo_id}", headers=headers)
|
|
2277
2599
|
return GetRepoResponse.from_dict(res)
|
|
2278
2600
|
|
|
2279
2601
|
def get_permission_levels(self, repo_id: str) -> GetRepoPermissionLevelsResponse:
|
|
2280
2602
|
"""Get repo permission levels.
|
|
2281
|
-
|
|
2603
|
+
|
|
2282
2604
|
Gets the permission levels that a user can have on an object.
|
|
2283
|
-
|
|
2605
|
+
|
|
2284
2606
|
:param repo_id: str
|
|
2285
2607
|
The repo for which to get or manage permissions.
|
|
2286
|
-
|
|
2608
|
+
|
|
2287
2609
|
:returns: :class:`GetRepoPermissionLevelsResponse`
|
|
2288
2610
|
"""
|
|
2289
2611
|
|
|
2290
|
-
headers = {
|
|
2612
|
+
headers = {
|
|
2613
|
+
"Accept": "application/json",
|
|
2614
|
+
}
|
|
2291
2615
|
|
|
2292
|
-
res = self._api.do(
|
|
2616
|
+
res = self._api.do("GET", f"/api/2.0/permissions/repos/{repo_id}/permissionLevels", headers=headers)
|
|
2293
2617
|
return GetRepoPermissionLevelsResponse.from_dict(res)
|
|
2294
2618
|
|
|
2295
2619
|
def get_permissions(self, repo_id: str) -> RepoPermissions:
|
|
2296
2620
|
"""Get repo permissions.
|
|
2297
|
-
|
|
2621
|
+
|
|
2298
2622
|
Gets the permissions of a repo. Repos can inherit permissions from their root object.
|
|
2299
|
-
|
|
2623
|
+
|
|
2300
2624
|
:param repo_id: str
|
|
2301
2625
|
The repo for which to get or manage permissions.
|
|
2302
|
-
|
|
2626
|
+
|
|
2303
2627
|
:returns: :class:`RepoPermissions`
|
|
2304
2628
|
"""
|
|
2305
2629
|
|
|
2306
|
-
headers = {
|
|
2630
|
+
headers = {
|
|
2631
|
+
"Accept": "application/json",
|
|
2632
|
+
}
|
|
2307
2633
|
|
|
2308
|
-
res = self._api.do(
|
|
2634
|
+
res = self._api.do("GET", f"/api/2.0/permissions/repos/{repo_id}", headers=headers)
|
|
2309
2635
|
return RepoPermissions.from_dict(res)
|
|
2310
2636
|
|
|
2311
|
-
def list(self,
|
|
2312
|
-
*,
|
|
2313
|
-
next_page_token: Optional[str] = None,
|
|
2314
|
-
path_prefix: Optional[str] = None) -> Iterator[RepoInfo]:
|
|
2637
|
+
def list(self, *, next_page_token: Optional[str] = None, path_prefix: Optional[str] = None) -> Iterator[RepoInfo]:
|
|
2315
2638
|
"""Get repos.
|
|
2316
|
-
|
|
2639
|
+
|
|
2317
2640
|
Returns repos that the calling user has Manage permissions on. Use `next_page_token` to iterate
|
|
2318
2641
|
through additional pages.
|
|
2319
|
-
|
|
2642
|
+
|
|
2320
2643
|
:param next_page_token: str (optional)
|
|
2321
2644
|
Token used to get the next page of results. If not specified, returns the first page of results as
|
|
2322
2645
|
well as a next page token if there are more results.
|
|
@@ -2324,59 +2647,66 @@ class ReposAPI:
|
|
|
2324
2647
|
Filters repos that have paths starting with the given path prefix. If not provided or when provided
|
|
2325
2648
|
an effectively empty prefix (`/` or `/Workspace`) Git folders (repos) from `/Workspace/Repos` will
|
|
2326
2649
|
be served.
|
|
2327
|
-
|
|
2650
|
+
|
|
2328
2651
|
:returns: Iterator over :class:`RepoInfo`
|
|
2329
2652
|
"""
|
|
2330
2653
|
|
|
2331
2654
|
query = {}
|
|
2332
|
-
if next_page_token is not None:
|
|
2333
|
-
|
|
2334
|
-
|
|
2655
|
+
if next_page_token is not None:
|
|
2656
|
+
query["next_page_token"] = next_page_token
|
|
2657
|
+
if path_prefix is not None:
|
|
2658
|
+
query["path_prefix"] = path_prefix
|
|
2659
|
+
headers = {
|
|
2660
|
+
"Accept": "application/json",
|
|
2661
|
+
}
|
|
2335
2662
|
|
|
2336
2663
|
while True:
|
|
2337
|
-
json = self._api.do(
|
|
2338
|
-
if
|
|
2339
|
-
for v in json[
|
|
2664
|
+
json = self._api.do("GET", "/api/2.0/repos", query=query, headers=headers)
|
|
2665
|
+
if "repos" in json:
|
|
2666
|
+
for v in json["repos"]:
|
|
2340
2667
|
yield RepoInfo.from_dict(v)
|
|
2341
|
-
if
|
|
2668
|
+
if "next_page_token" not in json or not json["next_page_token"]:
|
|
2342
2669
|
return
|
|
2343
|
-
query[
|
|
2670
|
+
query["next_page_token"] = json["next_page_token"]
|
|
2344
2671
|
|
|
2345
2672
|
def set_permissions(
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
*,
|
|
2349
|
-
access_control_list: Optional[List[RepoAccessControlRequest]] = None) -> RepoPermissions:
|
|
2673
|
+
self, repo_id: str, *, access_control_list: Optional[List[RepoAccessControlRequest]] = None
|
|
2674
|
+
) -> RepoPermissions:
|
|
2350
2675
|
"""Set repo permissions.
|
|
2351
|
-
|
|
2676
|
+
|
|
2352
2677
|
Sets permissions on an object, replacing existing permissions if they exist. Deletes all direct
|
|
2353
2678
|
permissions if none are specified. Objects can inherit permissions from their root object.
|
|
2354
|
-
|
|
2679
|
+
|
|
2355
2680
|
:param repo_id: str
|
|
2356
2681
|
The repo for which to get or manage permissions.
|
|
2357
2682
|
:param access_control_list: List[:class:`RepoAccessControlRequest`] (optional)
|
|
2358
|
-
|
|
2683
|
+
|
|
2359
2684
|
:returns: :class:`RepoPermissions`
|
|
2360
2685
|
"""
|
|
2361
2686
|
body = {}
|
|
2362
2687
|
if access_control_list is not None:
|
|
2363
|
-
body[
|
|
2364
|
-
headers = {
|
|
2688
|
+
body["access_control_list"] = [v.as_dict() for v in access_control_list]
|
|
2689
|
+
headers = {
|
|
2690
|
+
"Accept": "application/json",
|
|
2691
|
+
"Content-Type": "application/json",
|
|
2692
|
+
}
|
|
2365
2693
|
|
|
2366
|
-
res = self._api.do(
|
|
2694
|
+
res = self._api.do("PUT", f"/api/2.0/permissions/repos/{repo_id}", body=body, headers=headers)
|
|
2367
2695
|
return RepoPermissions.from_dict(res)
|
|
2368
2696
|
|
|
2369
|
-
def update(
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2697
|
+
def update(
|
|
2698
|
+
self,
|
|
2699
|
+
repo_id: int,
|
|
2700
|
+
*,
|
|
2701
|
+
branch: Optional[str] = None,
|
|
2702
|
+
sparse_checkout: Optional[SparseCheckoutUpdate] = None,
|
|
2703
|
+
tag: Optional[str] = None,
|
|
2704
|
+
):
|
|
2375
2705
|
"""Update a repo.
|
|
2376
|
-
|
|
2706
|
+
|
|
2377
2707
|
Updates the repo to a different branch or tag, or updates the repo to the latest commit on the same
|
|
2378
2708
|
branch.
|
|
2379
|
-
|
|
2709
|
+
|
|
2380
2710
|
:param repo_id: int
|
|
2381
2711
|
ID of the Git folder (repo) object in the workspace.
|
|
2382
2712
|
:param branch: str (optional)
|
|
@@ -2388,48 +2718,55 @@ class ReposAPI:
|
|
|
2388
2718
|
Tag that the local version of the repo is checked out to. Updating the repo to a tag puts the repo
|
|
2389
2719
|
in a detached HEAD state. Before committing new changes, you must update the repo to a branch
|
|
2390
2720
|
instead of the detached HEAD.
|
|
2391
|
-
|
|
2392
|
-
|
|
2721
|
+
|
|
2722
|
+
|
|
2393
2723
|
"""
|
|
2394
2724
|
body = {}
|
|
2395
|
-
if branch is not None:
|
|
2396
|
-
|
|
2397
|
-
if
|
|
2398
|
-
|
|
2725
|
+
if branch is not None:
|
|
2726
|
+
body["branch"] = branch
|
|
2727
|
+
if sparse_checkout is not None:
|
|
2728
|
+
body["sparse_checkout"] = sparse_checkout.as_dict()
|
|
2729
|
+
if tag is not None:
|
|
2730
|
+
body["tag"] = tag
|
|
2731
|
+
headers = {
|
|
2732
|
+
"Accept": "application/json",
|
|
2733
|
+
"Content-Type": "application/json",
|
|
2734
|
+
}
|
|
2399
2735
|
|
|
2400
|
-
self._api.do(
|
|
2736
|
+
self._api.do("PATCH", f"/api/2.0/repos/{repo_id}", body=body, headers=headers)
|
|
2401
2737
|
|
|
2402
2738
|
def update_permissions(
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
*,
|
|
2406
|
-
access_control_list: Optional[List[RepoAccessControlRequest]] = None) -> RepoPermissions:
|
|
2739
|
+
self, repo_id: str, *, access_control_list: Optional[List[RepoAccessControlRequest]] = None
|
|
2740
|
+
) -> RepoPermissions:
|
|
2407
2741
|
"""Update repo permissions.
|
|
2408
|
-
|
|
2742
|
+
|
|
2409
2743
|
Updates the permissions on a repo. Repos can inherit permissions from their root object.
|
|
2410
|
-
|
|
2744
|
+
|
|
2411
2745
|
:param repo_id: str
|
|
2412
2746
|
The repo for which to get or manage permissions.
|
|
2413
2747
|
:param access_control_list: List[:class:`RepoAccessControlRequest`] (optional)
|
|
2414
|
-
|
|
2748
|
+
|
|
2415
2749
|
:returns: :class:`RepoPermissions`
|
|
2416
2750
|
"""
|
|
2417
2751
|
body = {}
|
|
2418
2752
|
if access_control_list is not None:
|
|
2419
|
-
body[
|
|
2420
|
-
headers = {
|
|
2753
|
+
body["access_control_list"] = [v.as_dict() for v in access_control_list]
|
|
2754
|
+
headers = {
|
|
2755
|
+
"Accept": "application/json",
|
|
2756
|
+
"Content-Type": "application/json",
|
|
2757
|
+
}
|
|
2421
2758
|
|
|
2422
|
-
res = self._api.do(
|
|
2759
|
+
res = self._api.do("PATCH", f"/api/2.0/permissions/repos/{repo_id}", body=body, headers=headers)
|
|
2423
2760
|
return RepoPermissions.from_dict(res)
|
|
2424
2761
|
|
|
2425
2762
|
|
|
2426
2763
|
class SecretsAPI:
|
|
2427
2764
|
"""The Secrets API allows you to manage secrets, secret scopes, and access permissions.
|
|
2428
|
-
|
|
2765
|
+
|
|
2429
2766
|
Sometimes accessing data requires that you authenticate to external data sources through JDBC. Instead of
|
|
2430
2767
|
directly entering your credentials into a notebook, use Databricks secrets to store your credentials and
|
|
2431
2768
|
reference them in notebooks and jobs.
|
|
2432
|
-
|
|
2769
|
+
|
|
2433
2770
|
Administrators, secret creators, and users granted permission can read Databricks secrets. While
|
|
2434
2771
|
Databricks makes an effort to redact secret values that might be displayed in notebooks, it is not
|
|
2435
2772
|
possible to prevent such users from reading secrets."""
|
|
@@ -2437,17 +2774,19 @@ class SecretsAPI:
|
|
|
2437
2774
|
def __init__(self, api_client):
|
|
2438
2775
|
self._api = api_client
|
|
2439
2776
|
|
|
2440
|
-
def create_scope(
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2777
|
+
def create_scope(
|
|
2778
|
+
self,
|
|
2779
|
+
scope: str,
|
|
2780
|
+
*,
|
|
2781
|
+
backend_azure_keyvault: Optional[AzureKeyVaultSecretScopeMetadata] = None,
|
|
2782
|
+
initial_manage_principal: Optional[str] = None,
|
|
2783
|
+
scope_backend_type: Optional[ScopeBackendType] = None,
|
|
2784
|
+
):
|
|
2446
2785
|
"""Create a new secret scope.
|
|
2447
|
-
|
|
2786
|
+
|
|
2448
2787
|
The scope name must consist of alphanumeric characters, dashes, underscores, and periods, and may not
|
|
2449
2788
|
exceed 128 characters.
|
|
2450
|
-
|
|
2789
|
+
|
|
2451
2790
|
:param scope: str
|
|
2452
2791
|
Scope name requested by the user. Scope names are unique.
|
|
2453
2792
|
:param backend_azure_keyvault: :class:`AzureKeyVaultSecretScopeMetadata` (optional)
|
|
@@ -2456,269 +2795,308 @@ class SecretsAPI:
|
|
|
2456
2795
|
The principal that is initially granted `MANAGE` permission to the created scope.
|
|
2457
2796
|
:param scope_backend_type: :class:`ScopeBackendType` (optional)
|
|
2458
2797
|
The backend type the scope will be created with. If not specified, will default to `DATABRICKS`
|
|
2459
|
-
|
|
2460
|
-
|
|
2798
|
+
|
|
2799
|
+
|
|
2461
2800
|
"""
|
|
2462
2801
|
body = {}
|
|
2463
2802
|
if backend_azure_keyvault is not None:
|
|
2464
|
-
body[
|
|
2465
|
-
if initial_manage_principal is not None:
|
|
2466
|
-
|
|
2467
|
-
if
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2803
|
+
body["backend_azure_keyvault"] = backend_azure_keyvault.as_dict()
|
|
2804
|
+
if initial_manage_principal is not None:
|
|
2805
|
+
body["initial_manage_principal"] = initial_manage_principal
|
|
2806
|
+
if scope is not None:
|
|
2807
|
+
body["scope"] = scope
|
|
2808
|
+
if scope_backend_type is not None:
|
|
2809
|
+
body["scope_backend_type"] = scope_backend_type.value
|
|
2810
|
+
headers = {
|
|
2811
|
+
"Accept": "application/json",
|
|
2812
|
+
"Content-Type": "application/json",
|
|
2813
|
+
}
|
|
2814
|
+
|
|
2815
|
+
self._api.do("POST", "/api/2.0/secrets/scopes/create", body=body, headers=headers)
|
|
2471
2816
|
|
|
2472
2817
|
def delete_acl(self, scope: str, principal: str):
|
|
2473
2818
|
"""Delete an ACL.
|
|
2474
|
-
|
|
2819
|
+
|
|
2475
2820
|
Deletes the given ACL on the given scope.
|
|
2476
|
-
|
|
2821
|
+
|
|
2477
2822
|
Users must have the `MANAGE` permission to invoke this API. Throws `RESOURCE_DOES_NOT_EXIST` if no
|
|
2478
2823
|
such secret scope, principal, or ACL exists. Throws `PERMISSION_DENIED` if the user does not have
|
|
2479
2824
|
permission to make this API call.
|
|
2480
|
-
|
|
2825
|
+
|
|
2481
2826
|
:param scope: str
|
|
2482
2827
|
The name of the scope to remove permissions from.
|
|
2483
2828
|
:param principal: str
|
|
2484
2829
|
The principal to remove an existing ACL from.
|
|
2485
|
-
|
|
2486
|
-
|
|
2830
|
+
|
|
2831
|
+
|
|
2487
2832
|
"""
|
|
2488
2833
|
body = {}
|
|
2489
|
-
if principal is not None:
|
|
2490
|
-
|
|
2491
|
-
|
|
2834
|
+
if principal is not None:
|
|
2835
|
+
body["principal"] = principal
|
|
2836
|
+
if scope is not None:
|
|
2837
|
+
body["scope"] = scope
|
|
2838
|
+
headers = {
|
|
2839
|
+
"Accept": "application/json",
|
|
2840
|
+
"Content-Type": "application/json",
|
|
2841
|
+
}
|
|
2492
2842
|
|
|
2493
|
-
self._api.do(
|
|
2843
|
+
self._api.do("POST", "/api/2.0/secrets/acls/delete", body=body, headers=headers)
|
|
2494
2844
|
|
|
2495
2845
|
def delete_scope(self, scope: str):
|
|
2496
2846
|
"""Delete a secret scope.
|
|
2497
|
-
|
|
2847
|
+
|
|
2498
2848
|
Deletes a secret scope.
|
|
2499
|
-
|
|
2849
|
+
|
|
2500
2850
|
Throws `RESOURCE_DOES_NOT_EXIST` if the scope does not exist. Throws `PERMISSION_DENIED` if the user
|
|
2501
2851
|
does not have permission to make this API call.
|
|
2502
|
-
|
|
2852
|
+
|
|
2503
2853
|
:param scope: str
|
|
2504
2854
|
Name of the scope to delete.
|
|
2505
|
-
|
|
2506
|
-
|
|
2855
|
+
|
|
2856
|
+
|
|
2507
2857
|
"""
|
|
2508
2858
|
body = {}
|
|
2509
|
-
if scope is not None:
|
|
2510
|
-
|
|
2859
|
+
if scope is not None:
|
|
2860
|
+
body["scope"] = scope
|
|
2861
|
+
headers = {
|
|
2862
|
+
"Accept": "application/json",
|
|
2863
|
+
"Content-Type": "application/json",
|
|
2864
|
+
}
|
|
2511
2865
|
|
|
2512
|
-
self._api.do(
|
|
2866
|
+
self._api.do("POST", "/api/2.0/secrets/scopes/delete", body=body, headers=headers)
|
|
2513
2867
|
|
|
2514
2868
|
def delete_secret(self, scope: str, key: str):
|
|
2515
2869
|
"""Delete a secret.
|
|
2516
|
-
|
|
2870
|
+
|
|
2517
2871
|
Deletes the secret stored in this secret scope. You must have `WRITE` or `MANAGE` permission on the
|
|
2518
2872
|
secret scope.
|
|
2519
|
-
|
|
2873
|
+
|
|
2520
2874
|
Throws `RESOURCE_DOES_NOT_EXIST` if no such secret scope or secret exists. Throws `PERMISSION_DENIED`
|
|
2521
2875
|
if the user does not have permission to make this API call.
|
|
2522
|
-
|
|
2876
|
+
|
|
2523
2877
|
:param scope: str
|
|
2524
2878
|
The name of the scope that contains the secret to delete.
|
|
2525
2879
|
:param key: str
|
|
2526
2880
|
Name of the secret to delete.
|
|
2527
|
-
|
|
2528
|
-
|
|
2881
|
+
|
|
2882
|
+
|
|
2529
2883
|
"""
|
|
2530
2884
|
body = {}
|
|
2531
|
-
if key is not None:
|
|
2532
|
-
|
|
2533
|
-
|
|
2885
|
+
if key is not None:
|
|
2886
|
+
body["key"] = key
|
|
2887
|
+
if scope is not None:
|
|
2888
|
+
body["scope"] = scope
|
|
2889
|
+
headers = {
|
|
2890
|
+
"Accept": "application/json",
|
|
2891
|
+
"Content-Type": "application/json",
|
|
2892
|
+
}
|
|
2534
2893
|
|
|
2535
|
-
self._api.do(
|
|
2894
|
+
self._api.do("POST", "/api/2.0/secrets/delete", body=body, headers=headers)
|
|
2536
2895
|
|
|
2537
2896
|
def get_acl(self, scope: str, principal: str) -> AclItem:
|
|
2538
2897
|
"""Get secret ACL details.
|
|
2539
|
-
|
|
2898
|
+
|
|
2540
2899
|
Gets the details about the given ACL, such as the group and permission. Users must have the `MANAGE`
|
|
2541
2900
|
permission to invoke this API.
|
|
2542
|
-
|
|
2901
|
+
|
|
2543
2902
|
Throws `RESOURCE_DOES_NOT_EXIST` if no such secret scope exists. Throws `PERMISSION_DENIED` if the
|
|
2544
2903
|
user does not have permission to make this API call.
|
|
2545
|
-
|
|
2904
|
+
|
|
2546
2905
|
:param scope: str
|
|
2547
2906
|
The name of the scope to fetch ACL information from.
|
|
2548
2907
|
:param principal: str
|
|
2549
2908
|
The principal to fetch ACL information for.
|
|
2550
|
-
|
|
2909
|
+
|
|
2551
2910
|
:returns: :class:`AclItem`
|
|
2552
2911
|
"""
|
|
2553
2912
|
|
|
2554
2913
|
query = {}
|
|
2555
|
-
if principal is not None:
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2914
|
+
if principal is not None:
|
|
2915
|
+
query["principal"] = principal
|
|
2916
|
+
if scope is not None:
|
|
2917
|
+
query["scope"] = scope
|
|
2918
|
+
headers = {
|
|
2919
|
+
"Accept": "application/json",
|
|
2920
|
+
}
|
|
2921
|
+
|
|
2922
|
+
res = self._api.do("GET", "/api/2.0/secrets/acls/get", query=query, headers=headers)
|
|
2560
2923
|
return AclItem.from_dict(res)
|
|
2561
2924
|
|
|
2562
2925
|
def get_secret(self, scope: str, key: str) -> GetSecretResponse:
|
|
2563
2926
|
"""Get a secret.
|
|
2564
|
-
|
|
2927
|
+
|
|
2565
2928
|
Gets the bytes representation of a secret value for the specified scope and key.
|
|
2566
|
-
|
|
2929
|
+
|
|
2567
2930
|
Users need the READ permission to make this call.
|
|
2568
|
-
|
|
2931
|
+
|
|
2569
2932
|
Note that the secret value returned is in bytes. The interpretation of the bytes is determined by the
|
|
2570
2933
|
caller in DBUtils and the type the data is decoded into.
|
|
2571
|
-
|
|
2934
|
+
|
|
2572
2935
|
Throws ``PERMISSION_DENIED`` if the user does not have permission to make this API call. Throws
|
|
2573
2936
|
``RESOURCE_DOES_NOT_EXIST`` if no such secret or secret scope exists.
|
|
2574
|
-
|
|
2937
|
+
|
|
2575
2938
|
:param scope: str
|
|
2576
2939
|
The name of the scope to fetch secret information from.
|
|
2577
2940
|
:param key: str
|
|
2578
2941
|
The key to fetch secret for.
|
|
2579
|
-
|
|
2942
|
+
|
|
2580
2943
|
:returns: :class:`GetSecretResponse`
|
|
2581
2944
|
"""
|
|
2582
2945
|
|
|
2583
2946
|
query = {}
|
|
2584
|
-
if key is not None:
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2947
|
+
if key is not None:
|
|
2948
|
+
query["key"] = key
|
|
2949
|
+
if scope is not None:
|
|
2950
|
+
query["scope"] = scope
|
|
2951
|
+
headers = {
|
|
2952
|
+
"Accept": "application/json",
|
|
2953
|
+
}
|
|
2954
|
+
|
|
2955
|
+
res = self._api.do("GET", "/api/2.0/secrets/get", query=query, headers=headers)
|
|
2589
2956
|
return GetSecretResponse.from_dict(res)
|
|
2590
2957
|
|
|
2591
2958
|
def list_acls(self, scope: str) -> Iterator[AclItem]:
|
|
2592
2959
|
"""Lists ACLs.
|
|
2593
|
-
|
|
2960
|
+
|
|
2594
2961
|
List the ACLs for a given secret scope. Users must have the `MANAGE` permission to invoke this API.
|
|
2595
|
-
|
|
2962
|
+
|
|
2596
2963
|
Throws `RESOURCE_DOES_NOT_EXIST` if no such secret scope exists. Throws `PERMISSION_DENIED` if the
|
|
2597
2964
|
user does not have permission to make this API call.
|
|
2598
|
-
|
|
2965
|
+
|
|
2599
2966
|
:param scope: str
|
|
2600
2967
|
The name of the scope to fetch ACL information from.
|
|
2601
|
-
|
|
2968
|
+
|
|
2602
2969
|
:returns: Iterator over :class:`AclItem`
|
|
2603
2970
|
"""
|
|
2604
2971
|
|
|
2605
2972
|
query = {}
|
|
2606
|
-
if scope is not None:
|
|
2607
|
-
|
|
2973
|
+
if scope is not None:
|
|
2974
|
+
query["scope"] = scope
|
|
2975
|
+
headers = {
|
|
2976
|
+
"Accept": "application/json",
|
|
2977
|
+
}
|
|
2608
2978
|
|
|
2609
|
-
json = self._api.do(
|
|
2979
|
+
json = self._api.do("GET", "/api/2.0/secrets/acls/list", query=query, headers=headers)
|
|
2610
2980
|
parsed = ListAclsResponse.from_dict(json).items
|
|
2611
2981
|
return parsed if parsed is not None else []
|
|
2612
2982
|
|
|
2613
2983
|
def list_scopes(self) -> Iterator[SecretScope]:
|
|
2614
2984
|
"""List all scopes.
|
|
2615
|
-
|
|
2985
|
+
|
|
2616
2986
|
Lists all secret scopes available in the workspace.
|
|
2617
|
-
|
|
2987
|
+
|
|
2618
2988
|
Throws `PERMISSION_DENIED` if the user does not have permission to make this API call.
|
|
2619
|
-
|
|
2989
|
+
|
|
2620
2990
|
:returns: Iterator over :class:`SecretScope`
|
|
2621
2991
|
"""
|
|
2622
2992
|
|
|
2623
|
-
headers = {
|
|
2993
|
+
headers = {
|
|
2994
|
+
"Accept": "application/json",
|
|
2995
|
+
}
|
|
2624
2996
|
|
|
2625
|
-
json = self._api.do(
|
|
2997
|
+
json = self._api.do("GET", "/api/2.0/secrets/scopes/list", headers=headers)
|
|
2626
2998
|
parsed = ListScopesResponse.from_dict(json).scopes
|
|
2627
2999
|
return parsed if parsed is not None else []
|
|
2628
3000
|
|
|
2629
3001
|
def list_secrets(self, scope: str) -> Iterator[SecretMetadata]:
|
|
2630
3002
|
"""List secret keys.
|
|
2631
|
-
|
|
3003
|
+
|
|
2632
3004
|
Lists the secret keys that are stored at this scope. This is a metadata-only operation; secret data
|
|
2633
3005
|
cannot be retrieved using this API. Users need the READ permission to make this call.
|
|
2634
|
-
|
|
3006
|
+
|
|
2635
3007
|
The lastUpdatedTimestamp returned is in milliseconds since epoch. Throws `RESOURCE_DOES_NOT_EXIST` if
|
|
2636
3008
|
no such secret scope exists. Throws `PERMISSION_DENIED` if the user does not have permission to make
|
|
2637
3009
|
this API call.
|
|
2638
|
-
|
|
3010
|
+
|
|
2639
3011
|
:param scope: str
|
|
2640
3012
|
The name of the scope to list secrets within.
|
|
2641
|
-
|
|
3013
|
+
|
|
2642
3014
|
:returns: Iterator over :class:`SecretMetadata`
|
|
2643
3015
|
"""
|
|
2644
3016
|
|
|
2645
3017
|
query = {}
|
|
2646
|
-
if scope is not None:
|
|
2647
|
-
|
|
3018
|
+
if scope is not None:
|
|
3019
|
+
query["scope"] = scope
|
|
3020
|
+
headers = {
|
|
3021
|
+
"Accept": "application/json",
|
|
3022
|
+
}
|
|
2648
3023
|
|
|
2649
|
-
json = self._api.do(
|
|
3024
|
+
json = self._api.do("GET", "/api/2.0/secrets/list", query=query, headers=headers)
|
|
2650
3025
|
parsed = ListSecretsResponse.from_dict(json).secrets
|
|
2651
3026
|
return parsed if parsed is not None else []
|
|
2652
3027
|
|
|
2653
3028
|
def put_acl(self, scope: str, principal: str, permission: AclPermission):
|
|
2654
3029
|
"""Create/update an ACL.
|
|
2655
|
-
|
|
3030
|
+
|
|
2656
3031
|
Creates or overwrites the Access Control List (ACL) associated with the given principal (user or
|
|
2657
3032
|
group) on the specified scope point.
|
|
2658
|
-
|
|
3033
|
+
|
|
2659
3034
|
In general, a user or group will use the most powerful permission available to them, and permissions
|
|
2660
3035
|
are ordered as follows:
|
|
2661
|
-
|
|
3036
|
+
|
|
2662
3037
|
* `MANAGE` - Allowed to change ACLs, and read and write to this secret scope. * `WRITE` - Allowed to
|
|
2663
3038
|
read and write to this secret scope. * `READ` - Allowed to read this secret scope and list what
|
|
2664
3039
|
secrets are available.
|
|
2665
|
-
|
|
3040
|
+
|
|
2666
3041
|
Note that in general, secret values can only be read from within a command on a cluster (for example,
|
|
2667
3042
|
through a notebook). There is no API to read the actual secret value material outside of a cluster.
|
|
2668
3043
|
However, the user's permission will be applied based on who is executing the command, and they must
|
|
2669
3044
|
have at least READ permission.
|
|
2670
|
-
|
|
3045
|
+
|
|
2671
3046
|
Users must have the `MANAGE` permission to invoke this API.
|
|
2672
|
-
|
|
3047
|
+
|
|
2673
3048
|
The principal is a user or group name corresponding to an existing Databricks principal to be granted
|
|
2674
3049
|
or revoked access.
|
|
2675
|
-
|
|
3050
|
+
|
|
2676
3051
|
Throws `RESOURCE_DOES_NOT_EXIST` if no such secret scope exists. Throws `RESOURCE_ALREADY_EXISTS` if a
|
|
2677
3052
|
permission for the principal already exists. Throws `INVALID_PARAMETER_VALUE` if the permission or
|
|
2678
3053
|
principal is invalid. Throws `PERMISSION_DENIED` if the user does not have permission to make this API
|
|
2679
3054
|
call.
|
|
2680
|
-
|
|
3055
|
+
|
|
2681
3056
|
:param scope: str
|
|
2682
3057
|
The name of the scope to apply permissions to.
|
|
2683
3058
|
:param principal: str
|
|
2684
3059
|
The principal in which the permission is applied.
|
|
2685
3060
|
:param permission: :class:`AclPermission`
|
|
2686
3061
|
The permission level applied to the principal.
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
"""
|
|
2690
|
-
body = {}
|
|
2691
|
-
if permission is not None: body['permission'] = permission.value
|
|
2692
|
-
if principal is not None: body['principal'] = principal
|
|
2693
|
-
if scope is not None: body['scope'] = scope
|
|
2694
|
-
headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
|
|
2695
3062
|
|
|
2696
|
-
self._api.do('POST', '/api/2.0/secrets/acls/put', body=body, headers=headers)
|
|
2697
3063
|
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
3064
|
+
"""
|
|
3065
|
+
body = {}
|
|
3066
|
+
if permission is not None:
|
|
3067
|
+
body["permission"] = permission.value
|
|
3068
|
+
if principal is not None:
|
|
3069
|
+
body["principal"] = principal
|
|
3070
|
+
if scope is not None:
|
|
3071
|
+
body["scope"] = scope
|
|
3072
|
+
headers = {
|
|
3073
|
+
"Accept": "application/json",
|
|
3074
|
+
"Content-Type": "application/json",
|
|
3075
|
+
}
|
|
3076
|
+
|
|
3077
|
+
self._api.do("POST", "/api/2.0/secrets/acls/put", body=body, headers=headers)
|
|
3078
|
+
|
|
3079
|
+
def put_secret(
|
|
3080
|
+
self, scope: str, key: str, *, bytes_value: Optional[str] = None, string_value: Optional[str] = None
|
|
3081
|
+
):
|
|
2704
3082
|
"""Add a secret.
|
|
2705
|
-
|
|
3083
|
+
|
|
2706
3084
|
Inserts a secret under the provided scope with the given name. If a secret already exists with the
|
|
2707
3085
|
same name, this command overwrites the existing secret's value. The server encrypts the secret using
|
|
2708
3086
|
the secret scope's encryption settings before storing it.
|
|
2709
|
-
|
|
3087
|
+
|
|
2710
3088
|
You must have `WRITE` or `MANAGE` permission on the secret scope. The secret key must consist of
|
|
2711
3089
|
alphanumeric characters, dashes, underscores, and periods, and cannot exceed 128 characters. The
|
|
2712
3090
|
maximum allowed secret value size is 128 KB. The maximum number of secrets in a given scope is 1000.
|
|
2713
|
-
|
|
3091
|
+
|
|
2714
3092
|
The input fields "string_value" or "bytes_value" specify the type of the secret, which will determine
|
|
2715
3093
|
the value returned when the secret value is requested. Exactly one must be specified.
|
|
2716
|
-
|
|
3094
|
+
|
|
2717
3095
|
Throws `RESOURCE_DOES_NOT_EXIST` if no such secret scope exists. Throws `RESOURCE_LIMIT_EXCEEDED` if
|
|
2718
3096
|
maximum number of secrets in scope is exceeded. Throws `INVALID_PARAMETER_VALUE` if the key name or
|
|
2719
3097
|
value length is invalid. Throws `PERMISSION_DENIED` if the user does not have permission to make this
|
|
2720
3098
|
API call.
|
|
2721
|
-
|
|
3099
|
+
|
|
2722
3100
|
:param scope: str
|
|
2723
3101
|
The name of the scope to which the secret will be associated with.
|
|
2724
3102
|
:param key: str
|
|
@@ -2727,22 +3105,29 @@ class SecretsAPI:
|
|
|
2727
3105
|
If specified, value will be stored as bytes.
|
|
2728
3106
|
:param string_value: str (optional)
|
|
2729
3107
|
If specified, note that the value will be stored in UTF-8 (MB4) form.
|
|
2730
|
-
|
|
2731
|
-
|
|
3108
|
+
|
|
3109
|
+
|
|
2732
3110
|
"""
|
|
2733
3111
|
body = {}
|
|
2734
|
-
if bytes_value is not None:
|
|
2735
|
-
|
|
2736
|
-
if
|
|
2737
|
-
|
|
2738
|
-
|
|
3112
|
+
if bytes_value is not None:
|
|
3113
|
+
body["bytes_value"] = bytes_value
|
|
3114
|
+
if key is not None:
|
|
3115
|
+
body["key"] = key
|
|
3116
|
+
if scope is not None:
|
|
3117
|
+
body["scope"] = scope
|
|
3118
|
+
if string_value is not None:
|
|
3119
|
+
body["string_value"] = string_value
|
|
3120
|
+
headers = {
|
|
3121
|
+
"Accept": "application/json",
|
|
3122
|
+
"Content-Type": "application/json",
|
|
3123
|
+
}
|
|
2739
3124
|
|
|
2740
|
-
self._api.do(
|
|
3125
|
+
self._api.do("POST", "/api/2.0/secrets/put", body=body, headers=headers)
|
|
2741
3126
|
|
|
2742
3127
|
|
|
2743
3128
|
class WorkspaceAPI:
|
|
2744
3129
|
"""The Workspace API allows you to list, import, export, and delete notebooks and folders.
|
|
2745
|
-
|
|
3130
|
+
|
|
2746
3131
|
A notebook is a web-based interface to a document that contains runnable code, visualizations, and
|
|
2747
3132
|
explanatory text."""
|
|
2748
3133
|
|
|
@@ -2751,157 +3136,176 @@ class WorkspaceAPI:
|
|
|
2751
3136
|
|
|
2752
3137
|
def delete(self, path: str, *, recursive: Optional[bool] = None):
|
|
2753
3138
|
"""Delete a workspace object.
|
|
2754
|
-
|
|
3139
|
+
|
|
2755
3140
|
Deletes an object or a directory (and optionally recursively deletes all objects in the directory). *
|
|
2756
3141
|
If `path` does not exist, this call returns an error `RESOURCE_DOES_NOT_EXIST`. * If `path` is a
|
|
2757
3142
|
non-empty directory and `recursive` is set to `false`, this call returns an error
|
|
2758
3143
|
`DIRECTORY_NOT_EMPTY`.
|
|
2759
|
-
|
|
3144
|
+
|
|
2760
3145
|
Object deletion cannot be undone and deleting a directory recursively is not atomic.
|
|
2761
|
-
|
|
3146
|
+
|
|
2762
3147
|
:param path: str
|
|
2763
3148
|
The absolute path of the notebook or directory.
|
|
2764
3149
|
:param recursive: bool (optional)
|
|
2765
3150
|
The flag that specifies whether to delete the object recursively. It is `false` by default. Please
|
|
2766
3151
|
note this deleting directory is not atomic. If it fails in the middle, some of objects under this
|
|
2767
3152
|
directory may be deleted and cannot be undone.
|
|
2768
|
-
|
|
2769
|
-
|
|
3153
|
+
|
|
3154
|
+
|
|
2770
3155
|
"""
|
|
2771
3156
|
body = {}
|
|
2772
|
-
if path is not None:
|
|
2773
|
-
|
|
2774
|
-
|
|
3157
|
+
if path is not None:
|
|
3158
|
+
body["path"] = path
|
|
3159
|
+
if recursive is not None:
|
|
3160
|
+
body["recursive"] = recursive
|
|
3161
|
+
headers = {
|
|
3162
|
+
"Accept": "application/json",
|
|
3163
|
+
"Content-Type": "application/json",
|
|
3164
|
+
}
|
|
2775
3165
|
|
|
2776
|
-
self._api.do(
|
|
3166
|
+
self._api.do("POST", "/api/2.0/workspace/delete", body=body, headers=headers)
|
|
2777
3167
|
|
|
2778
3168
|
def export(self, path: str, *, format: Optional[ExportFormat] = None) -> ExportResponse:
|
|
2779
3169
|
"""Export a workspace object.
|
|
2780
|
-
|
|
3170
|
+
|
|
2781
3171
|
Exports an object or the contents of an entire directory.
|
|
2782
|
-
|
|
3172
|
+
|
|
2783
3173
|
If `path` does not exist, this call returns an error `RESOURCE_DOES_NOT_EXIST`.
|
|
2784
|
-
|
|
3174
|
+
|
|
2785
3175
|
If the exported data would exceed size limit, this call returns `MAX_NOTEBOOK_SIZE_EXCEEDED`.
|
|
2786
3176
|
Currently, this API does not support exporting a library.
|
|
2787
|
-
|
|
3177
|
+
|
|
2788
3178
|
:param path: str
|
|
2789
3179
|
The absolute path of the object or directory. Exporting a directory is only supported for the `DBC`,
|
|
2790
3180
|
`SOURCE`, and `AUTO` format.
|
|
2791
3181
|
:param format: :class:`ExportFormat` (optional)
|
|
2792
3182
|
This specifies the format of the exported file. By default, this is `SOURCE`.
|
|
2793
|
-
|
|
3183
|
+
|
|
2794
3184
|
The value is case sensitive.
|
|
2795
|
-
|
|
3185
|
+
|
|
2796
3186
|
- `SOURCE`: The notebook is exported as source code. Directory exports will not include non-notebook
|
|
2797
3187
|
entries. - `HTML`: The notebook is exported as an HTML file. - `JUPYTER`: The notebook is exported
|
|
2798
3188
|
as a Jupyter/IPython Notebook file. - `DBC`: The notebook is exported in Databricks archive format.
|
|
2799
3189
|
Directory exports will not include non-notebook entries. - `R_MARKDOWN`: The notebook is exported to
|
|
2800
3190
|
R Markdown format. - `AUTO`: The object or directory is exported depending on the objects type.
|
|
2801
3191
|
Directory exports will include notebooks and workspace files.
|
|
2802
|
-
|
|
3192
|
+
|
|
2803
3193
|
:returns: :class:`ExportResponse`
|
|
2804
3194
|
"""
|
|
2805
3195
|
|
|
2806
3196
|
query = {}
|
|
2807
|
-
if format is not None:
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
3197
|
+
if format is not None:
|
|
3198
|
+
query["format"] = format.value
|
|
3199
|
+
if path is not None:
|
|
3200
|
+
query["path"] = path
|
|
3201
|
+
headers = {
|
|
3202
|
+
"Accept": "application/json",
|
|
3203
|
+
}
|
|
3204
|
+
|
|
3205
|
+
res = self._api.do("GET", "/api/2.0/workspace/export", query=query, headers=headers)
|
|
2812
3206
|
return ExportResponse.from_dict(res)
|
|
2813
3207
|
|
|
2814
|
-
def get_permission_levels(
|
|
2815
|
-
|
|
3208
|
+
def get_permission_levels(
|
|
3209
|
+
self, workspace_object_type: str, workspace_object_id: str
|
|
3210
|
+
) -> GetWorkspaceObjectPermissionLevelsResponse:
|
|
2816
3211
|
"""Get workspace object permission levels.
|
|
2817
|
-
|
|
3212
|
+
|
|
2818
3213
|
Gets the permission levels that a user can have on an object.
|
|
2819
|
-
|
|
3214
|
+
|
|
2820
3215
|
:param workspace_object_type: str
|
|
2821
3216
|
The workspace object type for which to get or manage permissions.
|
|
2822
3217
|
:param workspace_object_id: str
|
|
2823
3218
|
The workspace object for which to get or manage permissions.
|
|
2824
|
-
|
|
3219
|
+
|
|
2825
3220
|
:returns: :class:`GetWorkspaceObjectPermissionLevelsResponse`
|
|
2826
3221
|
"""
|
|
2827
3222
|
|
|
2828
|
-
headers = {
|
|
3223
|
+
headers = {
|
|
3224
|
+
"Accept": "application/json",
|
|
3225
|
+
}
|
|
2829
3226
|
|
|
2830
3227
|
res = self._api.do(
|
|
2831
|
-
|
|
2832
|
-
f
|
|
2833
|
-
headers=headers
|
|
3228
|
+
"GET",
|
|
3229
|
+
f"/api/2.0/permissions/{workspace_object_type}/{workspace_object_id}/permissionLevels",
|
|
3230
|
+
headers=headers,
|
|
3231
|
+
)
|
|
2834
3232
|
return GetWorkspaceObjectPermissionLevelsResponse.from_dict(res)
|
|
2835
3233
|
|
|
2836
|
-
def get_permissions(self, workspace_object_type: str,
|
|
2837
|
-
workspace_object_id: str) -> WorkspaceObjectPermissions:
|
|
3234
|
+
def get_permissions(self, workspace_object_type: str, workspace_object_id: str) -> WorkspaceObjectPermissions:
|
|
2838
3235
|
"""Get workspace object permissions.
|
|
2839
|
-
|
|
3236
|
+
|
|
2840
3237
|
Gets the permissions of a workspace object. Workspace objects can inherit permissions from their
|
|
2841
3238
|
parent objects or root object.
|
|
2842
|
-
|
|
3239
|
+
|
|
2843
3240
|
:param workspace_object_type: str
|
|
2844
3241
|
The workspace object type for which to get or manage permissions.
|
|
2845
3242
|
:param workspace_object_id: str
|
|
2846
3243
|
The workspace object for which to get or manage permissions.
|
|
2847
|
-
|
|
3244
|
+
|
|
2848
3245
|
:returns: :class:`WorkspaceObjectPermissions`
|
|
2849
3246
|
"""
|
|
2850
3247
|
|
|
2851
|
-
headers = {
|
|
3248
|
+
headers = {
|
|
3249
|
+
"Accept": "application/json",
|
|
3250
|
+
}
|
|
2852
3251
|
|
|
2853
|
-
res = self._api.do(
|
|
2854
|
-
|
|
2855
|
-
|
|
3252
|
+
res = self._api.do(
|
|
3253
|
+
"GET", f"/api/2.0/permissions/{workspace_object_type}/{workspace_object_id}", headers=headers
|
|
3254
|
+
)
|
|
2856
3255
|
return WorkspaceObjectPermissions.from_dict(res)
|
|
2857
3256
|
|
|
2858
3257
|
def get_status(self, path: str) -> ObjectInfo:
|
|
2859
3258
|
"""Get status.
|
|
2860
|
-
|
|
3259
|
+
|
|
2861
3260
|
Gets the status of an object or a directory. If `path` does not exist, this call returns an error
|
|
2862
3261
|
`RESOURCE_DOES_NOT_EXIST`.
|
|
2863
|
-
|
|
3262
|
+
|
|
2864
3263
|
:param path: str
|
|
2865
3264
|
The absolute path of the notebook or directory.
|
|
2866
|
-
|
|
3265
|
+
|
|
2867
3266
|
:returns: :class:`ObjectInfo`
|
|
2868
3267
|
"""
|
|
2869
3268
|
|
|
2870
3269
|
query = {}
|
|
2871
|
-
if path is not None:
|
|
2872
|
-
|
|
3270
|
+
if path is not None:
|
|
3271
|
+
query["path"] = path
|
|
3272
|
+
headers = {
|
|
3273
|
+
"Accept": "application/json",
|
|
3274
|
+
}
|
|
2873
3275
|
|
|
2874
|
-
res = self._api.do(
|
|
3276
|
+
res = self._api.do("GET", "/api/2.0/workspace/get-status", query=query, headers=headers)
|
|
2875
3277
|
return ObjectInfo.from_dict(res)
|
|
2876
3278
|
|
|
2877
|
-
def import_(
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
3279
|
+
def import_(
|
|
3280
|
+
self,
|
|
3281
|
+
path: str,
|
|
3282
|
+
*,
|
|
3283
|
+
content: Optional[str] = None,
|
|
3284
|
+
format: Optional[ImportFormat] = None,
|
|
3285
|
+
language: Optional[Language] = None,
|
|
3286
|
+
overwrite: Optional[bool] = None,
|
|
3287
|
+
):
|
|
2884
3288
|
"""Import a workspace object.
|
|
2885
|
-
|
|
3289
|
+
|
|
2886
3290
|
Imports a workspace object (for example, a notebook or file) or the contents of an entire directory.
|
|
2887
3291
|
If `path` already exists and `overwrite` is set to `false`, this call returns an error
|
|
2888
3292
|
`RESOURCE_ALREADY_EXISTS`. To import a directory, you can use either the `DBC` format or the `SOURCE`
|
|
2889
3293
|
format with the `language` field unset. To import a single file as `SOURCE`, you must set the
|
|
2890
3294
|
`language` field.
|
|
2891
|
-
|
|
3295
|
+
|
|
2892
3296
|
:param path: str
|
|
2893
3297
|
The absolute path of the object or directory. Importing a directory is only supported for the `DBC`
|
|
2894
3298
|
and `SOURCE` formats.
|
|
2895
3299
|
:param content: str (optional)
|
|
2896
3300
|
The base64-encoded content. This has a limit of 10 MB.
|
|
2897
|
-
|
|
3301
|
+
|
|
2898
3302
|
If the limit (10MB) is exceeded, exception with error code **MAX_NOTEBOOK_SIZE_EXCEEDED** is thrown.
|
|
2899
3303
|
This parameter might be absent, and instead a posted file is used.
|
|
2900
3304
|
:param format: :class:`ImportFormat` (optional)
|
|
2901
3305
|
This specifies the format of the file to be imported.
|
|
2902
|
-
|
|
3306
|
+
|
|
2903
3307
|
The value is case sensitive.
|
|
2904
|
-
|
|
3308
|
+
|
|
2905
3309
|
- `AUTO`: The item is imported depending on an analysis of the item's extension and the header
|
|
2906
3310
|
content provided in the request. If the item is imported as a notebook, then the item's extension is
|
|
2907
3311
|
automatically removed. - `SOURCE`: The notebook or directory is imported as source code. - `HTML`:
|
|
@@ -2913,94 +3317,112 @@ class WorkspaceAPI:
|
|
|
2913
3317
|
:param overwrite: bool (optional)
|
|
2914
3318
|
The flag that specifies whether to overwrite existing object. It is `false` by default. For `DBC`
|
|
2915
3319
|
format, `overwrite` is not supported since it may contain a directory.
|
|
2916
|
-
|
|
2917
|
-
|
|
3320
|
+
|
|
3321
|
+
|
|
2918
3322
|
"""
|
|
2919
3323
|
body = {}
|
|
2920
|
-
if content is not None:
|
|
2921
|
-
|
|
2922
|
-
if
|
|
2923
|
-
|
|
2924
|
-
if
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
3324
|
+
if content is not None:
|
|
3325
|
+
body["content"] = content
|
|
3326
|
+
if format is not None:
|
|
3327
|
+
body["format"] = format.value
|
|
3328
|
+
if language is not None:
|
|
3329
|
+
body["language"] = language.value
|
|
3330
|
+
if overwrite is not None:
|
|
3331
|
+
body["overwrite"] = overwrite
|
|
3332
|
+
if path is not None:
|
|
3333
|
+
body["path"] = path
|
|
3334
|
+
headers = {
|
|
3335
|
+
"Accept": "application/json",
|
|
3336
|
+
"Content-Type": "application/json",
|
|
3337
|
+
}
|
|
3338
|
+
|
|
3339
|
+
self._api.do("POST", "/api/2.0/workspace/import", body=body, headers=headers)
|
|
2928
3340
|
|
|
2929
3341
|
def list(self, path: str, *, notebooks_modified_after: Optional[int] = None) -> Iterator[ObjectInfo]:
|
|
2930
3342
|
"""List contents.
|
|
2931
|
-
|
|
3343
|
+
|
|
2932
3344
|
Lists the contents of a directory, or the object if it is not a directory. If the input path does not
|
|
2933
3345
|
exist, this call returns an error `RESOURCE_DOES_NOT_EXIST`.
|
|
2934
|
-
|
|
3346
|
+
|
|
2935
3347
|
:param path: str
|
|
2936
3348
|
The absolute path of the notebook or directory.
|
|
2937
3349
|
:param notebooks_modified_after: int (optional)
|
|
2938
3350
|
UTC timestamp in milliseconds
|
|
2939
|
-
|
|
3351
|
+
|
|
2940
3352
|
:returns: Iterator over :class:`ObjectInfo`
|
|
2941
3353
|
"""
|
|
2942
3354
|
|
|
2943
3355
|
query = {}
|
|
2944
|
-
if notebooks_modified_after is not None:
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
3356
|
+
if notebooks_modified_after is not None:
|
|
3357
|
+
query["notebooks_modified_after"] = notebooks_modified_after
|
|
3358
|
+
if path is not None:
|
|
3359
|
+
query["path"] = path
|
|
3360
|
+
headers = {
|
|
3361
|
+
"Accept": "application/json",
|
|
3362
|
+
}
|
|
3363
|
+
|
|
3364
|
+
json = self._api.do("GET", "/api/2.0/workspace/list", query=query, headers=headers)
|
|
2949
3365
|
parsed = ListResponse.from_dict(json).objects
|
|
2950
3366
|
return parsed if parsed is not None else []
|
|
2951
3367
|
|
|
2952
3368
|
def mkdirs(self, path: str):
|
|
2953
3369
|
"""Create a directory.
|
|
2954
|
-
|
|
3370
|
+
|
|
2955
3371
|
Creates the specified directory (and necessary parent directories if they do not exist). If there is
|
|
2956
3372
|
an object (not a directory) at any prefix of the input path, this call returns an error
|
|
2957
3373
|
`RESOURCE_ALREADY_EXISTS`.
|
|
2958
|
-
|
|
3374
|
+
|
|
2959
3375
|
Note that if this operation fails it may have succeeded in creating some of the necessary parent
|
|
2960
3376
|
directories.
|
|
2961
|
-
|
|
3377
|
+
|
|
2962
3378
|
:param path: str
|
|
2963
3379
|
The absolute path of the directory. If the parent directories do not exist, it will also create
|
|
2964
3380
|
them. If the directory already exists, this command will do nothing and succeed.
|
|
2965
|
-
|
|
2966
|
-
|
|
3381
|
+
|
|
3382
|
+
|
|
2967
3383
|
"""
|
|
2968
3384
|
body = {}
|
|
2969
|
-
if path is not None:
|
|
2970
|
-
|
|
3385
|
+
if path is not None:
|
|
3386
|
+
body["path"] = path
|
|
3387
|
+
headers = {
|
|
3388
|
+
"Accept": "application/json",
|
|
3389
|
+
"Content-Type": "application/json",
|
|
3390
|
+
}
|
|
2971
3391
|
|
|
2972
|
-
self._api.do(
|
|
3392
|
+
self._api.do("POST", "/api/2.0/workspace/mkdirs", body=body, headers=headers)
|
|
2973
3393
|
|
|
2974
3394
|
def set_permissions(
|
|
2975
3395
|
self,
|
|
2976
3396
|
workspace_object_type: str,
|
|
2977
3397
|
workspace_object_id: str,
|
|
2978
3398
|
*,
|
|
2979
|
-
access_control_list: Optional[List[WorkspaceObjectAccessControlRequest]] = None
|
|
3399
|
+
access_control_list: Optional[List[WorkspaceObjectAccessControlRequest]] = None,
|
|
2980
3400
|
) -> WorkspaceObjectPermissions:
|
|
2981
3401
|
"""Set workspace object permissions.
|
|
2982
|
-
|
|
3402
|
+
|
|
2983
3403
|
Sets permissions on an object, replacing existing permissions if they exist. Deletes all direct
|
|
2984
3404
|
permissions if none are specified. Objects can inherit permissions from their parent objects or root
|
|
2985
3405
|
object.
|
|
2986
|
-
|
|
3406
|
+
|
|
2987
3407
|
:param workspace_object_type: str
|
|
2988
3408
|
The workspace object type for which to get or manage permissions.
|
|
2989
3409
|
:param workspace_object_id: str
|
|
2990
3410
|
The workspace object for which to get or manage permissions.
|
|
2991
3411
|
:param access_control_list: List[:class:`WorkspaceObjectAccessControlRequest`] (optional)
|
|
2992
|
-
|
|
3412
|
+
|
|
2993
3413
|
:returns: :class:`WorkspaceObjectPermissions`
|
|
2994
3414
|
"""
|
|
2995
3415
|
body = {}
|
|
2996
3416
|
if access_control_list is not None:
|
|
2997
|
-
body[
|
|
2998
|
-
headers = {
|
|
3417
|
+
body["access_control_list"] = [v.as_dict() for v in access_control_list]
|
|
3418
|
+
headers = {
|
|
3419
|
+
"Accept": "application/json",
|
|
3420
|
+
"Content-Type": "application/json",
|
|
3421
|
+
}
|
|
2999
3422
|
|
|
3000
|
-
res = self._api.do(
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
headers=headers)
|
|
3423
|
+
res = self._api.do(
|
|
3424
|
+
"PUT", f"/api/2.0/permissions/{workspace_object_type}/{workspace_object_id}", body=body, headers=headers
|
|
3425
|
+
)
|
|
3004
3426
|
return WorkspaceObjectPermissions.from_dict(res)
|
|
3005
3427
|
|
|
3006
3428
|
def update_permissions(
|
|
@@ -3008,28 +3430,30 @@ class WorkspaceAPI:
|
|
|
3008
3430
|
workspace_object_type: str,
|
|
3009
3431
|
workspace_object_id: str,
|
|
3010
3432
|
*,
|
|
3011
|
-
access_control_list: Optional[List[WorkspaceObjectAccessControlRequest]] = None
|
|
3433
|
+
access_control_list: Optional[List[WorkspaceObjectAccessControlRequest]] = None,
|
|
3012
3434
|
) -> WorkspaceObjectPermissions:
|
|
3013
3435
|
"""Update workspace object permissions.
|
|
3014
|
-
|
|
3436
|
+
|
|
3015
3437
|
Updates the permissions on a workspace object. Workspace objects can inherit permissions from their
|
|
3016
3438
|
parent objects or root object.
|
|
3017
|
-
|
|
3439
|
+
|
|
3018
3440
|
:param workspace_object_type: str
|
|
3019
3441
|
The workspace object type for which to get or manage permissions.
|
|
3020
3442
|
:param workspace_object_id: str
|
|
3021
3443
|
The workspace object for which to get or manage permissions.
|
|
3022
3444
|
:param access_control_list: List[:class:`WorkspaceObjectAccessControlRequest`] (optional)
|
|
3023
|
-
|
|
3445
|
+
|
|
3024
3446
|
:returns: :class:`WorkspaceObjectPermissions`
|
|
3025
3447
|
"""
|
|
3026
3448
|
body = {}
|
|
3027
3449
|
if access_control_list is not None:
|
|
3028
|
-
body[
|
|
3029
|
-
headers = {
|
|
3450
|
+
body["access_control_list"] = [v.as_dict() for v in access_control_list]
|
|
3451
|
+
headers = {
|
|
3452
|
+
"Accept": "application/json",
|
|
3453
|
+
"Content-Type": "application/json",
|
|
3454
|
+
}
|
|
3030
3455
|
|
|
3031
|
-
res = self._api.do(
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
headers=headers)
|
|
3456
|
+
res = self._api.do(
|
|
3457
|
+
"PATCH", f"/api/2.0/permissions/{workspace_object_type}/{workspace_object_id}", body=body, headers=headers
|
|
3458
|
+
)
|
|
3035
3459
|
return WorkspaceObjectPermissions.from_dict(res)
|