Skip to content

Commit

Permalink
chore: use "construct" instead of "node" across the library (#9584)
Browse files Browse the repository at this point in the history
As a follow-up for #9557, replace all usage of the deprecated `node` API with `construct`.

Related: aws/aws-cdk-rfcs#192


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
Elad Ben-Israel committed Jan 18, 2022
1 parent c650d44 commit 1f28a31
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/decdk/lib/declarative-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -383,9 +383,9 @@ function invokeMethod(stack: cdk.Stack, method: reflect.Callable, parameters: an
*/
function deconstructGetAtt(stack: cdk.Stack, id: string, attribute: string) {
return cdk.Lazy.stringValue({ produce: () => {
const res = stack.node.tryFindChild(id);
const res = stack.construct.tryFindChild(id);
if (!res) {
const include = stack.node.tryFindChild('Include') as cdk.CfnInclude;
const include = stack.construct.tryFindChild('Include') as cdk.CfnInclude;
if (!include) {
throw new Error(`Unexpected - "Include" should be in the stack at this point`);
}
Expand All @@ -403,15 +403,15 @@ function deconstructGetAtt(stack: cdk.Stack, id: string, attribute: string) {
}

function findConstruct(stack: cdk.Stack, id: string) {
const child = stack.node.tryFindChild(id);
const child = stack.construct.tryFindChild(id);
if (!child) {
throw new Error(`Construct with ID ${id} not found (it must be defined before it is referenced)`);
}
return child;
}

function processReferences(stack: cdk.Stack) {
const include = stack.node.findChild('Include') as cdk.CfnInclude;
const include = stack.construct.findChild('Include') as cdk.CfnInclude;
if (!include) {
throw new Error('Unexpected');
}
Expand Down

0 comments on commit 1f28a31

Please sign in to comment.