kroushan-nit commented on code in PR #599: URL: https://github.com/apache/incubator-xtable/pull/599#discussion_r1883958245
########## xtable-core/src/main/java/org/apache/xtable/catalog/glue/GlueCatalogConfig.java: ########## @@ -0,0 +1,90 @@ +/* + * 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.xtable.catalog.glue; + +import java.util.Collections; +import java.util.Map; +import java.util.stream.Collectors; + +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; + +@Getter +@EqualsAndHashCode +@ToString +public class GlueCatalogConfig { + + private static final ObjectMapper OBJECT_MAPPER = + new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + public static final String CLIENT_CREDENTIAL_PROVIDER_PREFIX = + "externalCatalog.glue.credentials.provider."; + + @JsonProperty("externalCatalog.glue.catalogId") + private String catalogId; + + @JsonProperty("externalCatalog.glue.region") + private String region; + + @JsonProperty("externalCatalog.glue.credentialsProviderClass") + private String clientCredentialsProviderClass; + + /** + * In case a credentialsProviderClass is configured and require additional properties for + * instantiation, those properties should start with {@link #CLIENT_CREDENTIAL_PROVIDER_PREFIX}. + * + * <p>For ex: if credentialsProviderClass requires `accessKey` and `secretAccessKey`, they should + * be configured using below keys: + * <li>externalCatalog.glue.credentials.provider.accessKey + * <li>externalCatalog.glue.credentials.provider.secretAccessKey + */ + @Setter private Map<String, String> clientCredentialConfigs; + + public static GlueCatalogConfig of(Map<String, String> properties) { Review Comment: @vinishjail97 Is this approach for creating config is fine or we should use a factory for creating these? -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
