chore(mixins-preview): improved find bucket policy#36144
Conversation
a67e432 to
f6ff948
Compare
| while (ancestor && ancestorDistance < closestDistance) { | ||
| // Check all siblings and their descendants at this ancestor level | ||
| for (const sibling of ancestor.node.children) { | ||
| searchChildren(sibling, ancestorDistance); |
There was a problem hiding this comment.
This will probably lead to us re-treading ground in a lot of places, but it does fix the problem the previous implementation had with not finding policies that were the children of a parent's sibling (or in other similar places).
If we are ok with duplicated work for the sake of completeness then I am fine approving this iteration, if not we may want to add some way to check if a node has been visited already.
|
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
|
Comments on closed issues and PRs are hard for our team to see. |
Reason for this change
A helper function to reflect on the construct tree to find the closet Bucket Policy for a Bucket.
Description of changes
Implemented a generic function to find two related resources that are "close" to each other. Close is defined here as:
Than added a specific function just for bucket. For now this is hand-written and not publicly exposed. If we can identify these kind of connection patterns, we can likely code gen this for all resources.
Describe any new or updated permissions being added
n/a
Description of how you validated changes
Unit tests.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license