databricks-sdk 0.58.0__py3-none-any.whl → 0.60.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.

Files changed (34) hide show
  1. databricks/sdk/__init__.py +18 -10
  2. databricks/sdk/credentials_provider.py +2 -2
  3. databricks/sdk/mixins/files.py +43 -15
  4. databricks/sdk/mixins/open_ai_client.py +28 -7
  5. databricks/sdk/oidc.py +6 -2
  6. databricks/sdk/service/{aibuilder.py → agentbricks.py} +5 -132
  7. databricks/sdk/service/apps.py +52 -46
  8. databricks/sdk/service/billing.py +9 -200
  9. databricks/sdk/service/catalog.py +5501 -7697
  10. databricks/sdk/service/cleanrooms.py +24 -54
  11. databricks/sdk/service/compute.py +456 -2515
  12. databricks/sdk/service/dashboards.py +1 -177
  13. databricks/sdk/service/database.py +34 -53
  14. databricks/sdk/service/files.py +2 -218
  15. databricks/sdk/service/iam.py +16 -295
  16. databricks/sdk/service/jobs.py +108 -1171
  17. databricks/sdk/service/marketplace.py +0 -573
  18. databricks/sdk/service/ml.py +76 -2445
  19. databricks/sdk/service/oauth2.py +122 -237
  20. databricks/sdk/service/pipelines.py +180 -752
  21. databricks/sdk/service/provisioning.py +0 -603
  22. databricks/sdk/service/serving.py +5 -577
  23. databricks/sdk/service/settings.py +192 -1560
  24. databricks/sdk/service/sharing.py +5 -470
  25. databricks/sdk/service/sql.py +117 -1704
  26. databricks/sdk/service/vectorsearch.py +0 -391
  27. databricks/sdk/service/workspace.py +250 -721
  28. databricks/sdk/version.py +1 -1
  29. {databricks_sdk-0.58.0.dist-info → databricks_sdk-0.60.0.dist-info}/METADATA +1 -1
  30. {databricks_sdk-0.58.0.dist-info → databricks_sdk-0.60.0.dist-info}/RECORD +34 -34
  31. {databricks_sdk-0.58.0.dist-info → databricks_sdk-0.60.0.dist-info}/WHEEL +0 -0
  32. {databricks_sdk-0.58.0.dist-info → databricks_sdk-0.60.0.dist-info}/licenses/LICENSE +0 -0
  33. {databricks_sdk-0.58.0.dist-info → databricks_sdk-0.60.0.dist-info}/licenses/NOTICE +0 -0
  34. {databricks_sdk-0.58.0.dist-info → databricks_sdk-0.60.0.dist-info}/top_level.txt +0 -0
@@ -17,6 +17,9 @@ _LOG = logging.getLogger("databricks.sdk")
17
17
 
18
18
  @dataclass
19
19
  class AclItem:
20
+ """An item representing an ACL rule applied to the given principal (user or group) on the
21
+ associated scope point."""
22
+
20
23
  principal: str
21
24
  """The principal in which the permission is applied."""
22
25
 
@@ -48,6 +51,7 @@ class AclItem:
48
51
 
49
52
 
50
53
  class AclPermission(Enum):
54
+ """The ACL permission levels for Secret ACLs applied to secret scopes."""
51
55
 
52
56
  MANAGE = "MANAGE"
53
57
  READ = "READ"
@@ -56,6 +60,8 @@ class AclPermission(Enum):
56
60
 
57
61
  @dataclass
58
62
  class AzureKeyVaultSecretScopeMetadata:
63
+ """The metadata of the Azure KeyVault for a secret scope of type `AZURE_KEYVAULT`"""
64
+
59
65
  resource_id: str
60
66
  """The resource id of the azure KeyVault that user wants to associate the scope with."""
61
67
 
@@ -86,58 +92,6 @@ class AzureKeyVaultSecretScopeMetadata:
86
92
  return cls(dns_name=d.get("dns_name", None), resource_id=d.get("resource_id", None))
87
93
 
88
94
 
89
- @dataclass
90
- class CreateCredentialsRequest:
91
- git_provider: str
92
- """Git provider. This field is case-insensitive. The available Git providers are `gitHub`,
93
- `bitbucketCloud`, `gitLab`, `azureDevOpsServices`, `gitHubEnterprise`, `bitbucketServer`,
94
- `gitLabEnterpriseEdition` and `awsCodeCommit`."""
95
-
96
- git_username: Optional[str] = None
97
- """The username or email provided with your Git provider account, depending on which provider you
98
- are using. For GitHub, GitHub Enterprise Server, or Azure DevOps Services, either email or
99
- username may be used. For GitLab, GitLab Enterprise Edition, email must be used. For AWS
100
- CodeCommit, BitBucket or BitBucket Server, username must be used. For all other providers please
101
- see your provider's Personal Access Token authentication documentation to see what is supported."""
102
-
103
- personal_access_token: Optional[str] = None
104
- """The personal access token used to authenticate to the corresponding Git provider. For certain
105
- providers, support may exist for other types of scoped access tokens. [Learn more].
106
-
107
- [Learn more]: https://docs.databricks.com/repos/get-access-tokens-from-git-provider.html"""
108
-
109
- def as_dict(self) -> dict:
110
- """Serializes the CreateCredentialsRequest into a dictionary suitable for use as a JSON request body."""
111
- body = {}
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
118
- return body
119
-
120
- def as_shallow_dict(self) -> dict:
121
- """Serializes the CreateCredentialsRequest into a shallow dictionary of its immediate attributes."""
122
- body = {}
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
129
- return body
130
-
131
- @classmethod
132
- def from_dict(cls, d: Dict[str, Any]) -> CreateCredentialsRequest:
133
- """Deserializes the CreateCredentialsRequest from a dictionary."""
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
- )
139
-
140
-
141
95
  @dataclass
142
96
  class CreateCredentialsResponse:
143
97
  credential_id: int
@@ -150,6 +104,12 @@ class CreateCredentialsResponse:
150
104
  """The username or email provided with your Git provider account and associated with the
151
105
  credential."""
152
106
 
107
+ is_default_for_provider: Optional[bool] = None
108
+ """if the credential is the default for the given provider"""
109
+
110
+ name: Optional[str] = None
111
+ """the name of the git credential, used for identification and ease of lookup"""
112
+
153
113
  def as_dict(self) -> dict:
154
114
  """Serializes the CreateCredentialsResponse into a dictionary suitable for use as a JSON request body."""
155
115
  body = {}
@@ -159,6 +119,10 @@ class CreateCredentialsResponse:
159
119
  body["git_provider"] = self.git_provider
160
120
  if self.git_username is not None:
161
121
  body["git_username"] = self.git_username
122
+ if self.is_default_for_provider is not None:
123
+ body["is_default_for_provider"] = self.is_default_for_provider
124
+ if self.name is not None:
125
+ body["name"] = self.name
162
126
  return body
163
127
 
164
128
  def as_shallow_dict(self) -> dict:
@@ -170,6 +134,10 @@ class CreateCredentialsResponse:
170
134
  body["git_provider"] = self.git_provider
171
135
  if self.git_username is not None:
172
136
  body["git_username"] = self.git_username
137
+ if self.is_default_for_provider is not None:
138
+ body["is_default_for_provider"] = self.is_default_for_provider
139
+ if self.name is not None:
140
+ body["name"] = self.name
173
141
  return body
174
142
 
175
143
  @classmethod
@@ -179,61 +147,8 @@ class CreateCredentialsResponse:
179
147
  credential_id=d.get("credential_id", None),
180
148
  git_provider=d.get("git_provider", None),
181
149
  git_username=d.get("git_username", None),
182
- )
183
-
184
-
185
- @dataclass
186
- class CreateRepoRequest:
187
- url: str
188
- """URL of the Git repository to be linked."""
189
-
190
- provider: str
191
- """Git provider. This field is case-insensitive. The available Git providers are `gitHub`,
192
- `bitbucketCloud`, `gitLab`, `azureDevOpsServices`, `gitHubEnterprise`, `bitbucketServer`,
193
- `gitLabEnterpriseEdition` and `awsCodeCommit`."""
194
-
195
- path: Optional[str] = None
196
- """Desired path for the repo in the workspace. Almost any path in the workspace can be chosen. If
197
- repo is created in `/Repos`, path must be in the format `/Repos/{folder}/{repo-name}`."""
198
-
199
- sparse_checkout: Optional[SparseCheckout] = None
200
- """If specified, the repo will be created with sparse checkout enabled. You cannot enable/disable
201
- sparse checkout after the repo is created."""
202
-
203
- def as_dict(self) -> dict:
204
- """Serializes the CreateRepoRequest into a dictionary suitable for use as a JSON request body."""
205
- body = {}
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
214
- return body
215
-
216
- def as_shallow_dict(self) -> dict:
217
- """Serializes the CreateRepoRequest into a shallow dictionary of its immediate attributes."""
218
- body = {}
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
227
- return body
228
-
229
- @classmethod
230
- def from_dict(cls, d: Dict[str, Any]) -> CreateRepoRequest:
231
- """Deserializes the CreateRepoRequest from a dictionary."""
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),
150
+ is_default_for_provider=d.get("is_default_for_provider", None),
151
+ name=d.get("name", None),
237
152
  )
238
153
 
239
154
 
@@ -312,57 +227,6 @@ class CreateRepoResponse:
312
227
  )
313
228
 
314
229
 
315
- @dataclass
316
- class CreateScope:
317
- scope: str
318
- """Scope name requested by the user. Scope names are unique."""
319
-
320
- backend_azure_keyvault: Optional[AzureKeyVaultSecretScopeMetadata] = None
321
- """The metadata for the secret scope if the type is `AZURE_KEYVAULT`"""
322
-
323
- initial_manage_principal: Optional[str] = None
324
- """The principal that is initially granted `MANAGE` permission to the created scope."""
325
-
326
- scope_backend_type: Optional[ScopeBackendType] = None
327
- """The backend type the scope will be created with. If not specified, will default to `DATABRICKS`"""
328
-
329
- def as_dict(self) -> dict:
330
- """Serializes the CreateScope into a dictionary suitable for use as a JSON request body."""
331
- body = {}
332
- if self.backend_azure_keyvault:
333
- body["backend_azure_keyvault"] = self.backend_azure_keyvault.as_dict()
334
- if self.initial_manage_principal is not None:
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
340
- return body
341
-
342
- def as_shallow_dict(self) -> dict:
343
- """Serializes the CreateScope into a shallow dictionary of its immediate attributes."""
344
- body = {}
345
- if self.backend_azure_keyvault:
346
- body["backend_azure_keyvault"] = self.backend_azure_keyvault
347
- if self.initial_manage_principal is not None:
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
353
- return body
354
-
355
- @classmethod
356
- def from_dict(cls, d: Dict[str, Any]) -> CreateScope:
357
- """Deserializes the CreateScope from a dictionary."""
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
- )
364
-
365
-
366
230
  @dataclass
367
231
  class CreateScopeResponse:
368
232
  def as_dict(self) -> dict:
@@ -393,6 +257,12 @@ class CredentialInfo:
393
257
  """The username or email provided with your Git provider account and associated with the
394
258
  credential."""
395
259
 
260
+ is_default_for_provider: Optional[bool] = None
261
+ """if the credential is the default for the given provider"""
262
+
263
+ name: Optional[str] = None
264
+ """the name of the git credential, used for identification and ease of lookup"""
265
+
396
266
  def as_dict(self) -> dict:
397
267
  """Serializes the CredentialInfo into a dictionary suitable for use as a JSON request body."""
398
268
  body = {}
@@ -402,6 +272,10 @@ class CredentialInfo:
402
272
  body["git_provider"] = self.git_provider
403
273
  if self.git_username is not None:
404
274
  body["git_username"] = self.git_username
275
+ if self.is_default_for_provider is not None:
276
+ body["is_default_for_provider"] = self.is_default_for_provider
277
+ if self.name is not None:
278
+ body["name"] = self.name
405
279
  return body
406
280
 
407
281
  def as_shallow_dict(self) -> dict:
@@ -413,6 +287,10 @@ class CredentialInfo:
413
287
  body["git_provider"] = self.git_provider
414
288
  if self.git_username is not None:
415
289
  body["git_username"] = self.git_username
290
+ if self.is_default_for_provider is not None:
291
+ body["is_default_for_provider"] = self.is_default_for_provider
292
+ if self.name is not None:
293
+ body["name"] = self.name
416
294
  return body
417
295
 
418
296
  @classmethod
@@ -422,75 +300,11 @@ class CredentialInfo:
422
300
  credential_id=d.get("credential_id", None),
423
301
  git_provider=d.get("git_provider", None),
424
302
  git_username=d.get("git_username", None),
303
+ is_default_for_provider=d.get("is_default_for_provider", None),
304
+ name=d.get("name", None),
425
305
  )
426
306
 
427
307
 
428
- @dataclass
429
- class Delete:
430
- path: str
431
- """The absolute path of the notebook or directory."""
432
-
433
- recursive: Optional[bool] = None
434
- """The flag that specifies whether to delete the object recursively. It is `false` by default.
435
- Please note this deleting directory is not atomic. If it fails in the middle, some of objects
436
- under this directory may be deleted and cannot be undone."""
437
-
438
- def as_dict(self) -> dict:
439
- """Serializes the Delete into a dictionary suitable for use as a JSON request body."""
440
- body = {}
441
- if self.path is not None:
442
- body["path"] = self.path
443
- if self.recursive is not None:
444
- body["recursive"] = self.recursive
445
- return body
446
-
447
- def as_shallow_dict(self) -> dict:
448
- """Serializes the Delete into a shallow dictionary of its immediate attributes."""
449
- body = {}
450
- if self.path is not None:
451
- body["path"] = self.path
452
- if self.recursive is not None:
453
- body["recursive"] = self.recursive
454
- return body
455
-
456
- @classmethod
457
- def from_dict(cls, d: Dict[str, Any]) -> Delete:
458
- """Deserializes the Delete from a dictionary."""
459
- return cls(path=d.get("path", None), recursive=d.get("recursive", None))
460
-
461
-
462
- @dataclass
463
- class DeleteAcl:
464
- scope: str
465
- """The name of the scope to remove permissions from."""
466
-
467
- principal: str
468
- """The principal to remove an existing ACL from."""
469
-
470
- def as_dict(self) -> dict:
471
- """Serializes the DeleteAcl into a dictionary suitable for use as a JSON request body."""
472
- body = {}
473
- if self.principal is not None:
474
- body["principal"] = self.principal
475
- if self.scope is not None:
476
- body["scope"] = self.scope
477
- return body
478
-
479
- def as_shallow_dict(self) -> dict:
480
- """Serializes the DeleteAcl into a shallow dictionary of its immediate attributes."""
481
- body = {}
482
- if self.principal is not None:
483
- body["principal"] = self.principal
484
- if self.scope is not None:
485
- body["scope"] = self.scope
486
- return body
487
-
488
- @classmethod
489
- def from_dict(cls, d: Dict[str, Any]) -> DeleteAcl:
490
- """Deserializes the DeleteAcl from a dictionary."""
491
- return cls(principal=d.get("principal", None), scope=d.get("scope", None))
492
-
493
-
494
308
  @dataclass
495
309
  class DeleteAclResponse:
496
310
  def as_dict(self) -> dict:
@@ -563,31 +377,6 @@ class DeleteResponse:
563
377
  return cls()
564
378
 
565
379
 
566
- @dataclass
567
- class DeleteScope:
568
- scope: str
569
- """Name of the scope to delete."""
570
-
571
- def as_dict(self) -> dict:
572
- """Serializes the DeleteScope into a dictionary suitable for use as a JSON request body."""
573
- body = {}
574
- if self.scope is not None:
575
- body["scope"] = self.scope
576
- return body
577
-
578
- def as_shallow_dict(self) -> dict:
579
- """Serializes the DeleteScope into a shallow dictionary of its immediate attributes."""
580
- body = {}
581
- if self.scope is not None:
582
- body["scope"] = self.scope
583
- return body
584
-
585
- @classmethod
586
- def from_dict(cls, d: Dict[str, Any]) -> DeleteScope:
587
- """Deserializes the DeleteScope from a dictionary."""
588
- return cls(scope=d.get("scope", None))
589
-
590
-
591
380
  @dataclass
592
381
  class DeleteScopeResponse:
593
382
  def as_dict(self) -> dict:
@@ -606,38 +395,6 @@ class DeleteScopeResponse:
606
395
  return cls()
607
396
 
608
397
 
609
- @dataclass
610
- class DeleteSecret:
611
- scope: str
612
- """The name of the scope that contains the secret to delete."""
613
-
614
- key: str
615
- """Name of the secret to delete."""
616
-
617
- def as_dict(self) -> dict:
618
- """Serializes the DeleteSecret into a dictionary suitable for use as a JSON request body."""
619
- body = {}
620
- if self.key is not None:
621
- body["key"] = self.key
622
- if self.scope is not None:
623
- body["scope"] = self.scope
624
- return body
625
-
626
- def as_shallow_dict(self) -> dict:
627
- """Serializes the DeleteSecret into a shallow dictionary of its immediate attributes."""
628
- body = {}
629
- if self.key is not None:
630
- body["key"] = self.key
631
- if self.scope is not None:
632
- body["scope"] = self.scope
633
- return body
634
-
635
- @classmethod
636
- def from_dict(cls, d: Dict[str, Any]) -> DeleteSecret:
637
- """Deserializes the DeleteSecret from a dictionary."""
638
- return cls(key=d.get("key", None), scope=d.get("scope", None))
639
-
640
-
641
398
  @dataclass
642
399
  class DeleteSecretResponse:
643
400
  def as_dict(self) -> dict:
@@ -716,6 +473,12 @@ class GetCredentialsResponse:
716
473
  """The username or email provided with your Git provider account and associated with the
717
474
  credential."""
718
475
 
476
+ is_default_for_provider: Optional[bool] = None
477
+ """if the credential is the default for the given provider"""
478
+
479
+ name: Optional[str] = None
480
+ """the name of the git credential, used for identification and ease of lookup"""
481
+
719
482
  def as_dict(self) -> dict:
720
483
  """Serializes the GetCredentialsResponse into a dictionary suitable for use as a JSON request body."""
721
484
  body = {}
@@ -725,6 +488,10 @@ class GetCredentialsResponse:
725
488
  body["git_provider"] = self.git_provider
726
489
  if self.git_username is not None:
727
490
  body["git_username"] = self.git_username
491
+ if self.is_default_for_provider is not None:
492
+ body["is_default_for_provider"] = self.is_default_for_provider
493
+ if self.name is not None:
494
+ body["name"] = self.name
728
495
  return body
729
496
 
730
497
  def as_shallow_dict(self) -> dict:
@@ -736,6 +503,10 @@ class GetCredentialsResponse:
736
503
  body["git_provider"] = self.git_provider
737
504
  if self.git_username is not None:
738
505
  body["git_username"] = self.git_username
506
+ if self.is_default_for_provider is not None:
507
+ body["is_default_for_provider"] = self.is_default_for_provider
508
+ if self.name is not None:
509
+ body["name"] = self.name
739
510
  return body
740
511
 
741
512
  @classmethod
@@ -745,6 +516,8 @@ class GetCredentialsResponse:
745
516
  credential_id=d.get("credential_id", None),
746
517
  git_provider=d.get("git_provider", None),
747
518
  git_username=d.get("git_username", None),
519
+ is_default_for_provider=d.get("is_default_for_provider", None),
520
+ name=d.get("name", None),
748
521
  )
749
522
 
750
523
 
@@ -905,80 +678,6 @@ class GetWorkspaceObjectPermissionLevelsResponse:
905
678
  return cls(permission_levels=_repeated_dict(d, "permission_levels", WorkspaceObjectPermissionsDescription))
906
679
 
907
680
 
908
- @dataclass
909
- class Import:
910
- path: str
911
- """The absolute path of the object or directory. Importing a directory is only supported for the
912
- `DBC` and `SOURCE` formats."""
913
-
914
- content: Optional[str] = None
915
- """The base64-encoded content. This has a limit of 10 MB.
916
-
917
- If the limit (10MB) is exceeded, exception with error code **MAX_NOTEBOOK_SIZE_EXCEEDED** is
918
- thrown. This parameter might be absent, and instead a posted file is used."""
919
-
920
- format: Optional[ImportFormat] = None
921
- """This specifies the format of the file to be imported.
922
-
923
- The value is case sensitive.
924
-
925
- - `AUTO`: The item is imported depending on an analysis of the item's extension and the header
926
- content provided in the request. If the item is imported as a notebook, then the item's
927
- extension is automatically removed. - `SOURCE`: The notebook or directory is imported as source
928
- code. - `HTML`: The notebook is imported as an HTML file. - `JUPYTER`: The notebook is imported
929
- as a Jupyter/IPython Notebook file. - `DBC`: The notebook is imported in Databricks archive
930
- format. Required for directories. - `R_MARKDOWN`: The notebook is imported from R Markdown
931
- format."""
932
-
933
- language: Optional[Language] = None
934
- """The language of the object. This value is set only if the object type is `NOTEBOOK`."""
935
-
936
- overwrite: Optional[bool] = None
937
- """The flag that specifies whether to overwrite existing object. It is `false` by default. For
938
- `DBC` format, `overwrite` is not supported since it may contain a directory."""
939
-
940
- def as_dict(self) -> dict:
941
- """Serializes the Import into a dictionary suitable for use as a JSON request body."""
942
- body = {}
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
953
- return body
954
-
955
- def as_shallow_dict(self) -> dict:
956
- """Serializes the Import into a shallow dictionary of its immediate attributes."""
957
- body = {}
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
968
- return body
969
-
970
- @classmethod
971
- def from_dict(cls, d: Dict[str, Any]) -> Import:
972
- """Deserializes the Import from a dictionary."""
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
- )
980
-
981
-
982
681
  class ImportFormat(Enum):
983
682
  """The format for workspace import and export."""
984
683
 
@@ -1176,32 +875,6 @@ class ListSecretsResponse:
1176
875
  return cls(secrets=_repeated_dict(d, "secrets", SecretMetadata))
1177
876
 
1178
877
 
1179
- @dataclass
1180
- class Mkdirs:
1181
- path: str
1182
- """The absolute path of the directory. If the parent directories do not exist, it will also create
1183
- them. If the directory already exists, this command will do nothing and succeed."""
1184
-
1185
- def as_dict(self) -> dict:
1186
- """Serializes the Mkdirs into a dictionary suitable for use as a JSON request body."""
1187
- body = {}
1188
- if self.path is not None:
1189
- body["path"] = self.path
1190
- return body
1191
-
1192
- def as_shallow_dict(self) -> dict:
1193
- """Serializes the Mkdirs into a shallow dictionary of its immediate attributes."""
1194
- body = {}
1195
- if self.path is not None:
1196
- body["path"] = self.path
1197
- return body
1198
-
1199
- @classmethod
1200
- def from_dict(cls, d: Dict[str, Any]) -> Mkdirs:
1201
- """Deserializes the Mkdirs from a dictionary."""
1202
- return cls(path=d.get("path", None))
1203
-
1204
-
1205
878
  @dataclass
1206
879
  class MkdirsResponse:
1207
880
  def as_dict(self) -> dict:
@@ -1320,49 +993,6 @@ class ObjectType(Enum):
1320
993
  REPO = "REPO"
1321
994
 
1322
995
 
1323
- @dataclass
1324
- class PutAcl:
1325
- scope: str
1326
- """The name of the scope to apply permissions to."""
1327
-
1328
- principal: str
1329
- """The principal in which the permission is applied."""
1330
-
1331
- permission: AclPermission
1332
- """The permission level applied to the principal."""
1333
-
1334
- def as_dict(self) -> dict:
1335
- """Serializes the PutAcl into a dictionary suitable for use as a JSON request body."""
1336
- body = {}
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
1343
- return body
1344
-
1345
- def as_shallow_dict(self) -> dict:
1346
- """Serializes the PutAcl into a shallow dictionary of its immediate attributes."""
1347
- body = {}
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
1354
- return body
1355
-
1356
- @classmethod
1357
- def from_dict(cls, d: Dict[str, Any]) -> PutAcl:
1358
- """Deserializes the PutAcl from a dictionary."""
1359
- return cls(
1360
- permission=_enum(d, "permission", AclPermission),
1361
- principal=d.get("principal", None),
1362
- scope=d.get("scope", None),
1363
- )
1364
-
1365
-
1366
996
  @dataclass
1367
997
  class PutAclResponse:
1368
998
  def as_dict(self) -> dict:
@@ -1381,57 +1011,6 @@ class PutAclResponse:
1381
1011
  return cls()
1382
1012
 
1383
1013
 
1384
- @dataclass
1385
- class PutSecret:
1386
- scope: str
1387
- """The name of the scope to which the secret will be associated with."""
1388
-
1389
- key: str
1390
- """A unique name to identify the secret."""
1391
-
1392
- bytes_value: Optional[str] = None
1393
- """If specified, value will be stored as bytes."""
1394
-
1395
- string_value: Optional[str] = None
1396
- """If specified, note that the value will be stored in UTF-8 (MB4) form."""
1397
-
1398
- def as_dict(self) -> dict:
1399
- """Serializes the PutSecret into a dictionary suitable for use as a JSON request body."""
1400
- body = {}
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
1409
- return body
1410
-
1411
- def as_shallow_dict(self) -> dict:
1412
- """Serializes the PutSecret into a shallow dictionary of its immediate attributes."""
1413
- body = {}
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
1422
- return body
1423
-
1424
- @classmethod
1425
- def from_dict(cls, d: Dict[str, Any]) -> PutSecret:
1426
- """Deserializes the PutSecret from a dictionary."""
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
- )
1433
-
1434
-
1435
1014
  @dataclass
1436
1015
  class PutSecretResponse:
1437
1016
  def as_dict(self) -> dict:
@@ -1757,41 +1336,9 @@ class RepoPermissionsDescription:
1757
1336
  )
1758
1337
 
1759
1338
 
1760
- @dataclass
1761
- class RepoPermissionsRequest:
1762
- access_control_list: Optional[List[RepoAccessControlRequest]] = None
1763
-
1764
- repo_id: Optional[str] = None
1765
- """The repo for which to get or manage permissions."""
1766
-
1767
- def as_dict(self) -> dict:
1768
- """Serializes the RepoPermissionsRequest into a dictionary suitable for use as a JSON request body."""
1769
- body = {}
1770
- if self.access_control_list:
1771
- body["access_control_list"] = [v.as_dict() for v in self.access_control_list]
1772
- if self.repo_id is not None:
1773
- body["repo_id"] = self.repo_id
1774
- return body
1775
-
1776
- def as_shallow_dict(self) -> dict:
1777
- """Serializes the RepoPermissionsRequest into a shallow dictionary of its immediate attributes."""
1778
- body = {}
1779
- if self.access_control_list:
1780
- body["access_control_list"] = self.access_control_list
1781
- if self.repo_id is not None:
1782
- body["repo_id"] = self.repo_id
1783
- return body
1784
-
1785
- @classmethod
1786
- def from_dict(cls, d: Dict[str, Any]) -> RepoPermissionsRequest:
1787
- """Deserializes the RepoPermissionsRequest from a dictionary."""
1788
- return cls(
1789
- access_control_list=_repeated_dict(d, "access_control_list", RepoAccessControlRequest),
1790
- repo_id=d.get("repo_id", None),
1791
- )
1792
-
1793
-
1794
1339
  class ScopeBackendType(Enum):
1340
+ """The types of secret scope backends in the Secret Manager. Azure KeyVault backed secret scopes
1341
+ will be supported in a later release."""
1795
1342
 
1796
1343
  AZURE_KEYVAULT = "AZURE_KEYVAULT"
1797
1344
  DATABRICKS = "DATABRICKS"
@@ -1799,6 +1346,9 @@ class ScopeBackendType(Enum):
1799
1346
 
1800
1347
  @dataclass
1801
1348
  class SecretMetadata:
1349
+ """The metadata about a secret. Returned when listing secrets. Does not contain the actual secret
1350
+ value."""
1351
+
1802
1352
  key: Optional[str] = None
1803
1353
  """A unique name to identify the secret."""
1804
1354
 
@@ -1831,11 +1381,15 @@ class SecretMetadata:
1831
1381
 
1832
1382
  @dataclass
1833
1383
  class SecretScope:
1384
+ """An organizational resource for storing secrets. Secret scopes can be different types
1385
+ (Databricks-managed, Azure KeyVault backed, etc), and ACLs can be applied to control permissions
1386
+ for all secrets within a scope."""
1387
+
1834
1388
  backend_type: Optional[ScopeBackendType] = None
1835
1389
  """The type of secret scope backend."""
1836
1390
 
1837
1391
  keyvault_metadata: Optional[AzureKeyVaultSecretScopeMetadata] = None
1838
- """The metadata for the secret scope if the type is `AZURE_KEYVAULT`"""
1392
+ """The metadata for the secret scope if the type is ``AZURE_KEYVAULT``"""
1839
1393
 
1840
1394
  name: Optional[str] = None
1841
1395
  """A unique name to identify the secret scope."""
@@ -1930,66 +1484,6 @@ class SparseCheckoutUpdate:
1930
1484
  return cls(patterns=d.get("patterns", None))
1931
1485
 
1932
1486
 
1933
- @dataclass
1934
- class UpdateCredentialsRequest:
1935
- git_provider: str
1936
- """Git provider. This field is case-insensitive. The available Git providers are `gitHub`,
1937
- `bitbucketCloud`, `gitLab`, `azureDevOpsServices`, `gitHubEnterprise`, `bitbucketServer`,
1938
- `gitLabEnterpriseEdition` and `awsCodeCommit`."""
1939
-
1940
- credential_id: Optional[int] = None
1941
- """The ID for the corresponding credential to access."""
1942
-
1943
- git_username: Optional[str] = None
1944
- """The username or email provided with your Git provider account, depending on which provider you
1945
- are using. For GitHub, GitHub Enterprise Server, or Azure DevOps Services, either email or
1946
- username may be used. For GitLab, GitLab Enterprise Edition, email must be used. For AWS
1947
- CodeCommit, BitBucket or BitBucket Server, username must be used. For all other providers please
1948
- see your provider's Personal Access Token authentication documentation to see what is supported."""
1949
-
1950
- personal_access_token: Optional[str] = None
1951
- """The personal access token used to authenticate to the corresponding Git provider. For certain
1952
- providers, support may exist for other types of scoped access tokens. [Learn more].
1953
-
1954
- [Learn more]: https://docs.databricks.com/repos/get-access-tokens-from-git-provider.html"""
1955
-
1956
- def as_dict(self) -> dict:
1957
- """Serializes the UpdateCredentialsRequest into a dictionary suitable for use as a JSON request body."""
1958
- body = {}
1959
- if self.credential_id is not None:
1960
- body["credential_id"] = self.credential_id
1961
- if self.git_provider is not None:
1962
- body["git_provider"] = self.git_provider
1963
- if self.git_username is not None:
1964
- body["git_username"] = self.git_username
1965
- if self.personal_access_token is not None:
1966
- body["personal_access_token"] = self.personal_access_token
1967
- return body
1968
-
1969
- def as_shallow_dict(self) -> dict:
1970
- """Serializes the UpdateCredentialsRequest into a shallow dictionary of its immediate attributes."""
1971
- body = {}
1972
- if self.credential_id is not None:
1973
- body["credential_id"] = self.credential_id
1974
- if self.git_provider is not None:
1975
- body["git_provider"] = self.git_provider
1976
- if self.git_username is not None:
1977
- body["git_username"] = self.git_username
1978
- if self.personal_access_token is not None:
1979
- body["personal_access_token"] = self.personal_access_token
1980
- return body
1981
-
1982
- @classmethod
1983
- def from_dict(cls, d: Dict[str, Any]) -> UpdateCredentialsRequest:
1984
- """Deserializes the UpdateCredentialsRequest from a dictionary."""
1985
- return cls(
1986
- credential_id=d.get("credential_id", None),
1987
- git_provider=d.get("git_provider", None),
1988
- git_username=d.get("git_username", None),
1989
- personal_access_token=d.get("personal_access_token", None),
1990
- )
1991
-
1992
-
1993
1487
  @dataclass
1994
1488
  class UpdateCredentialsResponse:
1995
1489
  def as_dict(self) -> dict:
@@ -2008,60 +1502,6 @@ class UpdateCredentialsResponse:
2008
1502
  return cls()
2009
1503
 
2010
1504
 
2011
- @dataclass
2012
- class UpdateRepoRequest:
2013
- branch: Optional[str] = None
2014
- """Branch that the local version of the repo is checked out to."""
2015
-
2016
- repo_id: Optional[int] = None
2017
- """ID of the Git folder (repo) object in the workspace."""
2018
-
2019
- sparse_checkout: Optional[SparseCheckoutUpdate] = None
2020
- """If specified, update the sparse checkout settings. The update will fail if sparse checkout is
2021
- not enabled for the repo."""
2022
-
2023
- tag: Optional[str] = None
2024
- """Tag that the local version of the repo is checked out to. Updating the repo to a tag puts the
2025
- repo in a detached HEAD state. Before committing new changes, you must update the repo to a
2026
- branch instead of the detached HEAD."""
2027
-
2028
- def as_dict(self) -> dict:
2029
- """Serializes the UpdateRepoRequest into a dictionary suitable for use as a JSON request body."""
2030
- body = {}
2031
- if self.branch is not None:
2032
- body["branch"] = self.branch
2033
- if self.repo_id is not None:
2034
- body["repo_id"] = self.repo_id
2035
- if self.sparse_checkout:
2036
- body["sparse_checkout"] = self.sparse_checkout.as_dict()
2037
- if self.tag is not None:
2038
- body["tag"] = self.tag
2039
- return body
2040
-
2041
- def as_shallow_dict(self) -> dict:
2042
- """Serializes the UpdateRepoRequest into a shallow dictionary of its immediate attributes."""
2043
- body = {}
2044
- if self.branch is not None:
2045
- body["branch"] = self.branch
2046
- if self.repo_id is not None:
2047
- body["repo_id"] = self.repo_id
2048
- if self.sparse_checkout:
2049
- body["sparse_checkout"] = self.sparse_checkout
2050
- if self.tag is not None:
2051
- body["tag"] = self.tag
2052
- return body
2053
-
2054
- @classmethod
2055
- def from_dict(cls, d: Dict[str, Any]) -> UpdateRepoRequest:
2056
- """Deserializes the UpdateRepoRequest from a dictionary."""
2057
- return cls(
2058
- branch=d.get("branch", None),
2059
- repo_id=d.get("repo_id", None),
2060
- sparse_checkout=_from_dict(d, "sparse_checkout", SparseCheckoutUpdate),
2061
- tag=d.get("tag", None),
2062
- )
2063
-
2064
-
2065
1505
  @dataclass
2066
1506
  class UpdateRepoResponse:
2067
1507
  def as_dict(self) -> dict:
@@ -2311,48 +1751,6 @@ class WorkspaceObjectPermissionsDescription:
2311
1751
  )
2312
1752
 
2313
1753
 
2314
- @dataclass
2315
- class WorkspaceObjectPermissionsRequest:
2316
- access_control_list: Optional[List[WorkspaceObjectAccessControlRequest]] = None
2317
-
2318
- workspace_object_id: Optional[str] = None
2319
- """The workspace object for which to get or manage permissions."""
2320
-
2321
- workspace_object_type: Optional[str] = None
2322
- """The workspace object type for which to get or manage permissions."""
2323
-
2324
- def as_dict(self) -> dict:
2325
- """Serializes the WorkspaceObjectPermissionsRequest into a dictionary suitable for use as a JSON request body."""
2326
- body = {}
2327
- if self.access_control_list:
2328
- body["access_control_list"] = [v.as_dict() for v in self.access_control_list]
2329
- if self.workspace_object_id is not None:
2330
- body["workspace_object_id"] = self.workspace_object_id
2331
- if self.workspace_object_type is not None:
2332
- body["workspace_object_type"] = self.workspace_object_type
2333
- return body
2334
-
2335
- def as_shallow_dict(self) -> dict:
2336
- """Serializes the WorkspaceObjectPermissionsRequest into a shallow dictionary of its immediate attributes."""
2337
- body = {}
2338
- if self.access_control_list:
2339
- body["access_control_list"] = self.access_control_list
2340
- if self.workspace_object_id is not None:
2341
- body["workspace_object_id"] = self.workspace_object_id
2342
- if self.workspace_object_type is not None:
2343
- body["workspace_object_type"] = self.workspace_object_type
2344
- return body
2345
-
2346
- @classmethod
2347
- def from_dict(cls, d: Dict[str, Any]) -> WorkspaceObjectPermissionsRequest:
2348
- """Deserializes the WorkspaceObjectPermissionsRequest from a dictionary."""
2349
- return cls(
2350
- access_control_list=_repeated_dict(d, "access_control_list", WorkspaceObjectAccessControlRequest),
2351
- workspace_object_id=d.get("workspace_object_id", None),
2352
- workspace_object_type=d.get("workspace_object_type", None),
2353
- )
2354
-
2355
-
2356
1754
  class GitCredentialsAPI:
2357
1755
  """Registers personal access token for Databricks to do operations on behalf of the user.
2358
1756
 
@@ -2364,7 +1762,13 @@ class GitCredentialsAPI:
2364
1762
  self._api = api_client
2365
1763
 
2366
1764
  def create(
2367
- self, git_provider: str, *, git_username: Optional[str] = None, personal_access_token: Optional[str] = None
1765
+ self,
1766
+ git_provider: str,
1767
+ *,
1768
+ git_username: Optional[str] = None,
1769
+ is_default_for_provider: Optional[bool] = None,
1770
+ name: Optional[str] = None,
1771
+ personal_access_token: Optional[str] = None,
2368
1772
  ) -> CreateCredentialsResponse:
2369
1773
  """Creates a Git credential entry for the user. Only one Git credential per user is supported, so any
2370
1774
  attempts to create credentials if an entry already exists will fail. Use the PATCH endpoint to update
@@ -2380,6 +1784,10 @@ class GitCredentialsAPI:
2380
1784
  be used. For GitLab, GitLab Enterprise Edition, email must be used. For AWS CodeCommit, BitBucket or
2381
1785
  BitBucket Server, username must be used. For all other providers please see your provider's Personal
2382
1786
  Access Token authentication documentation to see what is supported.
1787
+ :param is_default_for_provider: bool (optional)
1788
+ if the credential is the default for the given provider
1789
+ :param name: str (optional)
1790
+ the name of the git credential, used for identification and ease of lookup
2383
1791
  :param personal_access_token: str (optional)
2384
1792
  The personal access token used to authenticate to the corresponding Git provider. For certain
2385
1793
  providers, support may exist for other types of scoped access tokens. [Learn more].
@@ -2393,6 +1801,10 @@ class GitCredentialsAPI:
2393
1801
  body["git_provider"] = git_provider
2394
1802
  if git_username is not None:
2395
1803
  body["git_username"] = git_username
1804
+ if is_default_for_provider is not None:
1805
+ body["is_default_for_provider"] = is_default_for_provider
1806
+ if name is not None:
1807
+ body["name"] = name
2396
1808
  if personal_access_token is not None:
2397
1809
  body["personal_access_token"] = personal_access_token
2398
1810
  headers = {
@@ -2455,6 +1867,8 @@ class GitCredentialsAPI:
2455
1867
  git_provider: str,
2456
1868
  *,
2457
1869
  git_username: Optional[str] = None,
1870
+ is_default_for_provider: Optional[bool] = None,
1871
+ name: Optional[str] = None,
2458
1872
  personal_access_token: Optional[str] = None,
2459
1873
  ):
2460
1874
  """Updates the specified Git credential.
@@ -2471,6 +1885,10 @@ class GitCredentialsAPI:
2471
1885
  be used. For GitLab, GitLab Enterprise Edition, email must be used. For AWS CodeCommit, BitBucket or
2472
1886
  BitBucket Server, username must be used. For all other providers please see your provider's Personal
2473
1887
  Access Token authentication documentation to see what is supported.
1888
+ :param is_default_for_provider: bool (optional)
1889
+ if the credential is the default for the given provider
1890
+ :param name: str (optional)
1891
+ the name of the git credential, used for identification and ease of lookup
2474
1892
  :param personal_access_token: str (optional)
2475
1893
  The personal access token used to authenticate to the corresponding Git provider. For certain
2476
1894
  providers, support may exist for other types of scoped access tokens. [Learn more].
@@ -2484,6 +1902,10 @@ class GitCredentialsAPI:
2484
1902
  body["git_provider"] = git_provider
2485
1903
  if git_username is not None:
2486
1904
  body["git_username"] = git_username
1905
+ if is_default_for_provider is not None:
1906
+ body["is_default_for_provider"] = is_default_for_provider
1907
+ if name is not None:
1908
+ body["name"] = name
2487
1909
  if personal_access_token is not None:
2488
1910
  body["personal_access_token"] = personal_access_token
2489
1911
  headers = {
@@ -2749,17 +2171,47 @@ class SecretsAPI:
2749
2171
  initial_manage_principal: Optional[str] = None,
2750
2172
  scope_backend_type: Optional[ScopeBackendType] = None,
2751
2173
  ):
2752
- """The scope name must consist of alphanumeric characters, dashes, underscores, and periods, and may not
2174
+ """Creates a new secret scope.
2175
+
2176
+ The scope name must consist of alphanumeric characters, dashes, underscores, and periods, and may not
2753
2177
  exceed 128 characters.
2754
2178
 
2179
+ Example request:
2180
+
2181
+ .. code::
2182
+
2183
+ { "scope": "my-simple-databricks-scope", "initial_manage_principal": "users" "scope_backend_type":
2184
+ "databricks|azure_keyvault", # below is only required if scope type is azure_keyvault
2185
+ "backend_azure_keyvault": { "resource_id":
2186
+ "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/xxxx/providers/Microsoft.KeyVault/vaults/xxxx",
2187
+ "tenant_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "dns_name": "https://xxxx.vault.azure.net/", } }
2188
+
2189
+ If ``initial_manage_principal`` is specified, the initial ACL applied to the scope is applied to the
2190
+ supplied principal (user or group) with ``MANAGE`` permissions. The only supported principal for this
2191
+ option is the group ``users``, which contains all users in the workspace. If
2192
+ ``initial_manage_principal`` is not specified, the initial ACL with ``MANAGE`` permission applied to
2193
+ the scope is assigned to the API request issuer's user identity.
2194
+
2195
+ If ``scope_backend_type`` is ``azure_keyvault``, a secret scope is created with secrets from a given
2196
+ Azure KeyVault. The caller must provide the keyvault_resource_id and the tenant_id for the key vault.
2197
+ If ``scope_backend_type`` is ``databricks`` or is unspecified, an empty secret scope is created and
2198
+ stored in Databricks's own storage.
2199
+
2200
+ Throws ``RESOURCE_ALREADY_EXISTS`` if a scope with the given name already exists. Throws
2201
+ ``RESOURCE_LIMIT_EXCEEDED`` if maximum number of scopes in the workspace is exceeded. Throws
2202
+ ``INVALID_PARAMETER_VALUE`` if the scope name is invalid. Throws ``BAD_REQUEST`` if request violated
2203
+ constraints. Throws ``CUSTOMER_UNAUTHORIZED`` if normal user attempts to create a scope with name
2204
+ reserved for databricks internal usage. Throws ``UNAUTHENTICATED`` if unable to verify user access
2205
+ permission on Azure KeyVault
2206
+
2755
2207
  :param scope: str
2756
2208
  Scope name requested by the user. Scope names are unique.
2757
2209
  :param backend_azure_keyvault: :class:`AzureKeyVaultSecretScopeMetadata` (optional)
2758
- The metadata for the secret scope if the type is `AZURE_KEYVAULT`
2210
+ The metadata for the secret scope if the type is ``AZURE_KEYVAULT``
2759
2211
  :param initial_manage_principal: str (optional)
2760
- The principal that is initially granted `MANAGE` permission to the created scope.
2212
+ The principal that is initially granted ``MANAGE`` permission to the created scope.
2761
2213
  :param scope_backend_type: :class:`ScopeBackendType` (optional)
2762
- The backend type the scope will be created with. If not specified, will default to `DATABRICKS`
2214
+ The backend type the scope will be created with. If not specified, will default to ``DATABRICKS``
2763
2215
 
2764
2216
 
2765
2217
  """
@@ -2773,7 +2225,6 @@ class SecretsAPI:
2773
2225
  if scope_backend_type is not None:
2774
2226
  body["scope_backend_type"] = scope_backend_type.value
2775
2227
  headers = {
2776
- "Accept": "application/json",
2777
2228
  "Content-Type": "application/json",
2778
2229
  }
2779
2230
 
@@ -2782,9 +2233,17 @@ class SecretsAPI:
2782
2233
  def delete_acl(self, scope: str, principal: str):
2783
2234
  """Deletes the given ACL on the given scope.
2784
2235
 
2785
- Users must have the `MANAGE` permission to invoke this API. Throws `RESOURCE_DOES_NOT_EXIST` if no
2786
- such secret scope, principal, or ACL exists. Throws `PERMISSION_DENIED` if the user does not have
2787
- permission to make this API call.
2236
+ Users must have the ``MANAGE`` permission to invoke this API.
2237
+
2238
+ Example request:
2239
+
2240
+ .. code::
2241
+
2242
+ { "scope": "my-secret-scope", "principal": "data-scientists" }
2243
+
2244
+ Throws ``RESOURCE_DOES_NOT_EXIST`` if no such secret scope, principal, or ACL exists. Throws
2245
+ ``PERMISSION_DENIED`` if the user does not have permission to make this API call. Throws
2246
+ ``INVALID_PARAMETER_VALUE`` if the permission or principal is invalid.
2788
2247
 
2789
2248
  :param scope: str
2790
2249
  The name of the scope to remove permissions from.
@@ -2799,7 +2258,6 @@ class SecretsAPI:
2799
2258
  if scope is not None:
2800
2259
  body["scope"] = scope
2801
2260
  headers = {
2802
- "Accept": "application/json",
2803
2261
  "Content-Type": "application/json",
2804
2262
  }
2805
2263
 
@@ -2808,8 +2266,15 @@ class SecretsAPI:
2808
2266
  def delete_scope(self, scope: str):
2809
2267
  """Deletes a secret scope.
2810
2268
 
2811
- Throws `RESOURCE_DOES_NOT_EXIST` if the scope does not exist. Throws `PERMISSION_DENIED` if the user
2812
- does not have permission to make this API call.
2269
+ Example request:
2270
+
2271
+ .. code::
2272
+
2273
+ { "scope": "my-secret-scope" }
2274
+
2275
+ Throws ``RESOURCE_DOES_NOT_EXIST`` if the scope does not exist. Throws ``PERMISSION_DENIED`` if the
2276
+ user does not have permission to make this API call. Throws ``BAD_REQUEST`` if system user attempts to
2277
+ delete internal secret scope.
2813
2278
 
2814
2279
  :param scope: str
2815
2280
  Name of the scope to delete.
@@ -2820,18 +2285,25 @@ class SecretsAPI:
2820
2285
  if scope is not None:
2821
2286
  body["scope"] = scope
2822
2287
  headers = {
2823
- "Accept": "application/json",
2824
2288
  "Content-Type": "application/json",
2825
2289
  }
2826
2290
 
2827
2291
  self._api.do("POST", "/api/2.0/secrets/scopes/delete", body=body, headers=headers)
2828
2292
 
2829
2293
  def delete_secret(self, scope: str, key: str):
2830
- """Deletes the secret stored in this secret scope. You must have `WRITE` or `MANAGE` permission on the
2831
- secret scope.
2294
+ """Deletes the secret stored in this secret scope. You must have ``WRITE`` or ``MANAGE`` permission on
2295
+ the Secret Scope.
2832
2296
 
2833
- Throws `RESOURCE_DOES_NOT_EXIST` if no such secret scope or secret exists. Throws `PERMISSION_DENIED`
2834
- if the user does not have permission to make this API call.
2297
+ Example request:
2298
+
2299
+ .. code::
2300
+
2301
+ { "scope": "my-secret-scope", "key": "my-secret-key" }
2302
+
2303
+ Throws ``RESOURCE_DOES_NOT_EXIST`` if no such secret scope or secret exists. Throws
2304
+ ``PERMISSION_DENIED`` if the user does not have permission to make this API call. Throws
2305
+ ``BAD_REQUEST`` if system user attempts to delete an internal secret, or request is made against Azure
2306
+ KeyVault backed scope.
2835
2307
 
2836
2308
  :param scope: str
2837
2309
  The name of the scope that contains the secret to delete.
@@ -2853,11 +2325,19 @@ class SecretsAPI:
2853
2325
  self._api.do("POST", "/api/2.0/secrets/delete", body=body, headers=headers)
2854
2326
 
2855
2327
  def get_acl(self, scope: str, principal: str) -> AclItem:
2856
- """Gets the details about the given ACL, such as the group and permission. Users must have the `MANAGE`
2857
- permission to invoke this API.
2328
+ """Describes the details about the given ACL, such as the group and permission.
2858
2329
 
2859
- Throws `RESOURCE_DOES_NOT_EXIST` if no such secret scope exists. Throws `PERMISSION_DENIED` if the
2860
- user does not have permission to make this API call.
2330
+ Users must have the ``MANAGE`` permission to invoke this API.
2331
+
2332
+ Example response:
2333
+
2334
+ .. code::
2335
+
2336
+ { "principal": "data-scientists", "permission": "READ" }
2337
+
2338
+ Throws ``RESOURCE_DOES_NOT_EXIST`` if no such secret scope exists. Throws ``PERMISSION_DENIED`` if the
2339
+ user does not have permission to make this API call. Throws ``INVALID_PARAMETER_VALUE`` if the
2340
+ permission or principal is invalid.
2861
2341
 
2862
2342
  :param scope: str
2863
2343
  The name of the scope to fetch ACL information from.
@@ -2880,20 +2360,35 @@ class SecretsAPI:
2880
2360
  return AclItem.from_dict(res)
2881
2361
 
2882
2362
  def get_secret(self, scope: str, key: str) -> GetSecretResponse:
2883
- """Gets the bytes representation of a secret value for the specified scope and key.
2363
+ """Gets a secret for a given key and scope. This API can only be called from the DBUtils interface. Users
2364
+ need the READ permission to make this call.
2365
+
2366
+ Example response:
2884
2367
 
2885
- Users need the READ permission to make this call.
2368
+ .. code::
2369
+
2370
+ { "key": "my-string-key", "value": <bytes of the secret value> }
2886
2371
 
2887
2372
  Note that the secret value returned is in bytes. The interpretation of the bytes is determined by the
2888
2373
  caller in DBUtils and the type the data is decoded into.
2889
2374
 
2890
- Throws ``PERMISSION_DENIED`` if the user does not have permission to make this API call. Throws
2891
- ``RESOURCE_DOES_NOT_EXIST`` if no such secret or secret scope exists.
2375
+ Throws ``RESOURCE_DOES_NOT_EXIST`` if no such secret or secret scope exists. Throws
2376
+ ``PERMISSION_DENIED`` if the user does not have permission to make this API call.
2377
+
2378
+ Note: This is explicitly an undocumented API. It also doesn't need to be supported for the /preview
2379
+ prefix, because it's not a customer-facing API (i.e. only used for DBUtils SecretUtils to fetch
2380
+ secrets).
2381
+
2382
+ Throws ``RESOURCE_DOES_NOT_EXIST`` if no such secret scope or secret exists. Throws ``BAD_REQUEST`` if
2383
+ normal user calls get secret outside of a notebook. AKV specific errors: Throws
2384
+ ``INVALID_PARAMETER_VALUE`` if secret name is not alphanumeric or too long. Throws
2385
+ ``PERMISSION_DENIED`` if secret manager cannot access AKV with 403 error Throws ``MALFORMED_REQUEST``
2386
+ if secret manager cannot access AKV with any other 4xx error
2892
2387
 
2893
2388
  :param scope: str
2894
- The name of the scope to fetch secret information from.
2389
+ The name of the scope that contains the secret.
2895
2390
  :param key: str
2896
- The key to fetch secret for.
2391
+ Name of the secret to fetch value information.
2897
2392
 
2898
2393
  :returns: :class:`GetSecretResponse`
2899
2394
  """
@@ -2911,9 +2406,18 @@ class SecretsAPI:
2911
2406
  return GetSecretResponse.from_dict(res)
2912
2407
 
2913
2408
  def list_acls(self, scope: str) -> Iterator[AclItem]:
2914
- """List the ACLs for a given secret scope. Users must have the `MANAGE` permission to invoke this API.
2409
+ """Lists the ACLs set on the given scope.
2410
+
2411
+ Users must have the ``MANAGE`` permission to invoke this API.
2412
+
2413
+ Example response:
2915
2414
 
2916
- Throws `RESOURCE_DOES_NOT_EXIST` if no such secret scope exists. Throws `PERMISSION_DENIED` if the
2415
+ .. code::
2416
+
2417
+ { "acls": [{ "principal": "admins", "permission": "MANAGE" },{ "principal": "data-scientists",
2418
+ "permission": "READ" }] }
2419
+
2420
+ Throws ``RESOURCE_DOES_NOT_EXIST`` if no such secret scope exists. Throws ``PERMISSION_DENIED`` if the
2917
2421
  user does not have permission to make this API call.
2918
2422
 
2919
2423
  :param scope: str
@@ -2936,7 +2440,14 @@ class SecretsAPI:
2936
2440
  def list_scopes(self) -> Iterator[SecretScope]:
2937
2441
  """Lists all secret scopes available in the workspace.
2938
2442
 
2939
- Throws `PERMISSION_DENIED` if the user does not have permission to make this API call.
2443
+ Example response:
2444
+
2445
+ .. code::
2446
+
2447
+ { "scopes": [{ "name": "my-databricks-scope", "backend_type": "DATABRICKS" },{ "name": "mount-points",
2448
+ "backend_type": "DATABRICKS" }] }
2449
+
2450
+ Throws ``PERMISSION_DENIED`` if the user does not have permission to make this API call.
2940
2451
 
2941
2452
 
2942
2453
  :returns: Iterator over :class:`SecretScope`
@@ -2954,9 +2465,17 @@ class SecretsAPI:
2954
2465
  """Lists the secret keys that are stored at this scope. This is a metadata-only operation; secret data
2955
2466
  cannot be retrieved using this API. Users need the READ permission to make this call.
2956
2467
 
2957
- The lastUpdatedTimestamp returned is in milliseconds since epoch. Throws `RESOURCE_DOES_NOT_EXIST` if
2958
- no such secret scope exists. Throws `PERMISSION_DENIED` if the user does not have permission to make
2959
- this API call.
2468
+ Example response:
2469
+
2470
+ .. code::
2471
+
2472
+ { "secrets": [ { "key": "my-string-key"", "last_updated_timestamp": "1520467595000" }, { "key":
2473
+ "my-byte-key", "last_updated_timestamp": "1520467595000" }, ] }
2474
+
2475
+ The lastUpdatedTimestamp returned is in milliseconds since epoch.
2476
+
2477
+ Throws ``RESOURCE_DOES_NOT_EXIST`` if no such secret scope exists. Throws ``PERMISSION_DENIED`` if the
2478
+ user does not have permission to make this API call.
2960
2479
 
2961
2480
  :param scope: str
2962
2481
  The name of the scope to list secrets within.
@@ -2976,14 +2495,12 @@ class SecretsAPI:
2976
2495
  return parsed if parsed is not None else []
2977
2496
 
2978
2497
  def put_acl(self, scope: str, principal: str, permission: AclPermission):
2979
- """Creates or overwrites the Access Control List (ACL) associated with the given principal (user or
2980
- group) on the specified scope point.
2498
+ """Creates or overwrites the ACL associated with the given principal (user or group) on the specified
2499
+ scope point. In general, a user or group will use the most powerful permission available to them, and
2500
+ permissions are ordered as follows:
2981
2501
 
2982
- In general, a user or group will use the most powerful permission available to them, and permissions
2983
- are ordered as follows:
2984
-
2985
- * `MANAGE` - Allowed to change ACLs, and read and write to this secret scope. * `WRITE` - Allowed to
2986
- read and write to this secret scope. * `READ` - Allowed to read this secret scope and list what
2502
+ * ``MANAGE`` - Allowed to change ACLs, and read and write to this secret scope. * ``WRITE`` - Allowed
2503
+ to read and write to this secret scope. * ``READ`` - Allowed to read this secret scope and list what
2987
2504
  secrets are available.
2988
2505
 
2989
2506
  Note that in general, secret values can only be read from within a command on a cluster (for example,
@@ -2991,15 +2508,21 @@ class SecretsAPI:
2991
2508
  However, the user's permission will be applied based on who is executing the command, and they must
2992
2509
  have at least READ permission.
2993
2510
 
2994
- Users must have the `MANAGE` permission to invoke this API.
2511
+ Users must have the ``MANAGE`` permission to invoke this API.
2512
+
2513
+ Example request:
2514
+
2515
+ .. code::
2516
+
2517
+ { "scope": "my-secret-scope", "principal": "data-scientists", "permission": "READ" }
2995
2518
 
2996
2519
  The principal is a user or group name corresponding to an existing Databricks principal to be granted
2997
2520
  or revoked access.
2998
2521
 
2999
- Throws `RESOURCE_DOES_NOT_EXIST` if no such secret scope exists. Throws `RESOURCE_ALREADY_EXISTS` if a
3000
- permission for the principal already exists. Throws `INVALID_PARAMETER_VALUE` if the permission or
3001
- principal is invalid. Throws `PERMISSION_DENIED` if the user does not have permission to make this API
3002
- call.
2522
+ Throws ``RESOURCE_DOES_NOT_EXIST`` if no such secret scope exists. Throws ``RESOURCE_ALREADY_EXISTS``
2523
+ if a permission for the principal already exists. Throws ``INVALID_PARAMETER_VALUE`` if the permission
2524
+ or principal is invalid. Throws ``PERMISSION_DENIED`` if the user does not have permission to make
2525
+ this API call.
3003
2526
 
3004
2527
  :param scope: str
3005
2528
  The name of the scope to apply permissions to.
@@ -3018,7 +2541,6 @@ class SecretsAPI:
3018
2541
  if scope is not None:
3019
2542
  body["scope"] = scope
3020
2543
  headers = {
3021
- "Accept": "application/json",
3022
2544
  "Content-Type": "application/json",
3023
2545
  }
3024
2546
 
@@ -3029,19 +2551,27 @@ class SecretsAPI:
3029
2551
  ):
3030
2552
  """Inserts a secret under the provided scope with the given name. If a secret already exists with the
3031
2553
  same name, this command overwrites the existing secret's value. The server encrypts the secret using
3032
- the secret scope's encryption settings before storing it.
2554
+ the secret scope's encryption settings before storing it. You must have ``WRITE`` or ``MANAGE``
2555
+ permission on the secret scope.
2556
+
2557
+ The secret key must consist of alphanumeric characters, dashes, underscores, and periods, and cannot
2558
+ exceed 128 characters. The maximum allowed secret value size is 128 KB. The maximum number of secrets
2559
+ in a given scope is 1000.
3033
2560
 
3034
- You must have `WRITE` or `MANAGE` permission on the secret scope. The secret key must consist of
3035
- alphanumeric characters, dashes, underscores, and periods, and cannot exceed 128 characters. The
3036
- maximum allowed secret value size is 128 KB. The maximum number of secrets in a given scope is 1000.
2561
+ Example request:
2562
+
2563
+ .. code::
2564
+
2565
+ { "scope": "my-databricks-scope", "key": "my-string-key", "string_value": "foobar" }
3037
2566
 
3038
2567
  The input fields "string_value" or "bytes_value" specify the type of the secret, which will determine
3039
2568
  the value returned when the secret value is requested. Exactly one must be specified.
3040
2569
 
3041
- Throws `RESOURCE_DOES_NOT_EXIST` if no such secret scope exists. Throws `RESOURCE_LIMIT_EXCEEDED` if
3042
- maximum number of secrets in scope is exceeded. Throws `INVALID_PARAMETER_VALUE` if the key name or
3043
- value length is invalid. Throws `PERMISSION_DENIED` if the user does not have permission to make this
3044
- API call.
2570
+ Throws ``RESOURCE_DOES_NOT_EXIST`` if no such secret scope exists. Throws ``RESOURCE_LIMIT_EXCEEDED``
2571
+ if maximum number of secrets in scope is exceeded. Throws ``INVALID_PARAMETER_VALUE`` if the request
2572
+ parameters are invalid. Throws ``PERMISSION_DENIED`` if the user does not have permission to make this
2573
+ API call. Throws ``MALFORMED_REQUEST`` if request is incorrectly formatted or conflicting. Throws
2574
+ ``BAD_REQUEST`` if request is made against Azure KeyVault backed scope.
3045
2575
 
3046
2576
  :param scope: str
3047
2577
  The name of the scope to which the secret will be associated with.
@@ -3064,7 +2594,6 @@ class SecretsAPI:
3064
2594
  if string_value is not None:
3065
2595
  body["string_value"] = string_value
3066
2596
  headers = {
3067
- "Accept": "application/json",
3068
2597
  "Content-Type": "application/json",
3069
2598
  }
3070
2599