-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): add resource type and properties for all CfnResource cons…
…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
- Loading branch information
Showing
6 changed files
with
175 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* Inspector that maintains an attribute bag | ||
*/ | ||
export class TreeInspector { | ||
/** | ||
* Represents the bag of attributes as key-value pairs. | ||
*/ | ||
public readonly attributes: { [key: string]: any } = {}; | ||
|
||
/** | ||
* Adds attribute to bag. Keys should be added by convention to prevent conflicts | ||
* i.e. L1 constructs will contain attributes with keys prefixed with aws:cdk:cloudformation | ||
* | ||
* @param key - key for metadata | ||
* @param value - value of metadata. | ||
*/ | ||
public addAttribute(key: string, value: any) { | ||
this.attributes[key] = value; | ||
} | ||
} | ||
|
||
/** | ||
* Interface for examining a construct and exposing metadata. | ||
* | ||
*/ | ||
export interface IInspectable { | ||
/** | ||
* Examines construct | ||
* | ||
* @param inspector - tree inspector to collect and process attributes | ||
*/ | ||
inspect(inspector: TreeInspector): void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters