class Construct
Language | Type name |
---|---|
.NET | Amazon.CDK.Construct |
Java | software.amazon.awscdk.core.Construct |
Python | aws_cdk.core.Construct |
TypeScript (source) | @aws-cdk/core » Construct |
Implements
IConstruct
, IConstruct
, IDependable
Extends
Construct
Represents the building block of the construct graph.
All constructs besides the root construct must be created within the scope of another construct.
Example
const entry = '/path/to/function';
const image = DockerImage.fromBuild(entry);
new lambda.PythonFunction(this, 'function', {
entry,
runtime: Runtime.PYTHON_3_8,
bundling: {
buildArgs: { PIP_INDEX_URL: "https://your.index.url/simple/", PIP_EXTRA_INDEX_URL: "https://your.extra-index.url/simple/" },
},
});
Initializer
new Construct(scope: Construct, id: string)
Parameters
- scope
Construct
- id
string
Properties
Name | Type | Description |
---|---|---|
node | Construct | The construct tree node associated with this construct. |
node
Type:
Construct
The construct tree node associated with this construct.
Methods
Name | Description |
---|---|
to | Returns a string representation of this construct. |
protected on | Perform final modifications before synthesis. |
protected on | Allows this construct to emit artifacts into the cloud assembly during synthesis. |
protected on | Validate the current construct. |
protected prepare() | Perform final modifications before synthesis. |
protected synthesize(session) | Allows this construct to emit artifacts into the cloud assembly during synthesis. |
protected validate() | Validate the current construct. |
static is | Return whether the given object is a Construct. |
toString()
public toString(): string
Returns
string
Returns a string representation of this construct.
protected onPrepare()
protected onPrepare(): void
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 onSynthesize(session)
protected onSynthesize(session: ISynthesisSession): void
Parameters
- session
ISynthesis
— The synthesis session.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 onValidate()
protected onValidate(): string[]
Returns
string[]
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 prepare()
protected prepare(): void
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 synthesize(session)
protected synthesize(session: ISynthesisSession): void
Parameters
- session
ISynthesis
— The synthesis session.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 validate()
protected validate(): string[]
Returns
string[]
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.
static isConstruct(x)
public static isConstruct(x: any): boolean
Parameters
- x
any
Returns
boolean
Return whether the given object is a Construct.