external-systems 0.104.0rc1__py3-none-any.whl → 0.106.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 external-systems might be problematic. Click here for more details.
- external_systems/_version.py +1 -1
- external_systems/sources/__init__.py +2 -0
- external_systems/sources/_api.py +7 -1
- external_systems/sources/_sources.py +29 -7
- {external_systems-0.104.0rc1.dist-info → external_systems-0.106.0.dist-info}/METADATA +8 -5
- external_systems-0.106.0.dist-info/RECORD +15 -0
- {external_systems-0.104.0rc1.dist-info → external_systems-0.106.0.dist-info}/WHEEL +1 -1
- external_systems-0.104.0rc1.dist-info/RECORD +0 -15
- {external_systems-0.104.0rc1.dist-info → external_systems-0.106.0.dist-info}/LICENSE.txt +0 -0
external_systems/_version.py
CHANGED
|
@@ -16,6 +16,7 @@ from ._api import (
|
|
|
16
16
|
AwsCredentials,
|
|
17
17
|
ClientCertificate,
|
|
18
18
|
ClientCertificateFilePaths,
|
|
19
|
+
GcpOauthCredentials,
|
|
19
20
|
HttpsConnectionParameters,
|
|
20
21
|
SourceCredentials,
|
|
21
22
|
SourceParameters,
|
|
@@ -27,6 +28,7 @@ from ._sources import Source
|
|
|
27
28
|
__all__ = [
|
|
28
29
|
"ClientCertificate",
|
|
29
30
|
"ClientCertificateFilePaths",
|
|
31
|
+
"GcpOauthCredentials",
|
|
30
32
|
"HttpsConnection",
|
|
31
33
|
"HttpsConnectionParameters",
|
|
32
34
|
"Source",
|
external_systems/sources/_api.py
CHANGED
|
@@ -66,8 +66,14 @@ class AwsCredentials:
|
|
|
66
66
|
expiration: Optional[datetime] = None
|
|
67
67
|
|
|
68
68
|
|
|
69
|
+
@dataclass(frozen=True)
|
|
70
|
+
class GcpOauthCredentials:
|
|
71
|
+
access_token: str
|
|
72
|
+
expiration: Optional[datetime] = None
|
|
73
|
+
|
|
74
|
+
|
|
69
75
|
# Each new credential type must include an expiration field
|
|
70
|
-
SourceCredentials = Union[AwsCredentials]
|
|
76
|
+
SourceCredentials = Union[AwsCredentials, GcpOauthCredentials]
|
|
71
77
|
|
|
72
78
|
|
|
73
79
|
@dataclass(frozen=True)
|
|
@@ -16,9 +16,10 @@ import logging
|
|
|
16
16
|
import os
|
|
17
17
|
import random
|
|
18
18
|
import socket
|
|
19
|
+
import warnings
|
|
19
20
|
from functools import cached_property
|
|
20
21
|
from tempfile import NamedTemporaryFile
|
|
21
|
-
from typing import Any, Mapping, Optional, Tuple
|
|
22
|
+
from typing import Any, Mapping, Optional, Tuple, cast
|
|
22
23
|
|
|
23
24
|
import urllib3.util
|
|
24
25
|
from frozendict import frozendict
|
|
@@ -75,13 +76,20 @@ class Source:
|
|
|
75
76
|
def _https_connections(self) -> Mapping[str, HttpsConnection]:
|
|
76
77
|
return frozendict(
|
|
77
78
|
{
|
|
78
|
-
key: HttpsConnection(
|
|
79
|
+
key: HttpsConnection(
|
|
80
|
+
params, self._client_certificate, self._https_proxy_url, self.server_certificates_bundle_path
|
|
81
|
+
)
|
|
79
82
|
for key, params in self._source_parameters.https_connections.items()
|
|
80
83
|
}
|
|
81
84
|
)
|
|
82
85
|
|
|
83
|
-
@
|
|
84
|
-
def
|
|
86
|
+
@property
|
|
87
|
+
def server_certificates_bundle_path(self) -> Optional[str]:
|
|
88
|
+
"""
|
|
89
|
+
File path to the CA bundle file containing all server certificates required by the Source.
|
|
90
|
+
If no server certificates are defined on the Source, this will return None.
|
|
91
|
+
"""
|
|
92
|
+
|
|
85
93
|
if self._source_parameters.server_certificates is None:
|
|
86
94
|
return None
|
|
87
95
|
|
|
@@ -185,15 +193,29 @@ class Source:
|
|
|
185
193
|
|
|
186
194
|
def get_aws_credentials(self) -> Refreshable[AwsCredentials]:
|
|
187
195
|
"""
|
|
188
|
-
|
|
196
|
+
DEPRECATED: Use get_session_credentials instead.
|
|
197
|
+
"""
|
|
198
|
+
warnings.warn(
|
|
199
|
+
"get_aws_credentials is deprecated and will be removed in a future release. "
|
|
200
|
+
"Use get_session_credentials instead.",
|
|
201
|
+
DeprecationWarning,
|
|
202
|
+
stacklevel=2,
|
|
203
|
+
)
|
|
204
|
+
if self._maybe_refreshable_resolved_source_credentials is None:
|
|
205
|
+
raise ValueError("Resolved source credentials are not present on the Source.")
|
|
206
|
+
if not isinstance(self._maybe_refreshable_resolved_source_credentials.get(), AwsCredentials):
|
|
207
|
+
raise ValueError("Resolved source credentials are not of type AwsCredentials.")
|
|
208
|
+
return cast(Refreshable[AwsCredentials], self._maybe_refreshable_resolved_source_credentials)
|
|
189
209
|
|
|
210
|
+
def get_session_credentials(self) -> Refreshable[SourceCredentials]:
|
|
211
|
+
"""
|
|
190
212
|
Supported Sources:
|
|
191
213
|
- S3
|
|
214
|
+
- BigQuery
|
|
215
|
+
- Google Cloud Storage
|
|
192
216
|
"""
|
|
193
217
|
if self._maybe_refreshable_resolved_source_credentials is None:
|
|
194
218
|
raise ValueError("Resolved source credentials are not present on the Source.")
|
|
195
|
-
if not isinstance(self._maybe_refreshable_resolved_source_credentials.get(), AwsCredentials):
|
|
196
|
-
raise ValueError("Resolved source credentials are not of type AwsCredentials.")
|
|
197
219
|
return self._maybe_refreshable_resolved_source_credentials
|
|
198
220
|
|
|
199
221
|
def get_secret(self, key: str) -> str:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: external-systems
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.106.0
|
|
4
4
|
Summary: A Python library for interacting with Foundry Sources
|
|
5
5
|
License: Apache-2.0
|
|
6
6
|
Keywords: Palantir,Foundry,Sources,Compute Modules,Python Functions,Transforms
|
|
@@ -72,18 +72,21 @@ my_source: Source = ...
|
|
|
72
72
|
some_secret: str = my_source.get_secret("SECRET_NAME")
|
|
73
73
|
```
|
|
74
74
|
|
|
75
|
-
For sources using session credentials we support credentials generation and refresh management.
|
|
75
|
+
For sources using session credentials we support credentials generation and refresh management. This can be done by using `get_session_credentials` which supports `S3`, `BigQuery`, `Google Cloud Storage` sources.
|
|
76
76
|
|
|
77
77
|
_Session credentials may not be available in all Foundry runtime environments_
|
|
78
78
|
|
|
79
79
|
```python
|
|
80
|
-
from external_systems.sources import Source, Refreshable, AwsCredentials
|
|
80
|
+
from external_systems.sources import Source, Refreshable, SourceCredentials, AwsCredentials
|
|
81
81
|
|
|
82
82
|
s3_source: Source = ...
|
|
83
83
|
|
|
84
|
-
refreshable_credentials: Refreshable[
|
|
84
|
+
refreshable_credentials: Refreshable[SourceCredentials] = s3_source.get_session_credentials()
|
|
85
85
|
|
|
86
|
-
session_credentials:
|
|
86
|
+
session_credentials: SourceCredentials = refreshable_credentials.get()
|
|
87
|
+
|
|
88
|
+
if not isinstance(session_credentials, AwsCredentials):
|
|
89
|
+
raise ...
|
|
87
90
|
```
|
|
88
91
|
|
|
89
92
|
## On-prem Connectivity with [Foundry Agent Proxy](https://www.palantir.com/docs/foundry/data-connection/agent-proxy-runtime)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
external_systems/__init__.py,sha256=xXDUDD6_qRO-nHuXZx-fXp0R0vc3N_OOsB1F5mF_kpU,651
|
|
2
|
+
external_systems/_version.py,sha256=XybDtttIh2RAnNN-6aMq9sh0VI5lwaASQ2EA1--tSg0,749
|
|
3
|
+
external_systems/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
+
external_systems/sources/__init__.py,sha256=QGbNcUcv8QhVJwYraMV6Q3Uy3GgZdirA8KYl6Sss2tk,1208
|
|
5
|
+
external_systems/sources/_api.py,sha256=7hUwW5O4v36jZnBKerHgRChSyrvHeJc4511oYBZRrGk,3400
|
|
6
|
+
external_systems/sources/_connections.py,sha256=h82npEks29NALAAfMHrXcSnB7TY_OLeXgL3QN9Cssus,2509
|
|
7
|
+
external_systems/sources/_proxies.py,sha256=hwgMBpOUdlhyRLgCyXE7v9X5v-1a655PDFqHJtZ9c74,6576
|
|
8
|
+
external_systems/sources/_refreshable.py,sha256=0pa5XW0_2gTMW-ZymKhlhh3Kka_bWTWffThKvrTTifc,4421
|
|
9
|
+
external_systems/sources/_sockets.py,sha256=XH51adVnloqg8XYVHPxl6K8R_q2BCh6WZ77cq1L8nRg,4473
|
|
10
|
+
external_systems/sources/_sources.py,sha256=2sranCdLgb_IO8pHMPqwoGqWfmECiMro96piN6iVaZ4,11783
|
|
11
|
+
external_systems/sources/_utils.py,sha256=EmUKKiKRDOZ2cZs7FZ4qCSan_lq1K_tquh3kxleB-jA,1004
|
|
12
|
+
external_systems-0.106.0.dist-info/LICENSE.txt,sha256=NAk6Uc9K_N_J5V75k9qECpzUnO-ujT-mKK_jk_mboUE,569
|
|
13
|
+
external_systems-0.106.0.dist-info/METADATA,sha256=GohOFkVFmTYZ94j3folThj4TVBRKbPTEbbFYpR2UHDg,4809
|
|
14
|
+
external_systems-0.106.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
15
|
+
external_systems-0.106.0.dist-info/RECORD,,
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
external_systems/__init__.py,sha256=xXDUDD6_qRO-nHuXZx-fXp0R0vc3N_OOsB1F5mF_kpU,651
|
|
2
|
-
external_systems/_version.py,sha256=QmQh5TAlJE6LSLDKihn_ncuzbSKSaqmqoGlHq9LUaJM,753
|
|
3
|
-
external_systems/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
-
external_systems/sources/__init__.py,sha256=aqXbMIy_pnyIC1uPRzQfApLCbhYB4N8iRFnpOX4RdAk,1156
|
|
5
|
-
external_systems/sources/_api.py,sha256=NV7oNIgzSWz4ROFW8uPpUJjDN5vfFzdTs3yKC37S39k,3262
|
|
6
|
-
external_systems/sources/_connections.py,sha256=h82npEks29NALAAfMHrXcSnB7TY_OLeXgL3QN9Cssus,2509
|
|
7
|
-
external_systems/sources/_proxies.py,sha256=hwgMBpOUdlhyRLgCyXE7v9X5v-1a655PDFqHJtZ9c74,6576
|
|
8
|
-
external_systems/sources/_refreshable.py,sha256=0pa5XW0_2gTMW-ZymKhlhh3Kka_bWTWffThKvrTTifc,4421
|
|
9
|
-
external_systems/sources/_sockets.py,sha256=XH51adVnloqg8XYVHPxl6K8R_q2BCh6WZ77cq1L8nRg,4473
|
|
10
|
-
external_systems/sources/_sources.py,sha256=-DP1QzuCtXOnsijwTNxI9x2vyEmxgyRB47ZTVQshfXA,10829
|
|
11
|
-
external_systems/sources/_utils.py,sha256=EmUKKiKRDOZ2cZs7FZ4qCSan_lq1K_tquh3kxleB-jA,1004
|
|
12
|
-
external_systems-0.104.0rc1.dist-info/LICENSE.txt,sha256=NAk6Uc9K_N_J5V75k9qECpzUnO-ujT-mKK_jk_mboUE,569
|
|
13
|
-
external_systems-0.104.0rc1.dist-info/METADATA,sha256=YpFTlVEhDCfXz2fmZNoLG8Q-i-Q9fSeiIupDPLlrbX8,4768
|
|
14
|
-
external_systems-0.104.0rc1.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
|
|
15
|
-
external_systems-0.104.0rc1.dist-info/RECORD,,
|
|
File without changes
|