(private readonly host: Construct, scope: IConstruct, id: string)
| 81 | |
| 82 | |
| 83 | public constructor(private readonly host: Construct, scope: IConstruct, id: string) { |
| 84 | id = id ?? ''; // if undefined, convert to empty string |
| 85 | |
| 86 | this.id = sanitizeId(id); |
| 87 | this.scope = scope; |
| 88 | |
| 89 | if (scope && !this.id) { |
| 90 | throw new Error('Only root constructs may have an empty ID'); |
| 91 | } |
| 92 | |
| 93 | if (scope) { |
| 94 | scope.node.addChild(host, this.id); |
| 95 | this.path = scope.node.path ? `${scope.node.path}${Node.PATH_SEP}${this.id}` : this.id; |
| 96 | this._scopes = [...scope.node._scopes, this.host]; |
| 97 | } else { |
| 98 | this.path = this.id; |
| 99 | this._scopes = [this.host]; |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | /** |
| 104 | * All parent scopes of this construct. |
nothing calls this directly
no test coverage detected