external-systems 0.105.0__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 +19 -4
- {external_systems-0.105.0.dist-info → external_systems-0.106.0.dist-info}/METADATA +8 -5
- {external_systems-0.105.0.dist-info → external_systems-0.106.0.dist-info}/RECORD +8 -8
- {external_systems-0.105.0.dist-info → external_systems-0.106.0.dist-info}/WHEEL +1 -1
- {external_systems-0.105.0.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
|
|
@@ -192,15 +193,29 @@ class Source:
|
|
|
192
193
|
|
|
193
194
|
def get_aws_credentials(self) -> Refreshable[AwsCredentials]:
|
|
194
195
|
"""
|
|
195
|
-
|
|
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)
|
|
196
209
|
|
|
210
|
+
def get_session_credentials(self) -> Refreshable[SourceCredentials]:
|
|
211
|
+
"""
|
|
197
212
|
Supported Sources:
|
|
198
213
|
- S3
|
|
214
|
+
- BigQuery
|
|
215
|
+
- Google Cloud Storage
|
|
199
216
|
"""
|
|
200
217
|
if self._maybe_refreshable_resolved_source_credentials is None:
|
|
201
218
|
raise ValueError("Resolved source credentials are not present on the Source.")
|
|
202
|
-
if not isinstance(self._maybe_refreshable_resolved_source_credentials.get(), AwsCredentials):
|
|
203
|
-
raise ValueError("Resolved source credentials are not of type AwsCredentials.")
|
|
204
219
|
return self._maybe_refreshable_resolved_source_credentials
|
|
205
220
|
|
|
206
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)
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
external_systems/__init__.py,sha256=xXDUDD6_qRO-nHuXZx-fXp0R0vc3N_OOsB1F5mF_kpU,651
|
|
2
|
-
external_systems/_version.py,sha256
|
|
2
|
+
external_systems/_version.py,sha256=XybDtttIh2RAnNN-6aMq9sh0VI5lwaASQ2EA1--tSg0,749
|
|
3
3
|
external_systems/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
-
external_systems/sources/__init__.py,sha256=
|
|
5
|
-
external_systems/sources/_api.py,sha256=
|
|
4
|
+
external_systems/sources/__init__.py,sha256=QGbNcUcv8QhVJwYraMV6Q3Uy3GgZdirA8KYl6Sss2tk,1208
|
|
5
|
+
external_systems/sources/_api.py,sha256=7hUwW5O4v36jZnBKerHgRChSyrvHeJc4511oYBZRrGk,3400
|
|
6
6
|
external_systems/sources/_connections.py,sha256=h82npEks29NALAAfMHrXcSnB7TY_OLeXgL3QN9Cssus,2509
|
|
7
7
|
external_systems/sources/_proxies.py,sha256=hwgMBpOUdlhyRLgCyXE7v9X5v-1a655PDFqHJtZ9c74,6576
|
|
8
8
|
external_systems/sources/_refreshable.py,sha256=0pa5XW0_2gTMW-ZymKhlhh3Kka_bWTWffThKvrTTifc,4421
|
|
9
9
|
external_systems/sources/_sockets.py,sha256=XH51adVnloqg8XYVHPxl6K8R_q2BCh6WZ77cq1L8nRg,4473
|
|
10
|
-
external_systems/sources/_sources.py,sha256=
|
|
10
|
+
external_systems/sources/_sources.py,sha256=2sranCdLgb_IO8pHMPqwoGqWfmECiMro96piN6iVaZ4,11783
|
|
11
11
|
external_systems/sources/_utils.py,sha256=EmUKKiKRDOZ2cZs7FZ4qCSan_lq1K_tquh3kxleB-jA,1004
|
|
12
|
-
external_systems-0.
|
|
13
|
-
external_systems-0.
|
|
14
|
-
external_systems-0.
|
|
15
|
-
external_systems-0.
|
|
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,,
|
|
File without changes
|