-
Notifications
You must be signed in to change notification settings - Fork 8
/
Node.go
541 lines (483 loc) · 12.1 KB
/
Node.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
// A programming model for composable configuration
package constructs
import (
_init_ "github.com/aws/constructs-go/constructs/v3/jsii"
_jsii_ "github.com/aws/jsii-runtime-go/runtime"
)
// Represents the construct node in the scope tree.
type Node interface {
// Returns an opaque tree-unique address for this construct.
//
// Addresses are 42 characters hexadecimal strings. They begin with "c8"
// followed by 40 lowercase hexadecimal characters (0-9a-f).
//
// Addresses are calculated using a SHA-1 of the components of the construct
// path.
//
// To enable refactorings of construct trees, constructs with the ID `Default`
// will be excluded from the calculation. In those cases constructs in the
// same tree may have the same addreess.
//
// Example:
// c83a2846e506bcc5f10682b564084bca2d275709ee
//
Addr() *string
// All direct children of this construct.
Children() *[]IConstruct
// Returns the child construct that has the id `Default` or `Resource"`.
//
// This is usually the construct that provides the bulk of the underlying functionality.
// Useful for modifications of the underlying construct that are not available at the higher levels.
// Override the defaultChild property.
//
// This should only be used in the cases where the correct
// default child is not named 'Resource' or 'Default' as it
// should be.
//
// If you set this to undefined, the default behavior of finding
// the child named 'Resource' or 'Default' will be used.
//
// Returns: a construct or undefined if there is no default child.
DefaultChild() IConstruct
SetDefaultChild(val IConstruct)
// Return all dependencies registered on this node or any of its children.
Dependencies() *[]*Dependency
// The id of this construct within the current scope.
//
// This is a a scope-unique id. To obtain an app-unique id for this construct, use `uniqueId`.
Id() *string
// Returns true if this construct or the scopes in which it is defined are locked.
Locked() *bool
// An immutable array of metadata objects associated with this construct.
//
// This can be used, for example, to implement support for deprecation notices, source mapping, etc.
Metadata() *[]*MetadataEntry
// The full, absolute path of this construct in the tree.
//
// Components are separated by '/'.
Path() *string
// Returns the root of the construct tree.
//
// Returns: The root of the construct tree.
Root() IConstruct
// Returns the scope in which this construct is defined.
//
// The value is `undefined` at the root of the construct scope tree.
Scope() IConstruct
// All parent scopes of this construct.
//
// Returns: a list of parent scopes. The last element in the list will always
// be the current construct and the first element will be the root of the
// tree.
Scopes() *[]IConstruct
// A tree-global unique alphanumeric identifier for this construct.
//
// Includes
// all components of the tree.
// Deprecated: please avoid using this property and use `addr` to form unique names.
// This algorithm uses MD5, which is not FIPS-complient and also excludes the
// identity of the root construct from the calculation.
UniqueId() *string
// Add an ordering dependency on another Construct.
//
// All constructs in the dependency's scope will be deployed before any
// construct in this construct's scope.
AddDependency(dependencies ...IConstruct)
// Adds an { "error": <message> } metadata entry to this construct.
//
// The toolkit will fail synthesis when errors are reported.
AddError(message *string)
// Adds a { "info": <message> } metadata entry to this construct.
//
// The toolkit will display the info message when apps are synthesized.
AddInfo(message *string)
// Adds a metadata entry to this construct.
//
// Entries are arbitrary values and will also include a stack trace to allow tracing back to
// the code location for when the entry was added. It can be used, for example, to include source
// mapping in CloudFormation templates to improve diagnostics.
AddMetadata(type_ *string, data interface{}, fromFunction interface{})
// Adds a validation to this construct.
//
// When `node.validate()` is called, the `validate()` method will be called on
// all validations and all errors will be returned.
AddValidation(validation IValidation)
// Adds a { "warning": <message> } metadata entry to this construct.
//
// The toolkit will display the warning when an app is synthesized, or fail
// if run in --strict mode.
AddWarning(message *string)
// Applies the aspect to this Constructs node.
ApplyAspect(aspect IAspect)
// Return this construct and all of its children in the given order.
FindAll(order ConstructOrder) *[]IConstruct
// Return a direct child by id.
//
// Throws an error if the child is not found.
//
// Returns: Child with the given id.
FindChild(id *string) IConstruct
// Invokes "prepare" on all constructs (depth-first, post-order) in the tree under `node`.
Prepare()
// This can be used to set contextual values.
//
// Context must be set before any children are added, since children may consult context info during construction.
// If the key already exists, it will be overridden.
SetContext(key *string, value interface{})
// Synthesizes a CloudAssembly from a construct tree.
Synthesize(options *SynthesisOptions)
// Return a direct child by id, or undefined.
//
// Returns: the child if found, or undefined.
TryFindChild(id *string) IConstruct
// Retrieves a value from tree context.
//
// Context is usually initialized at the root, but can be overridden at any point in the tree.
//
// Returns: The context value or `undefined` if there is no context value for thie key.
TryGetContext(key *string) interface{}
// Remove the child with the given name, if present.
//
// Returns: Whether a child with the given name was deleted.
// Experimental.
TryRemoveChild(childName *string) *bool
// Validates tree (depth-first, pre-order) and returns the list of all errors.
//
// An empty list indicates that there are no errors.
Validate() *[]*ValidationError
}
// The jsii proxy struct for Node
type jsiiProxy_Node struct {
_ byte // padding
}
func (j *jsiiProxy_Node) Addr() *string {
var returns *string
_jsii_.Get(
j,
"addr",
&returns,
)
return returns
}
func (j *jsiiProxy_Node) Children() *[]IConstruct {
var returns *[]IConstruct
_jsii_.Get(
j,
"children",
&returns,
)
return returns
}
func (j *jsiiProxy_Node) DefaultChild() IConstruct {
var returns IConstruct
_jsii_.Get(
j,
"defaultChild",
&returns,
)
return returns
}
func (j *jsiiProxy_Node) Dependencies() *[]*Dependency {
var returns *[]*Dependency
_jsii_.Get(
j,
"dependencies",
&returns,
)
return returns
}
func (j *jsiiProxy_Node) Id() *string {
var returns *string
_jsii_.Get(
j,
"id",
&returns,
)
return returns
}
func (j *jsiiProxy_Node) Locked() *bool {
var returns *bool
_jsii_.Get(
j,
"locked",
&returns,
)
return returns
}
func (j *jsiiProxy_Node) Metadata() *[]*MetadataEntry {
var returns *[]*MetadataEntry
_jsii_.Get(
j,
"metadata",
&returns,
)
return returns
}
func (j *jsiiProxy_Node) Path() *string {
var returns *string
_jsii_.Get(
j,
"path",
&returns,
)
return returns
}
func (j *jsiiProxy_Node) Root() IConstruct {
var returns IConstruct
_jsii_.Get(
j,
"root",
&returns,
)
return returns
}
func (j *jsiiProxy_Node) Scope() IConstruct {
var returns IConstruct
_jsii_.Get(
j,
"scope",
&returns,
)
return returns
}
func (j *jsiiProxy_Node) Scopes() *[]IConstruct {
var returns *[]IConstruct
_jsii_.Get(
j,
"scopes",
&returns,
)
return returns
}
func (j *jsiiProxy_Node) UniqueId() *string {
var returns *string
_jsii_.Get(
j,
"uniqueId",
&returns,
)
return returns
}
func NewNode(host Construct, scope IConstruct, id *string) Node {
_init_.Initialize()
if err := validateNewNodeParameters(host, scope, id); err != nil {
panic(err)
}
j := jsiiProxy_Node{}
_jsii_.Create(
"constructs.Node",
[]interface{}{host, scope, id},
&j,
)
return &j
}
func NewNode_Override(n Node, host Construct, scope IConstruct, id *string) {
_init_.Initialize()
_jsii_.Create(
"constructs.Node",
[]interface{}{host, scope, id},
n,
)
}
func (j *jsiiProxy_Node)SetDefaultChild(val IConstruct) {
_jsii_.Set(
j,
"defaultChild",
val,
)
}
// Returns the node associated with a construct.
func Node_Of(construct IConstruct) Node {
_init_.Initialize()
if err := validateNode_OfParameters(construct); err != nil {
panic(err)
}
var returns Node
_jsii_.StaticInvoke(
"constructs.Node",
"of",
[]interface{}{construct},
&returns,
)
return returns
}
func Node_PATH_SEP() *string {
_init_.Initialize()
var returns *string
_jsii_.StaticGet(
"constructs.Node",
"PATH_SEP",
&returns,
)
return returns
}
func (n *jsiiProxy_Node) AddDependency(dependencies ...IConstruct) {
args := []interface{}{}
for _, a := range dependencies {
args = append(args, a)
}
_jsii_.InvokeVoid(
n,
"addDependency",
args,
)
}
func (n *jsiiProxy_Node) AddError(message *string) {
if err := n.validateAddErrorParameters(message); err != nil {
panic(err)
}
_jsii_.InvokeVoid(
n,
"addError",
[]interface{}{message},
)
}
func (n *jsiiProxy_Node) AddInfo(message *string) {
if err := n.validateAddInfoParameters(message); err != nil {
panic(err)
}
_jsii_.InvokeVoid(
n,
"addInfo",
[]interface{}{message},
)
}
func (n *jsiiProxy_Node) AddMetadata(type_ *string, data interface{}, fromFunction interface{}) {
if err := n.validateAddMetadataParameters(type_, data); err != nil {
panic(err)
}
_jsii_.InvokeVoid(
n,
"addMetadata",
[]interface{}{type_, data, fromFunction},
)
}
func (n *jsiiProxy_Node) AddValidation(validation IValidation) {
if err := n.validateAddValidationParameters(validation); err != nil {
panic(err)
}
_jsii_.InvokeVoid(
n,
"addValidation",
[]interface{}{validation},
)
}
func (n *jsiiProxy_Node) AddWarning(message *string) {
if err := n.validateAddWarningParameters(message); err != nil {
panic(err)
}
_jsii_.InvokeVoid(
n,
"addWarning",
[]interface{}{message},
)
}
func (n *jsiiProxy_Node) ApplyAspect(aspect IAspect) {
if err := n.validateApplyAspectParameters(aspect); err != nil {
panic(err)
}
_jsii_.InvokeVoid(
n,
"applyAspect",
[]interface{}{aspect},
)
}
func (n *jsiiProxy_Node) FindAll(order ConstructOrder) *[]IConstruct {
var returns *[]IConstruct
_jsii_.Invoke(
n,
"findAll",
[]interface{}{order},
&returns,
)
return returns
}
func (n *jsiiProxy_Node) FindChild(id *string) IConstruct {
if err := n.validateFindChildParameters(id); err != nil {
panic(err)
}
var returns IConstruct
_jsii_.Invoke(
n,
"findChild",
[]interface{}{id},
&returns,
)
return returns
}
func (n *jsiiProxy_Node) Prepare() {
_jsii_.InvokeVoid(
n,
"prepare",
nil, // no parameters
)
}
func (n *jsiiProxy_Node) SetContext(key *string, value interface{}) {
if err := n.validateSetContextParameters(key, value); err != nil {
panic(err)
}
_jsii_.InvokeVoid(
n,
"setContext",
[]interface{}{key, value},
)
}
func (n *jsiiProxy_Node) Synthesize(options *SynthesisOptions) {
if err := n.validateSynthesizeParameters(options); err != nil {
panic(err)
}
_jsii_.InvokeVoid(
n,
"synthesize",
[]interface{}{options},
)
}
func (n *jsiiProxy_Node) TryFindChild(id *string) IConstruct {
if err := n.validateTryFindChildParameters(id); err != nil {
panic(err)
}
var returns IConstruct
_jsii_.Invoke(
n,
"tryFindChild",
[]interface{}{id},
&returns,
)
return returns
}
func (n *jsiiProxy_Node) TryGetContext(key *string) interface{} {
if err := n.validateTryGetContextParameters(key); err != nil {
panic(err)
}
var returns interface{}
_jsii_.Invoke(
n,
"tryGetContext",
[]interface{}{key},
&returns,
)
return returns
}
func (n *jsiiProxy_Node) TryRemoveChild(childName *string) *bool {
if err := n.validateTryRemoveChildParameters(childName); err != nil {
panic(err)
}
var returns *bool
_jsii_.Invoke(
n,
"tryRemoveChild",
[]interface{}{childName},
&returns,
)
return returns
}
func (n *jsiiProxy_Node) Validate() *[]*ValidationError {
var returns *[]*ValidationError
_jsii_.Invoke(
n,
"validate",
nil, // no parameters
&returns,
)
return returns
}