Skip to content

Commit 3316f4e

Browse files
authored
Python client: add support for endpoint, sts-endpoint, path-style-access (#2127)
This change adds support for endpoint, sts-endpoint, path-style-access to the Polaris Python client. Amends #1913 and #2012
1 parent 8a3ebce commit 3316f4e

File tree

4 files changed

+21
-1
lines changed

4 files changed

+21
-1
lines changed

client/python/cli/command/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ def options_get(key, f=lambda x: x):
6565
hadoop_warehouse=options_get(Arguments.HADOOP_WAREHOUSE),
6666
iceberg_remote_catalog_name=options_get(Arguments.ICEBERG_REMOTE_CATALOG_NAME),
6767
remove_properties=[] if remove_properties is None else remove_properties,
68+
endpoint=options_get(Arguments.ENDPOINT),
69+
sts_endpoint=options_get(Arguments.STS_ENDPOINT),
70+
path_style_access=options_get(Arguments.PATH_STYLE_ACCESS),
6871
catalog_connection_type=options_get(Arguments.CATALOG_CONNECTION_TYPE),
6972
catalog_authentication_type=options_get(Arguments.CATALOG_AUTHENTICATION_TYPE),
7073
catalog_service_identity_type=options_get(Arguments.CATALOG_SERVICE_IDENTITY_TYPE),

client/python/cli/command/catalogs.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ class CatalogsCommand(Command):
6464
remove_properties: List[str]
6565
hadoop_warehouse: str
6666
iceberg_remote_catalog_name: str
67+
endpoint: str
68+
sts_endpoint: str
69+
path_style_access: bool
6770
catalog_connection_type: str
6871
catalog_authentication_type: str
6972
catalog_service_identity_type: str
@@ -161,7 +164,7 @@ def validate(self):
161164
)
162165

163166
def _has_aws_storage_info(self):
164-
return self.role_arn or self.external_id or self.user_arn or self.region
167+
return self.role_arn or self.external_id or self.user_arn or self.region or self.endpoint or self.sts_endpoint or self.path_style_access
165168

166169
def _has_azure_storage_info(self):
167170
return self.tenant_id or self.multi_tenant_app_name or self.consent_url
@@ -179,6 +182,9 @@ def _build_storage_config_info(self):
179182
external_id=self.external_id,
180183
user_arn=self.user_arn,
181184
region=self.region,
185+
endpoint=self.endpoint,
186+
sts_endpoint=self.sts_endpoint,
187+
path_style_access=self.path_style_access,
182188
)
183189
elif self.storage_type == StorageType.AZURE.value:
184190
config = AzureStorageConfigInfo(

client/python/cli/constants.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,9 @@ class Arguments:
166166
PROXY = "proxy"
167167
HADOOP_WAREHOUSE = "hadoop_warehouse"
168168
ICEBERG_REMOTE_CATALOG_NAME = "iceberg_remote_catalog_name"
169+
ENDPOINT = "endpoint"
170+
STS_ENDPOINT = "sts_endpoint"
171+
PATH_STYLE_ACCESS = "path_style_access"
169172
CATALOG_CONNECTION_TYPE = "catalog_connection_type"
170173
CATALOG_AUTHENTICATION_TYPE = "catalog_authentication_type"
171174
CATALOG_SERVICE_IDENTITY_TYPE = "catalog_service_identity_type"
@@ -223,6 +226,11 @@ class Create:
223226
EXTERNAL_ID = "(Only for S3) The external ID to use when connecting to S3"
224227
REGION = "(Only for S3) The region to use when connecting to S3"
225228
USER_ARN = "(Only for S3) A user ARN to use when connecting to S3"
229+
ENDPOINT = "(Only for S3) The S3 endpoint to use when connecting to S3"
230+
STS_ENDPOINT = (
231+
"(Only for S3) The STS endpoint to use when connecting to STS"
232+
)
233+
PATH_STYLE_ACCESS = "(Only for S3) Whether to use path-style-access for S3"
226234

227235
TENANT_ID = "(Required for Azure) A tenant ID to use when connecting to Azure Storage"
228236
MULTI_TENANT_APP_NAME = (

client/python/cli/options/option_tree.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ def get_tree() -> List[Option]:
116116
Argument(Arguments.STORAGE_TYPE, str, Hints.Catalogs.Create.STORAGE_TYPE, lower=True,
117117
choices=[st.value for st in StorageType]),
118118
Argument(Arguments.DEFAULT_BASE_LOCATION, str, Hints.Catalogs.Create.DEFAULT_BASE_LOCATION),
119+
Argument(Arguments.ENDPOINT, str, Hints.Catalogs.Create.ENDPOINT),
120+
Argument(Arguments.STS_ENDPOINT, str, Hints.Catalogs.Create.STS_ENDPOINT),
121+
Argument(Arguments.PATH_STYLE_ACCESS, bool, Hints.Catalogs.Create.PATH_STYLE_ACCESS),
119122
Argument(Arguments.ALLOWED_LOCATION, str, Hints.Catalogs.Create.ALLOWED_LOCATION,
120123
allow_repeats=True),
121124
Argument(Arguments.ROLE_ARN, str, Hints.Catalogs.Create.ROLE_ARN),

0 commit comments

Comments
 (0)