Table of Contents

Class Construct

Namespace
Amazon.CDK
Assembly
Amazon.CDK.dll

Represents the building block of the construct graph.

public class Construct : Construct, IConstruct, IConstruct, IDependable
Inheritance
Construct
Implements
IConstruct
Derived

Examples

var entry = "/path/to/function";
             var image = DockerImage.FromBuild(entry);

             new PythonFunction(this, "function", new PythonFunctionProps {
                 Entry = entry,
                 Runtime = Runtime.PYTHON_3_8,
                 Bundling = new BundlingOptions {
                     BuildArgs = new Dictionary<string, string> { { "PIP_INDEX_URL", "https://your.index.url/simple/" }, { "PIP_EXTRA_INDEX_URL", "https://your.extra-index.url/simple/" } }
                 }
             });

Remarks

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

ExampleMetadata: infused

Constructors

Construct(Construct, string)

public Construct(Construct scope, string id)

Parameters

scope Construct
id string

Properties

Node

The construct tree node associated with this construct.

public virtual ConstructNode Node { get; }

Property Value

ConstructNode

Methods

IsConstruct(object)

Return whether the given object is a Construct.

public static bool IsConstruct(object x)

Parameters

x object

Returns

bool

OnPrepare()

Perform final modifications before synthesis.

protected override void OnPrepare()

Remarks

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.

OnSynthesize(ISynthesisSession)

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

protected override void OnSynthesize(ISynthesisSession session)

Parameters

session ISynthesisSession

The synthesis session.

Remarks

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

OnValidate()

Validate the current construct.

protected override string[] OnValidate()

Returns

string[]

An array of validation error messages, or an empty array if the construct is valid.

Remarks

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

Prepare()

Perform final modifications before synthesis.

protected virtual void Prepare()

Remarks

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.

Synthesize(ISynthesisSession)

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

protected virtual void Synthesize(ISynthesisSession session)

Parameters

session ISynthesisSession

The synthesis session.

Remarks

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

Validate()

Validate the current construct.

protected virtual string[] Validate()

Returns

string[]

An array of validation error messages, or an empty array if the construct is valid.

Remarks

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