Class ConstructNode

java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.core.ConstructNode
All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:29:54.982Z") @Stability(Stable) public class ConstructNode extends software.amazon.jsii.JsiiObject
Represents the construct node in the scope tree.

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");
 
  • Field Details

    • PATH_SEP

      @Stability(Stable) public static final String 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

      @Stability(Deprecated) @Deprecated public static void prepare(@NotNull ConstructNode node)
      Deprecated.
      Use app.synth() instead
      (deprecated) Invokes "prepare" on all constructs (depth-first, post-order) in the tree under node.

      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.
      Use app.synth() or stage.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.
      Use app.synth() or stage.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

      @Stability(Stable) public void addDependency(@NotNull @NotNull 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.

      Parameters:
      dependencies - This parameter is required.
    • addError

      @Stability(Deprecated) @Deprecated public void addError(@NotNull String message)
      Deprecated.
      use Annotations.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

      @Stability(Deprecated) @Deprecated public void addInfo(@NotNull String message)
      Deprecated.
      use Annotations.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

      @Stability(Stable) public void addMetadata(@NotNull String type, @NotNull Object data)
      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

      @Stability(Deprecated) @Deprecated public void addWarning(@NotNull String message)
      Deprecated.
      use Annotations.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

      @Stability(Deprecated) @Deprecated public void applyAspect(@NotNull IAspect aspect)
      Deprecated.
      This API is going to be removed in the next major version of the AWS CDK. Please use Aspects.of(scope).add() instead.
      (deprecated) DEPRECATED: Applies the aspect to this Constructs node.

      Parameters:
      aspect - This parameter is required.
    • findAll

      @Stability(Stable) @NotNull public List<IConstruct> findAll(@Nullable ConstructOrder order)
      Return this construct and all of its children in the given order.

      Parameters:
      order -
    • findAll

      @Stability(Stable) @NotNull public List<IConstruct> findAll()
      Return this construct and all of its children in the given order.
    • findChild

      @Stability(Stable) @NotNull public IConstruct findChild(@NotNull String id)
      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

      @Stability(Stable) public void setContext(@NotNull String key, @NotNull 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.

      Parameters:
      key - The context key. This parameter is required.
      value - The context value. This parameter is required.
    • tryFindChild

      @Stability(Stable) @Nullable public IConstruct tryFindChild(@NotNull String id)
      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

      @Stability(Stable) @NotNull public Object tryGetContext(@NotNull 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.

      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

      @Stability(Stable) @NotNull public Boolean tryRemoveChild(@NotNull String childName)
      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

      @Stability(Stable) @NotNull public String 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

      @Stability(Stable) @NotNull public List<IConstruct> getChildren()
      All direct children of this construct.
    • getDependencies

      @Stability(Stable) @NotNull public List<Dependency> getDependencies()
      Return all dependencies registered on this node or any of its children.
    • getId

      @Stability(Stable) @NotNull public String 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

      @Stability(Stable) @NotNull public Boolean getLocked()
      Returns true if this construct or the scopes in which it is defined are locked.
    • getMetadata

      @Stability(Deprecated) @Deprecated @NotNull public List<MetadataEntry> getMetadata()
      Deprecated.
      use metadataEntry
      (deprecated) DEPRECATED.

    • getMetadataEntry

      @Stability(Stable) @NotNull public List<software.constructs.MetadataEntry> 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

      @Stability(Stable) @NotNull public String getPath()
      The full, absolute path of this construct in the tree.

      Components are separated by '/'.

    • getRoot

      @Stability(Stable) @NotNull public IConstruct getRoot()
      Returns:
      The root of the construct tree.
    • getScopes

      @Stability(Stable) @NotNull public List<IConstruct> 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

      @Stability(Deprecated) @Deprecated @NotNull public String getUniqueId()
      Deprecated.
      use node.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, use Names.uniqueId().
      (deprecated) A tree-global unique alphanumeric identifier for this construct.

      Includes all components of the tree.

    • getScope

      @Stability(Stable) @Nullable public IConstruct getScope()
      Returns the scope in which this construct is defined.

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

    • getDefaultChild

      @Stability(Stable) @Nullable public IConstruct getDefaultChild()
      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.

      Returns:
      a construct or undefined if there is no default child
    • setDefaultChild

      @Stability(Stable) public void setDefaultChild(@Nullable IConstruct value)
      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.