Skip to content

ConstructNode

Represents the construct node in the scope tree.

Initializers

using AlibabaCloud.SDK.ROS.CDK.Core;
new ConstructNode(Construct Host, IConstruct Scope, string Id);
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

private void AddDependency(IDependable Dependencies)

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

private void AddError(string Message)

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

The toolkit will fail synthesis when errors are reported.

MessageRequired

  • Type: string

The error message.


AddInfo

private void AddInfo(string Message)

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

private void AddMetadata(string Type, object Data, object FromFunction = null)

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: object

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

If null/undefined, metadata will not be added.


FromFunctionOptional

  • Type: object

a function under which to restrict the metadata entry's stack trace (defaults to this.addMetadata).


AddWarning

private void AddWarning(string Message)

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

private IConstruct[] FindAll(ConstructOrder Order = null)

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

OrderOptional


FindChild

private IConstruct FindChild(string Id)

Return a direct child by id.

Throws an error if the child is not found.

IdRequired

  • Type: string

Identifier of direct child.


SetContext

private void SetContext(string Key, object Value)

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: object

The context value.


TryFindChild

private IConstruct TryFindChild(string Id)

Return a direct child by id, or undefined.

IdRequired

  • Type: string

Identifier of direct child.


TryGetContext

private object TryGetContext(string Key)

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

private bool TryRemoveChild(string ChildName)

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~~

using AlibabaCloud.SDK.ROS.CDK.Core;
ConstructNode.Prepare(ConstructNode Node);

Invokes "prepare" on all constructs (depth-first, post-order) in the tree under node.

NodeRequired

The root node.


~~Synth~~

using AlibabaCloud.SDK.ROS.CDK.Core;
ConstructNode.Synth(ConstructNode Node, SynthesisOptions Options = null);

Synthesizes a CloudAssembly from a construct tree.

NodeRequired

The root of the construct tree.


OptionsOptional

Synthesis options.


Validate

using AlibabaCloud.SDK.ROS.CDK.Core;
ConstructNode.Validate(ConstructNode Node);

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 AlibabaCloud.SDK.ROS.CDK.Cxapi.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

public IConstruct[] Children { get; }

All direct children of this construct.


DependenciesRequired

public Dependency[] Dependencies { get; }

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


IdRequired

public string Id { get; }
  • 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

public bool Locked { get; }
  • Type: bool

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


MetadataRequired

public MetadataEntry[] Metadata { get; }
  • Type: AlibabaCloud.SDK.ROS.CDK.Cxapi.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

public string Path { get; }
  • Type: string

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

Components are separated by '/'.


RootRequired

public IConstruct Root { get; }

ScopesRequired

public IConstruct[] Scopes { get; }

All parent scopes of this construct.


UniqueIdRequired

public string UniqueId { get; }
  • Type: string

A tree-global unique alphanumeric identifier for this construct.

Includes all components of the tree.


ScopeOptional

public IConstruct Scope { get; }

Returns the scope in which this construct is defined.

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


DefaultChildOptional

public IConstruct DefaultChild { get; }

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

public string PathSep { get; }
  • Type: string

Separator used to delimit construct path components.