App
A construct which represents an entire CDK app. This construct is normally the root of the construct tree.
You would normally define an 'App' instance in your program's entrypoint, then define constructs where the app is used as the parent scope.
After all the child constructs are defined within the app, you should call 'app.synth()' which will emit a "ros template" from this app into the directory specified by 'outdir'.
Initializers
import ros_cdk_core
ros_cdk_core.App(
auto_synth: bool = None,
context: typing.Mapping[str] = None,
outdir: str = None,
runtime_info: bool = None,
stack_traces: bool = None,
tree_metadata: bool = None
)
Name | Type | Description |
---|---|---|
auto_synth |
bool |
Automatically call 'synth()' before the program exits. |
context |
typing.Mapping[str] |
Additional context values for the application. |
outdir |
str |
The output directory into which to emit synthesized artifacts. |
runtime_info |
bool |
Include runtime versioning information. |
stack_traces |
bool |
Include construct creation stack trace. |
tree_metadata |
bool |
Include construct tree metadata as part of the Cloud Assembly. |
auto_synth
Optional
- Type: bool
Automatically call 'synth()' before the program exits.
If you set this, you don't have to call 'synth()' explicitly. Note that this feature is only available for certain programming languages, and calling 'synth()' is still recommended.
Default true if running via CDK CLI ('CDK_OUTDIR' is set), 'false' otherwise
context
Optional
- Type: typing.Mapping[str]
- Default: no additional context
Additional context values for the application.
Context set by the CLI or the 'context' key in 'cdk.json' has precedence.
Context can be read from any construct using 'node.getContext(key)'.
outdir
Optional
- Type: str
The output directory into which to emit synthesized artifacts.
Default - If this value is not set, considers the environment variable 'CDK_OUTDIR'. If 'CDK_OUTDIR' is not defined, uses a temp directory.
runtime_info
Optional
- Type: bool
- Default: true runtime info is included unless related comtext is set.
Include runtime versioning information.
stack_traces
Optional
- Type: bool
- Default: true stack traces are included unless related context is set.
Include construct creation stack trace.
tree_metadata
Optional
- Type: bool
- Default: true
Include construct tree metadata as part of the Cloud Assembly.
Methods
Name | Description |
---|---|
to_string |
Returns a string representation of this construct. |
synthesize |
Allows this construct to emit artifacts into the cloud assembly during synthesis. |
synth |
Synthesize this stage into a cloud assembly. |
to_string
def to_string() -> str
Returns a string representation of this construct.
synthesize
def synthesize(
session: ISynthesisSession
) -> None
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.
- Type: ISynthesisSession
The synthesis session.
synth
def synth(
skip_validation: bool = None
) -> CloudAssembly
Synthesize this stage into a cloud assembly.
Once an assembly has been synthesized, it cannot be modified. Subsequent calls will return the same assembly.
- Type: bool
- Default: false
Should we skip construct validation.
Static Functions
Name | Description |
---|---|
is_construct |
Return whether the given object is a Construct. |
is_stage |
Test whether the given construct is a stage. |
of |
Return the stage this construct is contained with, if available. |
is_app |
Checks if an object is an instance of the 'App' class. |
is_construct
import ros_cdk_core
ros_cdk_core.App.is_construct(
x: typing.Any
)
Return whether the given object is a Construct.
- Type: typing.Any
is_stage
import ros_cdk_core
ros_cdk_core.App.is_stage(
x: typing.Any
)
Test whether the given construct is a stage.
- Type: typing.Any
of
import ros_cdk_core
ros_cdk_core.App.of(
construct: IConstruct
)
Return the stage this construct is contained with, if available.
If called on a nested stage, returns its parent.
- Type: IConstruct
is_app
import ros_cdk_core
ros_cdk_core.App.is_app(
obj: typing.Any
)
Checks if an object is an instance of the 'App' class.
Returns 'true' if 'obj' is an 'App'. Param obj The object to evaluate
- Type: typing.Any
Properties
Name | Type | Description |
---|---|---|
node |
ConstructNode |
The construct tree node associated with this construct. |
artifact_id |
str |
Artifact ID of the assembly if it is a nested stage. The root stage app will return an empty string. |
asset_outdir |
str |
The cloud assembly asset output directory. |
outdir |
str |
The cloud assembly output directory. |
stage_name |
str |
The name of the stage. |
account |
str |
The default account for all resources defined within this stage. |
parent_stage |
Stage |
The parent stage or 'undefined' if this is the app. |
region |
str |
The default region for all resources defined within this stage. |
node
Required
node: ConstructNode
- Type: ConstructNode
The construct tree node associated with this construct.
artifact_id
Required
artifact_id: str
- Type: str
Artifact ID of the assembly if it is a nested stage. The root stage app will return an empty string.
Derived from the construct path.
asset_outdir
Required
asset_outdir: str
- Type: str
The cloud assembly asset output directory.
outdir
Required
outdir: str
- Type: str
The cloud assembly output directory.
stage_name
Required
stage_name: str
- Type: str
The name of the stage.
Based on names of the parent stages separated by hypens.
account
Optional
account: str
- Type: str
The default account for all resources defined within this stage.
parent_stage
Optional
parent_stage: Stage
- Type: Stage
The parent stage or 'undefined' if this is the app.
*
region
Optional
region: str
- Type: str
The default region for all resources defined within this stage.