Skip to content

add timestream endpoint config prop #1483

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions awswrangler/_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class _ConfigArg(NamedTuple):
"lakeformation_endpoint_url": _ConfigArg(dtype=str, nullable=True, enforced=True),
"dynamodb_endpoint_url": _ConfigArg(dtype=str, nullable=True, enforced=True),
"secretsmanager_endpoint_url": _ConfigArg(dtype=str, nullable=True, enforced=True),
"timestream_endpoint_url": _ConfigArg(dtype=str, nullable=True, enforced=True),
# Botocore config
"botocore_config": _ConfigArg(dtype=botocore.config.Config, nullable=True),
"verify": _ConfigArg(dtype=str, nullable=True),
Expand All @@ -68,6 +69,7 @@ def __init__(self) -> None:
self.lakeformation_endpoint_url = None
self.dynamodb_endpoint_url = None
self.secretsmanager_endpoint_url = None
self.timestream_endpoint_url = None
self.botocore_config = None
self.verify = None
for name in _CONFIG_ARGS:
Expand Down Expand Up @@ -387,6 +389,15 @@ def secretsmanager_endpoint_url(self) -> Optional[str]:
def secretsmanager_endpoint_url(self, value: Optional[str]) -> None:
self._set_config_value(key="secretsmanager_endpoint_url", value=value)

@property
def timestream_endpoint_url(self) -> Optional[str]:
"""Property timestream_endpoint_url."""
return cast(Optional[str], self["timestream_endpoint_url"])

@timestream_endpoint_url.setter
def timestream_endpoint_url(self, value: Optional[str]) -> None:
self._set_config_value(key="timestream_endpoint_url", value=value)

@property
def botocore_config(self) -> botocore.config.Config:
"""Property botocore_config."""
Expand Down
2 changes: 2 additions & 0 deletions awswrangler/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ def _get_endpoint_url(service_name: str) -> Optional[str]:
endpoint_url = _config.config.dynamodb_endpoint_url
elif service_name == "secretsmanager" and _config.config.secretsmanager_endpoint_url is not None:
endpoint_url = _config.config.secretsmanager_endpoint_url
elif service_name == "timestream" and _config.config.timestream_endpoint_url is not None:
endpoint_url = _config.config.timestream_endpoint_url
return endpoint_url


Expand Down
4 changes: 4 additions & 0 deletions tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ def wrapper(self, **kwarg):
assert url == wr.config.glue_endpoint_url
elif name == "secretsmanager":
assert url == wr.config.secretsmanager_endpoint_url
elif name == "timestream":
assert url == wr.config.timestream_endpoint_url
return original(self, **kwarg)

with patch("botocore.client.ClientCreator.create_client", new=wrapper):
Expand Down Expand Up @@ -115,12 +117,14 @@ def test_basics(path, glue_database, glue_table, workgroup0, workgroup1):
wr.config.athena_endpoint_url = f"https://athena.{region}.amazonaws.com"
wr.config.glue_endpoint_url = f"https://glue.{region}.amazonaws.com"
wr.config.secretsmanager_endpoint_url = f"https://secretsmanager.{region}.amazonaws.com"
wr.config.timestream_endpoint_url = f"https://timestream.{region}.amazonaws.com"
_urls_test(glue_database)
os.environ["WR_STS_ENDPOINT_URL"] = f"https://sts.{region}.amazonaws.com"
os.environ["WR_S3_ENDPOINT_URL"] = f"https://s3.{region}.amazonaws.com"
os.environ["WR_ATHENA_ENDPOINT_URL"] = f"https://athena.{region}.amazonaws.com"
os.environ["WR_GLUE_ENDPOINT_URL"] = f"https://glue.{region}.amazonaws.com"
os.environ["WR_SECRETSMANAGER_ENDPOINT_URL"] = f"https://secretsmanager.{region}.amazonaws.com"
os.environ["WR_TIMESTREAM_ENDPOINT_URL"] = f"https://timestream.{region}.amazonaws.com"
wr.config.reset()
_urls_test(glue_database)

Expand Down