feat(route53resolver): improve FirewallRuleGroup import by name
Issue
Closes #16335.
Reason for this change
Currently, FirewallRuleGroup allows importing an existing rule group by ID using fromFirewallRuleGroupID(), but there is no built-in way to reference an existing rule group by name. Users need to implement their own lookup logic via the AWS SDK. This change provides a direct method to import a firewall rule group by name, simplifying the process.
Description of changes
- Added
FirewallRuleGroup.fromFirewallRuleGroupName(), which allows users to import a firewall rule group using its name instead of just an ID. - The method retrieves the rule group ID from the CDK context.
- If the provided firewall rule group name is not found in the context, it throws a meaningful error.
- Created unit tests, ensuring correct ID is returned when a valid name mapping is provided in the context and an error is thrown if firewall rule group name is not found in the context.
Describe any new or updated permissions being added
None
Description of how you validated changes
- Unit Tests: Added tests in firewall-rule-group.test.ts to validate both successful and failing cases.
- Integration Tests: Updated integration.firewall.js to reflect changes and updated snapshots.
Checklist
- [x] My code adheres to the CONTRIBUTING GUIDE and DESIGN GUIDELINES
Acknowledgements
Thanks to @arvchahal for collaboration on this feature!
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license
AWS CodeBuild CI Report
- CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
- Commit ID: 2eacc2e9495d607bcb133352a8137e81d988f36e
- Result: SUCCEEDED
- Build Logs (available for 30 days)
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository
This PR has been in the CHANGES REQUESTED state for 3 weeks, and looks abandoned. Note that PRs with failing linting check or builds are not reviewed, please ensure your build is passing
To prevent automatic closure:
- Resume work on the PR
- OR request an exemption by adding a comment containing 'Exemption Request' with justification e.x "Exemption Request:
" - OR request clarification by adding a comment containing 'Clarification Request' with a question e.x "Clarification Request:
"
This PR will automatically close in 14 days if no action is taken.
This PR has been deemed to be abandoned, and will be automatically closed. Please create a new PR for these changes if you think this decision has been made in error.
Comments on closed issues and PRs are hard for our team to see. If you need help, please open a new issue that references this one.