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. |
host
Required
- Type: Construct
scope
Required
- Type: IConstruct
id
Required
- Type: str
Methods
Name | Description |
---|---|
add_dependency |
Add an ordering dependency on another Construct. |
add_error |
Adds an { "error": |
add_info |
Adds a { "info": |
add_metadata |
Adds a metadata entry to this construct. |
add_warning |
Adds a { "warning": |
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.
- Type: IDependable
add_error
def add_error(
message: str
) -> None
Adds an { "error":
The toolkit will fail synthesis when errors are reported.
- Type: str
The error message.
add_info
def add_info(
message: str
) -> None
Adds a { "info":
The toolkit will display the info message when apps are synthesized.
- 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.
- Type: str
a string denoting the type of metadata.
- Type: typing.Any
the value of the metadata (can be a Token).
If null/undefined, metadata will not be added.
- 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":
The toolkit will display the warning when an app is synthesized, or fail if run in --strict mode.
- 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.
- Type: ConstructOrder
find_child
def find_child(
id: str
) -> IConstruct
Return a direct child by id.
Throws an error if the child is not found.
- 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.
- Type: str
The context key.
- Type: typing.Any
The context value.
try_find_child
def try_find_child(
id: str
) -> IConstruct
Return a direct child by id, or undefined.
- 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.
- 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.
- 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
.
- Type: ConstructNode
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.
- Type: ConstructNode
The root of the construct tree.
-
Deprecated: use
app.synth()
orstage.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.
-
Deprecated: use
app.synth()
orstage.synth()
instead -
Type: str
- Default: creates a temporary directory
The output directory into which to synthesize the cloud assembly.
-
Deprecated: use
app.synth()
orstage.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.
- Type: ConstructNode
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" . |
children
Required
children: typing.List[IConstruct]
- Type: typing.List[IConstruct]
All direct children of this construct.
dependencies
Required
dependencies: typing.List[Dependency]
- Type: typing.List[Dependency]
Return all dependencies registered on this node or any of its children.
id
Required
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
.
locked
Required
locked: bool
- Type: bool
Returns true if this construct or the scopes in which it is defined are locked.
metadata
Required
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.
path
Required
path: str
- Type: str
The full, absolute path of this construct in the tree.
Components are separated by '/'.
root
Required
root: IConstruct
- Type: IConstruct
scopes
Required
scopes: typing.List[IConstruct]
- Type: typing.List[IConstruct]
All parent scopes of this construct.
unique_id
Required
unique_id: str
- Type: str
A tree-global unique alphanumeric identifier for this construct.
Includes all components of the tree.
scope
Optional
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.
default_child
Optional
default_child: 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 |
---|---|---|
PATH_SEP |
str |
Separator used to delimit construct path components. |
PATH_SEP
Required
PATH_SEP: str
- Type: str
Separator used to delimit construct path components.