feat(aws-cdk-lib): all L1s now have a isCfn<ResourceName> static helper to check if a value is this L1 resource#36243
Conversation
…lper to check if something is this L1 resource
isCfn<Resource> type guard methods to L1 resources
isCfn<Resource> type guard methods to L1 resourcesisCfn<ResourceName> static helper to check if a value is this L1 resource
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
|
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). |
|
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). |
|
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. |
Issue # (if applicable)
N/A
Reason for this change
CloudFormation resource classes (CfnX) lack a type-safe way to check if an object is an instance of a specific resource type. This makes it difficult to perform runtime type checking with proper TypeScript type narrowing.
Description of changes
Adds a static
isCfn<Resource>method to all generated CloudFormation resource classes. This method:Example generated method:
Implementation adds the
makeIsAResource()method to the ResourceClass in spec2cdk, which generates this method for all CloudFormation resources.Describe any new or updated permissions being added
None
Description of how you validated changes
Updated snapshot tests verify the method is generated correctly for all resource types.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license