1 | # API Reference <a name="API Reference" id="api-reference"></a>
|
2 |
|
3 | ## Constructs <a name="Constructs" id="Constructs"></a>
|
4 |
|
5 | ### Construct <a name="Construct" id="constructs.Construct"></a>
|
6 |
|
7 | - *Implements:* <a href="#constructs.IConstruct">IConstruct</a>
|
8 |
|
9 | Represents the building block of the construct graph.
|
10 |
|
11 | All constructs besides the root construct must be created within the scope of
|
12 | another construct.
|
13 |
|
14 | #### Initializers <a name="Initializers" id="constructs.Construct.Initializer"></a>
|
15 |
|
16 | ```typescript
|
17 | import { Construct } from 'constructs'
|
18 |
|
19 | new Construct(scope: Construct, id: string)
|
20 | ```
|
21 |
|
22 | | **Name** | **Type** | **Description** |
|
23 | | --- | --- | --- |
|
24 | | <code><a href="#constructs.Construct.Initializer.parameter.scope">scope</a></code> | <code><a href="#constructs.Construct">Construct</a></code> | The scope in which to define this construct. |
|
25 | | <code><a href="#constructs.Construct.Initializer.parameter.id">id</a></code> | <code>string</code> | The scoped construct ID. |
|
26 |
|
27 | ---
|
28 |
|
29 | ##### `scope`<sup>Required</sup> <a name="scope" id="constructs.Construct.Initializer.parameter.scope"></a>
|
30 |
|
31 | - *Type:* <a href="#constructs.Construct">Construct</a>
|
32 |
|
33 | The scope in which to define this construct.
|
34 |
|
35 | ---
|
36 |
|
37 | ##### `id`<sup>Required</sup> <a name="id" id="constructs.Construct.Initializer.parameter.id"></a>
|
38 |
|
39 | - *Type:* string
|
40 |
|
41 | The scoped construct ID.
|
42 |
|
43 | Must be unique amongst siblings. If
|
44 | the ID includes a path separator (`/`), then it will be replaced by double
|
45 | dash `--`.
|
46 |
|
47 | ---
|
48 |
|
49 | #### Methods <a name="Methods" id="Methods"></a>
|
50 |
|
51 | | **Name** | **Description** |
|
52 | | --- | --- |
|
53 | | <code><a href="#constructs.Construct.toString">toString</a></code> | Returns a string representation of this construct. |
|
54 |
|
55 | ---
|
56 |
|
57 | ##### `toString` <a name="toString" id="constructs.Construct.toString"></a>
|
58 |
|
59 | ```typescript
|
60 | public toString(): string
|
61 | ```
|
62 |
|
63 | Returns a string representation of this construct.
|
64 |
|
65 | #### Static Functions <a name="Static Functions" id="Static Functions"></a>
|
66 |
|
67 | | **Name** | **Description** |
|
68 | | --- | --- |
|
69 | | <code><a href="#constructs.Construct.isConstruct">isConstruct</a></code> | Checks if `x` is a construct. |
|
70 |
|
71 | ---
|
72 |
|
73 | ##### `isConstruct` <a name="isConstruct" id="constructs.Construct.isConstruct"></a>
|
74 |
|
75 | ```typescript
|
76 | import { Construct } from 'constructs'
|
77 |
|
78 | Construct.isConstruct(x: any)
|
79 | ```
|
80 |
|
81 | Checks if `x` is a construct.
|
82 |
|
83 | Use this method instead of `instanceof` to properly detect `Construct`
|
84 | instances, even when the construct library is symlinked.
|
85 |
|
86 | Explanation: in JavaScript, multiple copies of the `constructs` library on
|
87 | disk are seen as independent, completely different libraries. As a
|
88 | consequence, the class `Construct` in each copy of the `constructs` library
|
89 | is seen as a different class, and an instance of one class will not test as
|
90 | `instanceof` the other class. `npm install` will not create installations
|
91 | like this, but users may manually symlink construct libraries together or
|
92 | use a monorepo tool: in those cases, multiple copies of the `constructs`
|
93 | library can be accidentally installed, and `instanceof` will behave
|
94 | unpredictably. It is safest to avoid using `instanceof`, and using
|
95 | this type-testing method instead.
|
96 |
|
97 | ###### `x`<sup>Required</sup> <a name="x" id="constructs.Construct.isConstruct.parameter.x"></a>
|
98 |
|
99 | - *Type:* any
|
100 |
|
101 | Any object.
|
102 |
|
103 | ---
|
104 |
|
105 | #### Properties <a name="Properties" id="Properties"></a>
|
106 |
|
107 | | **Name** | **Type** | **Description** |
|
108 | | --- | --- | --- |
|
109 | | <code><a href="#constructs.Construct.property.node">node</a></code> | <code><a href="#constructs.Node">Node</a></code> | The tree node. |
|
110 |
|
111 | ---
|
112 |
|
113 | ##### `node`<sup>Required</sup> <a name="node" id="constructs.Construct.property.node"></a>
|
114 |
|
115 | ```typescript
|
116 | public readonly node: Node;
|
117 | ```
|
118 |
|
119 | - *Type:* <a href="#constructs.Node">Node</a>
|
120 |
|
121 | The tree node.
|
122 |
|
123 | ---
|
124 |
|
125 |
|
126 | ### RootConstruct <a name="RootConstruct" id="constructs.RootConstruct"></a>
|
127 |
|
128 | Creates a new root construct node.
|
129 |
|
130 | The root construct represents the top of the construct tree and is not contained within a parent scope itself.
|
131 | For root constructs, the id is optional.
|
132 |
|
133 | #### Initializers <a name="Initializers" id="constructs.RootConstruct.Initializer"></a>
|
134 |
|
135 | ```typescript
|
136 | import { RootConstruct } from 'constructs'
|
137 |
|
138 | new RootConstruct(id?: string)
|
139 | ```
|
140 |
|
141 | | **Name** | **Type** | **Description** |
|
142 | | --- | --- | --- |
|
143 | | <code><a href="#constructs.RootConstruct.Initializer.parameter.id">id</a></code> | <code>string</code> | The scoped construct ID. |
|
144 |
|
145 | ---
|
146 |
|
147 | ##### `id`<sup>Optional</sup> <a name="id" id="constructs.RootConstruct.Initializer.parameter.id"></a>
|
148 |
|
149 | - *Type:* string
|
150 |
|
151 | The scoped construct ID.
|
152 |
|
153 | Must be unique amongst siblings. If
|
154 | the ID includes a path separator (`/`), then it will be replaced by double
|
155 | dash `--`.
|
156 |
|
157 | ---
|
158 |
|
159 | #### Methods <a name="Methods" id="Methods"></a>
|
160 |
|
161 | | **Name** | **Description** |
|
162 | | --- | --- |
|
163 | | <code><a href="#constructs.RootConstruct.toString">toString</a></code> | Returns a string representation of this construct. |
|
164 |
|
165 | ---
|
166 |
|
167 | ##### `toString` <a name="toString" id="constructs.RootConstruct.toString"></a>
|
168 |
|
169 | ```typescript
|
170 | public toString(): string
|
171 | ```
|
172 |
|
173 | Returns a string representation of this construct.
|
174 |
|
175 | #### Static Functions <a name="Static Functions" id="Static Functions"></a>
|
176 |
|
177 | | **Name** | **Description** |
|
178 | | --- | --- |
|
179 | | <code><a href="#constructs.RootConstruct.isConstruct">isConstruct</a></code> | Checks if `x` is a construct. |
|
180 |
|
181 | ---
|
182 |
|
183 | ##### `isConstruct` <a name="isConstruct" id="constructs.RootConstruct.isConstruct"></a>
|
184 |
|
185 | ```typescript
|
186 | import { RootConstruct } from 'constructs'
|
187 |
|
188 | RootConstruct.isConstruct(x: any)
|
189 | ```
|
190 |
|
191 | Checks if `x` is a construct.
|
192 |
|
193 | Use this method instead of `instanceof` to properly detect `Construct`
|
194 | instances, even when the construct library is symlinked.
|
195 |
|
196 | Explanation: in JavaScript, multiple copies of the `constructs` library on
|
197 | disk are seen as independent, completely different libraries. As a
|
198 | consequence, the class `Construct` in each copy of the `constructs` library
|
199 | is seen as a different class, and an instance of one class will not test as
|
200 | `instanceof` the other class. `npm install` will not create installations
|
201 | like this, but users may manually symlink construct libraries together or
|
202 | use a monorepo tool: in those cases, multiple copies of the `constructs`
|
203 | library can be accidentally installed, and `instanceof` will behave
|
204 | unpredictably. It is safest to avoid using `instanceof`, and using
|
205 | this type-testing method instead.
|
206 |
|
207 | ###### `x`<sup>Required</sup> <a name="x" id="constructs.RootConstruct.isConstruct.parameter.x"></a>
|
208 |
|
209 | - *Type:* any
|
210 |
|
211 | Any object.
|
212 |
|
213 | ---
|
214 |
|
215 | #### Properties <a name="Properties" id="Properties"></a>
|
216 |
|
217 | | **Name** | **Type** | **Description** |
|
218 | | --- | --- | --- |
|
219 | | <code><a href="#constructs.RootConstruct.property.node">node</a></code> | <code><a href="#constructs.Node">Node</a></code> | The tree node. |
|
220 |
|
221 | ---
|
222 |
|
223 | ##### `node`<sup>Required</sup> <a name="node" id="constructs.RootConstruct.property.node"></a>
|
224 |
|
225 | ```typescript
|
226 | public readonly node: Node;
|
227 | ```
|
228 |
|
229 | - *Type:* <a href="#constructs.Node">Node</a>
|
230 |
|
231 | The tree node.
|
232 |
|
233 | ---
|
234 |
|
235 |
|
236 | ## Structs <a name="Structs" id="Structs"></a>
|
237 |
|
238 | ### MetadataEntry <a name="MetadataEntry" id="constructs.MetadataEntry"></a>
|
239 |
|
240 | An entry in the construct metadata table.
|
241 |
|
242 | #### Initializer <a name="Initializer" id="constructs.MetadataEntry.Initializer"></a>
|
243 |
|
244 | ```typescript
|
245 | import { MetadataEntry } from 'constructs'
|
246 |
|
247 | const metadataEntry: MetadataEntry = { ... }
|
248 | ```
|
249 |
|
250 | #### Properties <a name="Properties" id="Properties"></a>
|
251 |
|
252 | | **Name** | **Type** | **Description** |
|
253 | | --- | --- | --- |
|
254 | | <code><a href="#constructs.MetadataEntry.property.data">data</a></code> | <code>any</code> | The data. |
|
255 | | <code><a href="#constructs.MetadataEntry.property.type">type</a></code> | <code>string</code> | The metadata entry type. |
|
256 | | <code><a href="#constructs.MetadataEntry.property.trace">trace</a></code> | <code>string[]</code> | Stack trace at the point of adding the metadata. |
|
257 |
|
258 | ---
|
259 |
|
260 | ##### `data`<sup>Required</sup> <a name="data" id="constructs.MetadataEntry.property.data"></a>
|
261 |
|
262 | ```typescript
|
263 | public readonly data: any;
|
264 | ```
|
265 |
|
266 | - *Type:* any
|
267 |
|
268 | The data.
|
269 |
|
270 | ---
|
271 |
|
272 | ##### `type`<sup>Required</sup> <a name="type" id="constructs.MetadataEntry.property.type"></a>
|
273 |
|
274 | ```typescript
|
275 | public readonly type: string;
|
276 | ```
|
277 |
|
278 | - *Type:* string
|
279 |
|
280 | The metadata entry type.
|
281 |
|
282 | ---
|
283 |
|
284 | ##### `trace`<sup>Optional</sup> <a name="trace" id="constructs.MetadataEntry.property.trace"></a>
|
285 |
|
286 | ```typescript
|
287 | public readonly trace: string[];
|
288 | ```
|
289 |
|
290 | - *Type:* string[]
|
291 | - *Default:* no trace information
|
292 |
|
293 | Stack trace at the point of adding the metadata.
|
294 |
|
295 | Only available if `addMetadata()` is called with `stackTrace: true`.
|
296 |
|
297 | ---
|
298 |
|
299 | ### MetadataOptions <a name="MetadataOptions" id="constructs.MetadataOptions"></a>
|
300 |
|
301 | Options for `construct.addMetadata()`.
|
302 |
|
303 | #### Initializer <a name="Initializer" id="constructs.MetadataOptions.Initializer"></a>
|
304 |
|
305 | ```typescript
|
306 | import { MetadataOptions } from 'constructs'
|
307 |
|
308 | const metadataOptions: MetadataOptions = { ... }
|
309 | ```
|
310 |
|
311 | #### Properties <a name="Properties" id="Properties"></a>
|
312 |
|
313 | | **Name** | **Type** | **Description** |
|
314 | | --- | --- | --- |
|
315 | | <code><a href="#constructs.MetadataOptions.property.stackTrace">stackTrace</a></code> | <code>boolean</code> | Include stack trace with metadata entry. |
|
316 | | <code><a href="#constructs.MetadataOptions.property.traceFromFunction">traceFromFunction</a></code> | <code>any</code> | A JavaScript function to begin tracing from. |
|
317 |
|
318 | ---
|
319 |
|
320 | ##### `stackTrace`<sup>Optional</sup> <a name="stackTrace" id="constructs.MetadataOptions.property.stackTrace"></a>
|
321 |
|
322 | ```typescript
|
323 | public readonly stackTrace: boolean;
|
324 | ```
|
325 |
|
326 | - *Type:* boolean
|
327 | - *Default:* false
|
328 |
|
329 | Include stack trace with metadata entry.
|
330 |
|
331 | ---
|
332 |
|
333 | ##### `traceFromFunction`<sup>Optional</sup> <a name="traceFromFunction" id="constructs.MetadataOptions.property.traceFromFunction"></a>
|
334 |
|
335 | ```typescript
|
336 | public readonly traceFromFunction: any;
|
337 | ```
|
338 |
|
339 | - *Type:* any
|
340 | - *Default:* addMetadata()
|
341 |
|
342 | A JavaScript function to begin tracing from.
|
343 |
|
344 | This option is ignored unless `stackTrace` is `true`.
|
345 |
|
346 | ---
|
347 |
|
348 | ## Classes <a name="Classes" id="Classes"></a>
|
349 |
|
350 | ### Dependable <a name="Dependable" id="constructs.Dependable"></a>
|
351 |
|
352 | Trait for IDependable.
|
353 |
|
354 | Traits are interfaces that are privately implemented by objects. Instead of
|
355 | showing up in the public interface of a class, they need to be queried
|
356 | explicitly. This is used to implement certain framework features that are
|
357 | not intended to be used by Construct consumers, and so should be hidden
|
358 | from accidental use.
|
359 |
|
360 | *Example*
|
361 |
|
362 | ```typescript
|
363 | // Usage
|
364 | const roots = Dependable.of(construct).dependencyRoots;
|
365 |
|
366 | // Definition
|
367 | Dependable.implement(construct, {
|
368 | dependencyRoots: [construct],
|
369 | });
|
370 | ```
|
371 |
|
372 |
|
373 | #### Initializers <a name="Initializers" id="constructs.Dependable.Initializer"></a>
|
374 |
|
375 | ```typescript
|
376 | import { Dependable } from 'constructs'
|
377 |
|
378 | new Dependable()
|
379 | ```
|
380 |
|
381 | | **Name** | **Type** | **Description** |
|
382 | | --- | --- | --- |
|
383 |
|
384 | ---
|
385 |
|
386 |
|
387 | #### Static Functions <a name="Static Functions" id="Static Functions"></a>
|
388 |
|
389 | | **Name** | **Description** |
|
390 | | --- | --- |
|
391 | | <code><a href="#constructs.Dependable.get">get</a></code> | Return the matching Dependable for the given class instance. |
|
392 | | <code><a href="#constructs.Dependable.implement">implement</a></code> | Turn any object into an IDependable. |
|
393 | | <code><a href="#constructs.Dependable.of">of</a></code> | Return the matching Dependable for the given class instance. |
|
394 |
|
395 | ---
|
396 |
|
397 | ##### ~~`get`~~ <a name="get" id="constructs.Dependable.get"></a>
|
398 |
|
399 | ```typescript
|
400 | import { Dependable } from 'constructs'
|
401 |
|
402 | Dependable.get(instance: IDependable)
|
403 | ```
|
404 |
|
405 | Return the matching Dependable for the given class instance.
|
406 |
|
407 | ###### `instance`<sup>Required</sup> <a name="instance" id="constructs.Dependable.get.parameter.instance"></a>
|
408 |
|
409 | - *Type:* <a href="#constructs.IDependable">IDependable</a>
|
410 |
|
411 | ---
|
412 |
|
413 | ##### `implement` <a name="implement" id="constructs.Dependable.implement"></a>
|
414 |
|
415 | ```typescript
|
416 | import { Dependable } from 'constructs'
|
417 |
|
418 | Dependable.implement(instance: IDependable, trait: Dependable)
|
419 | ```
|
420 |
|
421 | Turn any object into an IDependable.
|
422 |
|
423 | ###### `instance`<sup>Required</sup> <a name="instance" id="constructs.Dependable.implement.parameter.instance"></a>
|
424 |
|
425 | - *Type:* <a href="#constructs.IDependable">IDependable</a>
|
426 |
|
427 | ---
|
428 |
|
429 | ###### `trait`<sup>Required</sup> <a name="trait" id="constructs.Dependable.implement.parameter.trait"></a>
|
430 |
|
431 | - *Type:* <a href="#constructs.Dependable">Dependable</a>
|
432 |
|
433 | ---
|
434 |
|
435 | ##### `of` <a name="of" id="constructs.Dependable.of"></a>
|
436 |
|
437 | ```typescript
|
438 | import { Dependable } from 'constructs'
|
439 |
|
440 | Dependable.of(instance: IDependable)
|
441 | ```
|
442 |
|
443 | Return the matching Dependable for the given class instance.
|
444 |
|
445 | ###### `instance`<sup>Required</sup> <a name="instance" id="constructs.Dependable.of.parameter.instance"></a>
|
446 |
|
447 | - *Type:* <a href="#constructs.IDependable">IDependable</a>
|
448 |
|
449 | ---
|
450 |
|
451 | #### Properties <a name="Properties" id="Properties"></a>
|
452 |
|
453 | | **Name** | **Type** | **Description** |
|
454 | | --- | --- | --- |
|
455 | | <code><a href="#constructs.Dependable.property.dependencyRoots">dependencyRoots</a></code> | <code><a href="#constructs.IConstruct">IConstruct</a>[]</code> | The set of constructs that form the root of this dependable. |
|
456 |
|
457 | ---
|
458 |
|
459 | ##### `dependencyRoots`<sup>Required</sup> <a name="dependencyRoots" id="constructs.Dependable.property.dependencyRoots"></a>
|
460 |
|
461 | ```typescript
|
462 | public readonly dependencyRoots: IConstruct[];
|
463 | ```
|
464 |
|
465 | - *Type:* <a href="#constructs.IConstruct">IConstruct</a>[]
|
466 |
|
467 | The set of constructs that form the root of this dependable.
|
468 |
|
469 | All resources under all returned constructs are included in the ordering
|
470 | dependency.
|
471 |
|
472 | ---
|
473 |
|
474 |
|
475 | ### DependencyGroup <a name="DependencyGroup" id="constructs.DependencyGroup"></a>
|
476 |
|
477 | - *Implements:* <a href="#constructs.IDependable">IDependable</a>
|
478 |
|
479 | A set of constructs to be used as a dependable.
|
480 |
|
481 | This class can be used when a set of constructs which are disjoint in the
|
482 | construct tree needs to be combined to be used as a single dependable.
|
483 |
|
484 | #### Initializers <a name="Initializers" id="constructs.DependencyGroup.Initializer"></a>
|
485 |
|
486 | ```typescript
|
487 | import { DependencyGroup } from 'constructs'
|
488 |
|
489 | new DependencyGroup(deps: ...IDependable[])
|
490 | ```
|
491 |
|
492 | | **Name** | **Type** | **Description** |
|
493 | | --- | --- | --- |
|
494 | | <code><a href="#constructs.DependencyGroup.Initializer.parameter.deps">deps</a></code> | <code>...<a href="#constructs.IDependable">IDependable</a>[]</code> | *No description.* |
|
495 |
|
496 | ---
|
497 |
|
498 | ##### `deps`<sup>Required</sup> <a name="deps" id="constructs.DependencyGroup.Initializer.parameter.deps"></a>
|
499 |
|
500 | - *Type:* ...<a href="#constructs.IDependable">IDependable</a>[]
|
501 |
|
502 | ---
|
503 |
|
504 | #### Methods <a name="Methods" id="Methods"></a>
|
505 |
|
506 | | **Name** | **Description** |
|
507 | | --- | --- |
|
508 | | <code><a href="#constructs.DependencyGroup.add">add</a></code> | Add a construct to the dependency roots. |
|
509 |
|
510 | ---
|
511 |
|
512 | ##### `add` <a name="add" id="constructs.DependencyGroup.add"></a>
|
513 |
|
514 | ```typescript
|
515 | public add(scopes: ...IDependable[]): void
|
516 | ```
|
517 |
|
518 | Add a construct to the dependency roots.
|
519 |
|
520 | ###### `scopes`<sup>Required</sup> <a name="scopes" id="constructs.DependencyGroup.add.parameter.scopes"></a>
|
521 |
|
522 | - *Type:* ...<a href="#constructs.IDependable">IDependable</a>[]
|
523 |
|
524 | ---
|
525 |
|
526 |
|
527 |
|
528 |
|
529 | ### Node <a name="Node" id="constructs.Node"></a>
|
530 |
|
531 | Represents the construct node in the scope tree.
|
532 |
|
533 | #### Initializers <a name="Initializers" id="constructs.Node.Initializer"></a>
|
534 |
|
535 | ```typescript
|
536 | import { Node } from 'constructs'
|
537 |
|
538 | new Node(host: Construct, scope: IConstruct, id: string)
|
539 | ```
|
540 |
|
541 | | **Name** | **Type** | **Description** |
|
542 | | --- | --- | --- |
|
543 | | <code><a href="#constructs.Node.Initializer.parameter.host">host</a></code> | <code><a href="#constructs.Construct">Construct</a></code> | *No description.* |
|
544 | | <code><a href="#constructs.Node.Initializer.parameter.scope">scope</a></code> | <code><a href="#constructs.IConstruct">IConstruct</a></code> | *No description.* |
|
545 | | <code><a href="#constructs.Node.Initializer.parameter.id">id</a></code> | <code>string</code> | *No description.* |
|
546 |
|
547 | ---
|
548 |
|
549 | ##### `host`<sup>Required</sup> <a name="host" id="constructs.Node.Initializer.parameter.host"></a>
|
550 |
|
551 | - *Type:* <a href="#constructs.Construct">Construct</a>
|
552 |
|
553 | ---
|
554 |
|
555 | ##### `scope`<sup>Required</sup> <a name="scope" id="constructs.Node.Initializer.parameter.scope"></a>
|
556 |
|
557 | - *Type:* <a href="#constructs.IConstruct">IConstruct</a>
|
558 |
|
559 | ---
|
560 |
|
561 | ##### `id`<sup>Required</sup> <a name="id" id="constructs.Node.Initializer.parameter.id"></a>
|
562 |
|
563 | - *Type:* string
|
564 |
|
565 | ---
|
566 |
|
567 | #### Methods <a name="Methods" id="Methods"></a>
|
568 |
|
569 | | **Name** | **Description** |
|
570 | | --- | --- |
|
571 | | <code><a href="#constructs.Node.addDependency">addDependency</a></code> | Add an ordering dependency on another construct. |
|
572 | | <code><a href="#constructs.Node.addMetadata">addMetadata</a></code> | Adds a metadata entry to this construct. |
|
573 | | <code><a href="#constructs.Node.addValidation">addValidation</a></code> | Adds a validation to this construct. |
|
574 | | <code><a href="#constructs.Node.findAll">findAll</a></code> | Return this construct and all of its children in the given order. |
|
575 | | <code><a href="#constructs.Node.findChild">findChild</a></code> | Return a direct child by id. |
|
576 | | <code><a href="#constructs.Node.getAllContext">getAllContext</a></code> | Retrieves the all context of a node from tree context. |
|
577 | | <code><a href="#constructs.Node.getContext">getContext</a></code> | Retrieves a value from tree context if present. Otherwise, would throw an error. |
|
578 | | <code><a href="#constructs.Node.lock">lock</a></code> | Locks this construct from allowing more children to be added. |
|
579 | | <code><a href="#constructs.Node.setContext">setContext</a></code> | This can be used to set contextual values. |
|
580 | | <code><a href="#constructs.Node.tryFindChild">tryFindChild</a></code> | Return a direct child by id, or undefined. |
|
581 | | <code><a href="#constructs.Node.tryGetContext">tryGetContext</a></code> | Retrieves a value from tree context. |
|
582 | | <code><a href="#constructs.Node.tryRemoveChild">tryRemoveChild</a></code> | Remove the child with the given name, if present. |
|
583 | | <code><a href="#constructs.Node.validate">validate</a></code> | Validates this construct. |
|
584 |
|
585 | ---
|
586 |
|
587 | ##### `addDependency` <a name="addDependency" id="constructs.Node.addDependency"></a>
|
588 |
|
589 | ```typescript
|
590 | public addDependency(deps: ...IDependable[]): void
|
591 | ```
|
592 |
|
593 | Add an ordering dependency on another construct.
|
594 |
|
595 | An `IDependable`
|
596 |
|
597 | ###### `deps`<sup>Required</sup> <a name="deps" id="constructs.Node.addDependency.parameter.deps"></a>
|
598 |
|
599 | - *Type:* ...<a href="#constructs.IDependable">IDependable</a>[]
|
600 |
|
601 | ---
|
602 |
|
603 | ##### `addMetadata` <a name="addMetadata" id="constructs.Node.addMetadata"></a>
|
604 |
|
605 | ```typescript
|
606 | public addMetadata(type: string, data: any, options?: MetadataOptions): void
|
607 | ```
|
608 |
|
609 | Adds a metadata entry to this construct.
|
610 |
|
611 | Entries are arbitrary values and will also include a stack trace to allow tracing back to
|
612 | the code location for when the entry was added. It can be used, for example, to include source
|
613 | mapping in CloudFormation templates to improve diagnostics.
|
614 | Note that construct metadata is not the same as CloudFormation resource metadata and is never written to the CloudFormation template.
|
615 | The metadata entries are written to the Cloud Assembly Manifest if the `treeMetadata` property is specified in the props of the App that contains this Construct.
|
616 |
|
617 | ###### `type`<sup>Required</sup> <a name="type" id="constructs.Node.addMetadata.parameter.type"></a>
|
618 |
|
619 | - *Type:* string
|
620 |
|
621 | a string denoting the type of metadata.
|
622 |
|
623 | ---
|
624 |
|
625 | ###### `data`<sup>Required</sup> <a name="data" id="constructs.Node.addMetadata.parameter.data"></a>
|
626 |
|
627 | - *Type:* any
|
628 |
|
629 | the value of the metadata (can be a Token).
|
630 |
|
631 | If null/undefined, metadata will not be added.
|
632 |
|
633 | ---
|
634 |
|
635 | ###### `options`<sup>Optional</sup> <a name="options" id="constructs.Node.addMetadata.parameter.options"></a>
|
636 |
|
637 | - *Type:* <a href="#constructs.MetadataOptions">MetadataOptions</a>
|
638 |
|
639 | options.
|
640 |
|
641 | ---
|
642 |
|
643 | ##### `addValidation` <a name="addValidation" id="constructs.Node.addValidation"></a>
|
644 |
|
645 | ```typescript
|
646 | public addValidation(validation: IValidation): void
|
647 | ```
|
648 |
|
649 | Adds a validation to this construct.
|
650 |
|
651 | When `node.validate()` is called, the `validate()` method will be called on
|
652 | all validations and all errors will be returned.
|
653 |
|
654 | ###### `validation`<sup>Required</sup> <a name="validation" id="constructs.Node.addValidation.parameter.validation"></a>
|
655 |
|
656 | - *Type:* <a href="#constructs.IValidation">IValidation</a>
|
657 |
|
658 | The validation object.
|
659 |
|
660 | ---
|
661 |
|
662 | ##### `findAll` <a name="findAll" id="constructs.Node.findAll"></a>
|
663 |
|
664 | ```typescript
|
665 | public findAll(order?: ConstructOrder): IConstruct[]
|
666 | ```
|
667 |
|
668 | Return this construct and all of its children in the given order.
|
669 |
|
670 | ###### `order`<sup>Optional</sup> <a name="order" id="constructs.Node.findAll.parameter.order"></a>
|
671 |
|
672 | - *Type:* <a href="#constructs.ConstructOrder">ConstructOrder</a>
|
673 |
|
674 | ---
|
675 |
|
676 | ##### `findChild` <a name="findChild" id="constructs.Node.findChild"></a>
|
677 |
|
678 | ```typescript
|
679 | public findChild(id: string): IConstruct
|
680 | ```
|
681 |
|
682 | Return a direct child by id.
|
683 |
|
684 | Throws an error if the child is not found.
|
685 |
|
686 | ###### `id`<sup>Required</sup> <a name="id" id="constructs.Node.findChild.parameter.id"></a>
|
687 |
|
688 | - *Type:* string
|
689 |
|
690 | Identifier of direct child.
|
691 |
|
692 | ---
|
693 |
|
694 | ##### `getAllContext` <a name="getAllContext" id="constructs.Node.getAllContext"></a>
|
695 |
|
696 | ```typescript
|
697 | public getAllContext(defaults?: object): any
|
698 | ```
|
699 |
|
700 | Retrieves the all context of a node from tree context.
|
701 |
|
702 | Context is usually initialized at the root, but can be overridden at any point in the tree.
|
703 |
|
704 | ###### `defaults`<sup>Optional</sup> <a name="defaults" id="constructs.Node.getAllContext.parameter.defaults"></a>
|
705 |
|
706 | - *Type:* object
|
707 |
|
708 | Any keys to override the retrieved context.
|
709 |
|
710 | ---
|
711 |
|
712 | ##### `getContext` <a name="getContext" id="constructs.Node.getContext"></a>
|
713 |
|
714 | ```typescript
|
715 | public getContext(key: string): any
|
716 | ```
|
717 |
|
718 | Retrieves a value from tree context if present. Otherwise, would throw an error.
|
719 |
|
720 | Context is usually initialized at the root, but can be overridden at any point in the tree.
|
721 |
|
722 | ###### `key`<sup>Required</sup> <a name="key" id="constructs.Node.getContext.parameter.key"></a>
|
723 |
|
724 | - *Type:* string
|
725 |
|
726 | The context key.
|
727 |
|
728 | ---
|
729 |
|
730 | ##### `lock` <a name="lock" id="constructs.Node.lock"></a>
|
731 |
|
732 | ```typescript
|
733 | public lock(): void
|
734 | ```
|
735 |
|
736 | Locks this construct from allowing more children to be added.
|
737 |
|
738 | After this
|
739 | call, no more children can be added to this construct or to any children.
|
740 |
|
741 | ##### `setContext` <a name="setContext" id="constructs.Node.setContext"></a>
|
742 |
|
743 | ```typescript
|
744 | public setContext(key: string, value: any): void
|
745 | ```
|
746 |
|
747 | This can be used to set contextual values.
|
748 |
|
749 | Context must be set before any children are added, since children may consult context info during construction.
|
750 | If the key already exists, it will be overridden.
|
751 |
|
752 | ###### `key`<sup>Required</sup> <a name="key" id="constructs.Node.setContext.parameter.key"></a>
|
753 |
|
754 | - *Type:* string
|
755 |
|
756 | The context key.
|
757 |
|
758 | ---
|
759 |
|
760 | ###### `value`<sup>Required</sup> <a name="value" id="constructs.Node.setContext.parameter.value"></a>
|
761 |
|
762 | - *Type:* any
|
763 |
|
764 | The context value.
|
765 |
|
766 | ---
|
767 |
|
768 | ##### `tryFindChild` <a name="tryFindChild" id="constructs.Node.tryFindChild"></a>
|
769 |
|
770 | ```typescript
|
771 | public tryFindChild(id: string): IConstruct
|
772 | ```
|
773 |
|
774 | Return a direct child by id, or undefined.
|
775 |
|
776 | ###### `id`<sup>Required</sup> <a name="id" id="constructs.Node.tryFindChild.parameter.id"></a>
|
777 |
|
778 | - *Type:* string
|
779 |
|
780 | Identifier of direct child.
|
781 |
|
782 | ---
|
783 |
|
784 | ##### `tryGetContext` <a name="tryGetContext" id="constructs.Node.tryGetContext"></a>
|
785 |
|
786 | ```typescript
|
787 | public tryGetContext(key: string): any
|
788 | ```
|
789 |
|
790 | Retrieves a value from tree context.
|
791 |
|
792 | Context is usually initialized at the root, but can be overridden at any point in the tree.
|
793 |
|
794 | ###### `key`<sup>Required</sup> <a name="key" id="constructs.Node.tryGetContext.parameter.key"></a>
|
795 |
|
796 | - *Type:* string
|
797 |
|
798 | The context key.
|
799 |
|
800 | ---
|
801 |
|
802 | ##### `tryRemoveChild` <a name="tryRemoveChild" id="constructs.Node.tryRemoveChild"></a>
|
803 |
|
804 | ```typescript
|
805 | public tryRemoveChild(childName: string): boolean
|
806 | ```
|
807 |
|
808 | Remove the child with the given name, if present.
|
809 |
|
810 | ###### `childName`<sup>Required</sup> <a name="childName" id="constructs.Node.tryRemoveChild.parameter.childName"></a>
|
811 |
|
812 | - *Type:* string
|
813 |
|
814 | ---
|
815 |
|
816 | ##### `validate` <a name="validate" id="constructs.Node.validate"></a>
|
817 |
|
818 | ```typescript
|
819 | public validate(): string[]
|
820 | ```
|
821 |
|
822 | Validates this construct.
|
823 |
|
824 | Invokes the `validate()` method on all validations added through
|
825 | `addValidation()`.
|
826 |
|
827 | #### Static Functions <a name="Static Functions" id="Static Functions"></a>
|
828 |
|
829 | | **Name** | **Description** |
|
830 | | --- | --- |
|
831 | | <code><a href="#constructs.Node.of">of</a></code> | Returns the node associated with a construct. |
|
832 |
|
833 | ---
|
834 |
|
835 | ##### ~~`of`~~ <a name="of" id="constructs.Node.of"></a>
|
836 |
|
837 | ```typescript
|
838 | import { Node } from 'constructs'
|
839 |
|
840 | Node.of(construct: IConstruct)
|
841 | ```
|
842 |
|
843 | Returns the node associated with a construct.
|
844 |
|
845 | ###### `construct`<sup>Required</sup> <a name="construct" id="constructs.Node.of.parameter.construct"></a>
|
846 |
|
847 | - *Type:* <a href="#constructs.IConstruct">IConstruct</a>
|
848 |
|
849 | the construct.
|
850 |
|
851 | ---
|
852 |
|
853 | #### Properties <a name="Properties" id="Properties"></a>
|
854 |
|
855 | | **Name** | **Type** | **Description** |
|
856 | | --- | --- | --- |
|
857 | | <code><a href="#constructs.Node.property.addr">addr</a></code> | <code>string</code> | Returns an opaque tree-unique address for this construct. |
|
858 | | <code><a href="#constructs.Node.property.children">children</a></code> | <code><a href="#constructs.IConstruct">IConstruct</a>[]</code> | All direct children of this construct. |
|
859 | | <code><a href="#constructs.Node.property.dependencies">dependencies</a></code> | <code><a href="#constructs.IConstruct">IConstruct</a>[]</code> | Return all dependencies registered on this node (non-recursive). |
|
860 | | <code><a href="#constructs.Node.property.id">id</a></code> | <code>string</code> | The id of this construct within the current scope. |
|
861 | | <code><a href="#constructs.Node.property.locked">locked</a></code> | <code>boolean</code> | Returns true if this construct or the scopes in which it is defined are locked. |
|
862 | | <code><a href="#constructs.Node.property.metadata">metadata</a></code> | <code><a href="#constructs.MetadataEntry">MetadataEntry</a>[]</code> | An immutable array of metadata objects associated with this construct. |
|
863 | | <code><a href="#constructs.Node.property.path">path</a></code> | <code>string</code> | The full, absolute path of this construct in the tree. |
|
864 | | <code><a href="#constructs.Node.property.root">root</a></code> | <code><a href="#constructs.IConstruct">IConstruct</a></code> | Returns the root of the construct tree. |
|
865 | | <code><a href="#constructs.Node.property.scopes">scopes</a></code> | <code><a href="#constructs.IConstruct">IConstruct</a>[]</code> | All parent scopes of this construct. |
|
866 | | <code><a href="#constructs.Node.property.scope">scope</a></code> | <code><a href="#constructs.IConstruct">IConstruct</a></code> | Returns the scope in which this construct is defined. |
|
867 | | <code><a href="#constructs.Node.property.defaultChild">defaultChild</a></code> | <code><a href="#constructs.IConstruct">IConstruct</a></code> | Returns the child construct that has the id `Default` or `Resource"`. |
|
868 |
|
869 | ---
|
870 |
|
871 | ##### `addr`<sup>Required</sup> <a name="addr" id="constructs.Node.property.addr"></a>
|
872 |
|
873 | ```typescript
|
874 | public readonly addr: string;
|
875 | ```
|
876 |
|
877 | - *Type:* string
|
878 |
|
879 | Returns an opaque tree-unique address for this construct.
|
880 |
|
881 | Addresses are 42 characters hexadecimal strings. They begin with "c8"
|
882 | followed by 40 lowercase hexadecimal characters (0-9a-f).
|
883 |
|
884 | Addresses are calculated using a SHA-1 of the components of the construct
|
885 | path.
|
886 |
|
887 | To enable refactoring of construct trees, constructs with the ID `Default`
|
888 | will be excluded from the calculation. In those cases constructs in the
|
889 | same tree may have the same address.
|
890 |
|
891 | ---
|
892 |
|
893 | *Example*
|
894 |
|
895 | ```typescript
|
896 | c83a2846e506bcc5f10682b564084bca2d275709ee
|
897 | ```
|
898 |
|
899 |
|
900 | ##### `children`<sup>Required</sup> <a name="children" id="constructs.Node.property.children"></a>
|
901 |
|
902 | ```typescript
|
903 | public readonly children: IConstruct[];
|
904 | ```
|
905 |
|
906 | - *Type:* <a href="#constructs.IConstruct">IConstruct</a>[]
|
907 |
|
908 | All direct children of this construct.
|
909 |
|
910 | ---
|
911 |
|
912 | ##### `dependencies`<sup>Required</sup> <a name="dependencies" id="constructs.Node.property.dependencies"></a>
|
913 |
|
914 | ```typescript
|
915 | public readonly dependencies: IConstruct[];
|
916 | ```
|
917 |
|
918 | - *Type:* <a href="#constructs.IConstruct">IConstruct</a>[]
|
919 |
|
920 | Return all dependencies registered on this node (non-recursive).
|
921 |
|
922 | ---
|
923 |
|
924 | ##### `id`<sup>Required</sup> <a name="id" id="constructs.Node.property.id"></a>
|
925 |
|
926 | ```typescript
|
927 | public readonly id: string;
|
928 | ```
|
929 |
|
930 | - *Type:* string
|
931 |
|
932 | The id of this construct within the current scope.
|
933 |
|
934 | This is a scope-unique id. To obtain an app-unique id for this construct, use `addr`.
|
935 |
|
936 | ---
|
937 |
|
938 | ##### `locked`<sup>Required</sup> <a name="locked" id="constructs.Node.property.locked"></a>
|
939 |
|
940 | ```typescript
|
941 | public readonly locked: boolean;
|
942 | ```
|
943 |
|
944 | - *Type:* boolean
|
945 |
|
946 | Returns true if this construct or the scopes in which it is defined are locked.
|
947 |
|
948 | ---
|
949 |
|
950 | ##### `metadata`<sup>Required</sup> <a name="metadata" id="constructs.Node.property.metadata"></a>
|
951 |
|
952 | ```typescript
|
953 | public readonly metadata: MetadataEntry[];
|
954 | ```
|
955 |
|
956 | - *Type:* <a href="#constructs.MetadataEntry">MetadataEntry</a>[]
|
957 |
|
958 | An immutable array of metadata objects associated with this construct.
|
959 |
|
960 | This can be used, for example, to implement support for deprecation notices, source mapping, etc.
|
961 |
|
962 | ---
|
963 |
|
964 | ##### `path`<sup>Required</sup> <a name="path" id="constructs.Node.property.path"></a>
|
965 |
|
966 | ```typescript
|
967 | public readonly path: string;
|
968 | ```
|
969 |
|
970 | - *Type:* string
|
971 |
|
972 | The full, absolute path of this construct in the tree.
|
973 |
|
974 | Components are separated by '/'.
|
975 |
|
976 | ---
|
977 |
|
978 | ##### `root`<sup>Required</sup> <a name="root" id="constructs.Node.property.root"></a>
|
979 |
|
980 | ```typescript
|
981 | public readonly root: IConstruct;
|
982 | ```
|
983 |
|
984 | - *Type:* <a href="#constructs.IConstruct">IConstruct</a>
|
985 |
|
986 | Returns the root of the construct tree.
|
987 |
|
988 | ---
|
989 |
|
990 | ##### `scopes`<sup>Required</sup> <a name="scopes" id="constructs.Node.property.scopes"></a>
|
991 |
|
992 | ```typescript
|
993 | public readonly scopes: IConstruct[];
|
994 | ```
|
995 |
|
996 | - *Type:* <a href="#constructs.IConstruct">IConstruct</a>[]
|
997 |
|
998 | All parent scopes of this construct.
|
999 |
|
1000 | ---
|
1001 |
|
1002 | ##### `scope`<sup>Optional</sup> <a name="scope" id="constructs.Node.property.scope"></a>
|
1003 |
|
1004 | ```typescript
|
1005 | public readonly scope: IConstruct;
|
1006 | ```
|
1007 |
|
1008 | - *Type:* <a href="#constructs.IConstruct">IConstruct</a>
|
1009 |
|
1010 | Returns the scope in which this construct is defined.
|
1011 |
|
1012 | The value is `undefined` at the root of the construct scope tree.
|
1013 |
|
1014 | ---
|
1015 |
|
1016 | ##### `defaultChild`<sup>Optional</sup> <a name="defaultChild" id="constructs.Node.property.defaultChild"></a>
|
1017 |
|
1018 | ```typescript
|
1019 | public readonly defaultChild: IConstruct;
|
1020 | ```
|
1021 |
|
1022 | - *Type:* <a href="#constructs.IConstruct">IConstruct</a>
|
1023 |
|
1024 | Returns the child construct that has the id `Default` or `Resource"`.
|
1025 |
|
1026 | This is usually the construct that provides the bulk of the underlying functionality.
|
1027 | Useful for modifications of the underlying construct that are not available at the higher levels.
|
1028 | Override the defaultChild property.
|
1029 |
|
1030 | This should only be used in the cases where the correct
|
1031 | default child is not named 'Resource' or 'Default' as it
|
1032 | should be.
|
1033 |
|
1034 | If you set this to undefined, the default behavior of finding
|
1035 | the child named 'Resource' or 'Default' will be used.
|
1036 |
|
1037 | ---
|
1038 |
|
1039 | #### Constants <a name="Constants" id="Constants"></a>
|
1040 |
|
1041 | | **Name** | **Type** | **Description** |
|
1042 | | --- | --- | --- |
|
1043 | | <code><a href="#constructs.Node.property.PATH_SEP">PATH_SEP</a></code> | <code>string</code> | Separator used to delimit construct path components. |
|
1044 |
|
1045 | ---
|
1046 |
|
1047 | ##### `PATH_SEP`<sup>Required</sup> <a name="PATH_SEP" id="constructs.Node.property.PATH_SEP"></a>
|
1048 |
|
1049 | ```typescript
|
1050 | public readonly PATH_SEP: string;
|
1051 | ```
|
1052 |
|
1053 | - *Type:* string
|
1054 |
|
1055 | Separator used to delimit construct path components.
|
1056 |
|
1057 | ---
|
1058 |
|
1059 | ## Protocols <a name="Protocols" id="Protocols"></a>
|
1060 |
|
1061 | ### IConstruct <a name="IConstruct" id="constructs.IConstruct"></a>
|
1062 |
|
1063 | - *Extends:* <a href="#constructs.IDependable">IDependable</a>
|
1064 |
|
1065 | - *Implemented By:* <a href="#constructs.Construct">Construct</a>, <a href="#constructs.RootConstruct">RootConstruct</a>, cdklabs-projen-project-types.yarn.CdkLabsMonorepo, cdklabs-projen-project-types.yarn.Monorepo, cdklabs-projen-project-types.yarn.MonorepoRelease, cdklabs-projen-project-types.yarn.TypeScriptWorkspace, cdklabs-projen-project-types.yarn.WorkspaceRelease, cdklabs-projen-project-types.AutoMerge, cdklabs-projen-project-types.CdkConstructLibrary, cdklabs-projen-project-types.CdkJsiiProject, cdklabs-projen-project-types.CdkTypeScriptProject, cdklabs-projen-project-types.CdklabsConstructLibrary, cdklabs-projen-project-types.CdklabsJsiiProject, cdklabs-projen-project-types.CdklabsTypeScriptProject, cdklabs-projen-project-types.MergeQueue, cdklabs-projen-project-types.Rosetta, projen.awscdk.AutoDiscover, projen.awscdk.AwsCdkConstructLibrary, projen.awscdk.AwsCdkDeps, projen.awscdk.AwsCdkDepsJava, projen.awscdk.AwsCdkDepsJs, projen.awscdk.AwsCdkDepsPy, projen.awscdk.AwsCdkJavaApp, projen.awscdk.AwsCdkPythonApp, projen.awscdk.AwsCdkTypeScriptApp, projen.awscdk.CdkConfig, projen.awscdk.CdkTasks, projen.awscdk.ConstructLibraryAws, projen.awscdk.EdgeLambdaAutoDiscover, projen.awscdk.IntegrationTest, projen.awscdk.IntegrationTestAutoDiscover, projen.awscdk.LambdaAutoDiscover, projen.awscdk.LambdaExtension, projen.awscdk.LambdaExtensionAutoDiscover, projen.awscdk.LambdaFunction, projen.build.BuildWorkflow, projen.cdk.AutoDiscoverBase, projen.cdk.ConstructLibrary, projen.cdk.IntegrationTestAutoDiscoverBase, projen.cdk.IntegrationTestBase, projen.cdk.JsiiDocgen, projen.cdk.JsiiProject, projen.cdk8s.AutoDiscover, projen.cdk8s.Cdk8sDeps, projen.cdk8s.Cdk8sDepsPy, projen.cdk8s.Cdk8sPythonApp, projen.cdk8s.Cdk8sTypeScriptApp, projen.cdk8s.ConstructLibraryCdk8s, projen.cdk8s.IntegrationTest, projen.cdk8s.IntegrationTestAutoDiscover, projen.cdktf.ConstructLibraryCdktf, projen.circleci.Circleci, projen.github.AutoApprove, projen.github.AutoMerge, projen.github.Dependabot, projen.github.GitHub, projen.github.GitHubProject, projen.github.GithubWorkflow, projen.github.Mergify, projen.github.PullRequestBackport, projen.github.PullRequestLint, projen.github.PullRequestTemplate, projen.github.Stale, projen.github.TaskWorkflow, projen.github.TaskWorkflowJob, projen.gitlab.CiConfiguration, projen.gitlab.GitlabConfiguration, projen.gitlab.NestedConfiguration, projen.java.JavaProject, projen.java.Junit, projen.java.MavenCompile, projen.java.MavenPackaging, projen.java.MavenSample, projen.java.Pom, projen.java.Projenrc, projen.javascript.Bundler, projen.javascript.Eslint, projen.javascript.Jest, projen.javascript.LicenseChecker, projen.javascript.NodePackage, projen.javascript.NodeProject, projen.javascript.NpmConfig, projen.javascript.Prettier, projen.javascript.Projenrc, projen.javascript.TypescriptConfig, projen.javascript.UpgradeDependencies, projen.javascript.Yarnrc, projen.python.Pip, projen.python.Poetry, projen.python.PoetryPyproject, projen.python.Projenrc, projen.python.Pytest, projen.python.PytestSample, projen.python.PythonProject, projen.python.PythonSample, projen.python.RequirementsFile, projen.python.SetupPy, projen.python.Setuptools, projen.python.Venv, projen.release.Publisher, projen.release.Release, projen.typescript.Projenrc, projen.typescript.ProjenrcTs, projen.typescript.TypeScriptAppProject, projen.typescript.TypeScriptLibraryProject, projen.typescript.TypeScriptProject, projen.vscode.DevContainer, projen.vscode.VsCode, projen.vscode.VsCodeLaunchConfig, projen.vscode.VsCodeRecommendedExtensions, projen.vscode.VsCodeSettings, projen.web.NextComponent, projen.web.NextJsProject, projen.web.NextJsTypeScriptProject, projen.web.ReactComponent, projen.web.ReactProject, projen.web.ReactTypeDef, projen.web.ReactTypeScriptProject, projen.Component, projen.Dependencies, projen.DockerCompose, projen.FileBase, projen.GitAttributesFile, projen.Gitpod, projen.IgnoreFile, projen.IniFile, projen.JsonFile, projen.License, projen.Logger, projen.Makefile, projen.ObjectFile, projen.Project, projen.ProjectBuild, projen.ProjectTree, projen.Projenrc, projen.ProjenrcFile, projen.ProjenrcJson, projen.Renovatebot, projen.SampleDir, projen.SampleFile, projen.SampleReadme, projen.SourceCode, projen.Tasks, projen.TextFile, projen.TomlFile, projen.Version, projen.XmlFile, projen.YamlFile, <a href="#constructs.IConstruct">IConstruct</a>
|
1066 |
|
1067 | Represents a construct.
|
1068 |
|
1069 |
|
1070 | #### Properties <a name="Properties" id="Properties"></a>
|
1071 |
|
1072 | | **Name** | **Type** | **Description** |
|
1073 | | --- | --- | --- |
|
1074 | | <code><a href="#constructs.IConstruct.property.node">node</a></code> | <code><a href="#constructs.Node">Node</a></code> | The tree node. |
|
1075 |
|
1076 | ---
|
1077 |
|
1078 | ##### `node`<sup>Required</sup> <a name="node" id="constructs.IConstruct.property.node"></a>
|
1079 |
|
1080 | ```typescript
|
1081 | public readonly node: Node;
|
1082 | ```
|
1083 |
|
1084 | - *Type:* <a href="#constructs.Node">Node</a>
|
1085 |
|
1086 | The tree node.
|
1087 |
|
1088 | ---
|
1089 |
|
1090 | ### IDependable <a name="IDependable" id="constructs.IDependable"></a>
|
1091 |
|
1092 | - *Implemented By:* <a href="#constructs.Construct">Construct</a>, <a href="#constructs.DependencyGroup">DependencyGroup</a>, <a href="#constructs.RootConstruct">RootConstruct</a>, cdklabs-projen-project-types.yarn.CdkLabsMonorepo, cdklabs-projen-project-types.yarn.Monorepo, cdklabs-projen-project-types.yarn.MonorepoRelease, cdklabs-projen-project-types.yarn.TypeScriptWorkspace, cdklabs-projen-project-types.yarn.WorkspaceRelease, cdklabs-projen-project-types.AutoMerge, cdklabs-projen-project-types.CdkConstructLibrary, cdklabs-projen-project-types.CdkJsiiProject, cdklabs-projen-project-types.CdkTypeScriptProject, cdklabs-projen-project-types.CdklabsConstructLibrary, cdklabs-projen-project-types.CdklabsJsiiProject, cdklabs-projen-project-types.CdklabsTypeScriptProject, cdklabs-projen-project-types.MergeQueue, cdklabs-projen-project-types.Rosetta, projen.awscdk.AutoDiscover, projen.awscdk.AwsCdkConstructLibrary, projen.awscdk.AwsCdkDeps, projen.awscdk.AwsCdkDepsJava, projen.awscdk.AwsCdkDepsJs, projen.awscdk.AwsCdkDepsPy, projen.awscdk.AwsCdkJavaApp, projen.awscdk.AwsCdkPythonApp, projen.awscdk.AwsCdkTypeScriptApp, projen.awscdk.CdkConfig, projen.awscdk.CdkTasks, projen.awscdk.ConstructLibraryAws, projen.awscdk.EdgeLambdaAutoDiscover, projen.awscdk.IntegrationTest, projen.awscdk.IntegrationTestAutoDiscover, projen.awscdk.LambdaAutoDiscover, projen.awscdk.LambdaExtension, projen.awscdk.LambdaExtensionAutoDiscover, projen.awscdk.LambdaFunction, projen.build.BuildWorkflow, projen.cdk.AutoDiscoverBase, projen.cdk.ConstructLibrary, projen.cdk.IntegrationTestAutoDiscoverBase, projen.cdk.IntegrationTestBase, projen.cdk.JsiiDocgen, projen.cdk.JsiiProject, projen.cdk8s.AutoDiscover, projen.cdk8s.Cdk8sDeps, projen.cdk8s.Cdk8sDepsPy, projen.cdk8s.Cdk8sPythonApp, projen.cdk8s.Cdk8sTypeScriptApp, projen.cdk8s.ConstructLibraryCdk8s, projen.cdk8s.IntegrationTest, projen.cdk8s.IntegrationTestAutoDiscover, projen.cdktf.ConstructLibraryCdktf, projen.circleci.Circleci, projen.github.AutoApprove, projen.github.AutoMerge, projen.github.Dependabot, projen.github.GitHub, projen.github.GitHubProject, projen.github.GithubWorkflow, projen.github.Mergify, projen.github.PullRequestBackport, projen.github.PullRequestLint, projen.github.PullRequestTemplate, projen.github.Stale, projen.github.TaskWorkflow, projen.github.TaskWorkflowJob, projen.gitlab.CiConfiguration, projen.gitlab.GitlabConfiguration, projen.gitlab.NestedConfiguration, projen.java.JavaProject, projen.java.Junit, projen.java.MavenCompile, projen.java.MavenPackaging, projen.java.MavenSample, projen.java.Pom, projen.java.Projenrc, projen.javascript.Bundler, projen.javascript.Eslint, projen.javascript.Jest, projen.javascript.LicenseChecker, projen.javascript.NodePackage, projen.javascript.NodeProject, projen.javascript.NpmConfig, projen.javascript.Prettier, projen.javascript.Projenrc, projen.javascript.TypescriptConfig, projen.javascript.UpgradeDependencies, projen.javascript.Yarnrc, projen.python.Pip, projen.python.Poetry, projen.python.PoetryPyproject, projen.python.Projenrc, projen.python.Pytest, projen.python.PytestSample, projen.python.PythonProject, projen.python.PythonSample, projen.python.RequirementsFile, projen.python.SetupPy, projen.python.Setuptools, projen.python.Venv, projen.release.Publisher, projen.release.Release, projen.typescript.Projenrc, projen.typescript.ProjenrcTs, projen.typescript.TypeScriptAppProject, projen.typescript.TypeScriptLibraryProject, projen.typescript.TypeScriptProject, projen.vscode.DevContainer, projen.vscode.VsCode, projen.vscode.VsCodeLaunchConfig, projen.vscode.VsCodeRecommendedExtensions, projen.vscode.VsCodeSettings, projen.web.NextComponent, projen.web.NextJsProject, projen.web.NextJsTypeScriptProject, projen.web.ReactComponent, projen.web.ReactProject, projen.web.ReactTypeDef, projen.web.ReactTypeScriptProject, projen.Component, projen.Dependencies, projen.DockerCompose, projen.FileBase, projen.GitAttributesFile, projen.Gitpod, projen.IgnoreFile, projen.IniFile, projen.JsonFile, projen.License, projen.Logger, projen.Makefile, projen.ObjectFile, projen.Project, projen.ProjectBuild, projen.ProjectTree, projen.Projenrc, projen.ProjenrcFile, projen.ProjenrcJson, projen.Renovatebot, projen.SampleDir, projen.SampleFile, projen.SampleReadme, projen.SourceCode, projen.Tasks, projen.TextFile, projen.TomlFile, projen.Version, projen.XmlFile, projen.YamlFile, <a href="#constructs.IConstruct">IConstruct</a>, <a href="#constructs.IDependable">IDependable</a>
|
1093 |
|
1094 | Trait marker for classes that can be depended upon.
|
1095 |
|
1096 | The presence of this interface indicates that an object has
|
1097 | an `IDependable` implementation.
|
1098 |
|
1099 | This interface can be used to take an (ordering) dependency on a set of
|
1100 | constructs. An ordering dependency implies that the resources represented by
|
1101 | those constructs are deployed before the resources depending ON them are
|
1102 | deployed.
|
1103 |
|
1104 |
|
1105 |
|
1106 | ### IValidation <a name="IValidation" id="constructs.IValidation"></a>
|
1107 |
|
1108 | - *Implemented By:* <a href="#constructs.IValidation">IValidation</a>
|
1109 |
|
1110 | Implement this interface in order for the construct to be able to validate itself.
|
1111 |
|
1112 | #### Methods <a name="Methods" id="Methods"></a>
|
1113 |
|
1114 | | **Name** | **Description** |
|
1115 | | --- | --- |
|
1116 | | <code><a href="#constructs.IValidation.validate">validate</a></code> | Validate the current construct. |
|
1117 |
|
1118 | ---
|
1119 |
|
1120 | ##### `validate` <a name="validate" id="constructs.IValidation.validate"></a>
|
1121 |
|
1122 | ```typescript
|
1123 | public validate(): string[]
|
1124 | ```
|
1125 |
|
1126 | Validate the current construct.
|
1127 |
|
1128 | This method can be implemented by derived constructs in order to perform
|
1129 | validation logic. It is called on all constructs before synthesis.
|
1130 |
|
1131 |
|
1132 | ## Enums <a name="Enums" id="Enums"></a>
|
1133 |
|
1134 | ### ConstructOrder <a name="ConstructOrder" id="constructs.ConstructOrder"></a>
|
1135 |
|
1136 | In what order to return constructs.
|
1137 |
|
1138 | #### Members <a name="Members" id="Members"></a>
|
1139 |
|
1140 | | **Name** | **Description** |
|
1141 | | --- | --- |
|
1142 | | <code><a href="#constructs.ConstructOrder.PREORDER">PREORDER</a></code> | Depth-first, pre-order. |
|
1143 | | <code><a href="#constructs.ConstructOrder.POSTORDER">POSTORDER</a></code> | Depth-first, post-order (leaf nodes first). |
|
1144 |
|
1145 | ---
|
1146 |
|
1147 | ##### `PREORDER` <a name="PREORDER" id="constructs.ConstructOrder.PREORDER"></a>
|
1148 |
|
1149 | Depth-first, pre-order.
|
1150 |
|
1151 | ---
|
1152 |
|
1153 |
|
1154 | ##### `POSTORDER` <a name="POSTORDER" id="constructs.ConstructOrder.POSTORDER"></a>
|
1155 |
|
1156 | Depth-first, post-order (leaf nodes first).
|
1157 |
|
1158 | ---
|
1159 |
|