UNPKG

3.99 kBTypeScriptView Raw
1import { Construct } from 'constructs';
2import { ICustomSynthesis } from './private/synthesis';
3import { Stage } from './stage';
4/**
5 * Initialization props for apps.
6 */
7export interface AppProps {
8 /**
9 * Automatically call `synth()` before the program exits.
10 *
11 * If you set this, you don't have to call `synth()` explicitly. Note that
12 * this feature is only available for certain programming languages, and
13 * calling `synth()` is still recommended.
14 *
15 * @default true if running via CDK CLI (`CDK_OUTDIR` is set), `false`
16 * otherwise
17 */
18 readonly autoSynth?: boolean;
19 /**
20 * The output directory into which to emit synthesized artifacts.
21 *
22 * You should never need to set this value. By default, the value you pass to
23 * the CLI's `--output` flag will be used, and if you change it to a different
24 * directory the CLI will fail to pick up the generated Cloud Assembly.
25 *
26 * This property is intended for internal and testing use.
27 *
28 * @default - If this value is _not_ set, considers the environment variable `CDK_OUTDIR`.
29 * If `CDK_OUTDIR` is not defined, uses a temp directory.
30 */
31 readonly outdir?: string;
32 /**
33 * Include construct creation stack trace in the `aws:cdk:trace` metadata key of all constructs.
34 * @default true stack traces are included unless `aws:cdk:disable-stack-trace` is set in the context.
35 */
36 readonly stackTraces?: boolean;
37 /**
38 * Include runtime versioning information in the Stacks of this app
39 *
40 * @deprecated use `versionReporting` instead
41 * @default Value of 'aws:cdk:version-reporting' context key
42 */
43 readonly runtimeInfo?: boolean;
44 /**
45 * Include runtime versioning information in the Stacks of this app
46 *
47 * @default Value of 'aws:cdk:version-reporting' context key
48 */
49 readonly analyticsReporting?: boolean;
50 /**
51 * Additional context values for the application.
52 *
53 * Context set by the CLI or the `context` key in `cdk.json` has precedence.
54 *
55 * Context can be read from any construct using `node.getContext(key)`.
56 *
57 * @default - no additional context
58 */
59 readonly context?: {
60 [key: string]: any;
61 };
62 /**
63 * Include construct tree metadata as part of the Cloud Assembly.
64 *
65 * @default true
66 */
67 readonly treeMetadata?: boolean;
68}
69/**
70 * A construct which represents an entire CDK app. This construct is normally
71 * the root of the construct tree.
72 *
73 * You would normally define an `App` instance in your program's entrypoint,
74 * then define constructs where the app is used as the parent scope.
75 *
76 * After all the child constructs are defined within the app, you should call
77 * `app.synth()` which will emit a "cloud assembly" from this app into the
78 * directory specified by `outdir`. Cloud assemblies includes artifacts such as
79 * CloudFormation templates and assets that are needed to deploy this app into
80 * the AWS cloud.
81 *
82 * @see https://docs.aws.amazon.com/cdk/latest/guide/apps.html
83 */
84export declare class App extends Stage {
85 /**
86 * Checks if an object is an instance of the `App` class.
87 * @returns `true` if `obj` is an `App`.
88 * @param obj The object to evaluate
89 */
90 static isApp(obj: any): obj is App;
91 /**
92 * Initializes a CDK application.
93 * @param props initialization properties
94 */
95 constructor(props?: AppProps);
96 private loadContext;
97}
98/**
99 * Add a custom synthesis for the given construct
100 *
101 * When the construct is being synthesized, this allows it to add additional items
102 * into the Cloud Assembly output.
103 *
104 * This feature is intended for use by official AWS CDK libraries only; 3rd party
105 * library authors and CDK users should not use this function. That's why it's not
106 * exposed via jsii.
107 */
108export declare function attachCustomSynthesis(construct: Construct, synthesis: ICustomSynthesis): void;