Skip to content

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.

hostRequired


scopeRequired


idRequired

  • Type: *string

Methods

Name Description
AddDependency Add an ordering dependency on another Construct.
AddError Adds an { "error": } metadata entry to this construct.
AddInfo Adds a { "info": } metadata entry to this construct.
AddMetadata Adds a metadata entry to this construct.
AddWarning Adds a { "warning": } metadata entry to this construct.
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.

dependenciesRequired


AddError

func AddError(message *string)

Adds an { "error": } metadata entry to this construct.

The toolkit will fail synthesis when errors are reported.

messageRequired

  • Type: *string

The error message.


AddInfo

func AddInfo(message *string)

Adds a { "info": } metadata entry to this construct.

The toolkit will display the info message when apps are synthesized.

messageRequired

  • 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.

typeRequired

  • Type: *string

a string denoting the type of metadata.


dataRequired

  • Type: interface{}

the value of the metadata (can be a Token).

If null/undefined, metadata will not be added.


fromFunctionOptional

  • 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": } metadata entry to this construct.

The toolkit will display the warning when an app is synthesized, or fail if run in --strict mode.

messageRequired

  • Type: *string

The warning message.


FindAll

func FindAll(order ConstructOrder) *[]IConstruct

Return this construct and all of its children in the given order.

orderOptional


FindChild

func FindChild(id *string) IConstruct

Return a direct child by id.

Throws an error if the child is not found.

idRequired

  • 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.

keyRequired

  • Type: *string

The context key.


valueRequired

  • Type: interface{}

The context value.


TryFindChild

func TryFindChild(id *string) IConstruct

Return a direct child by id, or undefined.

idRequired

  • 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.

keyRequired

  • Type: *string

The context key.


TryRemoveChild

func TryRemoveChild(childName *string) *bool

Remove the child with the given name, if present.

childNameRequired

  • 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.

nodeRequired

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.

nodeRequired

The root of the construct tree.


optionsOptional

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.

nodeRequired

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".

ChildrenRequired

func Children() *[]IConstruct

All direct children of this construct.


DependenciesRequired

func Dependencies() *[]Dependency

Return all dependencies registered on this node or any of its children.


IdRequired

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.


LockedRequired

func Locked() *bool
  • Type: *bool

Returns true if this construct or the scopes in which it is defined are locked.


MetadataRequired

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.


PathRequired

func Path() *string
  • Type: *string

The full, absolute path of this construct in the tree.

Components are separated by '/'.


RootRequired

func Root() IConstruct

ScopesRequired

func Scopes() *[]IConstruct

All parent scopes of this construct.


UniqueIdRequired

func UniqueId() *string
  • Type: *string

A tree-global unique alphanumeric identifier for this construct.

Includes all components of the tree.


ScopeOptional

func Scope() IConstruct

Returns the scope in which this construct is defined.

The value is undefined at the root of the construct scope tree.


DefaultChildOptional

func DefaultChild() 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.

PathSepRequired

func PathSep() *string
  • Type: *string

Separator used to delimit construct path components.