export declare const PATH_SEP = "/"; /** * Represents the building block of the construct graph. * When a construct is created, it is always added as a child */ export declare class Construct { /** * Returns the parent of this node or undefined if this is a root node. */ readonly parent?: Construct; /** * The local id of the construct. * This id is unique amongst its siblings. * To obtain a tree-global unique id for this construct, use `uniqueId`. */ readonly id: string; /** * The full path of this construct in the tree. * Components are separated by '/'. */ readonly path: string; /** * A tree-global unique alphanumeric identifier for this construct. * Includes all components of the tree. */ readonly uniqueId: string; /** * List of children and their names */ private readonly _children; private readonly context; private readonly _metadata; /** * If this is set to 'true'. addChild() calls for this construct and any child * will fail. This is used to prevent tree mutations during synthesis. */ private _locked; /** * Creates a new construct node. * * @param parent The parent construct * @param props Properties for this construct */ constructor(parent: Construct, id: string); /** * Returns a string representation of this construct. */ toString(): string; /** * Returns a string with a tree representation of this construct and it's children. */ toTreeString(depth?: number): string; /** * Return a descendant by path, or undefined * * @param name Relative name of a direct or indirect child * @returns a child by path or undefined if not found. */ tryFindChild(path: string): Construct | undefined; /** * Return a descendant by path * * Throws an exception if the descendant is not found. * * @param name Relative name of a direct or indirect child * @returns Child with the given path. */ findChild(path: string): Construct; /** * All direct children of this construct. */ readonly children: Construct[]; /** * 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 */ setContext(key: string, value: any): void; /** * Retrieves a value from tree context. * * Context is usually initialized at the root, but can be overridden at any point in the tree. * * @param key The context key * @returns The context value or undefined */ getContext(key: string): any; /** * Retrieve a value from tree-global context * * It is an error if the context object is not available. */ requireContext(key: string): any; /** * An array of metadata objects associated with this construct. * This can be used, for example, to implement support for deprecation notices, source mapping, etc. */ readonly metadata: MetadataEntry[]; /** * 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). If null/undefined, metadata will not be added. * @param from a function under which to restrict the metadata entry's stack trace (defaults to this.addMetadata) */ addMetadata(type: string, data: any, from?: any): Construct; /** * 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. */ addInfo(message: string): Construct; /** * 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. */ addWarning(message: string): Construct; /** * Adds an { error: } metadata entry to this construct. * The toolkit will fail synthesis when errors are reported. * @param message The error message. */ addError(message: string): Construct; /** * This method can be implemented by derived constructs in order to perform * validation logic. It is called on all constructs before synthesis. * * @returns An array of validation error messages, or an empty array if there the construct is valid. */ validate(): string[]; /** * Invokes 'validate' on all child constructs and then on this construct (depth-first). * @returns A list of validation errors. If the list is empty, all constructs are valid. */ validateTree(): ValidationError[]; /** * Return the ancestors (including self) of this Construct up until and excluding the indicated component * * @param to The construct to return the path components relative to, or * the entire list of ancestors (including root) if omitted. */ protected ancestors(upTo?: Construct): Construct[]; /** * Validate that the id of the construct legal. * Construct IDs can be any characters besides the path separator. */ protected _validateId(id: string): void; /** * 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. * @param props The props bag. * @param name The name of the required property. * * @deprecated use ``requireProperty`` from ``@aws-cdk/runtime`` instead. */ protected required(props: any, name: string): any; /** * @returns The type name of this node. */ private readonly typename; /** * Adds a child construct to this node. * * @param child The child construct * @param name The type name of the child construct. * @returns The resolved path part name of the child */ protected addChild(child: Construct, childName: string): void; /** * 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. */ protected lock(): void; /** * Unlocks this costruct and allows mutations (adding children). */ protected unlock(): void; /** * Return the path of components up to but excluding the root */ private rootPath; /** * Returns true if this construct or any of it's parent constructs are * locked. */ private readonly locked; } /** * Represents the root of a construct tree. * No parent and no name. */ export declare class Root extends Construct { constructor(); } /** * An metadata entry in the construct. */ export interface MetadataEntry { /** * The type of the metadata entry. */ type: string; /** * The data. */ data?: any; /** * A stack trace for when the entry was created. */ trace: string[]; } export declare class ValidationError { readonly source: Construct; readonly message: string; constructor(source: Construct, message: string); }