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): Add API support for Expected Bucket Owner #13914

Conversation

joon-won
Copy link
Member

Description of changes

  • AlTop Level / Internal API to add expectedBucketOwner option

Unit tests will be included in a separate PR

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.

Copy link
Member

@AllanZhengYP AllanZhengYP left a comment

Choose a reason for hiding this comment

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

Left some questions above. This change still misses unit tests.

We have dedicated funcational test for custom API handlers, can you add them as well? link

Comment on lines 52 to 54
return {
accountID,
};
Copy link
Member

Choose a reason for hiding this comment

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

Usually a validator function does not return anything. The validateStorageOperationInput is special since we don't have better way to meeting the requirement than to return something. If you take a look at other validators in this folder, they don't return anything.

Copy link
Member Author

Choose a reason for hiding this comment

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

I see, I've included bucketownervalidator in validateStorageOperationInput since it might be the place we consolidate validators, that's why it also resembled its behavior. I'll update it not to return any

Copy link
Member

Choose a reason for hiding this comment

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

Missing other internals 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.

With current plan, Jim will work on internals I think next week

packages/storage/src/providers/s3/apis/internal/copy.ts Outdated Show resolved Hide resolved
packages/storage/src/providers/s3/apis/internal/copy.ts Outdated Show resolved Hide resolved
packages/storage/src/providers/s3/types/options.ts Outdated Show resolved Hide resolved
Copy link
Member

@jimblanc jimblanc left a comment

Choose a reason for hiding this comment

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

Looking good! Few questions & nits. Also need to update bundle limits

packages/storage/src/providers/s3/apis/internal/list.ts Outdated Show resolved Hide resolved
packages/storage/src/providers/s3/types/options.ts Outdated Show resolved Hide resolved
...assignStringVariables({ 'x-amz-checksum-crc32': input.ChecksumCRC32 }),
...assignStringVariables({
'x-amz-checksum-crc32': input.ChecksumCRC32,
'x-amz-expected-bucket-owner': input.ExpectedBucketOwner,
Copy link
Member

Choose a reason for hiding this comment

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

Sanity check: What happens here if expected bucket owner is missing (since its optional)? Does the header still get sent with a null/undefined value?

Copy link
Member Author

Choose a reason for hiding this comment

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

Testing from my E2E app, the header won't be included when there is no expectedBucketOwner set up thus/or receives null/undefined for it

@joon-won joon-won requested a review from a team as a code owner October 14, 2024 20:59
joon-won and others added 2 commits October 14, 2024 14:56
fix(storage): internals list function not able to decide which output…
Copy link
Member

@jimblanc jimblanc left a comment

Choose a reason for hiding this comment

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

LGTM, one nit

Copy link
Member

@AllanZhengYP AllanZhengYP left a comment

Choose a reason for hiding this comment

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

Looks good to me!🚀

@joon-won joon-won merged commit 96c2dc7 into aws-amplify:storage-browser/integrity Oct 15, 2024
28 checks passed
@joon-won joon-won deleted the sb/integrity/expected-bucket-owner branch October 15, 2024 21:53
@joon-won joon-won restored the sb/integrity/expected-bucket-owner branch October 15, 2024 21:53
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