fix(s3): improve BucketProps types for public access control #26555
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In this PR, we have enhanced the type definitions of BucketProps to provide safer and more explicit access control for S3 buckets. We've introduced two new types: BucketPropsPublicReadAccess and BucketPropsPrivateAccess, extending from the BucketPropsBase.
BucketPropsPublicReadAccess is intended for use cases where the S3 bucket needs to be publicly readable. It enforces the inclusion of a blockPublicAccess configuration whenever publicReadAccess is set to true, helping ensure that only necessary permissions are exposed.
BucketPropsPrivateAccess, on the other hand, is intended for cases where public read access is not required for the S3 bucket. It allows publicReadAccess to be false or undefined, and provides an optional blockPublicAccess configuration for additional control over public access.
Related #25983
Screenshot:
![Screenshot 2023-07-28 at 08 27 34](https://private-user-images.githubusercontent.com/26905440/256864639-4539db5e-4605-4e53-b8f8-71e74ebb4c6e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjA2OTE3NjcsIm5iZiI6MTcyMDY5MTQ2NywicGF0aCI6Ii8yNjkwNTQ0MC8yNTY4NjQ2MzktNDUzOWRiNWUtNDYwNS00ZTUzLWI4ZjgtNzFlNzRlYmI0YzZlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MTElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzExVDA5NTEwN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPThjYjE2ZTNlMmFiMzkwYmNkZTI2YWM2ZWE2ZTEyMGI1NTcxM2VmZWJkNzIwMjg3ZjdkYmQ5NTAzM2Y4MTI2MzgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.RUvuZfbyP_bGPO_QC1pSj2RH4q3hs3BWMbfUHPDNmy8)
Screen.Recording.2023-07-28.at.08.27.05.mov
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license