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

@@ -388,6 +388,23 @@ class ClientsTypes:
388
388
  return cls(jobs=d.get('jobs', None), notebooks=d.get('notebooks', None))
389
389
 
390
390
 
391
+ @dataclass
392
+ class CloneCluster:
393
+ source_cluster_id: str
394
+ """The cluster that is being cloned."""
395
+
396
+ def as_dict(self) -> dict:
397
+ """Serializes the CloneCluster into a dictionary suitable for use as a JSON request body."""
398
+ body = {}
399
+ if self.source_cluster_id is not None: body['source_cluster_id'] = self.source_cluster_id
400
+ return body
401
+
402
+ @classmethod
403
+ def from_dict(cls, d: Dict[str, any]) -> CloneCluster:
404
+ """Deserializes the CloneCluster from a dictionary."""
405
+ return cls(source_cluster_id=d.get('source_cluster_id', None))
406
+
407
+
391
408
  @dataclass
392
409
  class CloudProviderNodeInfo:
393
410
  status: Optional[List[CloudProviderNodeStatus]] = None
@@ -1420,6 +1437,10 @@ class ClusterSpec:
1420
1437
  """Attributes related to clusters running on Microsoft Azure. If not specified at cluster creation,
1421
1438
  a set of default values will be used."""
1422
1439
 
1440
+ clone_from: Optional[CloneCluster] = None
1441
+ """When specified, this clones libraries from a source cluster during the creation of a new
1442
+ cluster."""
1443
+
1423
1444
  cluster_log_conf: Optional[ClusterLogConf] = None
1424
1445
  """The configuration for delivering spark logs to a long-term storage destination. Two kinds of
1425
1446
  destinations (dbfs and s3) are supported. Only one destination can be specified for one cluster.
@@ -1554,6 +1575,7 @@ class ClusterSpec:
1554
1575
  body['autotermination_minutes'] = self.autotermination_minutes
1555
1576
  if self.aws_attributes: body['aws_attributes'] = self.aws_attributes.as_dict()
1556
1577
  if self.azure_attributes: body['azure_attributes'] = self.azure_attributes.as_dict()
1578
+ if self.clone_from: body['clone_from'] = self.clone_from.as_dict()
1557
1579
  if self.cluster_log_conf: body['cluster_log_conf'] = self.cluster_log_conf.as_dict()
1558
1580
  if self.cluster_name is not None: body['cluster_name'] = self.cluster_name
1559
1581
  if self.cluster_source is not None: body['cluster_source'] = self.cluster_source.value
@@ -1589,6 +1611,7 @@ class ClusterSpec:
1589
1611
  autotermination_minutes=d.get('autotermination_minutes', None),
1590
1612
  aws_attributes=_from_dict(d, 'aws_attributes', AwsAttributes),
1591
1613
  azure_attributes=_from_dict(d, 'azure_attributes', AzureAttributes),
1614
+ clone_from=_from_dict(d, 'clone_from', CloneCluster),
1592
1615
  cluster_log_conf=_from_dict(d, 'cluster_log_conf', ClusterLogConf),
1593
1616
  cluster_name=d.get('cluster_name', None),
1594
1617
  cluster_source=_enum(d, 'cluster_source', ClusterSource),
@@ -1679,29 +1702,6 @@ class CommandStatusResponse:
1679
1702
  status=_enum(d, 'status', CommandStatus))
1680
1703
 
1681
1704
 
1682
- @dataclass
1683
- class ComputeSpec:
1684
- kind: Optional[ComputeSpecKind] = None
1685
- """The kind of compute described by this compute specification."""
1686
-
1687
- def as_dict(self) -> dict:
1688
- """Serializes the ComputeSpec into a dictionary suitable for use as a JSON request body."""
1689
- body = {}
1690
- if self.kind is not None: body['kind'] = self.kind.value
1691
- return body
1692
-
1693
- @classmethod
1694
- def from_dict(cls, d: Dict[str, any]) -> ComputeSpec:
1695
- """Deserializes the ComputeSpec from a dictionary."""
1696
- return cls(kind=_enum(d, 'kind', ComputeSpecKind))
1697
-
1698
-
1699
- class ComputeSpecKind(Enum):
1700
- """The kind of compute described by this compute specification."""
1701
-
1702
- SERVERLESS_PREVIEW = 'SERVERLESS_PREVIEW'
1703
-
1704
-
1705
1705
  class ContextStatus(Enum):
1706
1706
 
1707
1707
  ERROR = 'Error'
@@ -1754,6 +1754,10 @@ class CreateCluster:
1754
1754
  """Attributes related to clusters running on Microsoft Azure. If not specified at cluster creation,
1755
1755
  a set of default values will be used."""
1756
1756
 
1757
+ clone_from: Optional[CloneCluster] = None
1758
+ """When specified, this clones libraries from a source cluster during the creation of a new
1759
+ cluster."""
1760
+
1757
1761
  cluster_log_conf: Optional[ClusterLogConf] = None
1758
1762
  """The configuration for delivering spark logs to a long-term storage destination. Two kinds of
1759
1763
  destinations (dbfs and s3) are supported. Only one destination can be specified for one cluster.
@@ -1884,6 +1888,7 @@ class CreateCluster:
1884
1888
  body['autotermination_minutes'] = self.autotermination_minutes
1885
1889
  if self.aws_attributes: body['aws_attributes'] = self.aws_attributes.as_dict()
1886
1890
  if self.azure_attributes: body['azure_attributes'] = self.azure_attributes.as_dict()
1891
+ if self.clone_from: body['clone_from'] = self.clone_from.as_dict()
1887
1892
  if self.cluster_log_conf: body['cluster_log_conf'] = self.cluster_log_conf.as_dict()
1888
1893
  if self.cluster_name is not None: body['cluster_name'] = self.cluster_name
1889
1894
  if self.cluster_source is not None: body['cluster_source'] = self.cluster_source.value
@@ -1919,6 +1924,7 @@ class CreateCluster:
1919
1924
  autotermination_minutes=d.get('autotermination_minutes', None),
1920
1925
  aws_attributes=_from_dict(d, 'aws_attributes', AwsAttributes),
1921
1926
  azure_attributes=_from_dict(d, 'azure_attributes', AzureAttributes),
1927
+ clone_from=_from_dict(d, 'clone_from', CloneCluster),
1922
1928
  cluster_log_conf=_from_dict(d, 'cluster_log_conf', ClusterLogConf),
1923
1929
  cluster_name=d.get('cluster_name', None),
1924
1930
  cluster_source=_enum(d, 'cluster_source', ClusterSource),
@@ -2592,6 +2598,10 @@ class EditCluster:
2592
2598
  """Attributes related to clusters running on Microsoft Azure. If not specified at cluster creation,
2593
2599
  a set of default values will be used."""
2594
2600
 
2601
+ clone_from: Optional[CloneCluster] = None
2602
+ """When specified, this clones libraries from a source cluster during the creation of a new
2603
+ cluster."""
2604
+
2595
2605
  cluster_log_conf: Optional[ClusterLogConf] = None
2596
2606
  """The configuration for delivering spark logs to a long-term storage destination. Two kinds of
2597
2607
  destinations (dbfs and s3) are supported. Only one destination can be specified for one cluster.
@@ -2722,6 +2732,7 @@ class EditCluster:
2722
2732
  body['autotermination_minutes'] = self.autotermination_minutes
2723
2733
  if self.aws_attributes: body['aws_attributes'] = self.aws_attributes.as_dict()
2724
2734
  if self.azure_attributes: body['azure_attributes'] = self.azure_attributes.as_dict()
2735
+ if self.clone_from: body['clone_from'] = self.clone_from.as_dict()
2725
2736
  if self.cluster_id is not None: body['cluster_id'] = self.cluster_id
2726
2737
  if self.cluster_log_conf: body['cluster_log_conf'] = self.cluster_log_conf.as_dict()
2727
2738
  if self.cluster_name is not None: body['cluster_name'] = self.cluster_name
@@ -2758,6 +2769,7 @@ class EditCluster:
2758
2769
  autotermination_minutes=d.get('autotermination_minutes', None),
2759
2770
  aws_attributes=_from_dict(d, 'aws_attributes', AwsAttributes),
2760
2771
  azure_attributes=_from_dict(d, 'azure_attributes', AzureAttributes),
2772
+ clone_from=_from_dict(d, 'clone_from', CloneCluster),
2761
2773
  cluster_id=d.get('cluster_id', None),
2762
2774
  cluster_log_conf=_from_dict(d, 'cluster_log_conf', ClusterLogConf),
2763
2775
  cluster_name=d.get('cluster_name', None),
@@ -2969,6 +2981,37 @@ class EditResponse:
2969
2981
  return cls()
2970
2982
 
2971
2983
 
2984
+ @dataclass
2985
+ class Environment:
2986
+ """The a environment entity used to preserve serverless environment side panel and jobs'
2987
+ environment for non-notebook task. In this minimal environment spec, only pip dependencies are
2988
+ supported. Next ID: 5"""
2989
+
2990
+ client: str
2991
+ """* User-friendly name for the client version: “client”: “1” The version is a string,
2992
+ consisting of the major client version"""
2993
+
2994
+ dependencies: Optional[List[str]] = None
2995
+ """List of pip dependencies, as supported by the version of pip in this environment. Each
2996
+ dependency is a pip requirement file line
2997
+ https://pip.pypa.io/en/stable/reference/requirements-file-format/ Allowed dependency could be
2998
+ <requirement specifier>, <archive url/path>, <local project path>(WSFS or Volumes in
2999
+ Databricks), <vcs project url> E.g. dependencies: ["foo==0.0.1", "-r
3000
+ /Workspace/test/requirements.txt"]"""
3001
+
3002
+ def as_dict(self) -> dict:
3003
+ """Serializes the Environment into a dictionary suitable for use as a JSON request body."""
3004
+ body = {}
3005
+ if self.client is not None: body['client'] = self.client
3006
+ if self.dependencies: body['dependencies'] = [v for v in self.dependencies]
3007
+ return body
3008
+
3009
+ @classmethod
3010
+ def from_dict(cls, d: Dict[str, any]) -> Environment:
3011
+ """Deserializes the Environment from a dictionary."""
3012
+ return cls(client=d.get('client', None), dependencies=d.get('dependencies', None))
3013
+
3014
+
2972
3015
  @dataclass
2973
3016
  class EventDetails:
2974
3017
  attributes: Optional[ClusterAttributes] = None
@@ -6208,6 +6251,7 @@ class ClustersAPI:
6208
6251
  autotermination_minutes: Optional[int] = None,
6209
6252
  aws_attributes: Optional[AwsAttributes] = None,
6210
6253
  azure_attributes: Optional[AzureAttributes] = None,
6254
+ clone_from: Optional[CloneCluster] = None,
6211
6255
  cluster_log_conf: Optional[ClusterLogConf] = None,
6212
6256
  cluster_name: Optional[str] = None,
6213
6257
  cluster_source: Optional[ClusterSource] = None,
@@ -6256,6 +6300,8 @@ class ClustersAPI:
6256
6300
  :param azure_attributes: :class:`AzureAttributes` (optional)
6257
6301
  Attributes related to clusters running on Microsoft Azure. If not specified at cluster creation, a
6258
6302
  set of default values will be used.
6303
+ :param clone_from: :class:`CloneCluster` (optional)
6304
+ When specified, this clones libraries from a source cluster during the creation of a new cluster.
6259
6305
  :param cluster_log_conf: :class:`ClusterLogConf` (optional)
6260
6306
  The configuration for delivering spark logs to a long-term storage destination. Two kinds of
6261
6307
  destinations (dbfs and s3) are supported. Only one destination can be specified for one cluster. If
@@ -6364,6 +6410,7 @@ class ClustersAPI:
6364
6410
  if autotermination_minutes is not None: body['autotermination_minutes'] = autotermination_minutes
6365
6411
  if aws_attributes is not None: body['aws_attributes'] = aws_attributes.as_dict()
6366
6412
  if azure_attributes is not None: body['azure_attributes'] = azure_attributes.as_dict()
6413
+ if clone_from is not None: body['clone_from'] = clone_from.as_dict()
6367
6414
  if cluster_log_conf is not None: body['cluster_log_conf'] = cluster_log_conf.as_dict()
6368
6415
  if cluster_name is not None: body['cluster_name'] = cluster_name
6369
6416
  if cluster_source is not None: body['cluster_source'] = cluster_source.value
@@ -6404,6 +6451,7 @@ class ClustersAPI:
6404
6451
  autotermination_minutes: Optional[int] = None,
6405
6452
  aws_attributes: Optional[AwsAttributes] = None,
6406
6453
  azure_attributes: Optional[AzureAttributes] = None,
6454
+ clone_from: Optional[CloneCluster] = None,
6407
6455
  cluster_log_conf: Optional[ClusterLogConf] = None,
6408
6456
  cluster_name: Optional[str] = None,
6409
6457
  cluster_source: Optional[ClusterSource] = None,
@@ -6432,6 +6480,7 @@ class ClustersAPI:
6432
6480
  autotermination_minutes=autotermination_minutes,
6433
6481
  aws_attributes=aws_attributes,
6434
6482
  azure_attributes=azure_attributes,
6483
+ clone_from=clone_from,
6435
6484
  cluster_log_conf=cluster_log_conf,
6436
6485
  cluster_name=cluster_name,
6437
6486
  cluster_source=cluster_source,
@@ -6491,6 +6540,7 @@ class ClustersAPI:
6491
6540
  autotermination_minutes: Optional[int] = None,
6492
6541
  aws_attributes: Optional[AwsAttributes] = None,
6493
6542
  azure_attributes: Optional[AzureAttributes] = None,
6543
+ clone_from: Optional[CloneCluster] = None,
6494
6544
  cluster_log_conf: Optional[ClusterLogConf] = None,
6495
6545
  cluster_name: Optional[str] = None,
6496
6546
  cluster_source: Optional[ClusterSource] = None,
@@ -6546,6 +6596,8 @@ class ClustersAPI:
6546
6596
  :param azure_attributes: :class:`AzureAttributes` (optional)
6547
6597
  Attributes related to clusters running on Microsoft Azure. If not specified at cluster creation, a
6548
6598
  set of default values will be used.
6599
+ :param clone_from: :class:`CloneCluster` (optional)
6600
+ When specified, this clones libraries from a source cluster during the creation of a new cluster.
6549
6601
  :param cluster_log_conf: :class:`ClusterLogConf` (optional)
6550
6602
  The configuration for delivering spark logs to a long-term storage destination. Two kinds of
6551
6603
  destinations (dbfs and s3) are supported. Only one destination can be specified for one cluster. If
@@ -6654,6 +6706,7 @@ class ClustersAPI:
6654
6706
  if autotermination_minutes is not None: body['autotermination_minutes'] = autotermination_minutes
6655
6707
  if aws_attributes is not None: body['aws_attributes'] = aws_attributes.as_dict()
6656
6708
  if azure_attributes is not None: body['azure_attributes'] = azure_attributes.as_dict()
6709
+ if clone_from is not None: body['clone_from'] = clone_from.as_dict()
6657
6710
  if cluster_id is not None: body['cluster_id'] = cluster_id
6658
6711
  if cluster_log_conf is not None: body['cluster_log_conf'] = cluster_log_conf.as_dict()
6659
6712
  if cluster_name is not None: body['cluster_name'] = cluster_name
@@ -6696,6 +6749,7 @@ class ClustersAPI:
6696
6749
  autotermination_minutes: Optional[int] = None,
6697
6750
  aws_attributes: Optional[AwsAttributes] = None,
6698
6751
  azure_attributes: Optional[AzureAttributes] = None,
6752
+ clone_from: Optional[CloneCluster] = None,
6699
6753
  cluster_log_conf: Optional[ClusterLogConf] = None,
6700
6754
  cluster_name: Optional[str] = None,
6701
6755
  cluster_source: Optional[ClusterSource] = None,
@@ -6724,6 +6778,7 @@ class ClustersAPI:
6724
6778
  autotermination_minutes=autotermination_minutes,
6725
6779
  aws_attributes=aws_attributes,
6726
6780
  azure_attributes=azure_attributes,
6781
+ clone_from=clone_from,
6727
6782
  cluster_id=cluster_id,
6728
6783
  cluster_log_conf=cluster_log_conf,
6729
6784
  cluster_name=cluster_name,
@@ -890,7 +890,7 @@ class PermissionsRequest:
890
890
  request_object_type: Optional[str] = None
891
891
  """The type of the request object. Can be one of the following: authorization, clusters,
892
892
  cluster-policies, directories, experiments, files, instance-pools, jobs, notebooks, pipelines,
893
- registered-models, repos, serving-endpoints, or sql-warehouses."""
893
+ registered-models, repos, serving-endpoints, or warehouses."""
894
894
 
895
895
  def as_dict(self) -> dict:
896
896
  """Serializes the PermissionsRequest into a dictionary suitable for use as a JSON request body."""
@@ -915,7 +915,7 @@ class PrincipalOutput:
915
915
  """The display name of the principal."""
916
916
 
917
917
  group_name: Optional[str] = None
918
- """The group name of the groupl. Present only if the principal is a group."""
918
+ """The group name of the group. Present only if the principal is a group."""
919
919
 
920
920
  principal_id: Optional[int] = None
921
921
  """The unique, opaque id of the principal."""
@@ -1135,7 +1135,9 @@ class UpdateRuleSetRequest:
1135
1135
  @dataclass
1136
1136
  class UpdateWorkspaceAssignments:
1137
1137
  permissions: List[WorkspacePermission]
1138
- """Array of permissions assignments to update on the workspace."""
1138
+ """Array of permissions assignments to update on the workspace. Note that excluding this field will
1139
+ have the same effect as providing an empty list which will result in the deletion of all
1140
+ permissions for the principal."""
1139
1141
 
1140
1142
  principal_id: Optional[int] = None
1141
1143
  """The ID of the user, service principal, or group."""
@@ -1238,20 +1240,6 @@ class UserSchema(Enum):
1238
1240
  URN_IETF_PARAMS_SCIM_SCHEMAS_EXTENSION_WORKSPACE_2_0_USER = 'urn:ietf:params:scim:schemas:extension:workspace:2.0:User'
1239
1241
 
1240
1242
 
1241
- @dataclass
1242
- class WorkspaceAssignmentsUpdated:
1243
-
1244
- def as_dict(self) -> dict:
1245
- """Serializes the WorkspaceAssignmentsUpdated into a dictionary suitable for use as a JSON request body."""
1246
- body = {}
1247
- return body
1248
-
1249
- @classmethod
1250
- def from_dict(cls, d: Dict[str, any]) -> WorkspaceAssignmentsUpdated:
1251
- """Deserializes the WorkspaceAssignmentsUpdated from a dictionary."""
1252
- return cls()
1253
-
1254
-
1255
1243
  class WorkspacePermission(Enum):
1256
1244
 
1257
1245
  ADMIN = 'ADMIN'
@@ -2607,7 +2595,7 @@ class PermissionsAPI:
2607
2595
  :param request_object_type: str
2608
2596
  The type of the request object. Can be one of the following: authorization, clusters,
2609
2597
  cluster-policies, directories, experiments, files, instance-pools, jobs, notebooks, pipelines,
2610
- registered-models, repos, serving-endpoints, or sql-warehouses.
2598
+ registered-models, repos, serving-endpoints, or warehouses.
2611
2599
  :param request_object_id: str
2612
2600
  The id of the request object.
2613
2601
 
@@ -2655,7 +2643,7 @@ class PermissionsAPI:
2655
2643
  :param request_object_type: str
2656
2644
  The type of the request object. Can be one of the following: authorization, clusters,
2657
2645
  cluster-policies, directories, experiments, files, instance-pools, jobs, notebooks, pipelines,
2658
- registered-models, repos, serving-endpoints, or sql-warehouses.
2646
+ registered-models, repos, serving-endpoints, or warehouses.
2659
2647
  :param request_object_id: str
2660
2648
  The id of the request object.
2661
2649
  :param access_control_list: List[:class:`AccessControlRequest`] (optional)
@@ -2686,7 +2674,7 @@ class PermissionsAPI:
2686
2674
  :param request_object_type: str
2687
2675
  The type of the request object. Can be one of the following: authorization, clusters,
2688
2676
  cluster-policies, directories, experiments, files, instance-pools, jobs, notebooks, pipelines,
2689
- registered-models, repos, serving-endpoints, or sql-warehouses.
2677
+ registered-models, repos, serving-endpoints, or warehouses.
2690
2678
  :param request_object_id: str
2691
2679
  The id of the request object.
2692
2680
  :param access_control_list: List[:class:`AccessControlRequest`] (optional)
@@ -3378,7 +3366,8 @@ class WorkspaceAssignmentAPI:
3378
3366
  parsed = PermissionAssignments.from_dict(json).permission_assignments
3379
3367
  return parsed if parsed is not None else []
3380
3368
 
3381
- def update(self, workspace_id: int, principal_id: int, permissions: List[WorkspacePermission]):
3369
+ def update(self, workspace_id: int, principal_id: int,
3370
+ permissions: List[WorkspacePermission]) -> PermissionAssignment:
3382
3371
  """Create or update permissions assignment.
3383
3372
 
3384
3373
  Creates or updates the workspace permissions assignment in a given account and workspace for the
@@ -3389,16 +3378,19 @@ class WorkspaceAssignmentAPI:
3389
3378
  :param principal_id: int
3390
3379
  The ID of the user, service principal, or group.
3391
3380
  :param permissions: List[:class:`WorkspacePermission`]
3392
- Array of permissions assignments to update on the workspace.
3393
-
3381
+ Array of permissions assignments to update on the workspace. Note that excluding this field will
3382
+ have the same effect as providing an empty list which will result in the deletion of all permissions
3383
+ for the principal.
3394
3384
 
3385
+ :returns: :class:`PermissionAssignment`
3395
3386
  """
3396
3387
  body = {}
3397
3388
  if permissions is not None: body['permissions'] = [v.value for v in permissions]
3398
3389
  headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
3399
3390
 
3400
- self._api.do(
3391
+ res = self._api.do(
3401
3392
  'PUT',
3402
3393
  f'/api/2.0/accounts/{self._api.account_id}/workspaces/{workspace_id}/permissionassignments/principals/{principal_id}',
3403
3394
  body=body,
3404
3395
  headers=headers)
3396
+ return PermissionAssignment.from_dict(res)