-
Notifications
You must be signed in to change notification settings - Fork 293
add refresh credentials property to loadTableResult #1164
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
63c7dc7
a885ffb
7912eca
aa6f1b1
9c1c283
0241b80
c1f2cbe
b0057d4
97b8990
d8e55c0
13d33a5
7961dc2
f2f3fd1
348f1ee
a2a4640
ab02a2d
87d8358
07f9dc1
7002409
aec31d7
bcea6c6
6ccc3e1
54ef878
315afda
d073982
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 |
---|---|---|
|
@@ -35,6 +35,7 @@ | |
import java.util.Optional; | ||
import java.util.Set; | ||
import java.util.function.Function; | ||
import org.apache.iceberg.aws.AwsClientProperties; | ||
import org.apache.iceberg.catalog.Catalog; | ||
import org.apache.iceberg.catalog.Namespace; | ||
import org.apache.iceberg.catalog.TableIdentifier; | ||
|
@@ -397,16 +398,38 @@ public Response loadTable( | |
.loadTableIfStale(tableIdentifier, ifNoneMatch, snapshots) | ||
.orElseThrow(() -> new WebApplicationException(Response.Status.NOT_MODIFIED)); | ||
} else { | ||
response = | ||
String credentialsEndpoint = | ||
String.format( | ||
"/v1/%s/namespaces/%s/tables/%s/credentials", | ||
prefix, tableIdentifier.namespace().toString(), tableIdentifier.name()); | ||
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. (Saw that #1164 (comment) got lost but think it still holds) 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. Agree the uri should be :
|
||
LoadTableResponse originalResponse = | ||
catalog | ||
.loadTableWithAccessDelegationIfStale(tableIdentifier, ifNoneMatch, snapshots) | ||
.orElseThrow(() -> new WebApplicationException(Response.Status.NOT_MODIFIED)); | ||
if (delegationModes.contains(VENDED_CREDENTIALS)) { | ||
response = | ||
injectRefreshVendedCredentialProperties(originalResponse, credentialsEndpoint); | ||
} else { | ||
response = originalResponse; | ||
} | ||
} | ||
|
||
return tryInsertETagHeader(Response.ok(response), response, namespace, table).build(); | ||
}); | ||
} | ||
|
||
private LoadTableResponse injectRefreshVendedCredentialProperties( | ||
LoadTableResponse originalResponse, String credentialsEndpoint) { | ||
LoadTableResponse.Builder loadResponseBuilder = | ||
LoadTableResponse.builder().withTableMetadata(originalResponse.tableMetadata()); | ||
Comment on lines
+423
to
+424
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. do we need to update metadata-location too ? |
||
loadResponseBuilder.addAllConfig(originalResponse.config()); | ||
loadResponseBuilder.addAllCredentials(originalResponse.credentials()); | ||
loadResponseBuilder.addConfig( | ||
AwsClientProperties.REFRESH_CREDENTIALS_ENDPOINT, credentialsEndpoint); | ||
loadResponseBuilder.addConfig(AwsClientProperties.REFRESH_CREDENTIALS_ENABLED, "true"); | ||
Comment on lines
+427
to
+429
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. ADLS also now supports creds refresh
Comment on lines
+427
to
+429
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. we should check the credential type too and send this only when storage is AWS |
||
return loadResponseBuilder.build(); | ||
} | ||
|
||
@Override | ||
public Response tableExists( | ||
String prefix, | ||
|
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.
This needs to be configurable. E.g., some hosts may prefix the URL with
/polaris
or with/your_account_name
or any number of prefixesThere 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.
does that mean they will do something like
/polaris-catalog-name
instead of just/catalog-name
? or I'm misunderstanding this?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.
prefix
identifies the catalog, does it not? Why would the.../credentials
endpoint for a table in one catalog need to be under a different prefix?