lefebsy commented on code in PR #389: URL: https://github.com/apache/polaris/pull/389#discussion_r1953598222
########## polaris-core/src/main/java/org/apache/polaris/core/storage/s3compatible/S3CompatibleStorageConfigurationInfo.java: ########## @@ -0,0 +1,138 @@ +/* + * 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.polaris.core.storage.s3compatible; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.base.MoreObjects; +import java.util.List; +import org.apache.polaris.core.storage.PolarisStorageConfigurationInfo; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * Polaris Storage Configuration information for an S3 Compatible solution, MinIO, Ceph, Dell ECS... + */ +public class S3CompatibleStorageConfigurationInfo extends PolarisStorageConfigurationInfo { + + // 5 is the approximate max allowed locations for the size of AccessPolicy when LIST is required + // for allowed read and write locations for subscoping creds. + @JsonIgnore private static final int MAX_ALLOWED_LOCATIONS = 5; + private @NotNull String s3Endpoint; + private @Nullable String s3CredentialsCatalogAccessKeyId; + private @Nullable String s3CredentialsCatalogSecretAccessKey; + private @Nullable Boolean s3PathStyleAccess; + private @NotNull Boolean skipCredentialSubscopingIndirection; + private @Nullable String s3CredentialsClientAccessKeyId; + private @Nullable String s3CredentialsClientSecretAccessKey; + private @Nullable String s3Region; + private @Nullable String s3RoleArn; + + // Constructor + @JsonCreator + public S3CompatibleStorageConfigurationInfo( + @JsonProperty(value = "storageType", required = true) @NotNull StorageType storageType, + @JsonProperty(value = "s3Endpoint", required = true) @NotNull String s3Endpoint, + @JsonProperty(value = "s3CredentialsCatalogAccessKeyId", required = true) @NotNull + String s3CredentialsCatalogAccessKeyId, + @JsonProperty(value = "s3CredentialsCatalogSecretAccessKey", required = true) @NotNull + String s3CredentialsCatalogSecretAccessKey, + @JsonProperty(value = "SkipCredentialSubscopingIndirection", required = false) @Nullable + Boolean skipCredentialSubscopingIndirection, + @JsonProperty(value = "s3CredentialsClientAccessKeyId", required = false) @Nullable + String s3CredentialsClientAccessKeyId, + @JsonProperty(value = "s3CredentialsClientSecretAccessKey", required = false) @Nullable + String s3CredentialsClientSecretAccessKey, + @JsonProperty(value = "s3PathStyleAccess", required = false) @Nullable + Boolean s3PathStyleAccess, + @JsonProperty(value = "s3Region", required = false) @Nullable String s3Region, + @JsonProperty(value = "s3RoleArn", required = false) @Nullable String s3RoleArn, + @JsonProperty(value = "allowedLocations", required = true) @Nullable + List<String> allowedLocations) { + + // storing properties + super(storageType, allowedLocations); + validateMaxAllowedLocations(MAX_ALLOWED_LOCATIONS); + this.s3PathStyleAccess = s3PathStyleAccess; + this.s3Endpoint = s3Endpoint; + this.s3CredentialsCatalogAccessKeyId = s3CredentialsCatalogAccessKeyId; + this.s3CredentialsCatalogSecretAccessKey = s3CredentialsCatalogSecretAccessKey; + this.s3CredentialsClientAccessKeyId = s3CredentialsClientAccessKeyId; + this.s3CredentialsClientSecretAccessKey = s3CredentialsClientSecretAccessKey; + this.skipCredentialSubscopingIndirection = skipCredentialSubscopingIndirection; + this.s3Region = s3Region; + this.s3RoleArn = s3RoleArn; + } + + public @NotNull String getS3Endpoint() { + return this.s3Endpoint; + } + + public @NotNull Boolean getS3PathStyleAccess() { + return this.s3PathStyleAccess; + } + + public @NotNull String getS3CredentialsCatalogAccessKeyId() { + return (this.s3CredentialsCatalogAccessKeyId == null) + ? "" + : this.s3CredentialsCatalogAccessKeyId; + } + + public @NotNull String getS3CredentialsCatalogSecretAccessKey() { + return (this.s3CredentialsCatalogSecretAccessKey == null) + ? "" + : this.s3CredentialsCatalogSecretAccessKey; + } + + public @NotNull String getS3CredentialsClientAccessKeyId() { + return (this.s3CredentialsClientAccessKeyId == null) ? "" : this.s3CredentialsClientAccessKeyId; + } + + public @NotNull String getS3CredentialsClientSecretAccessKey() { + return (this.s3CredentialsClientSecretAccessKey == null) + ? "" + : this.s3CredentialsClientSecretAccessKey; + } + + public @NotNull String getS3RoleArn() { + return this.s3RoleArn; + } + + public @Nullable String getS3Region() { + return this.s3Region; + } + + public @Nullable Boolean getSkipCredentialSubscopingIndirection() { + return this.skipCredentialSubscopingIndirection; + } + + @Override + public String toString() { + return MoreObjects.toStringHelper(this) + .add("storageType", getStorageType().name()) + .add("allowedLocation", getAllowedLocations()) + .toString(); Review Comment: ok -- 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]
