Class ConstructNode
- All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import software.amazon.awscdk.core.*; Construct construct; ConstructNode constructNode = new ConstructNode(construct, construct, "id");
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionConstructNode
(Construct host, IConstruct scope, String id) protected
ConstructNode
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
ConstructNode
(software.amazon.jsii.JsiiObjectRef objRef) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDependency
(@NotNull IDependable... dependencies) Add an ordering dependency on another Construct.void
Deprecated.void
Deprecated.useAnnotations.of(construct).addInfo()
void
addMetadata
(String type, Object data) Adds a metadata entry to this construct.void
addMetadata
(String type, Object data, Object fromFunction) Adds a metadata entry to this construct.void
addValidation
(software.constructs.IValidation validation) Add a validator to this construct Node.void
addWarning
(String message) Deprecated.useAnnotations.of(construct).addWarning()
void
applyAspect
(IAspect aspect) Deprecated.This API is going to be removed in the next major version of the AWS CDK.findAll()
Return this construct and all of its children in the given order.findAll
(ConstructOrder order) Return this construct and all of its children in the given order.Return a direct child by id.getAddr()
Returns an opaque tree-unique address for this construct.All direct children of this construct.Returns the child construct that has the idDefault
orResource"
.Return all dependencies registered on this node or any of its children.getId()
The id of this construct within the current scope.Returns true if this construct or the scopes in which it is defined are locked.Deprecated.usemetadataEntry
List<software.constructs.MetadataEntry>
An immutable array of metadata objects associated with this construct.getPath()
The full, absolute path of this construct in the tree.getRoot()
getScope()
Returns the scope in which this construct is defined.All parent scopes of this construct.Deprecated.usenode.addr
to obtain a consistent 42 character address for this node (see https://github.com/aws/constructs/pull/314).static void
prepare
(ConstructNode node) Deprecated.Useapp.synth()
insteadvoid
setContext
(String key, Object value) This can be used to set contextual values.void
setDefaultChild
(IConstruct value) Returns the child construct that has the idDefault
orResource"
.static CloudAssembly
synth
(ConstructNode node) Deprecated.Useapp.synth()
orstage.synth()
insteadstatic CloudAssembly
synth
(ConstructNode node, SynthesisOptions options) Deprecated.Useapp.synth()
orstage.synth()
insteadtryFindChild
(String id) Return a direct child by id, or undefined.tryGetContext
(String key) Retrieves a value from tree context.tryRemoveChild
(String childName) Remove the child with the given name, if present.static List<ValidationError>
validate
(ConstructNode node) Invokes "validate" on all constructs in the tree (depth-first, pre-order) and returns the list of all errors.Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
PATH_SEP
Separator used to delimit construct path components.
-
-
Constructor Details
-
ConstructNode
protected ConstructNode(software.amazon.jsii.JsiiObjectRef objRef) -
ConstructNode
protected ConstructNode(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
ConstructNode
@Stability(Stable) public ConstructNode(@NotNull Construct host, @NotNull IConstruct scope, @NotNull String id) - Parameters:
host
- This parameter is required.scope
- This parameter is required.id
- This parameter is required.
-
-
Method Details
-
prepare
Deprecated.Useapp.synth()
instead(deprecated) Invokes "prepare" on all constructs (depth-first, post-order) in the tree undernode
.- Parameters:
node
- The root node. This parameter is required.
-
synth
@Stability(Deprecated) @Deprecated @NotNull public static CloudAssembly synth(@NotNull ConstructNode node, @Nullable SynthesisOptions options) Deprecated.Useapp.synth()
orstage.synth()
instead(deprecated) Synthesizes a CloudAssembly from a construct tree.- Parameters:
node
- The root of the construct tree. This parameter is required.options
- Synthesis options.
-
synth
@Stability(Deprecated) @Deprecated @NotNull public static CloudAssembly synth(@NotNull ConstructNode node) Deprecated.Useapp.synth()
orstage.synth()
instead(deprecated) Synthesizes a CloudAssembly from a construct tree.- Parameters:
node
- The root of the construct tree. This parameter is required.
-
validate
@Stability(Stable) @NotNull public static List<ValidationError> validate(@NotNull 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.
- Parameters:
node
- The root node. This parameter is required.
-
addDependency
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.
- Parameters:
dependencies
- This parameter is required.
-
addError
Deprecated.useAnnotations.of(construct).addError()
(deprecated) DEPRECATED: Adds an { "error":} metadata entry to this construct. The toolkit will fail synthesis when errors are reported.
- Parameters:
message
- The error message. This parameter is required.
-
addInfo
Deprecated.useAnnotations.of(construct).addInfo()
(deprecated) DEPRECATED: Adds a { "info":} metadata entry to this construct. The toolkit will display the info message when apps are synthesized.
- Parameters:
message
- The info message. This parameter is required.
-
addMetadata
@Stability(Stable) public void addMetadata(@NotNull String type, @NotNull Object data, @Nullable Object fromFunction) 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 CloudFormation templates to improve diagnostics.
- Parameters:
type
- a string denoting the type of metadata. This parameter is required.data
- the value of the metadata (can be a Token). This parameter is required.fromFunction
- a function under which to restrict the metadata entry's stack trace (defaults to this.addMetadata).
-
addMetadata
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 CloudFormation templates to improve diagnostics.
- Parameters:
type
- a string denoting the type of metadata. This parameter is required.data
- the value of the metadata (can be a Token). This parameter is required.
-
addValidation
@Stability(Stable) public void addValidation(@NotNull software.constructs.IValidation validation) Add a validator to this construct Node.- Parameters:
validation
- This parameter is required.
-
addWarning
Deprecated.useAnnotations.of(construct).addWarning()
(deprecated) DEPRECATED: 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.
- Parameters:
message
- The warning message. This parameter is required.
-
applyAspect
Deprecated.This API is going to be removed in the next major version of the AWS CDK. Please useAspects.of(scope).add()
instead.(deprecated) DEPRECATED: Applies the aspect to this Constructs node.- Parameters:
aspect
- This parameter is required.
-
findAll
Return this construct and all of its children in the given order.- Parameters:
order
-
-
findAll
Return this construct and all of its children in the given order. -
findChild
Return a direct child by id.Throws an error if the child is not found.
- Parameters:
id
- Identifier of direct child. This parameter is required.- Returns:
- Child with the given id.
-
setContext
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.
- Parameters:
key
- The context key. This parameter is required.value
- The context value. This parameter is required.
-
tryFindChild
Return a direct child by id, or undefined.- Parameters:
id
- Identifier of direct child. This parameter is required.- Returns:
- the child if found, or undefined
-
tryGetContext
Retrieves a value from tree context.Context is usually initialized at the root, but can be overridden at any point in the tree.
- Parameters:
key
- The context key. This parameter is required.- Returns:
- The context value or
undefined
if there is no context value for the key.
-
tryRemoveChild
Remove the child with the given name, if present.- Parameters:
childName
- This parameter is required.- Returns:
- Whether a child with the given name was deleted.
-
getAddr
Returns an opaque tree-unique address for this construct.Addresses are 42 characters hexadecimal strings. They begin with "c8" followed by 40 lowercase hexadecimal characters (0-9a-f).
Addresses are calculated using a SHA-1 of the components of the construct path.
To enable refactorings of construct trees, constructs with the ID
Default
will be excluded from the calculation. In those cases constructs in the same tree may have the same addreess.Example value:
c83a2846e506bcc5f10682b564084bca2d275709ee
-
getChildren
All direct children of this construct. -
getDependencies
Return all dependencies registered on this node or any of its children. -
getId
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
. -
getLocked
Returns true if this construct or the scopes in which it is defined are locked. -
getMetadata
Deprecated.usemetadataEntry
(deprecated) DEPRECATED. -
getMetadataEntry
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.
-
getPath
The full, absolute path of this construct in the tree.Components are separated by '/'.
-
getRoot
- Returns:
- The root of the construct tree.
-
getScopes
All parent scopes of this construct.- Returns:
- a list of parent scopes. The last element in the list will always be the current construct and the first element will be the root of the tree.
-
getUniqueId
Deprecated.usenode.addr
to obtain a consistent 42 character address for this node (see https://github.com/aws/constructs/pull/314). Alternatively, to get a CloudFormation-compatible unique identifier, useNames.uniqueId()
.(deprecated) A tree-global unique alphanumeric identifier for this construct.Includes all components of the tree.
-
getScope
Returns the scope in which this construct is defined.The value is
undefined
at the root of the construct scope tree. -
getDefaultChild
Returns the child construct that has the idDefault
orResource"
.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.
- Returns:
- a construct or undefined if there is no default child
-
setDefaultChild
Returns the child construct that has the idDefault
orResource"
.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.
-
Annotations.of(construct).addError()