jackye1995 commented on a change in pull request #1844: URL: https://github.com/apache/iceberg/pull/1844#discussion_r537772026
########## File path: aws/src/main/java/org/apache/iceberg/aws/AwsClientConfigFactory.java ########## @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.iceberg.aws; + +import java.io.Serializable; +import org.apache.iceberg.catalog.CatalogConfigurable; +import software.amazon.awssdk.awscore.client.builder.AwsClientBuilder; +import software.amazon.awssdk.awscore.client.builder.AwsSyncClientBuilder; + +/** + * Interface for any customization of AWS client. + * <p> + * User can provide an implementation of this factory to perform any modification to AWS clients, + * such as credentials provider, region, endpoint, http client, etc. + * See {@link AssumeRoleClientConfigFactory} as an example. + */ +public interface AwsClientConfigFactory extends CatalogConfigurable, Serializable { Review comment: Yes I thought about just having a factory, but here are my reasons for having the additional `AwsClientConfigurer` delegation, please let me know if you think they are important or not: 1. the interface of the factory would continue to evolve as more clients are added. I think for a public interface used for dynamic loading, it is preferred to keep it stable and unchanged for most of the time, so there won't be incompatibility errors when the package versions do not match. 2. I see there are 3 layers of configuration, (1) defaults to initialize a bare-minimum client (http client impl, etc.) (2) user-specific defaults for all their clients (credentials, etc.), (3) user-specific client configurations (s3 client retry, etc.), and the intention of `setDefaultsAndConfigure` is to configure (1) and then leave (2) and (3) for customers to configure using the configurer. 3. If a user can directly load a factory, there is nothing to stop the user from overriding the specific get client methods and skip config layer 1. This also defeats the purpose of using a general `configure` method. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
