-
Notifications
You must be signed in to change notification settings - Fork 250
Refactor storage access configuration handling #1504
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* 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; | ||
|
||
import java.util.Map; | ||
import org.apache.polaris.immutables.PolarisImmutable; | ||
|
||
@PolarisImmutable | ||
public interface AccessConfig { | ||
Map<String, String> credentials(); | ||
|
||
Map<String, String> extraProperties(); | ||
|
||
static ImmutableAccessConfig.Builder builder() { | ||
return ImmutableAccessConfig.builder(); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,15 +18,23 @@ | |
*/ | ||
package org.apache.polaris.core.storage; | ||
|
||
/** Enum of polaris supported credential properties */ | ||
public enum PolarisCredentialProperty { | ||
/** | ||
* A subset of Iceberg catalog properties recognized by Polaris. | ||
* | ||
* <p>Most of these properties are meant to configure Iceberg FileIO objects for accessing data in | ||
* storage. | ||
*/ | ||
public enum StorageAccessProperty { | ||
AWS_KEY_ID(String.class, "s3.access-key-id", "the aws access key id"), | ||
AWS_SECRET_KEY(String.class, "s3.secret-access-key", "the aws access key secret"), | ||
AWS_TOKEN(String.class, "s3.session-token", "the aws scoped access token"), | ||
AWS_SESSION_TOKEN_EXPIRES_AT_MS( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this considered "credential"? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Key ID, Secret Key, Session Token, and expiry time is definitely together considered a "credential" for AWS. Not sure if there's a reason why you're asking this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd say it is part of the credential bunch of properties. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
String.class, | ||
"s3.session-token-expires-at-ms", | ||
"the time the aws session token expires, in milliseconds"), | ||
AWS_ENDPOINT(String.class, "s3.endpoint", "the S3 endpoint to use for requests", false), | ||
AWS_PATH_STYLE_ACCESS( | ||
Boolean.class, "s3.path-style-access", "whether to use S3 path style access", false), | ||
CLIENT_REGION( | ||
String.class, "client.region", "region to configure client for making requests to AWS"), | ||
|
||
|
@@ -50,19 +58,30 @@ public enum PolarisCredentialProperty { | |
private final Class valueType; | ||
private final String propertyName; | ||
private final String description; | ||
private final boolean isCredential; | ||
|
||
/* | ||
s3.access-key-id`: id for for credentials that provide access to the data in S3 | ||
- `s3.secret-access-key`: secret for credentials that provide access to data in S3 | ||
- `s3.session-token | ||
*/ | ||
PolarisCredentialProperty(Class valueType, String propertyName, String description) { | ||
StorageAccessProperty(Class valueType, String propertyName, String description) { | ||
this(valueType, propertyName, description, true); | ||
} | ||
|
||
StorageAccessProperty( | ||
Class valueType, String propertyName, String description, boolean isCredential) { | ||
this.valueType = valueType; | ||
this.propertyName = propertyName; | ||
this.description = description; | ||
this.isCredential = isCredential; | ||
} | ||
|
||
public String getPropertyName() { | ||
return propertyName; | ||
} | ||
|
||
public boolean isCredential() { | ||
return isCredential; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the need for breaking this out into separate fields? They all end up in the same map for every single caller
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main idea is to isolate credential and non-credential properties in REST API responses. Specifically in IcebergCatalogHandler.
This PR does not cause any functional change, but prepares for exposing properties like
s3.endpoint
to clients later.These properties are not always mixed together. PR #1225 brings some distinction in load table responses.