UNPKG

5.34 kBTypeScriptView Raw
1import { Construct } from 'constructs';
2import { CfnResource } from './cfn-resource';
3import { Duration } from './duration';
4import { RemovalPolicy } from './removal-policy';
5import { Stack } from './stack';
6/**
7 * Initialization props for the `NestedStack` construct.
8 *
9 */
10export interface NestedStackProps {
11 /**
12 * The set value pairs that represent the parameters passed to CloudFormation
13 * when this nested stack is created. Each parameter has a name corresponding
14 * to a parameter defined in the embedded template and a value representing
15 * the value that you want to set for the parameter.
16 *
17 * The nested stack construct will automatically synthesize parameters in order
18 * to bind references from the parent stack(s) into the nested stack.
19 *
20 * @default - no user-defined parameters are passed to the nested stack
21 */
22 readonly parameters?: {
23 [key: string]: string;
24 };
25 /**
26 * The length of time that CloudFormation waits for the nested stack to reach
27 * the CREATE_COMPLETE state.
28 *
29 * When CloudFormation detects that the nested stack has reached the
30 * CREATE_COMPLETE state, it marks the nested stack resource as
31 * CREATE_COMPLETE in the parent stack and resumes creating the parent stack.
32 * If the timeout period expires before the nested stack reaches
33 * CREATE_COMPLETE, CloudFormation marks the nested stack as failed and rolls
34 * back both the nested stack and parent stack.
35 *
36 * @default - no timeout
37 */
38 readonly timeout?: Duration;
39 /**
40 * The Simple Notification Service (SNS) topics to publish stack related
41 * events.
42 *
43 * @default - notifications are not sent for this stack.
44 */
45 readonly notificationArns?: string[];
46 /**
47 * Policy to apply when the nested stack is removed
48 *
49 * The default is `Destroy`, because all Removal Policies of resources inside the
50 * Nested Stack should already have been set correctly. You normally should
51 * not need to set this value.
52 *
53 * @default RemovalPolicy.DESTROY
54 */
55 readonly removalPolicy?: RemovalPolicy;
56}
57/**
58 * A CloudFormation nested stack.
59 *
60 * When you apply template changes to update a top-level stack, CloudFormation
61 * updates the top-level stack and initiates an update to its nested stacks.
62 * CloudFormation updates the resources of modified nested stacks, but does not
63 * update the resources of unmodified nested stacks.
64 *
65 * Furthermore, this stack will not be treated as an independent deployment
66 * artifact (won't be listed in "cdk list" or deployable through "cdk deploy"),
67 * but rather only synthesized as a template and uploaded as an asset to S3.
68 *
69 * Cross references of resource attributes between the parent stack and the
70 * nested stack will automatically be translated to stack parameters and
71 * outputs.
72 *
73 */
74export declare class NestedStack extends Stack {
75 /**
76 * Checks if `x` is an object of type `NestedStack`.
77 */
78 static isNestedStack(x: any): x is NestedStack;
79 readonly templateFile: string;
80 readonly nestedStackResource?: CfnResource;
81 private readonly parameters;
82 private readonly resource;
83 private readonly _contextualStackId;
84 private readonly _contextualStackName;
85 private _templateUrl?;
86 private _parentStack;
87 constructor(scope: Construct, id: string, props?: NestedStackProps);
88 /**
89 * An attribute that represents the name of the nested stack.
90 *
91 * This is a context aware attribute:
92 * - If this is referenced from the parent stack, it will return a token that parses the name from the stack ID.
93 * - If this is referenced from the context of the nested stack, it will return `{ "Ref": "AWS::StackName" }`
94 *
95 * Example value: `mystack-mynestedstack-sggfrhxhum7w`
96 * @attribute
97 */
98 get stackName(): string;
99 /**
100 * An attribute that represents the ID of the stack.
101 *
102 * This is a context aware attribute:
103 * - If this is referenced from the parent stack, it will return `{ "Ref": "LogicalIdOfNestedStackResource" }`.
104 * - If this is referenced from the context of the nested stack, it will return `{ "Ref": "AWS::StackId" }`
105 *
106 * Example value: `arn:aws:cloudformation:us-east-2:123456789012:stack/mystack-mynestedstack-sggfrhxhum7w/f449b250-b969-11e0-a185-5081d0136786`
107 * @attribute
108 */
109 get stackId(): string;
110 /**
111 * Assign a value to one of the nested stack parameters.
112 * @param name The parameter name (ID)
113 * @param value The value to assign
114 */
115 setParameter(name: string, value: string): void;
116 /**
117 * Defines an asset at the parent stack which represents the template of this
118 * nested stack.
119 *
120 * This private API is used by `App.prepare()` within a loop that rectifies
121 * references every time an asset is added. This is because (at the moment)
122 * assets are addressed using CloudFormation parameters.
123 *
124 * @returns `true` if a new asset was added or `false` if an asset was
125 * previously added. When this returns `true`, App will do another reference
126 * rectification cycle.
127 *
128 * @internal
129 */
130 _prepareTemplateAsset(): boolean;
131 private contextualAttribute;
132 private addResourceMetadata;
133}
134
\No newline at end of file