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

@@ -2937,6 +2937,42 @@ class Created:
2937
2937
  return cls(id=d.get('id', None))
2938
2938
 
2939
2939
 
2940
+ @dataclass
2941
+ class CustomPolicyTag:
2942
+ key: str
2943
+ """The key of the tag. - Must be unique among all custom tags of the same policy - Cannot be
2944
+ “budget-policy-name”, “budget-policy-id” or "budget-policy-resolution-result" - these
2945
+ tags are preserved.
2946
+
2947
+ - Follows the regex pattern defined in cluster-common/conf/src/ClusterTagConstraints.scala
2948
+ (https://src.dev.databricks.com/databricks/universe@1647196627c8dc7b4152ad098a94b86484b93a6c/-/blob/cluster-common/conf/src/ClusterTagConstraints.scala?L17)"""
2949
+
2950
+ value: Optional[str] = None
2951
+ """The value of the tag.
2952
+
2953
+ - Follows the regex pattern defined in cluster-common/conf/src/ClusterTagConstraints.scala
2954
+ (https://src.dev.databricks.com/databricks/universe@1647196627c8dc7b4152ad098a94b86484b93a6c/-/blob/cluster-common/conf/src/ClusterTagConstraints.scala?L24)"""
2955
+
2956
+ def as_dict(self) -> dict:
2957
+ """Serializes the CustomPolicyTag into a dictionary suitable for use as a JSON request body."""
2958
+ body = {}
2959
+ if self.key is not None: body['key'] = self.key
2960
+ if self.value is not None: body['value'] = self.value
2961
+ return body
2962
+
2963
+ def as_shallow_dict(self) -> dict:
2964
+ """Serializes the CustomPolicyTag into a shallow dictionary of its immediate attributes."""
2965
+ body = {}
2966
+ if self.key is not None: body['key'] = self.key
2967
+ if self.value is not None: body['value'] = self.value
2968
+ return body
2969
+
2970
+ @classmethod
2971
+ def from_dict(cls, d: Dict[str, any]) -> CustomPolicyTag:
2972
+ """Deserializes the CustomPolicyTag from a dictionary."""
2973
+ return cls(key=d.get('key', None), value=d.get('value', None))
2974
+
2975
+
2940
2976
  @dataclass
2941
2977
  class DataPlaneEventDetails:
2942
2978
  event_type: Optional[DataPlaneEventDetailsEventType] = None
@@ -4184,6 +4220,10 @@ class EventDetailsCause(Enum):
4184
4220
 
4185
4221
  class EventType(Enum):
4186
4222
 
4223
+ ADD_NODES_FAILED = 'ADD_NODES_FAILED'
4224
+ AUTOMATIC_CLUSTER_UPDATE = 'AUTOMATIC_CLUSTER_UPDATE'
4225
+ AUTOSCALING_BACKOFF = 'AUTOSCALING_BACKOFF'
4226
+ AUTOSCALING_FAILED = 'AUTOSCALING_FAILED'
4187
4227
  AUTOSCALING_STATS_REPORT = 'AUTOSCALING_STATS_REPORT'
4188
4228
  CREATING = 'CREATING'
4189
4229
  DBFS_DOWN = 'DBFS_DOWN'
@@ -381,8 +381,9 @@ class GenieMessage:
381
381
  status: Optional[MessageStatus] = None
382
382
  """MesssageStatus. The possible values are: * `FETCHING_METADATA`: Fetching metadata from the data
383
383
  sources. * `FILTERING_CONTEXT`: Running smart context step to determine relevant context. *
384
- `ASKING_AI`: Waiting for the LLM to respond to the users question. * `EXECUTING_QUERY`:
385
- Executing AI provided SQL query. Get the SQL query result by calling
384
+ `ASKING_AI`: Waiting for the LLM to respond to the users question. * `PENDING_WAREHOUSE`:
385
+ Waiting for warehouse before the SQL query can start executing. * `EXECUTING_QUERY`: Executing
386
+ AI provided SQL query. Get the SQL query result by calling
386
387
  [getMessageQueryResult](:method:genie/getMessageQueryResult) API. **Important: The message
387
388
  status will stay in the `EXECUTING_QUERY` until a client calls
388
389
  [getMessageQueryResult](:method:genie/getMessageQueryResult)**. * `FAILED`: Generating a
@@ -678,8 +679,9 @@ class MessageErrorType(Enum):
678
679
  class MessageStatus(Enum):
679
680
  """MesssageStatus. The possible values are: * `FETCHING_METADATA`: Fetching metadata from the data
680
681
  sources. * `FILTERING_CONTEXT`: Running smart context step to determine relevant context. *
681
- `ASKING_AI`: Waiting for the LLM to respond to the users question. * `EXECUTING_QUERY`:
682
- Executing AI provided SQL query. Get the SQL query result by calling
682
+ `ASKING_AI`: Waiting for the LLM to respond to the users question. * `PENDING_WAREHOUSE`:
683
+ Waiting for warehouse before the SQL query can start executing. * `EXECUTING_QUERY`: Executing
684
+ AI provided SQL query. Get the SQL query result by calling
683
685
  [getMessageQueryResult](:method:genie/getMessageQueryResult) API. **Important: The message
684
686
  status will stay in the `EXECUTING_QUERY` until a client calls
685
687
  [getMessageQueryResult](:method:genie/getMessageQueryResult)**. * `FAILED`: Generating a
@@ -696,6 +698,7 @@ class MessageStatus(Enum):
696
698
  FAILED = 'FAILED'
697
699
  FETCHING_METADATA = 'FETCHING_METADATA'
698
700
  FILTERING_CONTEXT = 'FILTERING_CONTEXT'
701
+ PENDING_WAREHOUSE = 'PENDING_WAREHOUSE'
699
702
  QUERY_RESULT_EXPIRED = 'QUERY_RESULT_EXPIRED'
700
703
  SUBMITTED = 'SUBMITTED'
701
704
 
@@ -843,6 +846,8 @@ class QueryAttachment:
843
846
  query: Optional[str] = None
844
847
  """AI generated SQL query"""
845
848
 
849
+ statement_id: Optional[str] = None
850
+
846
851
  title: Optional[str] = None
847
852
  """Name of the query"""
848
853
 
@@ -857,6 +862,7 @@ class QueryAttachment:
857
862
  if self.last_updated_timestamp is not None:
858
863
  body['last_updated_timestamp'] = self.last_updated_timestamp
859
864
  if self.query is not None: body['query'] = self.query
865
+ if self.statement_id is not None: body['statement_id'] = self.statement_id
860
866
  if self.title is not None: body['title'] = self.title
861
867
  return body
862
868
 
@@ -871,6 +877,7 @@ class QueryAttachment:
871
877
  if self.last_updated_timestamp is not None:
872
878
  body['last_updated_timestamp'] = self.last_updated_timestamp
873
879
  if self.query is not None: body['query'] = self.query
880
+ if self.statement_id is not None: body['statement_id'] = self.statement_id
874
881
  if self.title is not None: body['title'] = self.title
875
882
  return body
876
883
 
@@ -884,6 +891,7 @@ class QueryAttachment:
884
891
  instruction_title=d.get('instruction_title', None),
885
892
  last_updated_timestamp=d.get('last_updated_timestamp', None),
886
893
  query=d.get('query', None),
894
+ statement_id=d.get('statement_id', None),
887
895
  title=d.get('title', None))
888
896
 
889
897
 
@@ -925,9 +925,12 @@ class FilesAPI:
925
925
  /Volumes/<catalog_name>/<schema_name>/<volume_name>/<path_to_file>.
926
926
 
927
927
  The Files API has two distinct endpoints, one for working with files (`/fs/files`) and another one for
928
- working with directories (`/fs/directories`). Both endpoints, use the standard HTTP methods GET, HEAD,
929
- PUT, and DELETE to manage files and directories specified using their URI path. The path is always
930
- absolute.
928
+ working with directories (`/fs/directories`). Both endpoints use the standard HTTP methods GET, HEAD, PUT,
929
+ and DELETE to manage files and directories specified using their URI path. The path is always absolute.
930
+
931
+ Some Files API client features are currently experimental. To enable them, set
932
+ `enable_experimental_files_api_client = True` in your configuration profile or use the environment
933
+ variable `DATABRICKS_ENABLE_EXPERIMENTAL_FILES_API_CLIENT=True`.
931
934
 
932
935
  [Unity Catalog volumes]: https://docs.databricks.com/en/connect/unity-catalog/volumes.html"""
933
936
 
@@ -106,6 +106,58 @@ class AccessControlResponse:
106
106
  user_name=d.get('user_name', None))
107
107
 
108
108
 
109
+ @dataclass
110
+ class Actor:
111
+ """represents an identity trying to access a resource - user or a service principal group can be a
112
+ principal of a permission set assignment but an actor is always a user or a service principal"""
113
+
114
+ actor_id: Optional[int] = None
115
+
116
+ def as_dict(self) -> dict:
117
+ """Serializes the Actor into a dictionary suitable for use as a JSON request body."""
118
+ body = {}
119
+ if self.actor_id is not None: body['actor_id'] = self.actor_id
120
+ return body
121
+
122
+ def as_shallow_dict(self) -> dict:
123
+ """Serializes the Actor into a shallow dictionary of its immediate attributes."""
124
+ body = {}
125
+ if self.actor_id is not None: body['actor_id'] = self.actor_id
126
+ return body
127
+
128
+ @classmethod
129
+ def from_dict(cls, d: Dict[str, any]) -> Actor:
130
+ """Deserializes the Actor from a dictionary."""
131
+ return cls(actor_id=d.get('actor_id', None))
132
+
133
+
134
+ @dataclass
135
+ class CheckPolicyResponse:
136
+ consistency_token: ConsistencyToken
137
+
138
+ is_permitted: Optional[bool] = None
139
+
140
+ def as_dict(self) -> dict:
141
+ """Serializes the CheckPolicyResponse into a dictionary suitable for use as a JSON request body."""
142
+ body = {}
143
+ if self.consistency_token: body['consistency_token'] = self.consistency_token.as_dict()
144
+ if self.is_permitted is not None: body['is_permitted'] = self.is_permitted
145
+ return body
146
+
147
+ def as_shallow_dict(self) -> dict:
148
+ """Serializes the CheckPolicyResponse into a shallow dictionary of its immediate attributes."""
149
+ body = {}
150
+ if self.consistency_token: body['consistency_token'] = self.consistency_token
151
+ if self.is_permitted is not None: body['is_permitted'] = self.is_permitted
152
+ return body
153
+
154
+ @classmethod
155
+ def from_dict(cls, d: Dict[str, any]) -> CheckPolicyResponse:
156
+ """Deserializes the CheckPolicyResponse from a dictionary."""
157
+ return cls(consistency_token=_from_dict(d, 'consistency_token', ConsistencyToken),
158
+ is_permitted=d.get('is_permitted', None))
159
+
160
+
109
161
  @dataclass
110
162
  class ComplexValue:
111
163
  display: Optional[str] = None
@@ -148,6 +200,28 @@ class ComplexValue:
148
200
  value=d.get('value', None))
149
201
 
150
202
 
203
+ @dataclass
204
+ class ConsistencyToken:
205
+ value: str
206
+
207
+ def as_dict(self) -> dict:
208
+ """Serializes the ConsistencyToken into a dictionary suitable for use as a JSON request body."""
209
+ body = {}
210
+ if self.value is not None: body['value'] = self.value
211
+ return body
212
+
213
+ def as_shallow_dict(self) -> dict:
214
+ """Serializes the ConsistencyToken into a shallow dictionary of its immediate attributes."""
215
+ body = {}
216
+ if self.value is not None: body['value'] = self.value
217
+ return body
218
+
219
+ @classmethod
220
+ def from_dict(cls, d: Dict[str, any]) -> ConsistencyToken:
221
+ """Deserializes the ConsistencyToken from a dictionary."""
222
+ return cls(value=d.get('value', None))
223
+
224
+
151
225
  @dataclass
152
226
  class DeleteResponse:
153
227
 
@@ -1219,6 +1293,49 @@ class PrincipalOutput:
1219
1293
  user_name=d.get('user_name', None))
1220
1294
 
1221
1295
 
1296
+ class RequestAuthzIdentity(Enum):
1297
+ """Defines the identity to be used for authZ of the request on the server side. See one pager for
1298
+ for more information: http://go/acl/service-identity"""
1299
+
1300
+ REQUEST_AUTHZ_IDENTITY_SERVICE_IDENTITY = 'REQUEST_AUTHZ_IDENTITY_SERVICE_IDENTITY'
1301
+ REQUEST_AUTHZ_IDENTITY_USER_CONTEXT = 'REQUEST_AUTHZ_IDENTITY_USER_CONTEXT'
1302
+
1303
+
1304
+ @dataclass
1305
+ class ResourceInfo:
1306
+ id: str
1307
+ """Id of the current resource."""
1308
+
1309
+ legacy_acl_path: Optional[str] = None
1310
+ """The legacy acl path of the current resource."""
1311
+
1312
+ parent_resource_info: Optional[ResourceInfo] = None
1313
+ """Parent resource info for the current resource. The parent may have another parent."""
1314
+
1315
+ def as_dict(self) -> dict:
1316
+ """Serializes the ResourceInfo into a dictionary suitable for use as a JSON request body."""
1317
+ body = {}
1318
+ if self.id is not None: body['id'] = self.id
1319
+ if self.legacy_acl_path is not None: body['legacy_acl_path'] = self.legacy_acl_path
1320
+ if self.parent_resource_info: body['parent_resource_info'] = self.parent_resource_info.as_dict()
1321
+ return body
1322
+
1323
+ def as_shallow_dict(self) -> dict:
1324
+ """Serializes the ResourceInfo into a shallow dictionary of its immediate attributes."""
1325
+ body = {}
1326
+ if self.id is not None: body['id'] = self.id
1327
+ if self.legacy_acl_path is not None: body['legacy_acl_path'] = self.legacy_acl_path
1328
+ if self.parent_resource_info: body['parent_resource_info'] = self.parent_resource_info
1329
+ return body
1330
+
1331
+ @classmethod
1332
+ def from_dict(cls, d: Dict[str, any]) -> ResourceInfo:
1333
+ """Deserializes the ResourceInfo from a dictionary."""
1334
+ return cls(id=d.get('id', None),
1335
+ legacy_acl_path=d.get('legacy_acl_path', None),
1336
+ parent_resource_info=_from_dict(d, 'parent_resource_info', ResourceInfo))
1337
+
1338
+
1222
1339
  @dataclass
1223
1340
  class ResourceMeta:
1224
1341
  resource_type: Optional[str] = None
@@ -1622,6 +1739,47 @@ class WorkspacePermissions:
1622
1739
  return cls(permissions=_repeated_dict(d, 'permissions', PermissionOutput))
1623
1740
 
1624
1741
 
1742
+ class AccessControlAPI:
1743
+ """Rule based Access Control for Databricks Resources."""
1744
+
1745
+ def __init__(self, api_client):
1746
+ self._api = api_client
1747
+
1748
+ def check_policy(self,
1749
+ actor: Actor,
1750
+ permission: str,
1751
+ resource: str,
1752
+ consistency_token: ConsistencyToken,
1753
+ authz_identity: RequestAuthzIdentity,
1754
+ *,
1755
+ resource_info: Optional[ResourceInfo] = None) -> CheckPolicyResponse:
1756
+ """Check access policy to a resource.
1757
+
1758
+ :param actor: :class:`Actor`
1759
+ :param permission: str
1760
+ :param resource: str
1761
+ Ex: (servicePrincipal/use, accounts/<account-id>/servicePrincipals/<sp-id>) Ex:
1762
+ (servicePrincipal.ruleSet/update, accounts/<account-id>/servicePrincipals/<sp-id>/ruleSets/default)
1763
+ :param consistency_token: :class:`ConsistencyToken`
1764
+ :param authz_identity: :class:`RequestAuthzIdentity`
1765
+ :param resource_info: :class:`ResourceInfo` (optional)
1766
+
1767
+ :returns: :class:`CheckPolicyResponse`
1768
+ """
1769
+
1770
+ query = {}
1771
+ if actor is not None: query['actor'] = actor.as_dict()
1772
+ if authz_identity is not None: query['authz_identity'] = authz_identity.value
1773
+ if consistency_token is not None: query['consistency_token'] = consistency_token.as_dict()
1774
+ if permission is not None: query['permission'] = permission
1775
+ if resource is not None: query['resource'] = resource
1776
+ if resource_info is not None: query['resource_info'] = resource_info.as_dict()
1777
+ headers = {'Accept': 'application/json', }
1778
+
1779
+ res = self._api.do('GET', '/api/2.0/access-control/check-policy-v2', query=query, headers=headers)
1780
+ return CheckPolicyResponse.from_dict(res)
1781
+
1782
+
1625
1783
  class AccountAccessControlAPI:
1626
1784
  """These APIs manage access rules on resources in an account. Currently, only grant rules are supported. A
1627
1785
  grant rule specifies a role assigned to a set of principals. A list of rules attached to a resource is