All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awscdk.ConstructNode Maven / Gradle / Ivy

There is a newer version: 0.36.1
Show newest version
package software.amazon.awscdk;

/**
 * Represents the construct node in the scope tree.
 */
@javax.annotation.Generated(value = "jsii-pacmak/0.10.5 (build 46bc9b0)", date = "2019-05-06T20:49:40.943Z")
@software.amazon.jsii.Jsii(module = software.amazon.awscdk.$Module.class, fqn = "@aws-cdk/cdk.ConstructNode")
public class ConstructNode extends software.amazon.jsii.JsiiObject {
    protected ConstructNode(final software.amazon.jsii.JsiiObject.InitializationMode mode) {
        super(mode);
    }
    public ConstructNode(final software.amazon.awscdk.Construct host, final software.amazon.awscdk.IConstruct scope, final java.lang.String id) {
        super(software.amazon.jsii.JsiiObject.InitializationMode.Jsii);
        software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(host, "host is required"), java.util.Objects.requireNonNull(scope, "scope is required"), java.util.Objects.requireNonNull(id, "id is required") });
    }

    /**
     * Adds a child construct to this node.
     * 
     * @return The resolved path part name of the child
     * @param child The child construct.
     * @param childName The type name of the child construct.
     */
    public void addChild(final software.amazon.awscdk.IConstruct child, final java.lang.String childName) {
        this.jsiiCall("addChild", Void.class, new Object[] { java.util.Objects.requireNonNull(child, "child is required"), java.util.Objects.requireNonNull(childName, "childName is required") });
    }

    /**
     * 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.
     */
    public void addDependency(final software.amazon.awscdk.IDependable... dependencies) {
        this.jsiiCall("addDependency", Void.class, java.util.Arrays.stream(dependencies).toArray(Object[]::new));
    }

    /**
     * Adds an { error:  } metadata entry to this construct. The toolkit will fail synthesis when errors are reported.
     * 
     * @param message The error message.
     */
    public void addError(final java.lang.String message) {
        this.jsiiCall("addError", Void.class, new Object[] { java.util.Objects.requireNonNull(message, "message is required") });
    }

    /**
     * Adds a { "aws:cdk:info":  } metadata entry to this construct. The toolkit will display the info message when apps are synthesized.
     * 
     * @param message The info message.
     */
    public void addInfo(final java.lang.String message) {
        this.jsiiCall("addInfo", Void.class, new Object[] { java.util.Objects.requireNonNull(message, "message is required") });
    }

    /**
     * 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.
     * 
     * @param type a string denoting the type of metadata.
     * @param data the value of the metadata (can be a Token).
     * @param from a function under which to restrict the metadata entry's stack trace (defaults to this.addMetadata).
     */
    public void addMetadata(final java.lang.String type, @javax.annotation.Nullable final java.lang.Object data, @javax.annotation.Nullable final java.lang.Object from) {
        this.jsiiCall("addMetadata", Void.class, new Object[] { java.util.Objects.requireNonNull(type, "type is required"), data, from });
    }

    /**
     * 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.
     * 
     * @param type a string denoting the type of metadata.
     * @param data the value of the metadata (can be a Token).
     */
    public void addMetadata(final java.lang.String type, @javax.annotation.Nullable final java.lang.Object data) {
        this.jsiiCall("addMetadata", Void.class, new Object[] { java.util.Objects.requireNonNull(type, "type is required"), data });
    }

    /**
     * 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.
     * 
     * @param message The warning message.
     */
    public void addWarning(final java.lang.String message) {
        this.jsiiCall("addWarning", Void.class, new Object[] { java.util.Objects.requireNonNull(message, "message is required") });
    }

    /**
     * Return the ancestors (including self) of this Construct up until and excluding the indicated component.
     * 
     * @param upTo The construct to return the path components relative to, or the entire list of ancestors (including root) if omitted.
     */
    public java.util.List ancestors(@javax.annotation.Nullable final software.amazon.awscdk.Construct upTo) {
        return this.jsiiCall("ancestors", java.util.List.class, new Object[] { upTo });
    }

    /**
     * Return the ancestors (including self) of this Construct up until and excluding the indicated component.
     */
    public java.util.List ancestors() {
        return this.jsiiCall("ancestors", java.util.List.class);
    }

    /**
     * Applies the aspect to this Constructs node.
     */
    public void apply(final software.amazon.awscdk.IAspect aspect) {
        this.jsiiCall("apply", Void.class, new Object[] { java.util.Objects.requireNonNull(aspect, "aspect is required") });
    }

    /**
     * Return this construct and all of its children in the given order.
     */
    public java.util.List findAll(@javax.annotation.Nullable final software.amazon.awscdk.ConstructOrder order) {
        return this.jsiiCall("findAll", java.util.List.class, new Object[] { order });
    }

    /**
     * Return this construct and all of its children in the given order.
     */
    public java.util.List findAll() {
        return this.jsiiCall("findAll", java.util.List.class);
    }

    /**
     * Return a descendant by path.
     * 
     * Throws an exception if the descendant is not found.
     * 
     * Note that if the original ID of the construct you are looking for contained
     * a '/', then it would have been replaced by '--'.
     * 
     * @return Child with the given path.
     * @param path Relative path of a direct or indirect child.
     */
    public software.amazon.awscdk.IConstruct findChild(final java.lang.String path) {
        return this.jsiiCall("findChild", software.amazon.awscdk.IConstruct.class, new Object[] { java.util.Objects.requireNonNull(path, "path is required") });
    }

    /**
     * Return all dependencies registered on this node or any of its children.
     */
    public java.util.List findDependencies() {
        return this.jsiiCall("findDependencies", java.util.List.class);
    }

    /**
     * Return all references of the given type originating from this node or any of its children.
     */
    public java.util.List findReferences() {
        return this.jsiiCall("findReferences", java.util.List.class);
    }

    /**
     * Retrieves a value from tree context.
     * 
     * Context is usually initialized at the root, but can be overridden at any point in the tree.
     * 
     * @return The context value or undefined
     * @param key The context key.
     */
    @javax.annotation.Nullable
    public java.lang.Object getContext(final java.lang.String key) {
        return this.jsiiCall("getContext", java.lang.Object.class, new Object[] { java.util.Objects.requireNonNull(key, "key is required") });
    }

    /**
     * Locks this construct from allowing more children to be added.
     * 
     * After this
     * call, no more children can be added to this construct or to any children.
     */
    public void lock() {
        this.jsiiCall("lock", Void.class);
    }

    /**
     * Run 'prepare()' on all constructs in the tree.
     */
    public void prepareTree() {
        this.jsiiCall("prepareTree", Void.class);
    }

    /**
     * Record a reference originating from this construct node.
     */
    public void recordReference(final software.amazon.awscdk.Token... refs) {
        this.jsiiCall("recordReference", Void.class, java.util.Arrays.stream(refs).toArray(Object[]::new));
    }

    /**
     * Retrieve a value from tree-global context.
     * 
     * It is an error if the context object is not available.
     */
    @javax.annotation.Nullable
    public java.lang.Object requireContext(final java.lang.String key) {
        return this.jsiiCall("requireContext", java.lang.Object.class, new Object[] { java.util.Objects.requireNonNull(key, "key is required") });
    }

    /**
     * Throws if the `props` bag doesn't include the property `name`. In the future we can add some type-checking here, maybe even auto-generate during compilation.
     * 
     * @deprecated use ``requireProperty`` from ``
     * @param props The props bag.
     * @param name The name of the required property.
     */
    @javax.annotation.Nullable
    public java.lang.Object required(@javax.annotation.Nullable final java.lang.Object props, final java.lang.String name) {
        return this.jsiiCall("required", java.lang.Object.class, new Object[] { props, java.util.Objects.requireNonNull(name, "name is required") });
    }

    /**
     * Resolve a tokenized value in the context of the current Construct.
     */
    @javax.annotation.Nullable
    public java.lang.Object resolve(@javax.annotation.Nullable final java.lang.Object obj) {
        return this.jsiiCall("resolve", java.lang.Object.class, new Object[] { obj });
    }

    /**
     * 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.
     * 
     * @param key The context key.
     * @param value The context value.
     */
    public void setContext(final java.lang.String key, @javax.annotation.Nullable final java.lang.Object value) {
        this.jsiiCall("setContext", Void.class, new Object[] { java.util.Objects.requireNonNull(key, "key is required"), value });
    }

    /**
     * Convert an object, potentially containing tokens, to a JSON string.
     */
    public java.lang.String stringifyJson(@javax.annotation.Nullable final java.lang.Object obj) {
        return this.jsiiCall("stringifyJson", java.lang.String.class, new Object[] { obj });
    }

    /**
     * Returns a string with a tree representation of this construct and it's children.
     */
    public java.lang.String toTreeString(@javax.annotation.Nullable final java.lang.Number depth) {
        return this.jsiiCall("toTreeString", java.lang.String.class, new Object[] { depth });
    }

    /**
     * Returns a string with a tree representation of this construct and it's children.
     */
    public java.lang.String toTreeString() {
        return this.jsiiCall("toTreeString", java.lang.String.class);
    }

    /**
     * Return a descendant by path, or undefined.
     * 
     * Note that if the original ID of the construct you are looking for contained
     * a '/', then it would have been replaced by '--'.
     * 
     * @return a child by path or undefined if not found.
     * @param path Relative path of a direct or indirect child.
     */
    @javax.annotation.Nullable
    public software.amazon.awscdk.IConstruct tryFindChild(final java.lang.String path) {
        return this.jsiiCall("tryFindChild", software.amazon.awscdk.IConstruct.class, new Object[] { java.util.Objects.requireNonNull(path, "path is required") });
    }

    /**
     * Unlocks this costruct and allows mutations (adding children).
     */
    public void unlock() {
        this.jsiiCall("unlock", Void.class);
    }

    /**
     * Invokes 'validate' on all child constructs and then on this construct (depth-first).
     * 
     * @return A list of validation errors. If the list is empty, all constructs are valid.
     */
    public java.util.List validateTree() {
        return this.jsiiCall("validateTree", java.util.List.class);
    }

    /**
     * An array of aspects applied to this node.
     */
    public java.util.List getAspects() {
        return this.jsiiGet("aspects", java.util.List.class);
    }

    /**
     * All direct children of this construct.
     */
    public java.util.List getChildren() {
        return this.jsiiGet("children", java.util.List.class);
    }

    public software.amazon.awscdk.Construct getHost() {
        return this.jsiiGet("host", software.amazon.awscdk.Construct.class);
    }

    /**
     * The scoped construct ID This ID is unique amongst all constructs defined in the same scope. To obtain a global unique id for this construct, use `uniqueId`.
     */
    public java.lang.String getId() {
        return this.jsiiGet("id", java.lang.String.class);
    }

    /**
     * Returns true if this construct or the scopes in which it is defined are locked.
     */
    public java.lang.Boolean getLocked() {
        return this.jsiiGet("locked", java.lang.Boolean.class);
    }

    /**
     * An array of metadata objects associated with this construct. This can be used, for example, to implement support for deprecation notices, source mapping, etc.
     */
    public java.util.List getMetadata() {
        return this.jsiiGet("metadata", java.util.List.class);
    }

    /**
     * The full, absolute path of this construct in the tree.
     * 
     * Components are separated by '/'.
     */
    public java.lang.String getPath() {
        return this.jsiiGet("path", java.lang.String.class);
    }

    /**
     * The stack the construct is a part of.
     */
    public software.amazon.awscdk.Stack getStack() {
        return this.jsiiGet("stack", software.amazon.awscdk.Stack.class);
    }

    /**
     * @return The type name of this node.
     */
    public java.lang.String getTypename() {
        return this.jsiiGet("typename", java.lang.String.class);
    }

    /**
     * A tree-global unique alphanumeric identifier for this construct. Includes all components of the tree.
     */
    public java.lang.String getUniqueId() {
        return this.jsiiGet("uniqueId", java.lang.String.class);
    }

    /**
     * Returns the scope in which this construct is defined.
     */
    @javax.annotation.Nullable
    public software.amazon.awscdk.IConstruct getScope() {
        return this.jsiiGet("scope", software.amazon.awscdk.IConstruct.class);
    }
}