databricks-sdk 0.28.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 +74 -22
- databricks/sdk/config.py +89 -48
- databricks/sdk/core.py +38 -9
- databricks/sdk/credentials_provider.py +134 -57
- databricks/sdk/data_plane.py +65 -0
- databricks/sdk/dbutils.py +81 -3
- databricks/sdk/mixins/files.py +12 -4
- databricks/sdk/oauth.py +8 -6
- databricks/sdk/service/apps.py +977 -0
- databricks/sdk/service/billing.py +602 -218
- databricks/sdk/service/catalog.py +263 -62
- databricks/sdk/service/compute.py +515 -94
- databricks/sdk/service/dashboards.py +1310 -2
- databricks/sdk/service/iam.py +99 -88
- databricks/sdk/service/jobs.py +159 -166
- databricks/sdk/service/marketplace.py +74 -58
- databricks/sdk/service/oauth2.py +149 -70
- databricks/sdk/service/pipelines.py +73 -53
- databricks/sdk/service/serving.py +332 -694
- databricks/sdk/service/settings.py +424 -4
- databricks/sdk/service/sharing.py +235 -26
- databricks/sdk/service/sql.py +2484 -553
- databricks/sdk/service/vectorsearch.py +75 -0
- databricks/sdk/useragent.py +144 -0
- databricks/sdk/version.py +1 -1
- {databricks_sdk-0.28.0.dist-info → databricks_sdk-0.30.0.dist-info}/METADATA +37 -16
- {databricks_sdk-0.28.0.dist-info → databricks_sdk-0.30.0.dist-info}/RECORD +31 -28
- {databricks_sdk-0.28.0.dist-info → databricks_sdk-0.30.0.dist-info}/WHEEL +1 -1
- {databricks_sdk-0.28.0.dist-info → databricks_sdk-0.30.0.dist-info}/LICENSE +0 -0
- {databricks_sdk-0.28.0.dist-info → databricks_sdk-0.30.0.dist-info}/NOTICE +0 -0
- {databricks_sdk-0.28.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'
|
|
@@ -796,7 +832,6 @@ class Privilege(Enum):
|
|
|
796
832
|
REFRESH = 'REFRESH'
|
|
797
833
|
SELECT = 'SELECT'
|
|
798
834
|
SET_SHARE_PERMISSION = 'SET_SHARE_PERMISSION'
|
|
799
|
-
SINGLE_USER_ACCESS = 'SINGLE_USER_ACCESS'
|
|
800
835
|
USAGE = 'USAGE'
|
|
801
836
|
USE_CATALOG = 'USE_CATALOG'
|
|
802
837
|
USE_CONNECTION = 'USE_CONNECTION'
|
|
@@ -1526,6 +1561,9 @@ class UpdateRecipient:
|
|
|
1526
1561
|
comment: Optional[str] = None
|
|
1527
1562
|
"""Description about the recipient."""
|
|
1528
1563
|
|
|
1564
|
+
expiration_time: Optional[int] = None
|
|
1565
|
+
"""Expiration timestamp of the token, in epoch milliseconds."""
|
|
1566
|
+
|
|
1529
1567
|
ip_access_list: Optional[IpAccessList] = None
|
|
1530
1568
|
"""IP Access List"""
|
|
1531
1569
|
|
|
@@ -1547,6 +1585,7 @@ class UpdateRecipient:
|
|
|
1547
1585
|
"""Serializes the UpdateRecipient into a dictionary suitable for use as a JSON request body."""
|
|
1548
1586
|
body = {}
|
|
1549
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
|
|
1550
1589
|
if self.ip_access_list: body['ip_access_list'] = self.ip_access_list.as_dict()
|
|
1551
1590
|
if self.name is not None: body['name'] = self.name
|
|
1552
1591
|
if self.new_name is not None: body['new_name'] = self.new_name
|
|
@@ -1558,6 +1597,7 @@ class UpdateRecipient:
|
|
|
1558
1597
|
def from_dict(cls, d: Dict[str, any]) -> UpdateRecipient:
|
|
1559
1598
|
"""Deserializes the UpdateRecipient from a dictionary."""
|
|
1560
1599
|
return cls(comment=d.get('comment', None),
|
|
1600
|
+
expiration_time=d.get('expiration_time', None),
|
|
1561
1601
|
ip_access_list=_from_dict(d, 'ip_access_list', IpAccessList),
|
|
1562
1602
|
name=d.get('name', None),
|
|
1563
1603
|
new_name=d.get('new_name', None),
|
|
@@ -1626,20 +1666,37 @@ class UpdateSharePermissions:
|
|
|
1626
1666
|
changes: Optional[List[catalog.PermissionsChange]] = None
|
|
1627
1667
|
"""Array of permission changes."""
|
|
1628
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
|
+
|
|
1629
1678
|
name: Optional[str] = None
|
|
1630
1679
|
"""The name of the share."""
|
|
1631
1680
|
|
|
1681
|
+
page_token: Optional[str] = None
|
|
1682
|
+
"""Opaque pagination token to go to next page based on previous query."""
|
|
1683
|
+
|
|
1632
1684
|
def as_dict(self) -> dict:
|
|
1633
1685
|
"""Serializes the UpdateSharePermissions into a dictionary suitable for use as a JSON request body."""
|
|
1634
1686
|
body = {}
|
|
1635
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
|
|
1636
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
|
|
1637
1691
|
return body
|
|
1638
1692
|
|
|
1639
1693
|
@classmethod
|
|
1640
1694
|
def from_dict(cls, d: Dict[str, any]) -> UpdateSharePermissions:
|
|
1641
1695
|
"""Deserializes the UpdateSharePermissions from a dictionary."""
|
|
1642
|
-
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))
|
|
1643
1700
|
|
|
1644
1701
|
|
|
1645
1702
|
class CleanRoomsAPI:
|
|
@@ -1865,7 +1922,11 @@ class ProvidersAPI:
|
|
|
1865
1922
|
res = self._api.do('GET', f'/api/2.1/unity-catalog/providers/{name}', headers=headers)
|
|
1866
1923
|
return ProviderInfo.from_dict(res)
|
|
1867
1924
|
|
|
1868
|
-
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]:
|
|
1869
1930
|
"""List providers.
|
|
1870
1931
|
|
|
1871
1932
|
Gets an array of available authentication providers. The caller must either be a metastore admin or
|
|
@@ -1875,6 +1936,16 @@ class ProvidersAPI:
|
|
|
1875
1936
|
:param data_provider_global_metastore_id: str (optional)
|
|
1876
1937
|
If not provided, all providers will be returned. If no providers exist with this ID, no results will
|
|
1877
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.
|
|
1878
1949
|
|
|
1879
1950
|
:returns: Iterator over :class:`ProviderInfo`
|
|
1880
1951
|
"""
|
|
@@ -1882,13 +1953,24 @@ class ProvidersAPI:
|
|
|
1882
1953
|
query = {}
|
|
1883
1954
|
if data_provider_global_metastore_id is not None:
|
|
1884
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
|
|
1885
1958
|
headers = {'Accept': 'application/json', }
|
|
1886
1959
|
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
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']
|
|
1890
1968
|
|
|
1891
|
-
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]:
|
|
1892
1974
|
"""List shares by Provider.
|
|
1893
1975
|
|
|
1894
1976
|
Gets an array of a specified provider's shares within the metastore where:
|
|
@@ -1897,13 +1979,29 @@ class ProvidersAPI:
|
|
|
1897
1979
|
|
|
1898
1980
|
:param name: str
|
|
1899
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.
|
|
1900
1992
|
|
|
1901
1993
|
:returns: Iterator over :class:`ProviderShare`
|
|
1902
1994
|
"""
|
|
1903
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
|
|
1904
1999
|
headers = {'Accept': 'application/json', }
|
|
1905
2000
|
|
|
1906
|
-
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)
|
|
1907
2005
|
parsed = ListProviderSharesResponse.from_dict(json).shares
|
|
1908
2006
|
return parsed if parsed is not None else []
|
|
1909
2007
|
|
|
@@ -2016,6 +2114,7 @@ class RecipientsAPI:
|
|
|
2016
2114
|
*,
|
|
2017
2115
|
comment: Optional[str] = None,
|
|
2018
2116
|
data_recipient_global_metastore_id: Optional[str] = None,
|
|
2117
|
+
expiration_time: Optional[int] = None,
|
|
2019
2118
|
ip_access_list: Optional[IpAccessList] = None,
|
|
2020
2119
|
owner: Optional[str] = None,
|
|
2021
2120
|
properties_kvpairs: Optional[SecurablePropertiesKvPairs] = None,
|
|
@@ -2035,6 +2134,8 @@ class RecipientsAPI:
|
|
|
2035
2134
|
The global Unity Catalog metastore id provided by the data recipient. This field is required when
|
|
2036
2135
|
the __authentication_type__ is **DATABRICKS**. The identifier is of format
|
|
2037
2136
|
__cloud__:__region__:__metastore-uuid__.
|
|
2137
|
+
:param expiration_time: int (optional)
|
|
2138
|
+
Expiration timestamp of the token, in epoch milliseconds.
|
|
2038
2139
|
:param ip_access_list: :class:`IpAccessList` (optional)
|
|
2039
2140
|
IP Access List
|
|
2040
2141
|
:param owner: str (optional)
|
|
@@ -2052,6 +2153,7 @@ class RecipientsAPI:
|
|
|
2052
2153
|
if comment is not None: body['comment'] = comment
|
|
2053
2154
|
if data_recipient_global_metastore_id is not None:
|
|
2054
2155
|
body['data_recipient_global_metastore_id'] = data_recipient_global_metastore_id
|
|
2156
|
+
if expiration_time is not None: body['expiration_time'] = expiration_time
|
|
2055
2157
|
if ip_access_list is not None: body['ip_access_list'] = ip_access_list.as_dict()
|
|
2056
2158
|
if name is not None: body['name'] = name
|
|
2057
2159
|
if owner is not None: body['owner'] = owner
|
|
@@ -2095,7 +2197,11 @@ class RecipientsAPI:
|
|
|
2095
2197
|
res = self._api.do('GET', f'/api/2.1/unity-catalog/recipients/{name}', headers=headers)
|
|
2096
2198
|
return RecipientInfo.from_dict(res)
|
|
2097
2199
|
|
|
2098
|
-
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]:
|
|
2099
2205
|
"""List share recipients.
|
|
2100
2206
|
|
|
2101
2207
|
Gets an array of all share recipients within the current metastore where:
|
|
@@ -2106,6 +2212,16 @@ class RecipientsAPI:
|
|
|
2106
2212
|
:param data_recipient_global_metastore_id: str (optional)
|
|
2107
2213
|
If not provided, all recipients will be returned. If no recipients exist with this ID, no results
|
|
2108
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.
|
|
2109
2225
|
|
|
2110
2226
|
:returns: Iterator over :class:`RecipientInfo`
|
|
2111
2227
|
"""
|
|
@@ -2113,11 +2229,18 @@ class RecipientsAPI:
|
|
|
2113
2229
|
query = {}
|
|
2114
2230
|
if data_recipient_global_metastore_id is not None:
|
|
2115
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
|
|
2116
2234
|
headers = {'Accept': 'application/json', }
|
|
2117
2235
|
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
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']
|
|
2121
2244
|
|
|
2122
2245
|
def rotate_token(self, name: str, existing_token_expire_in_seconds: int) -> RecipientInfo:
|
|
2123
2246
|
"""Rotate a token.
|
|
@@ -2145,7 +2268,11 @@ class RecipientsAPI:
|
|
|
2145
2268
|
headers=headers)
|
|
2146
2269
|
return RecipientInfo.from_dict(res)
|
|
2147
2270
|
|
|
2148
|
-
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:
|
|
2149
2276
|
"""Get recipient share permissions.
|
|
2150
2277
|
|
|
2151
2278
|
Gets the share permissions for the specified Recipient. The caller must be a metastore admin or the
|
|
@@ -2153,14 +2280,28 @@ class RecipientsAPI:
|
|
|
2153
2280
|
|
|
2154
2281
|
:param name: str
|
|
2155
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.
|
|
2156
2293
|
|
|
2157
2294
|
:returns: :class:`GetRecipientSharePermissionsResponse`
|
|
2158
2295
|
"""
|
|
2159
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
|
|
2160
2300
|
headers = {'Accept': 'application/json', }
|
|
2161
2301
|
|
|
2162
2302
|
res = self._api.do('GET',
|
|
2163
2303
|
f'/api/2.1/unity-catalog/recipients/{name}/share-permissions',
|
|
2304
|
+
query=query,
|
|
2164
2305
|
headers=headers)
|
|
2165
2306
|
return GetRecipientSharePermissionsResponse.from_dict(res)
|
|
2166
2307
|
|
|
@@ -2168,6 +2309,7 @@ class RecipientsAPI:
|
|
|
2168
2309
|
name: str,
|
|
2169
2310
|
*,
|
|
2170
2311
|
comment: Optional[str] = None,
|
|
2312
|
+
expiration_time: Optional[int] = None,
|
|
2171
2313
|
ip_access_list: Optional[IpAccessList] = None,
|
|
2172
2314
|
new_name: Optional[str] = None,
|
|
2173
2315
|
owner: Optional[str] = None,
|
|
@@ -2182,6 +2324,8 @@ class RecipientsAPI:
|
|
|
2182
2324
|
Name of the recipient.
|
|
2183
2325
|
:param comment: str (optional)
|
|
2184
2326
|
Description about the recipient.
|
|
2327
|
+
:param expiration_time: int (optional)
|
|
2328
|
+
Expiration timestamp of the token, in epoch milliseconds.
|
|
2185
2329
|
:param ip_access_list: :class:`IpAccessList` (optional)
|
|
2186
2330
|
IP Access List
|
|
2187
2331
|
:param new_name: str (optional)
|
|
@@ -2197,6 +2341,7 @@ class RecipientsAPI:
|
|
|
2197
2341
|
"""
|
|
2198
2342
|
body = {}
|
|
2199
2343
|
if comment is not None: body['comment'] = comment
|
|
2344
|
+
if expiration_time is not None: body['expiration_time'] = expiration_time
|
|
2200
2345
|
if ip_access_list is not None: body['ip_access_list'] = ip_access_list.as_dict()
|
|
2201
2346
|
if new_name is not None: body['new_name'] = new_name
|
|
2202
2347
|
if owner is not None: body['owner'] = owner
|
|
@@ -2279,22 +2424,48 @@ class SharesAPI:
|
|
|
2279
2424
|
res = self._api.do('GET', f'/api/2.1/unity-catalog/shares/{name}', query=query, headers=headers)
|
|
2280
2425
|
return ShareInfo.from_dict(res)
|
|
2281
2426
|
|
|
2282
|
-
def list(self
|
|
2427
|
+
def list(self,
|
|
2428
|
+
*,
|
|
2429
|
+
max_results: Optional[int] = None,
|
|
2430
|
+
page_token: Optional[str] = None) -> Iterator[ShareInfo]:
|
|
2283
2431
|
"""List shares.
|
|
2284
2432
|
|
|
2285
2433
|
Gets an array of data object shares from the metastore. The caller must be a metastore admin or the
|
|
2286
2434
|
owner of the share. There is no guarantee of a specific ordering of the elements in the array.
|
|
2287
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
|
+
|
|
2288
2447
|
:returns: Iterator over :class:`ShareInfo`
|
|
2289
2448
|
"""
|
|
2290
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
|
|
2291
2453
|
headers = {'Accept': 'application/json', }
|
|
2292
2454
|
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
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']
|
|
2296
2463
|
|
|
2297
|
-
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:
|
|
2298
2469
|
"""Get permissions.
|
|
2299
2470
|
|
|
2300
2471
|
Gets the permissions for a data share from the metastore. The caller must be a metastore admin or the
|
|
@@ -2302,13 +2473,29 @@ class SharesAPI:
|
|
|
2302
2473
|
|
|
2303
2474
|
:param name: str
|
|
2304
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.
|
|
2305
2486
|
|
|
2306
2487
|
:returns: :class:`PermissionsList`
|
|
2307
2488
|
"""
|
|
2308
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
|
|
2309
2493
|
headers = {'Accept': 'application/json', }
|
|
2310
2494
|
|
|
2311
|
-
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)
|
|
2312
2499
|
return PermissionsList.from_dict(res)
|
|
2313
2500
|
|
|
2314
2501
|
def update(self,
|
|
@@ -2363,7 +2550,12 @@ class SharesAPI:
|
|
|
2363
2550
|
res = self._api.do('PATCH', f'/api/2.1/unity-catalog/shares/{name}', body=body, headers=headers)
|
|
2364
2551
|
return ShareInfo.from_dict(res)
|
|
2365
2552
|
|
|
2366
|
-
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):
|
|
2367
2559
|
"""Update permissions.
|
|
2368
2560
|
|
|
2369
2561
|
Updates the permissions for a data share in the metastore. The caller must be a metastore admin or an
|
|
@@ -2376,11 +2568,28 @@ class SharesAPI:
|
|
|
2376
2568
|
The name of the share.
|
|
2377
2569
|
:param changes: List[:class:`PermissionsChange`] (optional)
|
|
2378
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.
|
|
2379
2581
|
|
|
2380
2582
|
|
|
2381
2583
|
"""
|
|
2382
2584
|
body = {}
|
|
2585
|
+
query = {}
|
|
2383
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
|
|
2384
2589
|
headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
|
|
2385
2590
|
|
|
2386
|
-
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)
|