MCPcopy Create free account
hub / github.com/aws/constructs / constructor

Method constructor

src/construct.ts:73–85  ·  view source on GitHub ↗
(private readonly host: Construct, scope: IConstruct, id: string)

Source from the content-addressed store, hash-verified

71 private _addr?: string; // cache
72
73 public constructor(private readonly host: Construct, scope: IConstruct, id: string) {
74 id = id ?? ''; // if undefined, convert to empty string
75
76 this.id = sanitizeId(id);
77 this.scope = scope;
78
79 if (scope && !this.id) {
80 throw new Error('Only root constructs may have an empty ID');
81 }
82
83 // add to parent scope
84 scope?.node.addChild(host, this.id);
85 }
86
87 /**
88 * The full, absolute path of this construct in the tree.

Callers

nothing calls this directly

Calls 2

sanitizeIdFunction · 0.85
addChildMethod · 0.80

Tested by

no test coverage detected