rdblue commented on code in PR #6951:
URL: https://github.com/apache/iceberg/pull/6951#discussion_r1125178925


##########
core/src/main/java/org/apache/iceberg/rest/HTTPClient.java:
##########
@@ -361,6 +383,55 @@ public void close() throws IOException {
     httpClient.close(CloseMode.GRACEFUL);
   }
 
+  public static HTTPClient buildFrom(Map<String, String> properties) {
+    Builder builder = HTTPClient.builder();
+
+    builder.uri(properties.get(CatalogProperties.URI));
+
+    if (properties.containsKey(REQUEST_INTERCEPTOR_IMPL)) {
+      HttpRequestInterceptor interceptor =
+          loadInterceptorDynamically(properties.get(REQUEST_INTERCEPTOR_IMPL), 
properties);

Review Comment:
   While I agree that we need to load the interceptor dynamically because we 
can't reference the class, I don't think that we actually need to make this a 
configurable option. That's unnecessary behavior that we don't need to expose. 
Instead, I think that we should use `rest.sigv4.enabled=true` and a constant, 
`SIGV4_REQUEST_INTERCEPTOR_IMPL`.
   
   Then this would be:
   
   ```java
     if (PropertyUtil.getBoolean(properties, "rest.sigv4.enabled", false)) {
       HttpRequestInterceptor interceptor = 
loadInterceptorDynamically(SIGV4_REQUEST_INTERCEPTOR_IMPL, properties);
       builder.withRequestInterceptor(interceptor);
     }
   ```
   
   That keeps the scope as narrow as possible. Maybe we would want to support 
custom interceptors in the future, but there's no need to now.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to