Skip to content
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

[openhouse] Create GET /accesss endpoint for fetching DataAccessCredentials for a given table #243

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

raymondlam12
Copy link

Summary

[Issue] https://github.com/linkedin/openhouse/issues/242] Briefly discuss the summary of the changes made in this
pull request in 2-3 lines.

DataAccessCredentials are credentials that grant you access to a given table.

This commit introduces the /access endpoint for minting DataAccessCredentials that can be subsequently leveraged by clients to get a credential that grants access to the underlying storage of their tables

Changes

  • Client-facing API Changes
  • Internal API Changes
  • Bug Fixes
  • New Features
  • Performance Improvements
  • Code Style
  • Refactoring
  • Documentation
  • Tests

For all the boxes checked, please include additional details of the changes made in this pull request.

Testing Done

TODO

  • Manually Tested on local docker setup. Please include commands ran, and their output.
  • Added new tests for the changes made.
  • Updated existing tests to reflect the changes made.
  • No tests added or updated. Please explain why. If unsure, please feel free to ask for help.
  • Some other form of testing like staging or soak time in production. Please explain.

For all the boxes checked, include a detailed description of the testing done for the changes made in this pull request.

Additional Information

  • Breaking Changes
  • Deprecations
  • Large PR broken into smaller PRs, and PR plan linked in the description.

For all the boxes checked, include additional details of the changes made in this pull request.

…ntials for a given table

DataAccessCredentials are credentials that grant you access to a given table.
This commit introduces the /access endpoint for minting DataAccessCredentials that can be subsequently leveraged by clients to get a credential that grants access to the underlying storage of their tables
Copy link
Member

@abhisheknath2011 abhisheknath2011 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @raymondlam12. Clean PR! Added some comments.

description = "Map with the access credentials",
example = "{'token':'header.payload.signature', 'path':'/my/table'}")
@JsonProperty(access = JsonProperty.Access.READ_ONLY)
private Map<String, String> credential;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the possible key value pairs here? The example shows token and path. Do we expect any additional details?

@Parameter(description = "Database ID", required = true) @PathVariable String databaseId,
@Parameter(description = "Table ID", required = true) @PathVariable String tableId,
@Parameter(description = "Other Params", required = false) @PathVariable
Map<String, String> params) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the params here used for passing STS ID token?


Storage storage = storageManager.getStorage(tableStorageType);

return storage.getDataAccessCredentialForTableLocation(tableDto.getTableLocation(), params);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the storage layer going to interact with STS service to return the STS Access token?

if (!dataAccessCredential.isPresent()) {
throw new UnsupportedClientOperationException(
UnsupportedClientOperationException.Operation.DATA_ACCESS_CREDENTIAL_UNSUPPORTED,
"Unable to get a DataAccessCredential for the given table.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the table id and database id in the response message?

@ApiResponses(
value = {
@ApiResponse(responseCode = "200", description = "Access GET: OK"),
@ApiResponse(responseCode = "400", description = "Access GET: ACCESS_UNSUPPORTED"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HTTP status 400 should be associated with bad request such invalid input is provided. Can we consider some other HTTP code for unsupported?

value = {
@ApiResponse(responseCode = "200", description = "Access GET: OK"),
@ApiResponse(responseCode = "400", description = "Access GET: ACCESS_UNSUPPORTED"),
})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please as table not found as well.
@ApiResponse(responseCode = "404", description = "access GET: TABLE_NOT_FOUND")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants