aws/lambda_ecs/node_modules/constructs/API.md

API Reference

Classes

Name|Description ----|----------- Construct|Represents the building block of the construct graph. ConstructMetadata|Metadata keys used by constructs. Node|Represents the construct node in the scope tree.

Structs

Name|Description ----|----------- ConstructOptions|Options for creating constructs. Dependency|A single dependency. MetadataEntry|An entry in the construct metadata table. SynthesisOptions|Options for synthesis. ValidationError|An error returned during the validation phase.

Interfaces

Name|Description ----|----------- IAspect|Represents an Aspect. IConstruct|Represents a construct. INodeFactory|A factory for attaching Nodes to the construct. ISynthesisSession|Represents a single session of synthesis. IValidation|Implement this interface in order for the construct to be able to validate itself.

Enums

Name|Description ----|----------- ConstructOrder|In what order to return constructs.

class Construct

Represents the building block of the construct graph.

All constructs besides the root construct must be created within the scope of another construct.

Implements: IConstruct

Initializer

Creates a new construct node.

new Construct(scope: Construct, id: string, options?: ConstructOptions)

Methods

toString()

Returns a string representation of this construct.

toString(): string

Returns: * string

protected onPrepare()

Perform final modifications before synthesis.

This method can be implemented by derived constructs in order to perform final changes before synthesis. prepare() will be called after child constructs have been prepared.

This is an advanced framework feature. Only use this if you understand the implications.

protected onPrepare(): void

protected onSynthesize(session)

Allows this construct to emit artifacts into the cloud assembly during synthesis.

This method is usually implemented by framework-level constructs such as Stack and Asset as they participate in synthesizing the cloud assembly.

protected onSynthesize(session: ISynthesisSession): void

protected onValidate()⚠️

Validate the current construct.

This method can be implemented by derived constructs in order to perform validation logic. It is called on all constructs before synthesis.

protected onValidate(): Array<string>

Returns: * Array

class ConstructMetadata

Metadata keys used by constructs.

Properties

Name | Type | Description -----|------|------------- static DISABLE_STACK_TRACE_IN_METADATA | string | If set in the construct's context, omits stack traces from metadata entries. static ERROR_METADATA_KEY | string | Context type for error level messages. static INFO_METADATA_KEY | string | Context type for info level messages. static WARNING_METADATA_KEY | string | Context type for warning level messages.

class Node

Represents the construct node in the scope tree.

Initializer

new Node(host: Construct, scope: IConstruct, id: string)

Properties

Name | Type | Description -----|------|------------- addr | string | Returns an opaque tree-unique address for this construct. children | Array<IConstruct> | All direct children of this construct. dependencies | Array<Dependency> | Return all dependencies registered on this node or any of its children. id | string | The id of this construct within the current scope. locked | boolean | Returns true if this construct or the scopes in which it is defined are locked. metadata | Array<MetadataEntry> | An immutable array of metadata objects associated with this construct. path | string | The full, absolute path of this construct in the tree. root | IConstruct | Returns the root of the construct tree. scopes | Array<IConstruct> | All parent scopes of this construct. uniqueId⚠️ | string | A tree-global unique alphanumeric identifier for this construct. defaultChild? | IConstruct | Returns the child construct that has the id Default or Resource".Optional scope? | IConstruct | Returns the scope in which this construct is defined.Optional static PATH_SEP | string | Separator used to delimit construct path components.

Methods

addDependency(...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.

addDependency(...dependencies: IConstruct[]): void

addError(message)

Adds an { "error": } metadata entry to this construct.

The toolkit will fail synthesis when errors are reported.

addError(message: string): void

addInfo(message)

Adds a { "info": } metadata entry to this construct.

The toolkit will display the info message when apps are synthesized.

addInfo(message: string): void

addMetadata(type, data, 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.

addMetadata(type: string, data: any, fromFunction?: any): void

addValidation(validation)

Adds a validation to this construct.

When node.validate() is called, the validate() method will be called on all validations and all errors will be returned.

addValidation(validation: IValidation): void

addWarning(message)

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.

addWarning(message: string): void

applyAspect(aspect)

Applies the aspect to this Constructs node.

applyAspect(aspect: IAspect): void

findAll(order?)

Return this construct and all of its children in the given order.

findAll(order?: ConstructOrder): Array<IConstruct>

Returns: * Array<IConstruct>

findChild(id)

Return a direct child by id.

Throws an error if the child is not found.

findChild(id: string): IConstruct

Returns: * IConstruct

prepare()

Invokes "prepare" on all constructs (depth-first, post-order) in the tree under node.

prepare(): void

setContext(key, 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.

setContext(key: string, value: any): void

synthesize(options)

Synthesizes a CloudAssembly from a construct tree.

synthesize(options: SynthesisOptions): void

tryFindChild(id)

Return a direct child by id, or undefined.

tryFindChild(id: string): IConstruct

Returns: * IConstruct

tryGetContext(key)

Retrieves a value from tree context.

Context is usually initialized at the root, but can be overridden at any point in the tree.

tryGetContext(key: string): any

Returns: * any

tryRemoveChild(childName)🔹

Remove the child with the given name, if present.

tryRemoveChild(childName: string): boolean

Returns: * boolean

validate()

Validates tree (depth-first, pre-order) and returns the list of all errors.

An empty list indicates that there are no errors.

validate(): Array<ValidationError>

Returns: * Array<ValidationError>

static of(construct)

Returns the node associated with a construct.

static of(construct: IConstruct): Node

Returns: * Node

struct ConstructOptions

Options for creating constructs.

Name | Type | Description -----|------|------------- nodeFactory? | INodeFactory | A factory for attaching Nodes to the construct.Default: the default Node is associated

struct Dependency

A single dependency.

Name | Type | Description -----|------|------------- source | IConstruct | Source the dependency. target | IConstruct | Target of the dependency.

interface IAspect

Represents an Aspect.

Methods

visit(node)

All aspects can visit an IConstruct.

visit(node: IConstruct): void

interface IConstruct

Implemented by: Construct Obtainable from: Node.findChild(), Node.tryFindChild()

Represents a construct.

interface INodeFactory

A factory for attaching Nodes to the construct.

Methods

createNode(host, scope, id)

Returns a new Node associated with host.

createNode(host: Construct, scope: IConstruct, id: string): Node

Returns: * Node

interface ISynthesisSession

Represents a single session of synthesis.

Passed into construct.onSynthesize() methods.

Properties

Name | Type | Description -----|------|------------- outdir | string | The output directory for this synthesis session.

interface IValidation

Implement this interface in order for the construct to be able to validate itself.

Methods

validate()

Validate the current construct.

This method can be implemented by derived constructs in order to perform validation logic. It is called on all constructs before synthesis.

validate(): Array<string>

Returns: * Array

struct MetadataEntry

An entry in the construct metadata table.

Name | Type | Description -----|------|------------- data | any | The data. type | string | The metadata entry type. trace? | Array | Stack trace.Default: no trace information

struct SynthesisOptions

Options for synthesis.

Name | Type | Description -----|------|------------- outdir | string | The output directory into which to synthesize the cloud assembly. sessionContext? | Map | Additional context passed into the synthesis session object when construct.synth is called.Default: no additional context is passed to onSynthesize skipValidation? | boolean | Whether synthesis should skip the validation phase.Default: false

struct ValidationError

An error returned during the validation phase.

Name | Type | Description -----|------|------------- message | string | The error message. source | Construct | The construct which emitted the error.

enum ConstructOrder

In what order to return constructs.

Name | Description -----|----- PREORDER |Depth-first, pre-order. POSTORDER |Depth-first, post-order (leaf nodes first).



singha53/geomxCloud documentation built on Dec. 23, 2021, 2:29 a.m.