databricks-sdk 0.29.0__py3-none-any.whl → 0.30.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.
- databricks/sdk/__init__.py +67 -19
- databricks/sdk/config.py +61 -75
- databricks/sdk/core.py +16 -9
- databricks/sdk/credentials_provider.py +15 -15
- databricks/sdk/data_plane.py +65 -0
- databricks/sdk/mixins/files.py +12 -4
- databricks/sdk/service/apps.py +977 -0
- databricks/sdk/service/billing.py +602 -218
- databricks/sdk/service/catalog.py +131 -34
- databricks/sdk/service/compute.py +494 -81
- databricks/sdk/service/dashboards.py +608 -5
- databricks/sdk/service/iam.py +99 -88
- databricks/sdk/service/jobs.py +34 -15
- databricks/sdk/service/marketplace.py +2 -122
- databricks/sdk/service/oauth2.py +127 -70
- databricks/sdk/service/pipelines.py +72 -52
- databricks/sdk/service/serving.py +303 -750
- databricks/sdk/service/settings.py +423 -4
- databricks/sdk/service/sharing.py +235 -25
- databricks/sdk/service/sql.py +2417 -566
- databricks/sdk/useragent.py +144 -0
- databricks/sdk/version.py +1 -1
- {databricks_sdk-0.29.0.dist-info → databricks_sdk-0.30.0.dist-info}/METADATA +36 -16
- {databricks_sdk-0.29.0.dist-info → databricks_sdk-0.30.0.dist-info}/RECORD +28 -25
- {databricks_sdk-0.29.0.dist-info → databricks_sdk-0.30.0.dist-info}/WHEEL +1 -1
- {databricks_sdk-0.29.0.dist-info → databricks_sdk-0.30.0.dist-info}/LICENSE +0 -0
- {databricks_sdk-0.29.0.dist-info → databricks_sdk-0.30.0.dist-info}/NOTICE +0 -0
- {databricks_sdk-0.29.0.dist-info → databricks_sdk-0.30.0.dist-info}/top_level.txt +0 -0
|
@@ -483,6 +483,9 @@ class CreateRecipient:
|
|
|
483
483
|
when the __authentication_type__ is **DATABRICKS**. The identifier is of format
|
|
484
484
|
__cloud__:__region__:__metastore-uuid__."""
|
|
485
485
|
|
|
486
|
+
expiration_time: Optional[int] = None
|
|
487
|
+
"""Expiration timestamp of the token, in epoch milliseconds."""
|
|
488
|
+
|
|
486
489
|
ip_access_list: Optional[IpAccessList] = None
|
|
487
490
|
"""IP Access List"""
|
|
488
491
|
|
|
@@ -503,6 +506,7 @@ class CreateRecipient:
|
|
|
503
506
|
if self.comment is not None: body['comment'] = self.comment
|
|
504
507
|
if self.data_recipient_global_metastore_id is not None:
|
|
505
508
|
body['data_recipient_global_metastore_id'] = self.data_recipient_global_metastore_id
|
|
509
|
+
if self.expiration_time is not None: body['expiration_time'] = self.expiration_time
|
|
506
510
|
if self.ip_access_list: body['ip_access_list'] = self.ip_access_list.as_dict()
|
|
507
511
|
if self.name is not None: body['name'] = self.name
|
|
508
512
|
if self.owner is not None: body['owner'] = self.owner
|
|
@@ -516,6 +520,7 @@ class CreateRecipient:
|
|
|
516
520
|
return cls(authentication_type=_enum(d, 'authentication_type', AuthenticationType),
|
|
517
521
|
comment=d.get('comment', None),
|
|
518
522
|
data_recipient_global_metastore_id=d.get('data_recipient_global_metastore_id', None),
|
|
523
|
+
expiration_time=d.get('expiration_time', None),
|
|
519
524
|
ip_access_list=_from_dict(d, 'ip_access_list', IpAccessList),
|
|
520
525
|
name=d.get('name', None),
|
|
521
526
|
owner=d.get('owner', None),
|
|
@@ -580,19 +585,25 @@ class GetActivationUrlInfoResponse:
|
|
|
580
585
|
|
|
581
586
|
@dataclass
|
|
582
587
|
class GetRecipientSharePermissionsResponse:
|
|
588
|
+
next_page_token: Optional[str] = None
|
|
589
|
+
"""Opaque token to retrieve the next page of results. Absent if there are no more pages.
|
|
590
|
+
__page_token__ should be set to this value for the next request (for the next page of results)."""
|
|
591
|
+
|
|
583
592
|
permissions_out: Optional[List[ShareToPrivilegeAssignment]] = None
|
|
584
593
|
"""An array of data share permissions for a recipient."""
|
|
585
594
|
|
|
586
595
|
def as_dict(self) -> dict:
|
|
587
596
|
"""Serializes the GetRecipientSharePermissionsResponse into a dictionary suitable for use as a JSON request body."""
|
|
588
597
|
body = {}
|
|
598
|
+
if self.next_page_token is not None: body['next_page_token'] = self.next_page_token
|
|
589
599
|
if self.permissions_out: body['permissions_out'] = [v.as_dict() for v in self.permissions_out]
|
|
590
600
|
return body
|
|
591
601
|
|
|
592
602
|
@classmethod
|
|
593
603
|
def from_dict(cls, d: Dict[str, any]) -> GetRecipientSharePermissionsResponse:
|
|
594
604
|
"""Deserializes the GetRecipientSharePermissionsResponse from a dictionary."""
|
|
595
|
-
return cls(
|
|
605
|
+
return cls(next_page_token=d.get('next_page_token', None),
|
|
606
|
+
permissions_out=_repeated_dict(d, 'permissions_out', ShareToPrivilegeAssignment))
|
|
596
607
|
|
|
597
608
|
|
|
598
609
|
@dataclass
|
|
@@ -637,70 +648,94 @@ class ListCleanRoomsResponse:
|
|
|
637
648
|
|
|
638
649
|
@dataclass
|
|
639
650
|
class ListProviderSharesResponse:
|
|
651
|
+
next_page_token: Optional[str] = None
|
|
652
|
+
"""Opaque token to retrieve the next page of results. Absent if there are no more pages.
|
|
653
|
+
__page_token__ should be set to this value for the next request (for the next page of results)."""
|
|
654
|
+
|
|
640
655
|
shares: Optional[List[ProviderShare]] = None
|
|
641
656
|
"""An array of provider shares."""
|
|
642
657
|
|
|
643
658
|
def as_dict(self) -> dict:
|
|
644
659
|
"""Serializes the ListProviderSharesResponse into a dictionary suitable for use as a JSON request body."""
|
|
645
660
|
body = {}
|
|
661
|
+
if self.next_page_token is not None: body['next_page_token'] = self.next_page_token
|
|
646
662
|
if self.shares: body['shares'] = [v.as_dict() for v in self.shares]
|
|
647
663
|
return body
|
|
648
664
|
|
|
649
665
|
@classmethod
|
|
650
666
|
def from_dict(cls, d: Dict[str, any]) -> ListProviderSharesResponse:
|
|
651
667
|
"""Deserializes the ListProviderSharesResponse from a dictionary."""
|
|
652
|
-
return cls(
|
|
668
|
+
return cls(next_page_token=d.get('next_page_token', None),
|
|
669
|
+
shares=_repeated_dict(d, 'shares', ProviderShare))
|
|
653
670
|
|
|
654
671
|
|
|
655
672
|
@dataclass
|
|
656
673
|
class ListProvidersResponse:
|
|
674
|
+
next_page_token: Optional[str] = None
|
|
675
|
+
"""Opaque token to retrieve the next page of results. Absent if there are no more pages.
|
|
676
|
+
__page_token__ should be set to this value for the next request (for the next page of results)."""
|
|
677
|
+
|
|
657
678
|
providers: Optional[List[ProviderInfo]] = None
|
|
658
679
|
"""An array of provider information objects."""
|
|
659
680
|
|
|
660
681
|
def as_dict(self) -> dict:
|
|
661
682
|
"""Serializes the ListProvidersResponse into a dictionary suitable for use as a JSON request body."""
|
|
662
683
|
body = {}
|
|
684
|
+
if self.next_page_token is not None: body['next_page_token'] = self.next_page_token
|
|
663
685
|
if self.providers: body['providers'] = [v.as_dict() for v in self.providers]
|
|
664
686
|
return body
|
|
665
687
|
|
|
666
688
|
@classmethod
|
|
667
689
|
def from_dict(cls, d: Dict[str, any]) -> ListProvidersResponse:
|
|
668
690
|
"""Deserializes the ListProvidersResponse from a dictionary."""
|
|
669
|
-
return cls(
|
|
691
|
+
return cls(next_page_token=d.get('next_page_token', None),
|
|
692
|
+
providers=_repeated_dict(d, 'providers', ProviderInfo))
|
|
670
693
|
|
|
671
694
|
|
|
672
695
|
@dataclass
|
|
673
696
|
class ListRecipientsResponse:
|
|
697
|
+
next_page_token: Optional[str] = None
|
|
698
|
+
"""Opaque token to retrieve the next page of results. Absent if there are no more pages.
|
|
699
|
+
__page_token__ should be set to this value for the next request (for the next page of results)."""
|
|
700
|
+
|
|
674
701
|
recipients: Optional[List[RecipientInfo]] = None
|
|
675
702
|
"""An array of recipient information objects."""
|
|
676
703
|
|
|
677
704
|
def as_dict(self) -> dict:
|
|
678
705
|
"""Serializes the ListRecipientsResponse into a dictionary suitable for use as a JSON request body."""
|
|
679
706
|
body = {}
|
|
707
|
+
if self.next_page_token is not None: body['next_page_token'] = self.next_page_token
|
|
680
708
|
if self.recipients: body['recipients'] = [v.as_dict() for v in self.recipients]
|
|
681
709
|
return body
|
|
682
710
|
|
|
683
711
|
@classmethod
|
|
684
712
|
def from_dict(cls, d: Dict[str, any]) -> ListRecipientsResponse:
|
|
685
713
|
"""Deserializes the ListRecipientsResponse from a dictionary."""
|
|
686
|
-
return cls(
|
|
714
|
+
return cls(next_page_token=d.get('next_page_token', None),
|
|
715
|
+
recipients=_repeated_dict(d, 'recipients', RecipientInfo))
|
|
687
716
|
|
|
688
717
|
|
|
689
718
|
@dataclass
|
|
690
719
|
class ListSharesResponse:
|
|
720
|
+
next_page_token: Optional[str] = None
|
|
721
|
+
"""Opaque token to retrieve the next page of results. Absent if there are no more pages.
|
|
722
|
+
__page_token__ should be set to this value for the next request (for the next page of results)."""
|
|
723
|
+
|
|
691
724
|
shares: Optional[List[ShareInfo]] = None
|
|
692
725
|
"""An array of data share information objects."""
|
|
693
726
|
|
|
694
727
|
def as_dict(self) -> dict:
|
|
695
728
|
"""Serializes the ListSharesResponse into a dictionary suitable for use as a JSON request body."""
|
|
696
729
|
body = {}
|
|
730
|
+
if self.next_page_token is not None: body['next_page_token'] = self.next_page_token
|
|
697
731
|
if self.shares: body['shares'] = [v.as_dict() for v in self.shares]
|
|
698
732
|
return body
|
|
699
733
|
|
|
700
734
|
@classmethod
|
|
701
735
|
def from_dict(cls, d: Dict[str, any]) -> ListSharesResponse:
|
|
702
736
|
"""Deserializes the ListSharesResponse from a dictionary."""
|
|
703
|
-
return cls(
|
|
737
|
+
return cls(next_page_token=d.get('next_page_token', None),
|
|
738
|
+
shares=_repeated_dict(d, 'shares', ShareInfo))
|
|
704
739
|
|
|
705
740
|
|
|
706
741
|
@dataclass
|
|
@@ -788,6 +823,7 @@ class Privilege(Enum):
|
|
|
788
823
|
CREATE_VIEW = 'CREATE_VIEW'
|
|
789
824
|
CREATE_VOLUME = 'CREATE_VOLUME'
|
|
790
825
|
EXECUTE = 'EXECUTE'
|
|
826
|
+
MANAGE = 'MANAGE'
|
|
791
827
|
MANAGE_ALLOWLIST = 'MANAGE_ALLOWLIST'
|
|
792
828
|
MODIFY = 'MODIFY'
|
|
793
829
|
READ_FILES = 'READ_FILES'
|
|
@@ -1525,6 +1561,9 @@ class UpdateRecipient:
|
|
|
1525
1561
|
comment: Optional[str] = None
|
|
1526
1562
|
"""Description about the recipient."""
|
|
1527
1563
|
|
|
1564
|
+
expiration_time: Optional[int] = None
|
|
1565
|
+
"""Expiration timestamp of the token, in epoch milliseconds."""
|
|
1566
|
+
|
|
1528
1567
|
ip_access_list: Optional[IpAccessList] = None
|
|
1529
1568
|
"""IP Access List"""
|
|
1530
1569
|
|
|
@@ -1546,6 +1585,7 @@ class UpdateRecipient:
|
|
|
1546
1585
|
"""Serializes the UpdateRecipient into a dictionary suitable for use as a JSON request body."""
|
|
1547
1586
|
body = {}
|
|
1548
1587
|
if self.comment is not None: body['comment'] = self.comment
|
|
1588
|
+
if self.expiration_time is not None: body['expiration_time'] = self.expiration_time
|
|
1549
1589
|
if self.ip_access_list: body['ip_access_list'] = self.ip_access_list.as_dict()
|
|
1550
1590
|
if self.name is not None: body['name'] = self.name
|
|
1551
1591
|
if self.new_name is not None: body['new_name'] = self.new_name
|
|
@@ -1557,6 +1597,7 @@ class UpdateRecipient:
|
|
|
1557
1597
|
def from_dict(cls, d: Dict[str, any]) -> UpdateRecipient:
|
|
1558
1598
|
"""Deserializes the UpdateRecipient from a dictionary."""
|
|
1559
1599
|
return cls(comment=d.get('comment', None),
|
|
1600
|
+
expiration_time=d.get('expiration_time', None),
|
|
1560
1601
|
ip_access_list=_from_dict(d, 'ip_access_list', IpAccessList),
|
|
1561
1602
|
name=d.get('name', None),
|
|
1562
1603
|
new_name=d.get('new_name', None),
|
|
@@ -1625,20 +1666,37 @@ class UpdateSharePermissions:
|
|
|
1625
1666
|
changes: Optional[List[catalog.PermissionsChange]] = None
|
|
1626
1667
|
"""Array of permission changes."""
|
|
1627
1668
|
|
|
1669
|
+
max_results: Optional[int] = None
|
|
1670
|
+
"""Maximum number of permissions to return. - when set to 0, the page length is set to a server
|
|
1671
|
+
configured value (recommended); - when set to a value greater than 0, the page length is the
|
|
1672
|
+
minimum of this value and a server configured value; - when set to a value less than 0, an
|
|
1673
|
+
invalid parameter error is returned; - If not set, all valid permissions are returned (not
|
|
1674
|
+
recommended). - Note: The number of returned permissions might be less than the specified
|
|
1675
|
+
max_results size, even zero. The only definitive indication that no further permissions can be
|
|
1676
|
+
fetched is when the next_page_token is unset from the response."""
|
|
1677
|
+
|
|
1628
1678
|
name: Optional[str] = None
|
|
1629
1679
|
"""The name of the share."""
|
|
1630
1680
|
|
|
1681
|
+
page_token: Optional[str] = None
|
|
1682
|
+
"""Opaque pagination token to go to next page based on previous query."""
|
|
1683
|
+
|
|
1631
1684
|
def as_dict(self) -> dict:
|
|
1632
1685
|
"""Serializes the UpdateSharePermissions into a dictionary suitable for use as a JSON request body."""
|
|
1633
1686
|
body = {}
|
|
1634
1687
|
if self.changes: body['changes'] = [v.as_dict() for v in self.changes]
|
|
1688
|
+
if self.max_results is not None: body['max_results'] = self.max_results
|
|
1635
1689
|
if self.name is not None: body['name'] = self.name
|
|
1690
|
+
if self.page_token is not None: body['page_token'] = self.page_token
|
|
1636
1691
|
return body
|
|
1637
1692
|
|
|
1638
1693
|
@classmethod
|
|
1639
1694
|
def from_dict(cls, d: Dict[str, any]) -> UpdateSharePermissions:
|
|
1640
1695
|
"""Deserializes the UpdateSharePermissions from a dictionary."""
|
|
1641
|
-
return cls(changes=_repeated_dict(d, 'changes', catalog.PermissionsChange),
|
|
1696
|
+
return cls(changes=_repeated_dict(d, 'changes', catalog.PermissionsChange),
|
|
1697
|
+
max_results=d.get('max_results', None),
|
|
1698
|
+
name=d.get('name', None),
|
|
1699
|
+
page_token=d.get('page_token', None))
|
|
1642
1700
|
|
|
1643
1701
|
|
|
1644
1702
|
class CleanRoomsAPI:
|
|
@@ -1864,7 +1922,11 @@ class ProvidersAPI:
|
|
|
1864
1922
|
res = self._api.do('GET', f'/api/2.1/unity-catalog/providers/{name}', headers=headers)
|
|
1865
1923
|
return ProviderInfo.from_dict(res)
|
|
1866
1924
|
|
|
1867
|
-
def list(self,
|
|
1925
|
+
def list(self,
|
|
1926
|
+
*,
|
|
1927
|
+
data_provider_global_metastore_id: Optional[str] = None,
|
|
1928
|
+
max_results: Optional[int] = None,
|
|
1929
|
+
page_token: Optional[str] = None) -> Iterator[ProviderInfo]:
|
|
1868
1930
|
"""List providers.
|
|
1869
1931
|
|
|
1870
1932
|
Gets an array of available authentication providers. The caller must either be a metastore admin or
|
|
@@ -1874,6 +1936,16 @@ class ProvidersAPI:
|
|
|
1874
1936
|
:param data_provider_global_metastore_id: str (optional)
|
|
1875
1937
|
If not provided, all providers will be returned. If no providers exist with this ID, no results will
|
|
1876
1938
|
be returned.
|
|
1939
|
+
:param max_results: int (optional)
|
|
1940
|
+
Maximum number of providers to return. - when set to 0, the page length is set to a server
|
|
1941
|
+
configured value (recommended); - when set to a value greater than 0, the page length is the minimum
|
|
1942
|
+
of this value and a server configured value; - when set to a value less than 0, an invalid parameter
|
|
1943
|
+
error is returned; - If not set, all valid providers are returned (not recommended). - Note: The
|
|
1944
|
+
number of returned providers might be less than the specified max_results size, even zero. The only
|
|
1945
|
+
definitive indication that no further providers can be fetched is when the next_page_token is unset
|
|
1946
|
+
from the response.
|
|
1947
|
+
:param page_token: str (optional)
|
|
1948
|
+
Opaque pagination token to go to next page based on previous query.
|
|
1877
1949
|
|
|
1878
1950
|
:returns: Iterator over :class:`ProviderInfo`
|
|
1879
1951
|
"""
|
|
@@ -1881,13 +1953,24 @@ class ProvidersAPI:
|
|
|
1881
1953
|
query = {}
|
|
1882
1954
|
if data_provider_global_metastore_id is not None:
|
|
1883
1955
|
query['data_provider_global_metastore_id'] = data_provider_global_metastore_id
|
|
1956
|
+
if max_results is not None: query['max_results'] = max_results
|
|
1957
|
+
if page_token is not None: query['page_token'] = page_token
|
|
1884
1958
|
headers = {'Accept': 'application/json', }
|
|
1885
1959
|
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1960
|
+
while True:
|
|
1961
|
+
json = self._api.do('GET', '/api/2.1/unity-catalog/providers', query=query, headers=headers)
|
|
1962
|
+
if 'providers' in json:
|
|
1963
|
+
for v in json['providers']:
|
|
1964
|
+
yield ProviderInfo.from_dict(v)
|
|
1965
|
+
if 'next_page_token' not in json or not json['next_page_token']:
|
|
1966
|
+
return
|
|
1967
|
+
query['page_token'] = json['next_page_token']
|
|
1889
1968
|
|
|
1890
|
-
def list_shares(self,
|
|
1969
|
+
def list_shares(self,
|
|
1970
|
+
name: str,
|
|
1971
|
+
*,
|
|
1972
|
+
max_results: Optional[int] = None,
|
|
1973
|
+
page_token: Optional[str] = None) -> Iterator[ProviderShare]:
|
|
1891
1974
|
"""List shares by Provider.
|
|
1892
1975
|
|
|
1893
1976
|
Gets an array of a specified provider's shares within the metastore where:
|
|
@@ -1896,13 +1979,29 @@ class ProvidersAPI:
|
|
|
1896
1979
|
|
|
1897
1980
|
:param name: str
|
|
1898
1981
|
Name of the provider in which to list shares.
|
|
1982
|
+
:param max_results: int (optional)
|
|
1983
|
+
Maximum number of shares to return. - when set to 0, the page length is set to a server configured
|
|
1984
|
+
value (recommended); - when set to a value greater than 0, the page length is the minimum of this
|
|
1985
|
+
value and a server configured value; - when set to a value less than 0, an invalid parameter error
|
|
1986
|
+
is returned; - If not set, all valid shares are returned (not recommended). - Note: The number of
|
|
1987
|
+
returned shares might be less than the specified max_results size, even zero. The only definitive
|
|
1988
|
+
indication that no further shares can be fetched is when the next_page_token is unset from the
|
|
1989
|
+
response.
|
|
1990
|
+
:param page_token: str (optional)
|
|
1991
|
+
Opaque pagination token to go to next page based on previous query.
|
|
1899
1992
|
|
|
1900
1993
|
:returns: Iterator over :class:`ProviderShare`
|
|
1901
1994
|
"""
|
|
1902
1995
|
|
|
1996
|
+
query = {}
|
|
1997
|
+
if max_results is not None: query['max_results'] = max_results
|
|
1998
|
+
if page_token is not None: query['page_token'] = page_token
|
|
1903
1999
|
headers = {'Accept': 'application/json', }
|
|
1904
2000
|
|
|
1905
|
-
json = self._api.do('GET',
|
|
2001
|
+
json = self._api.do('GET',
|
|
2002
|
+
f'/api/2.1/unity-catalog/providers/{name}/shares',
|
|
2003
|
+
query=query,
|
|
2004
|
+
headers=headers)
|
|
1906
2005
|
parsed = ListProviderSharesResponse.from_dict(json).shares
|
|
1907
2006
|
return parsed if parsed is not None else []
|
|
1908
2007
|
|
|
@@ -2015,6 +2114,7 @@ class RecipientsAPI:
|
|
|
2015
2114
|
*,
|
|
2016
2115
|
comment: Optional[str] = None,
|
|
2017
2116
|
data_recipient_global_metastore_id: Optional[str] = None,
|
|
2117
|
+
expiration_time: Optional[int] = None,
|
|
2018
2118
|
ip_access_list: Optional[IpAccessList] = None,
|
|
2019
2119
|
owner: Optional[str] = None,
|
|
2020
2120
|
properties_kvpairs: Optional[SecurablePropertiesKvPairs] = None,
|
|
@@ -2034,6 +2134,8 @@ class RecipientsAPI:
|
|
|
2034
2134
|
The global Unity Catalog metastore id provided by the data recipient. This field is required when
|
|
2035
2135
|
the __authentication_type__ is **DATABRICKS**. The identifier is of format
|
|
2036
2136
|
__cloud__:__region__:__metastore-uuid__.
|
|
2137
|
+
:param expiration_time: int (optional)
|
|
2138
|
+
Expiration timestamp of the token, in epoch milliseconds.
|
|
2037
2139
|
:param ip_access_list: :class:`IpAccessList` (optional)
|
|
2038
2140
|
IP Access List
|
|
2039
2141
|
:param owner: str (optional)
|
|
@@ -2051,6 +2153,7 @@ class RecipientsAPI:
|
|
|
2051
2153
|
if comment is not None: body['comment'] = comment
|
|
2052
2154
|
if data_recipient_global_metastore_id is not None:
|
|
2053
2155
|
body['data_recipient_global_metastore_id'] = data_recipient_global_metastore_id
|
|
2156
|
+
if expiration_time is not None: body['expiration_time'] = expiration_time
|
|
2054
2157
|
if ip_access_list is not None: body['ip_access_list'] = ip_access_list.as_dict()
|
|
2055
2158
|
if name is not None: body['name'] = name
|
|
2056
2159
|
if owner is not None: body['owner'] = owner
|
|
@@ -2094,7 +2197,11 @@ class RecipientsAPI:
|
|
|
2094
2197
|
res = self._api.do('GET', f'/api/2.1/unity-catalog/recipients/{name}', headers=headers)
|
|
2095
2198
|
return RecipientInfo.from_dict(res)
|
|
2096
2199
|
|
|
2097
|
-
def list(self,
|
|
2200
|
+
def list(self,
|
|
2201
|
+
*,
|
|
2202
|
+
data_recipient_global_metastore_id: Optional[str] = None,
|
|
2203
|
+
max_results: Optional[int] = None,
|
|
2204
|
+
page_token: Optional[str] = None) -> Iterator[RecipientInfo]:
|
|
2098
2205
|
"""List share recipients.
|
|
2099
2206
|
|
|
2100
2207
|
Gets an array of all share recipients within the current metastore where:
|
|
@@ -2105,6 +2212,16 @@ class RecipientsAPI:
|
|
|
2105
2212
|
:param data_recipient_global_metastore_id: str (optional)
|
|
2106
2213
|
If not provided, all recipients will be returned. If no recipients exist with this ID, no results
|
|
2107
2214
|
will be returned.
|
|
2215
|
+
:param max_results: int (optional)
|
|
2216
|
+
Maximum number of recipients to return. - when set to 0, the page length is set to a server
|
|
2217
|
+
configured value (recommended); - when set to a value greater than 0, the page length is the minimum
|
|
2218
|
+
of this value and a server configured value; - when set to a value less than 0, an invalid parameter
|
|
2219
|
+
error is returned; - If not set, all valid recipients are returned (not recommended). - Note: The
|
|
2220
|
+
number of returned recipients might be less than the specified max_results size, even zero. The only
|
|
2221
|
+
definitive indication that no further recipients can be fetched is when the next_page_token is unset
|
|
2222
|
+
from the response.
|
|
2223
|
+
:param page_token: str (optional)
|
|
2224
|
+
Opaque pagination token to go to next page based on previous query.
|
|
2108
2225
|
|
|
2109
2226
|
:returns: Iterator over :class:`RecipientInfo`
|
|
2110
2227
|
"""
|
|
@@ -2112,11 +2229,18 @@ class RecipientsAPI:
|
|
|
2112
2229
|
query = {}
|
|
2113
2230
|
if data_recipient_global_metastore_id is not None:
|
|
2114
2231
|
query['data_recipient_global_metastore_id'] = data_recipient_global_metastore_id
|
|
2232
|
+
if max_results is not None: query['max_results'] = max_results
|
|
2233
|
+
if page_token is not None: query['page_token'] = page_token
|
|
2115
2234
|
headers = {'Accept': 'application/json', }
|
|
2116
2235
|
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2236
|
+
while True:
|
|
2237
|
+
json = self._api.do('GET', '/api/2.1/unity-catalog/recipients', query=query, headers=headers)
|
|
2238
|
+
if 'recipients' in json:
|
|
2239
|
+
for v in json['recipients']:
|
|
2240
|
+
yield RecipientInfo.from_dict(v)
|
|
2241
|
+
if 'next_page_token' not in json or not json['next_page_token']:
|
|
2242
|
+
return
|
|
2243
|
+
query['page_token'] = json['next_page_token']
|
|
2120
2244
|
|
|
2121
2245
|
def rotate_token(self, name: str, existing_token_expire_in_seconds: int) -> RecipientInfo:
|
|
2122
2246
|
"""Rotate a token.
|
|
@@ -2144,7 +2268,11 @@ class RecipientsAPI:
|
|
|
2144
2268
|
headers=headers)
|
|
2145
2269
|
return RecipientInfo.from_dict(res)
|
|
2146
2270
|
|
|
2147
|
-
def share_permissions(self,
|
|
2271
|
+
def share_permissions(self,
|
|
2272
|
+
name: str,
|
|
2273
|
+
*,
|
|
2274
|
+
max_results: Optional[int] = None,
|
|
2275
|
+
page_token: Optional[str] = None) -> GetRecipientSharePermissionsResponse:
|
|
2148
2276
|
"""Get recipient share permissions.
|
|
2149
2277
|
|
|
2150
2278
|
Gets the share permissions for the specified Recipient. The caller must be a metastore admin or the
|
|
@@ -2152,14 +2280,28 @@ class RecipientsAPI:
|
|
|
2152
2280
|
|
|
2153
2281
|
:param name: str
|
|
2154
2282
|
The name of the Recipient.
|
|
2283
|
+
:param max_results: int (optional)
|
|
2284
|
+
Maximum number of permissions to return. - when set to 0, the page length is set to a server
|
|
2285
|
+
configured value (recommended); - when set to a value greater than 0, the page length is the minimum
|
|
2286
|
+
of this value and a server configured value; - when set to a value less than 0, an invalid parameter
|
|
2287
|
+
error is returned; - If not set, all valid permissions are returned (not recommended). - Note: The
|
|
2288
|
+
number of returned permissions might be less than the specified max_results size, even zero. The
|
|
2289
|
+
only definitive indication that no further permissions can be fetched is when the next_page_token is
|
|
2290
|
+
unset from the response.
|
|
2291
|
+
:param page_token: str (optional)
|
|
2292
|
+
Opaque pagination token to go to next page based on previous query.
|
|
2155
2293
|
|
|
2156
2294
|
:returns: :class:`GetRecipientSharePermissionsResponse`
|
|
2157
2295
|
"""
|
|
2158
2296
|
|
|
2297
|
+
query = {}
|
|
2298
|
+
if max_results is not None: query['max_results'] = max_results
|
|
2299
|
+
if page_token is not None: query['page_token'] = page_token
|
|
2159
2300
|
headers = {'Accept': 'application/json', }
|
|
2160
2301
|
|
|
2161
2302
|
res = self._api.do('GET',
|
|
2162
2303
|
f'/api/2.1/unity-catalog/recipients/{name}/share-permissions',
|
|
2304
|
+
query=query,
|
|
2163
2305
|
headers=headers)
|
|
2164
2306
|
return GetRecipientSharePermissionsResponse.from_dict(res)
|
|
2165
2307
|
|
|
@@ -2167,6 +2309,7 @@ class RecipientsAPI:
|
|
|
2167
2309
|
name: str,
|
|
2168
2310
|
*,
|
|
2169
2311
|
comment: Optional[str] = None,
|
|
2312
|
+
expiration_time: Optional[int] = None,
|
|
2170
2313
|
ip_access_list: Optional[IpAccessList] = None,
|
|
2171
2314
|
new_name: Optional[str] = None,
|
|
2172
2315
|
owner: Optional[str] = None,
|
|
@@ -2181,6 +2324,8 @@ class RecipientsAPI:
|
|
|
2181
2324
|
Name of the recipient.
|
|
2182
2325
|
:param comment: str (optional)
|
|
2183
2326
|
Description about the recipient.
|
|
2327
|
+
:param expiration_time: int (optional)
|
|
2328
|
+
Expiration timestamp of the token, in epoch milliseconds.
|
|
2184
2329
|
:param ip_access_list: :class:`IpAccessList` (optional)
|
|
2185
2330
|
IP Access List
|
|
2186
2331
|
:param new_name: str (optional)
|
|
@@ -2196,6 +2341,7 @@ class RecipientsAPI:
|
|
|
2196
2341
|
"""
|
|
2197
2342
|
body = {}
|
|
2198
2343
|
if comment is not None: body['comment'] = comment
|
|
2344
|
+
if expiration_time is not None: body['expiration_time'] = expiration_time
|
|
2199
2345
|
if ip_access_list is not None: body['ip_access_list'] = ip_access_list.as_dict()
|
|
2200
2346
|
if new_name is not None: body['new_name'] = new_name
|
|
2201
2347
|
if owner is not None: body['owner'] = owner
|
|
@@ -2278,22 +2424,48 @@ class SharesAPI:
|
|
|
2278
2424
|
res = self._api.do('GET', f'/api/2.1/unity-catalog/shares/{name}', query=query, headers=headers)
|
|
2279
2425
|
return ShareInfo.from_dict(res)
|
|
2280
2426
|
|
|
2281
|
-
def list(self
|
|
2427
|
+
def list(self,
|
|
2428
|
+
*,
|
|
2429
|
+
max_results: Optional[int] = None,
|
|
2430
|
+
page_token: Optional[str] = None) -> Iterator[ShareInfo]:
|
|
2282
2431
|
"""List shares.
|
|
2283
2432
|
|
|
2284
2433
|
Gets an array of data object shares from the metastore. The caller must be a metastore admin or the
|
|
2285
2434
|
owner of the share. There is no guarantee of a specific ordering of the elements in the array.
|
|
2286
2435
|
|
|
2436
|
+
:param max_results: int (optional)
|
|
2437
|
+
Maximum number of shares to return. - when set to 0, the page length is set to a server configured
|
|
2438
|
+
value (recommended); - when set to a value greater than 0, the page length is the minimum of this
|
|
2439
|
+
value and a server configured value; - when set to a value less than 0, an invalid parameter error
|
|
2440
|
+
is returned; - If not set, all valid shares are returned (not recommended). - Note: The number of
|
|
2441
|
+
returned shares might be less than the specified max_results size, even zero. The only definitive
|
|
2442
|
+
indication that no further shares can be fetched is when the next_page_token is unset from the
|
|
2443
|
+
response.
|
|
2444
|
+
:param page_token: str (optional)
|
|
2445
|
+
Opaque pagination token to go to next page based on previous query.
|
|
2446
|
+
|
|
2287
2447
|
:returns: Iterator over :class:`ShareInfo`
|
|
2288
2448
|
"""
|
|
2289
2449
|
|
|
2450
|
+
query = {}
|
|
2451
|
+
if max_results is not None: query['max_results'] = max_results
|
|
2452
|
+
if page_token is not None: query['page_token'] = page_token
|
|
2290
2453
|
headers = {'Accept': 'application/json', }
|
|
2291
2454
|
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2455
|
+
while True:
|
|
2456
|
+
json = self._api.do('GET', '/api/2.1/unity-catalog/shares', query=query, headers=headers)
|
|
2457
|
+
if 'shares' in json:
|
|
2458
|
+
for v in json['shares']:
|
|
2459
|
+
yield ShareInfo.from_dict(v)
|
|
2460
|
+
if 'next_page_token' not in json or not json['next_page_token']:
|
|
2461
|
+
return
|
|
2462
|
+
query['page_token'] = json['next_page_token']
|
|
2295
2463
|
|
|
2296
|
-
def share_permissions(self,
|
|
2464
|
+
def share_permissions(self,
|
|
2465
|
+
name: str,
|
|
2466
|
+
*,
|
|
2467
|
+
max_results: Optional[int] = None,
|
|
2468
|
+
page_token: Optional[str] = None) -> catalog.PermissionsList:
|
|
2297
2469
|
"""Get permissions.
|
|
2298
2470
|
|
|
2299
2471
|
Gets the permissions for a data share from the metastore. The caller must be a metastore admin or the
|
|
@@ -2301,13 +2473,29 @@ class SharesAPI:
|
|
|
2301
2473
|
|
|
2302
2474
|
:param name: str
|
|
2303
2475
|
The name of the share.
|
|
2476
|
+
:param max_results: int (optional)
|
|
2477
|
+
Maximum number of permissions to return. - when set to 0, the page length is set to a server
|
|
2478
|
+
configured value (recommended); - when set to a value greater than 0, the page length is the minimum
|
|
2479
|
+
of this value and a server configured value; - when set to a value less than 0, an invalid parameter
|
|
2480
|
+
error is returned; - If not set, all valid permissions are returned (not recommended). - Note: The
|
|
2481
|
+
number of returned permissions might be less than the specified max_results size, even zero. The
|
|
2482
|
+
only definitive indication that no further permissions can be fetched is when the next_page_token is
|
|
2483
|
+
unset from the response.
|
|
2484
|
+
:param page_token: str (optional)
|
|
2485
|
+
Opaque pagination token to go to next page based on previous query.
|
|
2304
2486
|
|
|
2305
2487
|
:returns: :class:`PermissionsList`
|
|
2306
2488
|
"""
|
|
2307
2489
|
|
|
2490
|
+
query = {}
|
|
2491
|
+
if max_results is not None: query['max_results'] = max_results
|
|
2492
|
+
if page_token is not None: query['page_token'] = page_token
|
|
2308
2493
|
headers = {'Accept': 'application/json', }
|
|
2309
2494
|
|
|
2310
|
-
res = self._api.do('GET',
|
|
2495
|
+
res = self._api.do('GET',
|
|
2496
|
+
f'/api/2.1/unity-catalog/shares/{name}/permissions',
|
|
2497
|
+
query=query,
|
|
2498
|
+
headers=headers)
|
|
2311
2499
|
return PermissionsList.from_dict(res)
|
|
2312
2500
|
|
|
2313
2501
|
def update(self,
|
|
@@ -2362,7 +2550,12 @@ class SharesAPI:
|
|
|
2362
2550
|
res = self._api.do('PATCH', f'/api/2.1/unity-catalog/shares/{name}', body=body, headers=headers)
|
|
2363
2551
|
return ShareInfo.from_dict(res)
|
|
2364
2552
|
|
|
2365
|
-
def update_permissions(self,
|
|
2553
|
+
def update_permissions(self,
|
|
2554
|
+
name: str,
|
|
2555
|
+
*,
|
|
2556
|
+
changes: Optional[List[catalog.PermissionsChange]] = None,
|
|
2557
|
+
max_results: Optional[int] = None,
|
|
2558
|
+
page_token: Optional[str] = None):
|
|
2366
2559
|
"""Update permissions.
|
|
2367
2560
|
|
|
2368
2561
|
Updates the permissions for a data share in the metastore. The caller must be a metastore admin or an
|
|
@@ -2375,11 +2568,28 @@ class SharesAPI:
|
|
|
2375
2568
|
The name of the share.
|
|
2376
2569
|
:param changes: List[:class:`PermissionsChange`] (optional)
|
|
2377
2570
|
Array of permission changes.
|
|
2571
|
+
:param max_results: int (optional)
|
|
2572
|
+
Maximum number of permissions to return. - when set to 0, the page length is set to a server
|
|
2573
|
+
configured value (recommended); - when set to a value greater than 0, the page length is the minimum
|
|
2574
|
+
of this value and a server configured value; - when set to a value less than 0, an invalid parameter
|
|
2575
|
+
error is returned; - If not set, all valid permissions are returned (not recommended). - Note: The
|
|
2576
|
+
number of returned permissions might be less than the specified max_results size, even zero. The
|
|
2577
|
+
only definitive indication that no further permissions can be fetched is when the next_page_token is
|
|
2578
|
+
unset from the response.
|
|
2579
|
+
:param page_token: str (optional)
|
|
2580
|
+
Opaque pagination token to go to next page based on previous query.
|
|
2378
2581
|
|
|
2379
2582
|
|
|
2380
2583
|
"""
|
|
2381
2584
|
body = {}
|
|
2585
|
+
query = {}
|
|
2382
2586
|
if changes is not None: body['changes'] = [v.as_dict() for v in changes]
|
|
2587
|
+
if max_results is not None: query['max_results'] = max_results
|
|
2588
|
+
if page_token is not None: query['page_token'] = page_token
|
|
2383
2589
|
headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
|
|
2384
2590
|
|
|
2385
|
-
self._api.do('PATCH',
|
|
2591
|
+
self._api.do('PATCH',
|
|
2592
|
+
f'/api/2.1/unity-catalog/shares/{name}/permissions',
|
|
2593
|
+
query=query,
|
|
2594
|
+
body=body,
|
|
2595
|
+
headers=headers)
|