Skip to content

ConstructNode

Represents the construct node in the scope tree.

Initializers

import ros_cdk_core
ros_cdk_core.ConstructNode(
  host: Construct,
  scope: IConstruct,
  id: str
)
Name Type Description
host Construct No description.
scope IConstruct No description.
id str No description.

hostRequired


scopeRequired


idRequired

  • Type: str

Methods

Name Description
add_dependency Add an ordering dependency on another Construct.
add_error Adds an { "error": } metadata entry to this construct.
add_info Adds a { "info": } metadata entry to this construct.
add_metadata Adds a metadata entry to this construct.
add_warning Adds a { "warning": } metadata entry to this construct.
find_all Return this construct and all of its children in the given order.
find_child Return a direct child by id.
set_context This can be used to set contextual values.
try_find_child Return a direct child by id, or undefined.
try_get_context Retrieves a value from tree context.
try_remove_child Remove the child with the given name, if present.

add_dependency

def add_dependency(
  dependencies: IDependable
) -> None

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


add_error

def add_error(
  message: str
) -> None

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

The toolkit will fail synthesis when errors are reported.

messageRequired

  • Type: str

The error message.


add_info

def add_info(
  message: str
) -> None

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

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

messageRequired

  • Type: str

The info message.


add_metadata

def add_metadata(
  type: str,
  data: typing.Any,
  from_function: typing.Any = None
) -> None

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

a string denoting the type of metadata.


dataRequired

  • Type: typing.Any

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

If null/undefined, metadata will not be added.


from_functionOptional

  • Type: typing.Any

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


add_warning

def add_warning(
  message: str
) -> None

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

The warning message.


find_all

def find_all(
  order: ConstructOrder = None
) -> typing.List[IConstruct]

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

orderOptional


find_child

def find_child(
  id: str
) -> IConstruct

Return a direct child by id.

Throws an error if the child is not found.

idRequired

  • Type: str

Identifier of direct child.


set_context

def set_context(
  key: str,
  value: typing.Any
) -> None

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

The context key.


valueRequired

  • Type: typing.Any

The context value.


try_find_child

def try_find_child(
  id: str
) -> IConstruct

Return a direct child by id, or undefined.

idRequired

  • Type: str

Identifier of direct child.


try_get_context

def try_get_context(
  key: str
) -> typing.Any

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

The context key.


try_remove_child

def try_remove_child(
  child_name: str
) -> bool

Remove the child with the given name, if present.

child_nameRequired

  • Type: str

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 ros_cdk_core
ros_cdk_core.ConstructNode.prepare(
  node: ConstructNode
)

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

nodeRequired

The root node.


~~synth~~

import ros_cdk_core
ros_cdk_core.ConstructNode.synth(
  node: ConstructNode,
  runtime_info: RuntimeInfo = None,
  outdir: str = None,
  skip_validation: bool = None
)

Synthesizes a CloudAssembly from a construct tree.

nodeRequired

The root of the construct tree.


~~runtime_info~~Optional

  • Deprecated: use app.synth() or stage.synth() instead

  • Type: ros_cdk_cxapi.RuntimeInfo

  • Default: if this option is not specified, runtime info will not be included

Include the specified runtime information (module versions) in manifest.


~~outdir~~Optional

  • Deprecated: use app.synth() or stage.synth() instead

  • Type: str

  • Default: creates a temporary directory

The output directory into which to synthesize the cloud assembly.


~~skip_validation~~Optional

  • Deprecated: use app.synth() or stage.synth() instead

  • Type: bool

  • Default: false

Whether synthesis should skip the validation phase.


validate

import ros_cdk_core
ros_cdk_core.ConstructNode.validate(
  node: ConstructNode
)

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 typing.List[IConstruct] All direct children of this construct.
dependencies typing.List[Dependency] Return all dependencies registered on this node or any of its children.
id str 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 typing.List[ros_cdk_cxapi.MetadataEntry] An immutable array of metadata objects associated with this construct.
path str The full, absolute path of this construct in the tree.
root IConstruct No description.
scopes typing.List[IConstruct] All parent scopes of this construct.
unique_id str A tree-global unique alphanumeric identifier for this construct.
scope IConstruct Returns the scope in which this construct is defined.
default_child IConstruct Returns the child construct that has the id Default or Resource".

childrenRequired

children: typing.List[IConstruct]

All direct children of this construct.


dependenciesRequired

dependencies: typing.List[Dependency]

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


idRequired

id: str
  • Type: str

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

locked: bool
  • Type: bool

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


metadataRequired

metadata: typing.List[MetadataEntry]
  • Type: typing.List[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

path: str
  • Type: str

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

Components are separated by '/'.


rootRequired

root: IConstruct

scopesRequired

scopes: typing.List[IConstruct]

All parent scopes of this construct.


unique_idRequired

unique_id: str
  • Type: str

A tree-global unique alphanumeric identifier for this construct.

Includes all components of the tree.


scopeOptional

scope: IConstruct

Returns the scope in which this construct is defined.

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


default_childOptional

default_child: 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
PATH_SEP str Separator used to delimit construct path components.

PATH_SEPRequired

PATH_SEP: str
  • Type: str

Separator used to delimit construct path components.