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

@@ -534,6 +534,74 @@ class DeltaSharingTableDependency:
534
534
  return cls(schema_name=d.get("schema_name", None), table_name=d.get("table_name", None))
535
535
 
536
536
 
537
+ @dataclass
538
+ class FederationPolicy:
539
+ comment: Optional[str] = None
540
+ """Description of the policy. This is a user-provided description."""
541
+
542
+ create_time: Optional[str] = None
543
+ """System-generated timestamp indicating when the policy was created."""
544
+
545
+ id: Optional[str] = None
546
+ """Unique, immutable system-generated identifier for the federation policy."""
547
+
548
+ name: Optional[str] = None
549
+ """Name of the federation policy. A recipient can have multiple policies with different names. The
550
+ name must contain only lowercase alphanumeric characters, numbers, and hyphens."""
551
+
552
+ oidc_policy: Optional[OidcFederationPolicy] = None
553
+ """Specifies the policy to use for validating OIDC claims in the federated tokens."""
554
+
555
+ update_time: Optional[str] = None
556
+ """System-generated timestamp indicating when the policy was last updated."""
557
+
558
+ def as_dict(self) -> dict:
559
+ """Serializes the FederationPolicy into a dictionary suitable for use as a JSON request body."""
560
+ body = {}
561
+ if self.comment is not None:
562
+ body["comment"] = self.comment
563
+ if self.create_time is not None:
564
+ body["create_time"] = self.create_time
565
+ if self.id is not None:
566
+ body["id"] = self.id
567
+ if self.name is not None:
568
+ body["name"] = self.name
569
+ if self.oidc_policy:
570
+ body["oidc_policy"] = self.oidc_policy.as_dict()
571
+ if self.update_time is not None:
572
+ body["update_time"] = self.update_time
573
+ return body
574
+
575
+ def as_shallow_dict(self) -> dict:
576
+ """Serializes the FederationPolicy into a shallow dictionary of its immediate attributes."""
577
+ body = {}
578
+ if self.comment is not None:
579
+ body["comment"] = self.comment
580
+ if self.create_time is not None:
581
+ body["create_time"] = self.create_time
582
+ if self.id is not None:
583
+ body["id"] = self.id
584
+ if self.name is not None:
585
+ body["name"] = self.name
586
+ if self.oidc_policy:
587
+ body["oidc_policy"] = self.oidc_policy
588
+ if self.update_time is not None:
589
+ body["update_time"] = self.update_time
590
+ return body
591
+
592
+ @classmethod
593
+ def from_dict(cls, d: Dict[str, Any]) -> FederationPolicy:
594
+ """Deserializes the FederationPolicy from a dictionary."""
595
+ return cls(
596
+ comment=d.get("comment", None),
597
+ create_time=d.get("create_time", None),
598
+ id=d.get("id", None),
599
+ name=d.get("name", None),
600
+ oidc_policy=_from_dict(d, "oidc_policy", OidcFederationPolicy),
601
+ update_time=d.get("update_time", None),
602
+ )
603
+
604
+
537
605
  @dataclass
538
606
  class FunctionParameterInfo:
539
607
  """Represents a parameter of a function. The same message is used for both input and output
@@ -805,6 +873,38 @@ class IpAccessList:
805
873
  return cls(allowed_ip_addresses=d.get("allowed_ip_addresses", None))
806
874
 
807
875
 
876
+ @dataclass
877
+ class ListFederationPoliciesResponse:
878
+ next_page_token: Optional[str] = None
879
+
880
+ policies: Optional[List[FederationPolicy]] = None
881
+
882
+ def as_dict(self) -> dict:
883
+ """Serializes the ListFederationPoliciesResponse into a dictionary suitable for use as a JSON request body."""
884
+ body = {}
885
+ if self.next_page_token is not None:
886
+ body["next_page_token"] = self.next_page_token
887
+ if self.policies:
888
+ body["policies"] = [v.as_dict() for v in self.policies]
889
+ return body
890
+
891
+ def as_shallow_dict(self) -> dict:
892
+ """Serializes the ListFederationPoliciesResponse into a shallow dictionary of its immediate attributes."""
893
+ body = {}
894
+ if self.next_page_token is not None:
895
+ body["next_page_token"] = self.next_page_token
896
+ if self.policies:
897
+ body["policies"] = self.policies
898
+ return body
899
+
900
+ @classmethod
901
+ def from_dict(cls, d: Dict[str, Any]) -> ListFederationPoliciesResponse:
902
+ """Deserializes the ListFederationPoliciesResponse from a dictionary."""
903
+ return cls(
904
+ next_page_token=d.get("next_page_token", None), policies=_repeated_dict(d, "policies", FederationPolicy)
905
+ )
906
+
907
+
808
908
  @dataclass
809
909
  class ListProviderShareAssetsResponse:
810
910
  """Response to ListProviderShareAssets, which contains the list of assets of a share."""
@@ -1061,6 +1161,74 @@ class NotebookFile:
1061
1161
  )
1062
1162
 
1063
1163
 
1164
+ @dataclass
1165
+ class OidcFederationPolicy:
1166
+ """Specifies the policy to use for validating OIDC claims in your federated tokens from Delta
1167
+ Sharing Clients. Refer to https://docs.databricks.com/en/delta-sharing/create-recipient-oidc-fed
1168
+ for more details."""
1169
+
1170
+ issuer: str
1171
+ """The required token issuer, as specified in the 'iss' claim of federated tokens."""
1172
+
1173
+ subject_claim: str
1174
+ """The claim that contains the subject of the token. Depending on the identity provider and the use
1175
+ case (U2M or M2M), this can vary: - For Entra ID (AAD): * U2M flow (group access): Use `groups`.
1176
+ * U2M flow (user access): Use `oid`. * M2M flow (OAuth App access): Use `azp`. - For other IdPs,
1177
+ refer to the specific IdP documentation.
1178
+
1179
+ Supported `subject_claim` values are: - `oid`: Object ID of the user. - `azp`: Client ID of the
1180
+ OAuth app. - `groups`: Object ID of the group. - `sub`: Subject identifier for other use cases."""
1181
+
1182
+ subject: str
1183
+ """The required token subject, as specified in the subject claim of federated tokens. The subject
1184
+ claim identifies the identity of the user or machine accessing the resource. Examples for Entra
1185
+ ID (AAD): - U2M flow (group access): If the subject claim is `groups`, this must be the Object
1186
+ ID of the group in Entra ID. - U2M flow (user access): If the subject claim is `oid`, this must
1187
+ be the Object ID of the user in Entra ID. - M2M flow (OAuth App access): If the subject claim is
1188
+ `azp`, this must be the client ID of the OAuth app registered in Entra ID."""
1189
+
1190
+ audiences: Optional[List[str]] = None
1191
+ """The allowed token audiences, as specified in the 'aud' claim of federated tokens. The audience
1192
+ identifier is intended to represent the recipient of the token. Can be any non-empty string
1193
+ value. As long as the audience in the token matches at least one audience in the policy,"""
1194
+
1195
+ def as_dict(self) -> dict:
1196
+ """Serializes the OidcFederationPolicy into a dictionary suitable for use as a JSON request body."""
1197
+ body = {}
1198
+ if self.audiences:
1199
+ body["audiences"] = [v for v in self.audiences]
1200
+ if self.issuer is not None:
1201
+ body["issuer"] = self.issuer
1202
+ if self.subject is not None:
1203
+ body["subject"] = self.subject
1204
+ if self.subject_claim is not None:
1205
+ body["subject_claim"] = self.subject_claim
1206
+ return body
1207
+
1208
+ def as_shallow_dict(self) -> dict:
1209
+ """Serializes the OidcFederationPolicy into a shallow dictionary of its immediate attributes."""
1210
+ body = {}
1211
+ if self.audiences:
1212
+ body["audiences"] = self.audiences
1213
+ if self.issuer is not None:
1214
+ body["issuer"] = self.issuer
1215
+ if self.subject is not None:
1216
+ body["subject"] = self.subject
1217
+ if self.subject_claim is not None:
1218
+ body["subject_claim"] = self.subject_claim
1219
+ return body
1220
+
1221
+ @classmethod
1222
+ def from_dict(cls, d: Dict[str, Any]) -> OidcFederationPolicy:
1223
+ """Deserializes the OidcFederationPolicy from a dictionary."""
1224
+ return cls(
1225
+ audiences=d.get("audiences", None),
1226
+ issuer=d.get("issuer", None),
1227
+ subject=d.get("subject", None),
1228
+ subject_claim=d.get("subject_claim", None),
1229
+ )
1230
+
1231
+
1064
1232
  @dataclass
1065
1233
  class Partition:
1066
1234
  values: Optional[List[PartitionValue]] = None
@@ -2232,6 +2400,9 @@ class Table:
2232
2400
  internal_attributes: Optional[TableInternalAttributes] = None
2233
2401
  """Internal information for D2D sharing that should not be disclosed to external users."""
2234
2402
 
2403
+ materialization_namespace: Optional[str] = None
2404
+ """The catalog and schema of the materialized table"""
2405
+
2235
2406
  materialized_table_name: Optional[str] = None
2236
2407
  """The name of a materialized table."""
2237
2408
 
@@ -2259,6 +2430,8 @@ class Table:
2259
2430
  body["id"] = self.id
2260
2431
  if self.internal_attributes:
2261
2432
  body["internal_attributes"] = self.internal_attributes.as_dict()
2433
+ if self.materialization_namespace is not None:
2434
+ body["materialization_namespace"] = self.materialization_namespace
2262
2435
  if self.materialized_table_name is not None:
2263
2436
  body["materialized_table_name"] = self.materialized_table_name
2264
2437
  if self.name is not None:
@@ -2282,6 +2455,8 @@ class Table:
2282
2455
  body["id"] = self.id
2283
2456
  if self.internal_attributes:
2284
2457
  body["internal_attributes"] = self.internal_attributes
2458
+ if self.materialization_namespace is not None:
2459
+ body["materialization_namespace"] = self.materialization_namespace
2285
2460
  if self.materialized_table_name is not None:
2286
2461
  body["materialized_table_name"] = self.materialized_table_name
2287
2462
  if self.name is not None:
@@ -2303,6 +2478,7 @@ class Table:
2303
2478
  comment=d.get("comment", None),
2304
2479
  id=d.get("id", None),
2305
2480
  internal_attributes=_from_dict(d, "internal_attributes", TableInternalAttributes),
2481
+ materialization_namespace=d.get("materialization_namespace", None),
2306
2482
  materialized_table_name=d.get("materialized_table_name", None),
2307
2483
  name=d.get("name", None),
2308
2484
  schema=d.get("schema", None),
@@ -2592,6 +2768,9 @@ class UpdateSharePermissions:
2592
2768
  name: Optional[str] = None
2593
2769
  """The name of the share."""
2594
2770
 
2771
+ omit_permissions_list: Optional[bool] = None
2772
+ """Optional. Whether to return the latest permissions list of the share in the response."""
2773
+
2595
2774
  def as_dict(self) -> dict:
2596
2775
  """Serializes the UpdateSharePermissions into a dictionary suitable for use as a JSON request body."""
2597
2776
  body = {}
@@ -2599,6 +2778,8 @@ class UpdateSharePermissions:
2599
2778
  body["changes"] = [v.as_dict() for v in self.changes]
2600
2779
  if self.name is not None:
2601
2780
  body["name"] = self.name
2781
+ if self.omit_permissions_list is not None:
2782
+ body["omit_permissions_list"] = self.omit_permissions_list
2602
2783
  return body
2603
2784
 
2604
2785
  def as_shallow_dict(self) -> dict:
@@ -2608,12 +2789,18 @@ class UpdateSharePermissions:
2608
2789
  body["changes"] = self.changes
2609
2790
  if self.name is not None:
2610
2791
  body["name"] = self.name
2792
+ if self.omit_permissions_list is not None:
2793
+ body["omit_permissions_list"] = self.omit_permissions_list
2611
2794
  return body
2612
2795
 
2613
2796
  @classmethod
2614
2797
  def from_dict(cls, d: Dict[str, Any]) -> UpdateSharePermissions:
2615
2798
  """Deserializes the UpdateSharePermissions from a dictionary."""
2616
- return cls(changes=_repeated_dict(d, "changes", PermissionsChange), name=d.get("name", None))
2799
+ return cls(
2800
+ changes=_repeated_dict(d, "changes", PermissionsChange),
2801
+ name=d.get("name", None),
2802
+ omit_permissions_list=d.get("omit_permissions_list", None),
2803
+ )
2617
2804
 
2618
2805
 
2619
2806
  @dataclass
@@ -3088,6 +3275,197 @@ class RecipientActivationAPI:
3088
3275
  return RetrieveTokenResponse.from_dict(res)
3089
3276
 
3090
3277
 
3278
+ class RecipientFederationPoliciesAPI:
3279
+ """The Recipient Federation Policies APIs are only applicable in the open sharing model where the recipient
3280
+ object has the authentication type of `OIDC_RECIPIENT`, enabling data sharing from Databricks to
3281
+ non-Databricks recipients. OIDC Token Federation enables secure, secret-less authentication for accessing
3282
+ Delta Sharing servers. Users and applications authenticate using short-lived OIDC tokens issued by their
3283
+ own Identity Provider (IdP), such as Azure Entra ID or Okta, without the need for managing static
3284
+ credentials or client secrets. A federation policy defines how non-Databricks recipients authenticate
3285
+ using OIDC tokens. It validates the OIDC claims in federated tokens and is set at the recipient level. The
3286
+ caller must be the owner of the recipient to create or manage a federation policy. Federation policies
3287
+ support the following scenarios: - User-to-Machine (U2M) flow: A user accesses Delta Shares using their
3288
+ own identity, such as connecting through PowerBI Delta Sharing Client. - Machine-to-Machine (M2M) flow: An
3289
+ application accesses Delta Shares using its own identity, typically for automation tasks like nightly jobs
3290
+ through Python Delta Sharing Client. OIDC Token Federation enables fine-grained access control, supports
3291
+ Multi-Factor Authentication (MFA), and enhances security by minimizing the risk of credential leakage
3292
+ through the use of short-lived, expiring tokens. It is designed for strong identity governance, secure
3293
+ cross-platform data sharing, and reduced operational overhead for credential management.
3294
+
3295
+ For more information, see
3296
+ https://www.databricks.com/blog/announcing-oidc-token-federation-enhanced-delta-sharing-security and
3297
+ https://docs.databricks.com/en/delta-sharing/create-recipient-oidc-fed"""
3298
+
3299
+ def __init__(self, api_client):
3300
+ self._api = api_client
3301
+
3302
+ def create(self, recipient_name: str, policy: FederationPolicy) -> FederationPolicy:
3303
+ """Create recipient federation policy.
3304
+
3305
+ Create a federation policy for an OIDC_FEDERATION recipient for sharing data from Databricks to
3306
+ non-Databricks recipients. The caller must be the owner of the recipient. When sharing data from
3307
+ Databricks to non-Databricks clients, you can define a federation policy to authenticate
3308
+ non-Databricks recipients. The federation policy validates OIDC claims in federated tokens and is
3309
+ defined at the recipient level. This enables secretless sharing clients to authenticate using OIDC
3310
+ tokens.
3311
+
3312
+ Supported scenarios for federation policies: 1. **User-to-Machine (U2M) flow** (e.g., PowerBI): A user
3313
+ accesses a resource using their own identity. 2. **Machine-to-Machine (M2M) flow** (e.g., OAuth App):
3314
+ An OAuth App accesses a resource using its own identity, typically for tasks like running nightly
3315
+ jobs.
3316
+
3317
+ For an overview, refer to: - Blog post: Overview of feature:
3318
+ https://www.databricks.com/blog/announcing-oidc-token-federation-enhanced-delta-sharing-security
3319
+
3320
+ For detailed configuration guides based on your use case: - Creating a Federation Policy as a
3321
+ provider: https://docs.databricks.com/en/delta-sharing/create-recipient-oidc-fed - Configuration and
3322
+ usage for Machine-to-Machine (M2M) applications (e.g., Python Delta Sharing Client):
3323
+ https://docs.databricks.com/aws/en/delta-sharing/sharing-over-oidc-m2m - Configuration and usage for
3324
+ User-to-Machine (U2M) applications (e.g., PowerBI):
3325
+ https://docs.databricks.com/aws/en/delta-sharing/sharing-over-oidc-u2m
3326
+
3327
+ :param recipient_name: str
3328
+ Name of the recipient. This is the name of the recipient for which the policy is being created.
3329
+ :param policy: :class:`FederationPolicy`
3330
+
3331
+ :returns: :class:`FederationPolicy`
3332
+ """
3333
+ body = policy.as_dict()
3334
+ headers = {
3335
+ "Accept": "application/json",
3336
+ "Content-Type": "application/json",
3337
+ }
3338
+
3339
+ res = self._api.do(
3340
+ "POST", f"/api/2.0/data-sharing/recipients/{recipient_name}/federation-policies", body=body, headers=headers
3341
+ )
3342
+ return FederationPolicy.from_dict(res)
3343
+
3344
+ def delete(self, recipient_name: str, name: str):
3345
+ """Delete recipient federation policy.
3346
+
3347
+ Deletes an existing federation policy for an OIDC_FEDERATION recipient. The caller must be the owner
3348
+ of the recipient.
3349
+
3350
+ :param recipient_name: str
3351
+ Name of the recipient. This is the name of the recipient for which the policy is being deleted.
3352
+ :param name: str
3353
+ Name of the policy. This is the name of the policy to be deleted.
3354
+
3355
+
3356
+ """
3357
+
3358
+ headers = {
3359
+ "Accept": "application/json",
3360
+ }
3361
+
3362
+ self._api.do(
3363
+ "DELETE", f"/api/2.0/data-sharing/recipients/{recipient_name}/federation-policies/{name}", headers=headers
3364
+ )
3365
+
3366
+ def get_federation_policy(self, recipient_name: str, name: str) -> FederationPolicy:
3367
+ """Get recipient federation policy.
3368
+
3369
+ Reads an existing federation policy for an OIDC_FEDERATION recipient for sharing data from Databricks
3370
+ to non-Databricks recipients. The caller must have read access to the recipient.
3371
+
3372
+ :param recipient_name: str
3373
+ Name of the recipient. This is the name of the recipient for which the policy is being retrieved.
3374
+ :param name: str
3375
+ Name of the policy. This is the name of the policy to be retrieved.
3376
+
3377
+ :returns: :class:`FederationPolicy`
3378
+ """
3379
+
3380
+ headers = {
3381
+ "Accept": "application/json",
3382
+ }
3383
+
3384
+ res = self._api.do(
3385
+ "GET", f"/api/2.0/data-sharing/recipients/{recipient_name}/federation-policies/{name}", headers=headers
3386
+ )
3387
+ return FederationPolicy.from_dict(res)
3388
+
3389
+ def list(
3390
+ self, recipient_name: str, *, max_results: Optional[int] = None, page_token: Optional[str] = None
3391
+ ) -> Iterator[FederationPolicy]:
3392
+ """List recipient federation policies.
3393
+
3394
+ Lists federation policies for an OIDC_FEDERATION recipient for sharing data from Databricks to
3395
+ non-Databricks recipients. The caller must have read access to the recipient.
3396
+
3397
+ :param recipient_name: str
3398
+ Name of the recipient. This is the name of the recipient for which the policies are being listed.
3399
+ :param max_results: int (optional)
3400
+ :param page_token: str (optional)
3401
+
3402
+ :returns: Iterator over :class:`FederationPolicy`
3403
+ """
3404
+
3405
+ query = {}
3406
+ if max_results is not None:
3407
+ query["max_results"] = max_results
3408
+ if page_token is not None:
3409
+ query["page_token"] = page_token
3410
+ headers = {
3411
+ "Accept": "application/json",
3412
+ }
3413
+
3414
+ while True:
3415
+ json = self._api.do(
3416
+ "GET",
3417
+ f"/api/2.0/data-sharing/recipients/{recipient_name}/federation-policies",
3418
+ query=query,
3419
+ headers=headers,
3420
+ )
3421
+ if "policies" in json:
3422
+ for v in json["policies"]:
3423
+ yield FederationPolicy.from_dict(v)
3424
+ if "next_page_token" not in json or not json["next_page_token"]:
3425
+ return
3426
+ query["page_token"] = json["next_page_token"]
3427
+
3428
+ def update(
3429
+ self, recipient_name: str, name: str, policy: FederationPolicy, *, update_mask: Optional[str] = None
3430
+ ) -> FederationPolicy:
3431
+ """Update recipient federation policy.
3432
+
3433
+ Updates an existing federation policy for an OIDC_RECIPIENT. The caller must be the owner of the
3434
+ recipient.
3435
+
3436
+ :param recipient_name: str
3437
+ Name of the recipient. This is the name of the recipient for which the policy is being updated.
3438
+ :param name: str
3439
+ Name of the policy. This is the name of the current name of the policy.
3440
+ :param policy: :class:`FederationPolicy`
3441
+ :param update_mask: str (optional)
3442
+ The field mask specifies which fields of the policy to update. To specify multiple fields in the
3443
+ field mask, use comma as the separator (no space). The special value '*' indicates that all fields
3444
+ should be updated (full replacement). If unspecified, all fields that are set in the policy provided
3445
+ in the update request will overwrite the corresponding fields in the existing policy. Example value:
3446
+ 'comment,oidc_policy.audiences'.
3447
+
3448
+ :returns: :class:`FederationPolicy`
3449
+ """
3450
+ body = policy.as_dict()
3451
+ query = {}
3452
+ if update_mask is not None:
3453
+ query["update_mask"] = update_mask
3454
+ headers = {
3455
+ "Accept": "application/json",
3456
+ "Content-Type": "application/json",
3457
+ }
3458
+
3459
+ res = self._api.do(
3460
+ "PATCH",
3461
+ f"/api/2.0/data-sharing/recipients/{recipient_name}/federation-policies/{name}",
3462
+ query=query,
3463
+ body=body,
3464
+ headers=headers,
3465
+ )
3466
+ return FederationPolicy.from_dict(res)
3467
+
3468
+
3091
3469
  class RecipientsAPI:
3092
3470
  """A recipient is an object you create using :method:recipients/create to represent an organization which you
3093
3471
  want to allow access shares. The way how sharing works differs depending on whether or not your recipient
@@ -3604,7 +3982,11 @@ class SharesAPI:
3604
3982
  return ShareInfo.from_dict(res)
3605
3983
 
3606
3984
  def update_permissions(
3607
- self, name: str, *, changes: Optional[List[PermissionsChange]] = None
3985
+ self,
3986
+ name: str,
3987
+ *,
3988
+ changes: Optional[List[PermissionsChange]] = None,
3989
+ omit_permissions_list: Optional[bool] = None,
3608
3990
  ) -> UpdateSharePermissionsResponse:
3609
3991
  """Update permissions.
3610
3992
 
@@ -3618,12 +4000,16 @@ class SharesAPI:
3618
4000
  The name of the share.
3619
4001
  :param changes: List[:class:`PermissionsChange`] (optional)
3620
4002
  Array of permission changes.
4003
+ :param omit_permissions_list: bool (optional)
4004
+ Optional. Whether to return the latest permissions list of the share in the response.
3621
4005
 
3622
4006
  :returns: :class:`UpdateSharePermissionsResponse`
3623
4007
  """
3624
4008
  body = {}
3625
4009
  if changes is not None:
3626
4010
  body["changes"] = [v.as_dict() for v in changes]
4011
+ if omit_permissions_list is not None:
4012
+ body["omit_permissions_list"] = omit_permissions_list
3627
4013
  headers = {
3628
4014
  "Accept": "application/json",
3629
4015
  "Content-Type": "application/json",