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

feat(storage): integrate locationCredentialsProvider #13590

Draft
wants to merge 15 commits into
base: storage-browser/main
Choose a base branch
from

Conversation

israx
Copy link
Member

@israx israx commented Jul 12, 2024

Description of changes

Integrates the locationCredentialsProvider into the Storage APIs

The following changes will throw an exception,

  • if and only if locationCredentialsProvider is defined, and
    • path is not a string;
    • bucket is an empty string or is not defined;
  • if bucket and region are not defined from the Amplify singleton or API input

Issue #, if available

Description of how you validated changes

Checklist

  • PR description included
  • yarn test passes
  • Unit Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced)

Checklist for repo maintainers

  • Verify E2E tests for existing workflows are working as expected or add E2E tests for newly added workflows
  • New source file paths included in this PR have been added to CODEOWNERS, if appropriate

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@israx israx force-pushed the integrate-location-credentials-prov branch from a4eec0d to 1757c15 Compare July 15, 2024 14:02
export interface S3InternalConfig {
serviceOptions: S3ServiceOptions;
libraryOptions: S3LibraryOptions;
export interface S3InternalConfig extends S3ServiceOptions, S3LibraryOptions {
Copy link
Member

Choose a reason for hiding this comment

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

Why flatten this out further? It seems a little more organized to keep serviceOptions & libraryOptions in their own fields.

Copy link
Member Author

@israx israx Jul 15, 2024

Choose a reason for hiding this comment

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

This feedback came from @AllanZhengYP, the argument was that serviceOptions and libraryOptions are related to the configuration from the singleton and would be best just to pass the specific storage configuration. Open to discussion

packages/storage/src/providers/s3/apis/internal/copy.ts Outdated Show resolved Hide resolved
@@ -44,16 +68,194 @@ const createDefaultIdentityIdProvider = (amplify: AmplifyClassV6) => {
*/
export const createStorageConfiguration = (
amplify: AmplifyClassV6,
apiInput: unknown,
permission: Permission,
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if permission should just be optional so we don't need to pass in "dummy" values for our normal APIs.

Copy link
Member Author

Choose a reason for hiding this comment

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

every Storage API needs to pass a permission to resolve the locationCredentialsProvider

Copy link
Member

Choose a reason for hiding this comment

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

+1. I dont think we should pass in a value on all API that is not provided by the customer and we can not assume permission for them. we can keep it optional and throw an error from resolve for locationCreds if there is no permission in there. I think that will be better

@israx israx marked this pull request as ready for review July 15, 2024 16:40
@israx israx requested review from a team as code owners July 15, 2024 16:40
@israx israx marked this pull request as draft July 15, 2024 17:49
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.

3 participants