ConstructNode
Represents the construct node in the scope tree.
Initializers
import "github.com/alibabacloud-go/ros-cdk/alicloudroscdkcore"
alicloudroscdkcore.NewConstructNode(host Construct, scope IConstruct, id *string) ConstructNode
Name | Type | Description |
---|---|---|
host |
Construct |
No description. |
scope |
IConstruct |
No description. |
id |
*string |
No description. |
host
Required
- Type: Construct
scope
Required
- Type: IConstruct
id
Required
- Type: *string
Methods
Name | Description |
---|---|
AddDependency |
Add an ordering dependency on another Construct. |
AddError |
Adds an { "error": |
AddInfo |
Adds a { "info": |
AddMetadata |
Adds a metadata entry to this construct. |
AddWarning |
Adds a { "warning": |
FindAll |
Return this construct and all of its children in the given order. |
FindChild |
Return a direct child by id. |
SetContext |
This can be used to set contextual values. |
TryFindChild |
Return a direct child by id, or undefined. |
TryGetContext |
Retrieves a value from tree context. |
TryRemoveChild |
Remove the child with the given name, if present. |
AddDependency
func AddDependency(dependencies IDependable)
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.
- Type: IDependable
AddError
func AddError(message *string)
Adds an { "error":
The toolkit will fail synthesis when errors are reported.
- Type: *string
The error message.
AddInfo
func AddInfo(message *string)
Adds a { "info":
The toolkit will display the info message when apps are synthesized.
- Type: *string
The info message.
AddMetadata
func AddMetadata(type *string, data interface{}, fromFunction interface{})
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 templates to improve diagnostics.
- Type: *string
a string denoting the type of metadata.
- Type: interface{}
the value of the metadata (can be a Token).
If null/undefined, metadata will not be added.
- Type: interface{}
a function under which to restrict the metadata entry's stack trace (defaults to this.addMetadata).
AddWarning
func AddWarning(message *string)
Adds a { "warning":
The toolkit will display the warning when an app is synthesized, or fail if run in --strict mode.
- Type: *string
The warning message.
FindAll
func FindAll(order ConstructOrder) *[]IConstruct
Return this construct and all of its children in the given order.
- Type: ConstructOrder
FindChild
func FindChild(id *string) IConstruct
Return a direct child by id.
Throws an error if the child is not found.
- Type: *string
Identifier of direct child.
SetContext
func SetContext(key *string, value interface{})
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.
- Type: *string
The context key.
- Type: interface{}
The context value.
TryFindChild
func TryFindChild(id *string) IConstruct
Return a direct child by id, or undefined.
- Type: *string
Identifier of direct child.
TryGetContext
func TryGetContext(key *string) interface{}
Retrieves a value from tree context.
Context is usually initialized at the root, but can be overridden at any point in the tree.
- Type: *string
The context key.
TryRemoveChild
func TryRemoveChild(childName *string) *bool
Remove the child with the given name, if present.
- Type: *string
Static Functions
Name | Description |
---|---|
Prepare |
Invokes "prepare" on all constructs (depth-first, post-order) in the tree under node . |
Synth |
Synthesizes a CloudAssembly from a construct tree. |
Validate |
Invokes "validate" on all constructs in the tree (depth-first, pre-order) and returns the list of all errors. |
~~Prepare
~~
import "github.com/alibabacloud-go/ros-cdk/alicloudroscdkcore"
alicloudroscdkcore.ConstructNode_Prepare(node ConstructNode)
Invokes "prepare" on all constructs (depth-first, post-order) in the tree under node
.
- Type: ConstructNode
The root node.
~~Synth
~~
import "github.com/alibabacloud-go/ros-cdk/alicloudroscdkcore"
alicloudroscdkcore.ConstructNode_Synth(node ConstructNode, options SynthesisOptions) CloudAssembly
Synthesizes a CloudAssembly from a construct tree.
- Type: ConstructNode
The root of the construct tree.
- Type: SynthesisOptions
Synthesis options.
Validate
import "github.com/alibabacloud-go/ros-cdk/alicloudroscdkcore"
alicloudroscdkcore.ConstructNode_Validate(node ConstructNode) *[]ValidationError
Invokes "validate" on all constructs in the tree (depth-first, pre-order) and returns the list of all errors.
An empty list indicates that there are no errors.
- Type: ConstructNode
The root node.
Properties
Name | Type | Description |
---|---|---|
Children |
*[]IConstruct |
All direct children of this construct. |
Dependencies |
*[]Dependency |
Return all dependencies registered on this node or any of its children. |
Id |
*string |
The id of this construct within the current scope. |
Locked |
*bool |
Returns true if this construct or the scopes in which it is defined are locked. |
Metadata |
*[]github.com/alibabacloud-go/ros-cdk/alicloudroscdkcxapi.MetadataEntry |
An immutable array of metadata objects associated with this construct. |
Path |
*string |
The full, absolute path of this construct in the tree. |
Root |
IConstruct |
No description. |
Scopes |
*[]IConstruct |
All parent scopes of this construct. |
UniqueId |
*string |
A tree-global unique alphanumeric identifier for this construct. |
Scope |
IConstruct |
Returns the scope in which this construct is defined. |
DefaultChild |
IConstruct |
Returns the child construct that has the id Default or Resource" . |
Children
Required
func Children() *[]IConstruct
- Type: *[]IConstruct
All direct children of this construct.
Dependencies
Required
func Dependencies() *[]Dependency
- Type: *[]Dependency
Return all dependencies registered on this node or any of its children.
Id
Required
func Id() *string
- Type: *string
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
.
Locked
Required
func Locked() *bool
- Type: *bool
Returns true if this construct or the scopes in which it is defined are locked.
Metadata
Required
func Metadata() *[]MetadataEntry
- Type: *[]github.com/alibabacloud-go/ros-cdk/alicloudroscdkcxapi.MetadataEntry
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.
Path
Required
func Path() *string
- Type: *string
The full, absolute path of this construct in the tree.
Components are separated by '/'.
Root
Required
func Root() IConstruct
- Type: IConstruct
Scopes
Required
func Scopes() *[]IConstruct
- Type: *[]IConstruct
All parent scopes of this construct.
UniqueId
Required
func UniqueId() *string
- Type: *string
A tree-global unique alphanumeric identifier for this construct.
Includes all components of the tree.
Scope
Optional
func Scope() IConstruct
- Type: IConstruct
Returns the scope in which this construct is defined.
The value is undefined
at the root of the construct scope tree.
DefaultChild
Optional
func DefaultChild() IConstruct
- Type: 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.
Constants
Name | Type | Description |
---|---|---|
PathSep |
*string |
Separator used to delimit construct path components. |
PathSep
Required
func PathSep() *string
- Type: *string
Separator used to delimit construct path components.