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 com.aliyun.ros.cdk.core.App;
App.Builder.create()
// .autoSynth(java.lang.Boolean)
// .context(java.util.Map<java.lang.String, java.lang.String>)
// .outdir(java.lang.String)
// .runtimeInfo(java.lang.Boolean)
// .stackTraces(java.lang.Boolean)
// .treeMetadata(java.lang.Boolean)
.build();
Name | Type | Description |
---|---|---|
autoSynth |
java.lang.Boolean |
Automatically call 'synth()' before the program exits. |
context |
java.util.Map |
Additional context values for the application. |
outdir |
java.lang.String |
The output directory into which to emit synthesized artifacts. |
runtimeInfo |
java.lang.Boolean |
Include runtime versioning information. |
stackTraces |
java.lang.Boolean |
Include construct creation stack trace. |
treeMetadata |
java.lang.Boolean |
Include construct tree metadata as part of the Cloud Assembly. |
autoSynth
Optional
- Type: java.lang.Boolean
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: java.util.Map
- 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: java.lang.String
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.
runtimeInfo
Optional
- Type: java.lang.Boolean
- Default: true runtime info is included unless related comtext is set.
Include runtime versioning information.
stackTraces
Optional
- Type: java.lang.Boolean
- Default: true stack traces are included unless related context is set.
Include construct creation stack trace.
treeMetadata
Optional
- Type: java.lang.Boolean
- Default: true
Include construct tree metadata as part of the Cloud Assembly.
Methods
Name | Description |
---|---|
toString |
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. |
toString
public java.lang.String toString()
Returns a string representation of this construct.
synthesize
public void synthesize(ISynthesisSession 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.
- Type: ISynthesisSession
The synthesis session.
synth
public CloudAssembly synth()
public CloudAssembly synth(StageSynthesisOptions options)
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: StageSynthesisOptions
Static Functions
Name | Description |
---|---|
isConstruct |
Return whether the given object is a Construct. |
isStage |
Test whether the given construct is a stage. |
of |
Return the stage this construct is contained with, if available. |
isApp |
Checks if an object is an instance of the 'App' class. |
isConstruct
import com.aliyun.ros.cdk.core.App;
App.isConstruct(java.lang.Object x)
Return whether the given object is a Construct.
- Type: java.lang.Object
isStage
import com.aliyun.ros.cdk.core.App;
App.isStage(java.lang.Object x)
Test whether the given construct is a stage.
- Type: java.lang.Object
of
import com.aliyun.ros.cdk.core.App;
App.of(IConstruct construct)
Return the stage this construct is contained with, if available.
If called on a nested stage, returns its parent.
- Type: IConstruct
isApp
import com.aliyun.ros.cdk.core.App;
App.isApp(java.lang.Object obj)
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: java.lang.Object
Properties
Name | Type | Description |
---|---|---|
node |
ConstructNode |
The construct tree node associated with this construct. |
artifactId |
java.lang.String |
Artifact ID of the assembly if it is a nested stage. The root stage app will return an empty string. |
assetOutdir |
java.lang.String |
The cloud assembly asset output directory. |
outdir |
java.lang.String |
The cloud assembly output directory. |
stageName |
java.lang.String |
The name of the stage. |
account |
java.lang.String |
The default account for all resources defined within this stage. |
parentStage |
Stage |
The parent stage or 'undefined' if this is the app. |
region |
java.lang.String |
The default region for all resources defined within this stage. |
node
Required
public ConstructNode getNode();
- Type: ConstructNode
The construct tree node associated with this construct.
artifactId
Required
public java.lang.String getArtifactId();
- Type: java.lang.String
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.
assetOutdir
Required
public java.lang.String getAssetOutdir();
- Type: java.lang.String
The cloud assembly asset output directory.
outdir
Required
public java.lang.String getOutdir();
- Type: java.lang.String
The cloud assembly output directory.
stageName
Required
public java.lang.String getStageName();
- Type: java.lang.String
The name of the stage.
Based on names of the parent stages separated by hypens.
account
Optional
public java.lang.String getAccount();
- Type: java.lang.String
The default account for all resources defined within this stage.
parentStage
Optional
public Stage getParentStage();
- Type: Stage
The parent stage or 'undefined' if this is the app.
*
region
Optional
public java.lang.String getRegion();
- Type: java.lang.String
The default region for all resources defined within this stage.