Skip to content

Commit f13c0a4

Browse files
committed
Python client: make S3 role-ARN optional and add missing endpoint-internal property
1 parent 4c23eb7 commit f13c0a4

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

client/python/cli/command/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ def options_get(key, f=lambda x: x):
6666
iceberg_remote_catalog_name=options_get(Arguments.ICEBERG_REMOTE_CATALOG_NAME),
6767
remove_properties=[] if remove_properties is None else remove_properties,
6868
endpoint=options_get(Arguments.ENDPOINT),
69+
endpoint_internal=options_get(Arguments.ENDPOINT_INTERNAL),
6970
sts_endpoint=options_get(Arguments.STS_ENDPOINT),
7071
path_style_access=options_get(Arguments.PATH_STYLE_ACCESS),
7172
catalog_connection_type=options_get(Arguments.CATALOG_CONNECTION_TYPE),

client/python/cli/command/catalogs.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ class CatalogsCommand(Command):
6565
hadoop_warehouse: str
6666
iceberg_remote_catalog_name: str
6767
endpoint: str
68+
endpoint_internal: str
6869
sts_endpoint: str
6970
path_style_access: bool
7071
catalog_connection_type: str
@@ -121,18 +122,17 @@ def validate(self):
121122
f" {Argument.to_flag_name(Arguments.CATALOG_SERVICE_IDENTITY_IAM_ARN)}")
122123

123124
if self.storage_type == StorageType.S3.value:
124-
if not self.role_arn:
125-
raise Exception(
126-
f"Missing required argument for storage type 's3':"
127-
f" {Argument.to_flag_name(Arguments.ROLE_ARN)}"
128-
)
129125
if self._has_azure_storage_info() or self._has_gcs_storage_info():
130126
raise Exception(
131127
f"Storage type 's3' supports the storage credentials"
132128
f" {Argument.to_flag_name(Arguments.ROLE_ARN)},"
133129
f" {Argument.to_flag_name(Arguments.REGION)},"
134-
f" {Argument.to_flag_name(Arguments.EXTERNAL_ID)}, and"
135-
f" {Argument.to_flag_name(Arguments.USER_ARN)}"
130+
f" {Argument.to_flag_name(Arguments.EXTERNAL_ID)},"
131+
f" {Argument.to_flag_name(Arguments.USER_ARN)},"
132+
f" {Argument.to_flag_name(Arguments.ENDPOINT)},"
133+
f" {Argument.to_flag_name(Arguments.ENDPOINT_INTERNAL)},"
134+
f" {Argument.to_flag_name(Arguments.STS_ENDPOINT)}, and"
135+
f" {Argument.to_flag_name(Arguments.PATH_STYLE_ACCESS)}"
136136
)
137137
elif self.storage_type == StorageType.AZURE.value:
138138
if not self.tenant_id:
@@ -164,7 +164,7 @@ def validate(self):
164164
)
165165

166166
def _has_aws_storage_info(self):
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
167+
return self.role_arn or self.external_id or self.user_arn or self.region or self.endpoint or self.endpoint_internal or self.sts_endpoint or self.path_style_access
168168

169169
def _has_azure_storage_info(self):
170170
return self.tenant_id or self.multi_tenant_app_name or self.consent_url
@@ -183,6 +183,7 @@ def _build_storage_config_info(self):
183183
user_arn=self.user_arn,
184184
region=self.region,
185185
endpoint=self.endpoint,
186+
endpoint_internal=self.endpoint_internal,
186187
sts_endpoint=self.sts_endpoint,
187188
path_style_access=self.path_style_access,
188189
)

client/python/cli/constants.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ class Arguments:
168168
HADOOP_WAREHOUSE = "hadoop_warehouse"
169169
ICEBERG_REMOTE_CATALOG_NAME = "iceberg_remote_catalog_name"
170170
ENDPOINT = "endpoint"
171+
ENDPOINT_INTERNAL = "endpoint_internal"
171172
STS_ENDPOINT = "sts_endpoint"
172173
PATH_STYLE_ACCESS = "path_style_access"
173174
CATALOG_CONNECTION_TYPE = "catalog_connection_type"
@@ -223,11 +224,12 @@ class Create:
223224
"Multiple locations can be provided by specifying this option more than once."
224225
)
225226

226-
ROLE_ARN = "(Required for S3) A role ARN to use when connecting to S3"
227+
ROLE_ARN = "(Only for S3) A role ARN to use when connecting to S3"
227228
EXTERNAL_ID = "(Only for S3) The external ID to use when connecting to S3"
228229
REGION = "(Only for S3) The region to use when connecting to S3"
229230
USER_ARN = "(Only for S3) A user ARN to use when connecting to S3"
230231
ENDPOINT = "(Only for S3) The S3 endpoint to use when connecting to S3"
232+
ENDPOINT_INTERNAL = "(Only for S3) The S3 endpoint used by Polaris to use when connecting to S3, if different from the one that clients use"
231233
STS_ENDPOINT = (
232234
"(Only for S3) The STS endpoint to use when connecting to STS"
233235
)

client/python/cli/options/option_tree.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ def get_tree() -> List[Option]:
117117
choices=[st.value for st in StorageType]),
118118
Argument(Arguments.DEFAULT_BASE_LOCATION, str, Hints.Catalogs.Create.DEFAULT_BASE_LOCATION),
119119
Argument(Arguments.ENDPOINT, str, Hints.Catalogs.Create.ENDPOINT),
120+
Argument(Arguments.ENDPOINT_INTERNAL, str, Hints.Catalogs.Create.ENDPOINT_INTERNAL),
120121
Argument(Arguments.STS_ENDPOINT, str, Hints.Catalogs.Create.STS_ENDPOINT),
121122
Argument(Arguments.PATH_STYLE_ACCESS, bool, Hints.Catalogs.Create.PATH_STYLE_ACCESS),
122123
Argument(Arguments.ALLOWED_LOCATION, str, Hints.Catalogs.Create.ALLOWED_LOCATION,

0 commit comments

Comments
 (0)