chore(s3): additional documentation for addToResourcePolicy. #15761
chore(s3): additional documentation for addToResourcePolicy. #15761mergify[bot] merged 4 commits intoaws:masterfrom otaviomacedo:add-policy-s3-doc
Conversation
…to clarify that in some cases the policy will not be added and the result should be checked.
| ```ts | ||
| const bucket = new Bucket(this, 'MyBucket'); | ||
| bucket.addToResourcePolicy(new iam.PolicyStatement({ | ||
| const result = bucket.addToResourcePolicy(new iam.PolicyStatement({ |
There was a problem hiding this comment.
Note for the future -
I'm not a big fan of this behaviour. Ideally, this API should fail if the 'add' does not occur. It's feels counter intuitive, poor ergonomics, that an action 'add' doesn't actually 'add' in some cases.
We should have added a second API tryAddToResourcePolicy() that does not fail in such cases.
There was a problem hiding this comment.
Good point. I can create this new API.
There was a problem hiding this comment.
Wondering if this API has been created and whether this can fail more loudly! The silent failure of addToResourcePolicy is very confusing (per #6548) and it's not clear under what circumstances a person should know to check for success.
|
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
|
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
This is to clarify that in some cases the policy will not be added and the result should be checked.
Closes #6548 and #7370.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license