-
Notifications
You must be signed in to change notification settings - Fork 4.4k
feat(core): Add resource type and properties of all CfnResource constructs to tree.json #4562
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ructs to tree.json Also, switch the children node from an array to an object with each child object keyed on its id.
|
Thanks so much for taking the time to contribute to the AWS CDK ❤️ We will shortly assign someone to review this pull request and help get it
|
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
eladb
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems upside down...
I don't think CfnResources should be special nor that the tree should encode the concept of type and properties. I believe the design we discussed was that each tree node has a set of key-value attributes and constructs can "contribute" to this attribute bag by implementing some interface. Then CfnResource implements the interface and contributes the attributes aws.cloudformation.type and aws.cloudformation.properties (which will be key/value pairs).
Something like:
interface ITreeAttributes {
treeAttributes: { [key: string]: any };
}And then:
class CfnResource implements ITreeAttributes {
public get treeAttributes() {
return {
'aws:cloudformation:type': this.resourceType,
'aws:cloudformation:properties': this.cfnProperties
}
}
}
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
This is my miss for not closing the RFC sooner. Yes we did decide that we would have an attribute bag and constructs will provide information into it. L1's would report back all the properties in Type was the thing we hadn't closed discussion on. Initially, I felt it's nice to have as a top-level attribute of a Node, but I agree that since it's not applicable to every construct, that it's better off living in the attribute bag. I'll update the RFC to make the change to nest type into the attribute bag of a tree node, rather than a top-level attribute. |
…tructs to tree.json (#4894) Modifies the children node from an array to an object with each child object keyed on its id. Also added an interface `IInspectable` that constructs can optionally implement to contribute attributes into `tree.json`. Generated classes for Cfn resources implement `IInspectable` and contribute their resource type and props in the attribute bag. Supercedes #4562
Also, switch the children node from an array to an object with each child object keyed on its id.
TODO:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license