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.

@@ -14,6 +14,48 @@ _LOG = logging.getLogger('databricks.sdk')
14
14
  # all definitions in this file are in alphabetical order
15
15
 
16
16
 
17
+ @dataclass
18
+ class AccountIpAccessEnable:
19
+ acct_ip_acl_enable: BooleanMessage
20
+
21
+ etag: Optional[str] = None
22
+ """etag used for versioning. The response is at least as fresh as the eTag provided. This is used
23
+ for optimistic concurrency control as a way to help prevent simultaneous writes of a setting
24
+ overwriting each other. It is strongly suggested that systems make use of the etag in the read
25
+ -> update pattern to perform setting updates in order to avoid race conditions. That is, get an
26
+ etag from a GET request, and pass it with the PATCH request to identify the setting version you
27
+ are updating."""
28
+
29
+ setting_name: Optional[str] = None
30
+ """Name of the corresponding setting. This field is populated in the response, but it will not be
31
+ respected even if it's set in the request body. The setting name in the path parameter will be
32
+ respected instead. Setting name is required to be 'default' if the setting only has one instance
33
+ per workspace."""
34
+
35
+ def as_dict(self) -> dict:
36
+ """Serializes the AccountIpAccessEnable into a dictionary suitable for use as a JSON request body."""
37
+ body = {}
38
+ if self.acct_ip_acl_enable: body['acct_ip_acl_enable'] = self.acct_ip_acl_enable.as_dict()
39
+ if self.etag is not None: body['etag'] = self.etag
40
+ if self.setting_name is not None: body['setting_name'] = self.setting_name
41
+ return body
42
+
43
+ def as_shallow_dict(self) -> dict:
44
+ """Serializes the AccountIpAccessEnable into a shallow dictionary of its immediate attributes."""
45
+ body = {}
46
+ if self.acct_ip_acl_enable: body['acct_ip_acl_enable'] = self.acct_ip_acl_enable
47
+ if self.etag is not None: body['etag'] = self.etag
48
+ if self.setting_name is not None: body['setting_name'] = self.setting_name
49
+ return body
50
+
51
+ @classmethod
52
+ def from_dict(cls, d: Dict[str, any]) -> AccountIpAccessEnable:
53
+ """Deserializes the AccountIpAccessEnable from a dictionary."""
54
+ return cls(acct_ip_acl_enable=_from_dict(d, 'acct_ip_acl_enable', BooleanMessage),
55
+ etag=d.get('etag', None),
56
+ setting_name=d.get('setting_name', None))
57
+
58
+
17
59
  @dataclass
18
60
  class AibiDashboardEmbeddingAccessPolicy:
19
61
  access_policy_type: AibiDashboardEmbeddingAccessPolicyAccessPolicyType
@@ -991,6 +1033,36 @@ class DefaultNamespaceSetting:
991
1033
  setting_name=d.get('setting_name', None))
992
1034
 
993
1035
 
1036
+ @dataclass
1037
+ class DeleteAccountIpAccessEnableResponse:
1038
+ """The etag is returned."""
1039
+
1040
+ etag: str
1041
+ """etag used for versioning. The response is at least as fresh as the eTag provided. This is used
1042
+ for optimistic concurrency control as a way to help prevent simultaneous writes of a setting
1043
+ overwriting each other. It is strongly suggested that systems make use of the etag in the read
1044
+ -> delete pattern to perform setting deletions in order to avoid race conditions. That is, get
1045
+ an etag from a GET request, and pass it with the DELETE request to identify the rule set version
1046
+ you are deleting."""
1047
+
1048
+ def as_dict(self) -> dict:
1049
+ """Serializes the DeleteAccountIpAccessEnableResponse into a dictionary suitable for use as a JSON request body."""
1050
+ body = {}
1051
+ if self.etag is not None: body['etag'] = self.etag
1052
+ return body
1053
+
1054
+ def as_shallow_dict(self) -> dict:
1055
+ """Serializes the DeleteAccountIpAccessEnableResponse into a shallow dictionary of its immediate attributes."""
1056
+ body = {}
1057
+ if self.etag is not None: body['etag'] = self.etag
1058
+ return body
1059
+
1060
+ @classmethod
1061
+ def from_dict(cls, d: Dict[str, any]) -> DeleteAccountIpAccessEnableResponse:
1062
+ """Deserializes the DeleteAccountIpAccessEnableResponse from a dictionary."""
1063
+ return cls(etag=d.get('etag', None))
1064
+
1065
+
994
1066
  @dataclass
995
1067
  class DeleteAibiDashboardEmbeddingAccessPolicySettingResponse:
996
1068
  """The etag is returned."""
@@ -3556,9 +3628,48 @@ class TokenType(Enum):
3556
3628
  """The type of token request. As of now, only `AZURE_ACTIVE_DIRECTORY_TOKEN` is supported."""
3557
3629
 
3558
3630
  ARCLIGHT_AZURE_EXCHANGE_TOKEN = 'ARCLIGHT_AZURE_EXCHANGE_TOKEN'
3631
+ ARCLIGHT_AZURE_EXCHANGE_TOKEN_WITH_USER_DELEGATION_KEY = 'ARCLIGHT_AZURE_EXCHANGE_TOKEN_WITH_USER_DELEGATION_KEY'
3559
3632
  AZURE_ACTIVE_DIRECTORY_TOKEN = 'AZURE_ACTIVE_DIRECTORY_TOKEN'
3560
3633
 
3561
3634
 
3635
+ @dataclass
3636
+ class UpdateAccountIpAccessEnableRequest:
3637
+ """Details required to update a setting."""
3638
+
3639
+ allow_missing: bool
3640
+ """This should always be set to true for Settings API. Added for AIP compliance."""
3641
+
3642
+ setting: AccountIpAccessEnable
3643
+
3644
+ field_mask: str
3645
+ """Field mask is required to be passed into the PATCH request. Field mask specifies which fields of
3646
+ the setting payload will be updated. The field mask needs to be supplied as single string. To
3647
+ specify multiple fields in the field mask, use comma as the separator (no space)."""
3648
+
3649
+ def as_dict(self) -> dict:
3650
+ """Serializes the UpdateAccountIpAccessEnableRequest into a dictionary suitable for use as a JSON request body."""
3651
+ body = {}
3652
+ if self.allow_missing is not None: body['allow_missing'] = self.allow_missing
3653
+ if self.field_mask is not None: body['field_mask'] = self.field_mask
3654
+ if self.setting: body['setting'] = self.setting.as_dict()
3655
+ return body
3656
+
3657
+ def as_shallow_dict(self) -> dict:
3658
+ """Serializes the UpdateAccountIpAccessEnableRequest into a shallow dictionary of its immediate attributes."""
3659
+ body = {}
3660
+ if self.allow_missing is not None: body['allow_missing'] = self.allow_missing
3661
+ if self.field_mask is not None: body['field_mask'] = self.field_mask
3662
+ if self.setting: body['setting'] = self.setting
3663
+ return body
3664
+
3665
+ @classmethod
3666
+ def from_dict(cls, d: Dict[str, any]) -> UpdateAccountIpAccessEnableRequest:
3667
+ """Deserializes the UpdateAccountIpAccessEnableRequest from a dictionary."""
3668
+ return cls(allow_missing=d.get('allow_missing', None),
3669
+ field_mask=d.get('field_mask', None),
3670
+ setting=_from_dict(d, 'setting', AccountIpAccessEnable))
3671
+
3672
+
3562
3673
  @dataclass
3563
3674
  class UpdateAibiDashboardEmbeddingAccessPolicySettingRequest:
3564
3675
  """Details required to update a setting."""
@@ -4391,6 +4502,7 @@ class AccountSettingsAPI:
4391
4502
 
4392
4503
  self._csp_enablement_account = CspEnablementAccountAPI(self._api)
4393
4504
  self._disable_legacy_features = DisableLegacyFeaturesAPI(self._api)
4505
+ self._enable_ip_access_lists = EnableIpAccessListsAPI(self._api)
4394
4506
  self._esm_enablement_account = EsmEnablementAccountAPI(self._api)
4395
4507
  self._personal_compute = PersonalComputeAPI(self._api)
4396
4508
 
@@ -4404,6 +4516,11 @@ class AccountSettingsAPI:
4404
4516
  """Disable legacy features for new Databricks workspaces."""
4405
4517
  return self._disable_legacy_features
4406
4518
 
4519
+ @property
4520
+ def enable_ip_access_lists(self) -> EnableIpAccessListsAPI:
4521
+ """Controls the enforcement of IP access lists for accessing the account console."""
4522
+ return self._enable_ip_access_lists
4523
+
4407
4524
  @property
4408
4525
  def esm_enablement_account(self) -> EsmEnablementAccountAPI:
4409
4526
  """The enhanced security monitoring setting at the account level controls whether to enable the feature on new workspaces."""
@@ -5203,6 +5320,95 @@ class DisableLegacyFeaturesAPI:
5203
5320
  return DisableLegacyFeatures.from_dict(res)
5204
5321
 
5205
5322
 
5323
+ class EnableIpAccessListsAPI:
5324
+ """Controls the enforcement of IP access lists for accessing the account console. Allowing you to enable or
5325
+ disable restricted access based on IP addresses."""
5326
+
5327
+ def __init__(self, api_client):
5328
+ self._api = api_client
5329
+
5330
+ def delete(self, *, etag: Optional[str] = None) -> DeleteAccountIpAccessEnableResponse:
5331
+ """Delete the account IP access toggle setting.
5332
+
5333
+ Reverts the value of the account IP access toggle setting to default (ON)
5334
+
5335
+ :param etag: str (optional)
5336
+ etag used for versioning. The response is at least as fresh as the eTag provided. This is used for
5337
+ optimistic concurrency control as a way to help prevent simultaneous writes of a setting overwriting
5338
+ each other. It is strongly suggested that systems make use of the etag in the read -> delete pattern
5339
+ to perform setting deletions in order to avoid race conditions. That is, get an etag from a GET
5340
+ request, and pass it with the DELETE request to identify the rule set version you are deleting.
5341
+
5342
+ :returns: :class:`DeleteAccountIpAccessEnableResponse`
5343
+ """
5344
+
5345
+ query = {}
5346
+ if etag is not None: query['etag'] = etag
5347
+ headers = {'Accept': 'application/json', }
5348
+
5349
+ res = self._api.do(
5350
+ 'DELETE',
5351
+ f'/api/2.0/accounts/{self._api.account_id}/settings/types/acct_ip_acl_enable/names/default',
5352
+ query=query,
5353
+ headers=headers)
5354
+ return DeleteAccountIpAccessEnableResponse.from_dict(res)
5355
+
5356
+ def get(self, *, etag: Optional[str] = None) -> AccountIpAccessEnable:
5357
+ """Get the account IP access toggle setting.
5358
+
5359
+ Gets the value of the account IP access toggle setting.
5360
+
5361
+ :param etag: str (optional)
5362
+ etag used for versioning. The response is at least as fresh as the eTag provided. This is used for
5363
+ optimistic concurrency control as a way to help prevent simultaneous writes of a setting overwriting
5364
+ each other. It is strongly suggested that systems make use of the etag in the read -> delete pattern
5365
+ to perform setting deletions in order to avoid race conditions. That is, get an etag from a GET
5366
+ request, and pass it with the DELETE request to identify the rule set version you are deleting.
5367
+
5368
+ :returns: :class:`AccountIpAccessEnable`
5369
+ """
5370
+
5371
+ query = {}
5372
+ if etag is not None: query['etag'] = etag
5373
+ headers = {'Accept': 'application/json', }
5374
+
5375
+ res = self._api.do(
5376
+ 'GET',
5377
+ f'/api/2.0/accounts/{self._api.account_id}/settings/types/acct_ip_acl_enable/names/default',
5378
+ query=query,
5379
+ headers=headers)
5380
+ return AccountIpAccessEnable.from_dict(res)
5381
+
5382
+ def update(self, allow_missing: bool, setting: AccountIpAccessEnable,
5383
+ field_mask: str) -> AccountIpAccessEnable:
5384
+ """Update the account IP access toggle setting.
5385
+
5386
+ Updates the value of the account IP access toggle setting.
5387
+
5388
+ :param allow_missing: bool
5389
+ This should always be set to true for Settings API. Added for AIP compliance.
5390
+ :param setting: :class:`AccountIpAccessEnable`
5391
+ :param field_mask: str
5392
+ Field mask is required to be passed into the PATCH request. Field mask specifies which fields of the
5393
+ setting payload will be updated. The field mask needs to be supplied as single string. To specify
5394
+ multiple fields in the field mask, use comma as the separator (no space).
5395
+
5396
+ :returns: :class:`AccountIpAccessEnable`
5397
+ """
5398
+ body = {}
5399
+ if allow_missing is not None: body['allow_missing'] = allow_missing
5400
+ if field_mask is not None: body['field_mask'] = field_mask
5401
+ if setting is not None: body['setting'] = setting.as_dict()
5402
+ headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
5403
+
5404
+ res = self._api.do(
5405
+ 'PATCH',
5406
+ f'/api/2.0/accounts/{self._api.account_id}/settings/types/acct_ip_acl_enable/names/default',
5407
+ body=body,
5408
+ headers=headers)
5409
+ return AccountIpAccessEnable.from_dict(res)
5410
+
5411
+
5206
5412
  class EnhancedSecurityMonitoringAPI:
5207
5413
  """Controls whether enhanced security monitoring is enabled for the current workspace. If the compliance
5208
5414
  security profile is enabled, this is automatically enabled. By default, it is disabled. However, if the
@@ -35,7 +35,8 @@ class CreateProvider:
35
35
  """Description about the provider."""
36
36
 
37
37
  recipient_profile_str: Optional[str] = None
38
- """This field is required when the __authentication_type__ is **TOKEN** or not provided."""
38
+ """This field is required when the __authentication_type__ is **TOKEN**,
39
+ **OAUTH_CLIENT_CREDENTIALS** or not provided."""
39
40
 
40
41
  def as_dict(self) -> dict:
41
42
  """Serializes the CreateProvider into a dictionary suitable for use as a JSON request body."""
@@ -76,7 +77,7 @@ class CreateRecipient:
76
77
  """Description about the recipient."""
77
78
 
78
79
  data_recipient_global_metastore_id: Optional[str] = None
79
- """The global Unity Catalog metastore id provided by the data recipient. This field is required
80
+ """The global Unity Catalog metastore id provided by the data recipient. This field is only present
80
81
  when the __authentication_type__ is **DATABRICKS**. The identifier is of format
81
82
  __cloud__:__region__:__metastore-uuid__."""
82
83
 
@@ -90,10 +91,12 @@ class CreateRecipient:
90
91
  """Username of the recipient owner."""
91
92
 
92
93
  properties_kvpairs: Optional[SecurablePropertiesKvPairs] = None
93
- """Recipient properties as map of string key-value pairs."""
94
+ """Recipient properties as map of string key-value pairs. When provided in update request, the
95
+ specified properties will override the existing properties. To add and remove properties, one
96
+ would need to perform a read-modify-write."""
94
97
 
95
98
  sharing_code: Optional[str] = None
96
- """The one-time sharing code provided by the data recipient. This field is required when the
99
+ """The one-time sharing code provided by the data recipient. This field is only present when the
97
100
  __authentication_type__ is **DATABRICKS**."""
98
101
 
99
102
  def as_dict(self) -> dict:
@@ -581,7 +584,7 @@ class ProviderInfo:
581
584
  data_provider_global_metastore_id: Optional[str] = None
582
585
  """The global UC metastore id of the data provider. This field is only present when the
583
586
  __authentication_type__ is **DATABRICKS**. The identifier is of format
584
- <cloud>:<region>:<metastore-uuid>."""
587
+ __cloud__:__region__:__metastore-uuid__."""
585
588
 
586
589
  metastore_id: Optional[str] = None
587
590
  """UUID of the provider's UC metastore. This field is only present when the __authentication_type__
@@ -594,10 +597,12 @@ class ProviderInfo:
594
597
  """Username of Provider owner."""
595
598
 
596
599
  recipient_profile: Optional[RecipientProfile] = None
597
- """The recipient profile. This field is only present when the authentication_type is `TOKEN`."""
600
+ """The recipient profile. This field is only present when the authentication_type is `TOKEN` or
601
+ `OAUTH_CLIENT_CREDENTIALS`."""
598
602
 
599
603
  recipient_profile_str: Optional[str] = None
600
- """This field is only present when the authentication_type is `TOKEN` or not provided."""
604
+ """This field is required when the __authentication_type__ is **TOKEN**,
605
+ **OAUTH_CLIENT_CREDENTIALS** or not provided."""
601
606
 
602
607
  region: Optional[str] = None
603
608
  """Cloud region of the provider's UC metastore. This field is only present when the
@@ -607,7 +612,7 @@ class ProviderInfo:
607
612
  """Time at which this Provider was created, in epoch milliseconds."""
608
613
 
609
614
  updated_by: Optional[str] = None
610
- """Username of user who last modified Share."""
615
+ """Username of user who last modified Provider."""
611
616
 
612
617
  def as_dict(self) -> dict:
613
618
  """Serializes the ProviderInfo into a dictionary suitable for use as a JSON request body."""
@@ -704,8 +709,8 @@ class RecipientInfo:
704
709
  """The delta sharing authentication type."""
705
710
 
706
711
  cloud: Optional[str] = None
707
- """Cloud vendor of the recipient's Unity Catalog Metstore. This field is only present when the
708
- __authentication_type__ is **DATABRICKS**`."""
712
+ """Cloud vendor of the recipient's Unity Catalog Metastore. This field is only present when the
713
+ __authentication_type__ is **DATABRICKS**."""
709
714
 
710
715
  comment: Optional[str] = None
711
716
  """Description about the recipient."""
@@ -721,12 +726,15 @@ class RecipientInfo:
721
726
  when the __authentication_type__ is **DATABRICKS**. The identifier is of format
722
727
  __cloud__:__region__:__metastore-uuid__."""
723
728
 
729
+ expiration_time: Optional[int] = None
730
+ """Expiration timestamp of the token, in epoch milliseconds."""
731
+
724
732
  ip_access_list: Optional[IpAccessList] = None
725
733
  """IP Access List"""
726
734
 
727
735
  metastore_id: Optional[str] = None
728
- """Unique identifier of recipient's Unity Catalog metastore. This field is only present when the
729
- __authentication_type__ is **DATABRICKS**"""
736
+ """Unique identifier of recipient's Unity Catalog Metastore. This field is only present when the
737
+ __authentication_type__ is **DATABRICKS**."""
730
738
 
731
739
  name: Optional[str] = None
732
740
  """Name of Recipient."""
@@ -735,10 +743,12 @@ class RecipientInfo:
735
743
  """Username of the recipient owner."""
736
744
 
737
745
  properties_kvpairs: Optional[SecurablePropertiesKvPairs] = None
738
- """Recipient properties as map of string key-value pairs."""
746
+ """Recipient properties as map of string key-value pairs. When provided in update request, the
747
+ specified properties will override the existing properties. To add and remove properties, one
748
+ would need to perform a read-modify-write."""
739
749
 
740
750
  region: Optional[str] = None
741
- """Cloud region of the recipient's Unity Catalog Metstore. This field is only present when the
751
+ """Cloud region of the recipient's Unity Catalog Metastore. This field is only present when the
742
752
  __authentication_type__ is **DATABRICKS**."""
743
753
 
744
754
  sharing_code: Optional[str] = None
@@ -766,6 +776,7 @@ class RecipientInfo:
766
776
  if self.created_by is not None: body['created_by'] = self.created_by
767
777
  if self.data_recipient_global_metastore_id is not None:
768
778
  body['data_recipient_global_metastore_id'] = self.data_recipient_global_metastore_id
779
+ if self.expiration_time is not None: body['expiration_time'] = self.expiration_time
769
780
  if self.ip_access_list: body['ip_access_list'] = self.ip_access_list.as_dict()
770
781
  if self.metastore_id is not None: body['metastore_id'] = self.metastore_id
771
782
  if self.name is not None: body['name'] = self.name
@@ -790,6 +801,7 @@ class RecipientInfo:
790
801
  if self.created_by is not None: body['created_by'] = self.created_by
791
802
  if self.data_recipient_global_metastore_id is not None:
792
803
  body['data_recipient_global_metastore_id'] = self.data_recipient_global_metastore_id
804
+ if self.expiration_time is not None: body['expiration_time'] = self.expiration_time
793
805
  if self.ip_access_list: body['ip_access_list'] = self.ip_access_list
794
806
  if self.metastore_id is not None: body['metastore_id'] = self.metastore_id
795
807
  if self.name is not None: body['name'] = self.name
@@ -813,6 +825,7 @@ class RecipientInfo:
813
825
  created_at=d.get('created_at', None),
814
826
  created_by=d.get('created_by', None),
815
827
  data_recipient_global_metastore_id=d.get('data_recipient_global_metastore_id', None),
828
+ expiration_time=d.get('expiration_time', None),
816
829
  ip_access_list=_from_dict(d, 'ip_access_list', IpAccessList),
817
830
  metastore_id=d.get('metastore_id', None),
818
831
  name=d.get('name', None),
@@ -869,7 +882,7 @@ class RecipientTokenInfo:
869
882
  retrieved."""
870
883
 
871
884
  created_at: Optional[int] = None
872
- """Time at which this recipient Token was created, in epoch milliseconds."""
885
+ """Time at which this recipient token was created, in epoch milliseconds."""
873
886
 
874
887
  created_by: Optional[str] = None
875
888
  """Username of recipient token creator."""
@@ -881,10 +894,10 @@ class RecipientTokenInfo:
881
894
  """Unique ID of the recipient token."""
882
895
 
883
896
  updated_at: Optional[int] = None
884
- """Time at which this recipient Token was updated, in epoch milliseconds."""
897
+ """Time at which this recipient token was updated, in epoch milliseconds."""
885
898
 
886
899
  updated_by: Optional[str] = None
887
- """Username of recipient Token updater."""
900
+ """Username of recipient token updater."""
888
901
 
889
902
  def as_dict(self) -> dict:
890
903
  """Serializes the RecipientTokenInfo into a dictionary suitable for use as a JSON request body."""
@@ -973,7 +986,7 @@ class RotateRecipientToken:
973
986
  expire the existing token immediately, negative number will return an error."""
974
987
 
975
988
  name: Optional[str] = None
976
- """The name of the recipient."""
989
+ """The name of the Recipient."""
977
990
 
978
991
  def as_dict(self) -> dict:
979
992
  """Serializes the RotateRecipientToken into a dictionary suitable for use as a JSON request body."""
@@ -1023,9 +1036,6 @@ class SecurablePropertiesKvPairs:
1023
1036
  return cls(properties=d.get('properties', None))
1024
1037
 
1025
1038
 
1026
- SecurablePropertiesMap = Dict[str, str]
1027
-
1028
-
1029
1039
  @dataclass
1030
1040
  class ShareInfo:
1031
1041
  comment: Optional[str] = None
@@ -1346,7 +1356,8 @@ class UpdateProvider:
1346
1356
  """Username of Provider owner."""
1347
1357
 
1348
1358
  recipient_profile_str: Optional[str] = None
1349
- """This field is required when the __authentication_type__ is **TOKEN** or not provided."""
1359
+ """This field is required when the __authentication_type__ is **TOKEN**,
1360
+ **OAUTH_CLIENT_CREDENTIALS** or not provided."""
1350
1361
 
1351
1362
  def as_dict(self) -> dict:
1352
1363
  """Serializes the UpdateProvider into a dictionary suitable for use as a JSON request body."""
@@ -1393,7 +1404,7 @@ class UpdateRecipient:
1393
1404
  """Name of the recipient."""
1394
1405
 
1395
1406
  new_name: Optional[str] = None
1396
- """New name for the recipient."""
1407
+ """New name for the recipient. ."""
1397
1408
 
1398
1409
  owner: Optional[str] = None
1399
1410
  """Username of the recipient owner."""
@@ -1439,25 +1450,6 @@ class UpdateRecipient:
1439
1450
  properties_kvpairs=_from_dict(d, 'properties_kvpairs', SecurablePropertiesKvPairs))
1440
1451
 
1441
1452
 
1442
- @dataclass
1443
- class UpdateResponse:
1444
-
1445
- def as_dict(self) -> dict:
1446
- """Serializes the UpdateResponse into a dictionary suitable for use as a JSON request body."""
1447
- body = {}
1448
- return body
1449
-
1450
- def as_shallow_dict(self) -> dict:
1451
- """Serializes the UpdateResponse into a shallow dictionary of its immediate attributes."""
1452
- body = {}
1453
- return body
1454
-
1455
- @classmethod
1456
- def from_dict(cls, d: Dict[str, any]) -> UpdateResponse:
1457
- """Deserializes the UpdateResponse from a dictionary."""
1458
- return cls()
1459
-
1460
-
1461
1453
  @dataclass
1462
1454
  class UpdateShare:
1463
1455
  comment: Optional[str] = None
@@ -1583,7 +1575,8 @@ class ProvidersAPI:
1583
1575
  :param comment: str (optional)
1584
1576
  Description about the provider.
1585
1577
  :param recipient_profile_str: str (optional)
1586
- This field is required when the __authentication_type__ is **TOKEN** or not provided.
1578
+ This field is required when the __authentication_type__ is **TOKEN**, **OAUTH_CLIENT_CREDENTIALS**
1579
+ or not provided.
1587
1580
 
1588
1581
  :returns: :class:`ProviderInfo`
1589
1582
  """
@@ -1735,7 +1728,8 @@ class ProvidersAPI:
1735
1728
  :param owner: str (optional)
1736
1729
  Username of Provider owner.
1737
1730
  :param recipient_profile_str: str (optional)
1738
- This field is required when the __authentication_type__ is **TOKEN** or not provided.
1731
+ This field is required when the __authentication_type__ is **TOKEN**, **OAUTH_CLIENT_CREDENTIALS**
1732
+ or not provided.
1739
1733
 
1740
1734
  :returns: :class:`ProviderInfo`
1741
1735
  """
@@ -1830,7 +1824,7 @@ class RecipientsAPI:
1830
1824
  """Create a share recipient.
1831
1825
 
1832
1826
  Creates a new recipient with the delta sharing authentication type in the metastore. The caller must
1833
- be a metastore admin or has the **CREATE_RECIPIENT** privilege on the metastore.
1827
+ be a metastore admin or have the **CREATE_RECIPIENT** privilege on the metastore.
1834
1828
 
1835
1829
  :param name: str
1836
1830
  Name of Recipient.
@@ -1839,8 +1833,8 @@ class RecipientsAPI:
1839
1833
  :param comment: str (optional)
1840
1834
  Description about the recipient.
1841
1835
  :param data_recipient_global_metastore_id: str (optional)
1842
- The global Unity Catalog metastore id provided by the data recipient. This field is required when
1843
- the __authentication_type__ is **DATABRICKS**. The identifier is of format
1836
+ The global Unity Catalog metastore id provided by the data recipient. This field is only present
1837
+ when the __authentication_type__ is **DATABRICKS**. The identifier is of format
1844
1838
  __cloud__:__region__:__metastore-uuid__.
1845
1839
  :param expiration_time: int (optional)
1846
1840
  Expiration timestamp of the token, in epoch milliseconds.
@@ -1849,9 +1843,11 @@ class RecipientsAPI:
1849
1843
  :param owner: str (optional)
1850
1844
  Username of the recipient owner.
1851
1845
  :param properties_kvpairs: :class:`SecurablePropertiesKvPairs` (optional)
1852
- Recipient properties as map of string key-value pairs.
1846
+ Recipient properties as map of string key-value pairs. When provided in update request, the
1847
+ specified properties will override the existing properties. To add and remove properties, one would
1848
+ need to perform a read-modify-write.
1853
1849
  :param sharing_code: str (optional)
1854
- The one-time sharing code provided by the data recipient. This field is required when the
1850
+ The one-time sharing code provided by the data recipient. This field is only present when the
1855
1851
  __authentication_type__ is **DATABRICKS**.
1856
1852
 
1857
1853
  :returns: :class:`RecipientInfo`
@@ -1957,7 +1953,7 @@ class RecipientsAPI:
1957
1953
  The caller must be the owner of the recipient.
1958
1954
 
1959
1955
  :param name: str
1960
- The name of the recipient.
1956
+ The name of the Recipient.
1961
1957
  :param existing_token_expire_in_seconds: int
1962
1958
  The expiration time of the bearer token in ISO 8601 format. This will set the expiration_time of
1963
1959
  existing token only to a smaller timestamp, it cannot extend the expiration_time. Use 0 to expire
@@ -2021,7 +2017,7 @@ class RecipientsAPI:
2021
2017
  ip_access_list: Optional[IpAccessList] = None,
2022
2018
  new_name: Optional[str] = None,
2023
2019
  owner: Optional[str] = None,
2024
- properties_kvpairs: Optional[SecurablePropertiesKvPairs] = None):
2020
+ properties_kvpairs: Optional[SecurablePropertiesKvPairs] = None) -> RecipientInfo:
2025
2021
  """Update a share recipient.
2026
2022
 
2027
2023
  Updates an existing recipient in the metastore. The caller must be a metastore admin or the owner of
@@ -2037,7 +2033,7 @@ class RecipientsAPI:
2037
2033
  :param ip_access_list: :class:`IpAccessList` (optional)
2038
2034
  IP Access List
2039
2035
  :param new_name: str (optional)
2040
- New name for the recipient.
2036
+ New name for the recipient. .
2041
2037
  :param owner: str (optional)
2042
2038
  Username of the recipient owner.
2043
2039
  :param properties_kvpairs: :class:`SecurablePropertiesKvPairs` (optional)
@@ -2045,7 +2041,7 @@ class RecipientsAPI:
2045
2041
  specified properties will override the existing properties. To add and remove properties, one would
2046
2042
  need to perform a read-modify-write.
2047
2043
 
2048
-
2044
+ :returns: :class:`RecipientInfo`
2049
2045
  """
2050
2046
  body = {}
2051
2047
  if comment is not None: body['comment'] = comment
@@ -2056,7 +2052,8 @@ class RecipientsAPI:
2056
2052
  if properties_kvpairs is not None: body['properties_kvpairs'] = properties_kvpairs.as_dict()
2057
2053
  headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
2058
2054
 
2059
- self._api.do('PATCH', f'/api/2.1/unity-catalog/recipients/{name}', body=body, headers=headers)
2055
+ res = self._api.do('PATCH', f'/api/2.1/unity-catalog/recipients/{name}', body=body, headers=headers)
2056
+ return RecipientInfo.from_dict(res)
2060
2057
 
2061
2058
 
2062
2059
  class SharesAPI:
@@ -148,4 +148,58 @@ def to_string(alternate_product_info: Optional[Tuple[str, str]] = None,
148
148
  base.extend(_extra)
149
149
  base.extend(_get_upstream_user_agent_info())
150
150
  base.extend(_get_runtime_info())
151
+ if cicd_provider() != "":
152
+ base.append((CICD_KEY, cicd_provider()))
151
153
  return " ".join(f"{k}/{v}" for k, v in base)
154
+
155
+
156
+ # List of CI/CD providers and pairs of envvar/value that are used to detect them.
157
+ _PROVIDERS = {
158
+ "github": [("GITHUB_ACTIONS", "true")],
159
+ "gitlab": [("GITLAB_CI", "true")],
160
+ "jenkins": [("JENKINS_URL", "")],
161
+ "azure-devops": [("TF_BUILD", "True")],
162
+ "circle": [("CIRCLECI", "true")],
163
+ "travis": [("TRAVIS", "true")],
164
+ "bitbucket": [("BITBUCKET_BUILD_NUMBER", "")],
165
+ "google-cloud-build": [("PROJECT_ID", ""), ("BUILD_ID", ""), ("PROJECT_NUMBER", ""), ("LOCATION", "")],
166
+ "aws-code-build": [("CODEBUILD_BUILD_ARN", "")],
167
+ "tf-cloud": [("TFC_RUN_ID", "")],
168
+ }
169
+
170
+ # Private variable to store the CI/CD provider. This value is computed at
171
+ # the first invocation of cicd_providers() and is cached for subsequent calls.
172
+ _cicd_provider = None
173
+
174
+
175
+ def cicd_provider() -> str:
176
+ """Return the CI/CD provider if detected, or an empty string otherwise."""
177
+
178
+ # This function is safe because (i) assignation are atomic, and (ii)
179
+ # computating the CI/CD provider is idempotent.
180
+ global _cicd_provider
181
+ if _cicd_provider is not None:
182
+ return _cicd_provider
183
+
184
+ providers = []
185
+ for p in _PROVIDERS:
186
+ found = True
187
+ for envvar, value in _PROVIDERS[p]:
188
+ v = os.getenv(envvar)
189
+ if v is None or (value != "" and v != value):
190
+ found = False
191
+ break
192
+
193
+ if found:
194
+ providers.append(p)
195
+
196
+ if len(providers) == 0:
197
+ _cicd_provider = ""
198
+ else:
199
+ # TODO: reconsider what to do if multiple providers are detected.
200
+ # The current mechanism as the benefit of being deterministic and
201
+ # robust to ordering changes in _PROVIDERS.
202
+ providers.sort()
203
+ _cicd_provider = providers[0]
204
+
205
+ return _cicd_provider
databricks/sdk/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = '0.40.0'
1
+ __version__ = '0.42.0'