1 | import * as cxapi from '@aws-cdk/cx-api';
|
2 | import { type DescribeChangeSetCommandOutput, type Parameter, type ResourceIdentifierSummary, type ResourceToImport, type Stack, type Tag } from '@aws-sdk/client-cloudformation';
|
3 | import type { ICloudFormationClient, SdkProvider } from '../aws-auth';
|
4 | import type { Deployments } from './deployments';
|
5 | import { StackStatus } from '../util/cloudformation/stack-status';
|
6 | import { TemplateBodyParameter } from '../util/template-body-parameter';
|
7 | export type ResourcesToImport = ResourceToImport[];
|
8 | export type ResourceIdentifierSummaries = ResourceIdentifierSummary[];
|
9 | export type ResourceIdentifierProperties = Record<string, string>;
|
10 | export type Template = {
|
11 | Parameters?: Record<string, TemplateParameter>;
|
12 | [key: string]: any;
|
13 | };
|
14 | interface TemplateParameter {
|
15 | Type: string;
|
16 | Default?: any;
|
17 | Description?: string;
|
18 | [key: string]: any;
|
19 | }
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 | export declare class CloudFormationStack {
|
27 | private readonly cfn;
|
28 | readonly stackName: string;
|
29 | private readonly stack?;
|
30 | private readonly retrieveProcessedTemplate;
|
31 | static lookup(cfn: ICloudFormationClient, stackName: string, retrieveProcessedTemplate?: boolean): Promise<CloudFormationStack>;
|
32 | |
33 |
|
34 |
|
35 |
|
36 |
|
37 | static doesNotExist(cfn: ICloudFormationClient, stackName: string): CloudFormationStack;
|
38 | |
39 |
|
40 |
|
41 | static fromStaticInformation(cfn: ICloudFormationClient, stackName: string, stack: Stack): CloudFormationStack;
|
42 | private _template;
|
43 | protected constructor(cfn: ICloudFormationClient, stackName: string, stack?: Stack | undefined, retrieveProcessedTemplate?: boolean);
|
44 | /**
|
45 | * Retrieve the stack's deployed template
|
46 | *
|
47 | * Cached, so will only be retrieved once. Will return an empty
|
48 | * structure if the stack does not exist.
|
49 | */
|
50 | template(): Promise<Template>;
|
51 | /**
|
52 | * Whether the stack exists
|
53 | */
|
54 | get exists(): boolean;
|
55 | /**
|
56 | * The stack's ID
|
57 | *
|
58 | * Throws if the stack doesn't exist.
|
59 | */
|
60 | get stackId(): string;
|
61 | /**
|
62 | * The stack's current outputs
|
63 | *
|
64 | * Empty object if the stack doesn't exist
|
65 | */
|
66 | get outputs(): Record<string, string>;
|
67 | /**
|
68 | * The stack's status
|
69 | *
|
70 | * Special status NOT_FOUND if the stack does not exist.
|
71 | */
|
72 | get stackStatus(): StackStatus;
|
73 | /**
|
74 | * The stack's current tags
|
75 | *
|
76 | * Empty list if the stack does not exist
|
77 | */
|
78 | get tags(): Tag[];
|
79 | /**
|
80 | * SNS Topic ARNs that will receive stack events.
|
81 | *
|
82 | * Empty list if the stack does not exist
|
83 | */
|
84 | get notificationArns(): string[];
|
85 | /**
|
86 | * Return the names of all current parameters to the stack
|
87 | *
|
88 | * Empty list if the stack does not exist.
|
89 | */
|
90 | get parameterNames(): string[];
|
91 | /**
|
92 | * Return the names and values of all current parameters to the stack
|
93 | *
|
94 | * Empty object if the stack does not exist.
|
95 | */
|
96 | get parameters(): Record<string, string>;
|
97 | /**
|
98 | * Return the termination protection of the stack
|
99 | */
|
100 | get terminationProtection(): boolean | undefined;
|
101 | private assertExists;
|
102 | }
|
103 | /**
|
104 | * Waits for a ChangeSet to be available for triggering a StackUpdate.
|
105 | *
|
106 | * Will return a changeset that is either ready to be executed or has no changes.
|
107 | * Will throw in other cases.
|
108 | *
|
109 | * @param cfn a CloudFormation client
|
110 | * @param stackName the name of the Stack that the ChangeSet belongs to
|
111 | * @param changeSetName the name of the ChangeSet
|
112 | * @param fetchAll if true, fetches all pages of the ChangeSet before returning.
|
113 | *
|
114 | * @returns the CloudFormation description of the ChangeSet
|
115 | */
|
116 | export declare function waitForChangeSet(cfn: ICloudFormationClient, stackName: string, changeSetName: string, { fetchAll }: {
|
117 | fetchAll: boolean;
|
118 | }): Promise<DescribeChangeSetCommandOutput>;
|
119 | export type PrepareChangeSetOptions = {
|
120 | stack: cxapi.CloudFormationStackArtifact;
|
121 | deployments: Deployments;
|
122 | uuid: string;
|
123 | willExecute: boolean;
|
124 | sdkProvider: SdkProvider;
|
125 | stream: NodeJS.WritableStream;
|
126 | parameters: {
|
127 | [name: string]: string | undefined;
|
128 | };
|
129 | resourcesToImport?: ResourcesToImport;
|
130 | };
|
131 | export type CreateChangeSetOptions = {
|
132 | cfn: ICloudFormationClient;
|
133 | changeSetName: string;
|
134 | willExecute: boolean;
|
135 | exists: boolean;
|
136 | uuid: string;
|
137 | stack: cxapi.CloudFormationStackArtifact;
|
138 | bodyParameter: TemplateBodyParameter;
|
139 | parameters: {
|
140 | [name: string]: string | undefined;
|
141 | };
|
142 | resourcesToImport?: ResourceToImport[];
|
143 | role?: string;
|
144 | };
|
145 |
|
146 |
|
147 |
|
148 | export declare function createDiffChangeSet(options: PrepareChangeSetOptions): Promise<DescribeChangeSetCommandOutput | undefined>;
|
149 |
|
150 |
|
151 |
|
152 |
|
153 |
|
154 |
|
155 |
|
156 |
|
157 | export declare function uploadStackTemplateAssets(stack: cxapi.CloudFormationStackArtifact, deployments: Deployments): Promise<void>;
|
158 | export declare function cleanupOldChangeset(changeSetName: string, stackName: string, cfn: ICloudFormationClient): Promise<void>;
|
159 |
|
160 |
|
161 |
|
162 |
|
163 |
|
164 |
|
165 |
|
166 | export declare function changeSetHasNoChanges(description: DescribeChangeSetCommandOutput): boolean;
|
167 |
|
168 |
|
169 |
|
170 |
|
171 |
|
172 |
|
173 |
|
174 |
|
175 |
|
176 |
|
177 |
|
178 |
|
179 | export declare function waitForStackDelete(cfn: ICloudFormationClient, stackName: string): Promise<CloudFormationStack | undefined>;
|
180 |
|
181 |
|
182 |
|
183 |
|
184 |
|
185 |
|
186 |
|
187 |
|
188 |
|
189 |
|
190 |
|
191 | export declare function waitForStackDeploy(cfn: ICloudFormationClient, stackName: string): Promise<CloudFormationStack | undefined>;
|
192 |
|
193 |
|
194 |
|
195 | export declare function stabilizeStack(cfn: ICloudFormationClient, stackName: string): Promise<CloudFormationStack | undefined>;
|
196 |
|
197 |
|
198 |
|
199 | export declare class TemplateParameters {
|
200 | private readonly params;
|
201 | static fromTemplate(template: Template): TemplateParameters;
|
202 | constructor(params: Record<string, TemplateParameter>);
|
203 | /**
|
204 | * Calculate stack parameters to pass from the given desired parameter values
|
205 | *
|
206 | * Will throw if parameters without a Default value or a Previous value are not
|
207 | * supplied.
|
208 | */
|
209 | supplyAll(updates: Record<string, string | undefined>): ParameterValues;
|
210 | /**
|
211 | * From the template, the given desired values and the current values, calculate the changes to the stack parameters
|
212 | *
|
213 | * Will take into account parameters already set on the template (will emit
|
214 | * 'UsePreviousValue: true' for those unless the value is changed), and will
|
215 | * throw if parameters without a Default value or a Previous value are not
|
216 | * supplied.
|
217 | */
|
218 | updateExisting(updates: Record<string, string | undefined>, previousValues: Record<string, string>): ParameterValues;
|
219 | }
|
220 | /**
|
221 | * The set of parameters we're going to pass to a Stack
|
222 | */
|
223 | export declare class ParameterValues {
|
224 | private readonly formalParams;
|
225 | readonly values: Record<string, string>;
|
226 | readonly apiParameters: Parameter[];
|
227 | constructor(formalParams: Record<string, TemplateParameter>, updates: Record<string, string | undefined>, previousValues?: Record<string, string>);
|
228 | /**
|
229 | * Whether this set of parameter updates will change the actual stack values
|
230 | */
|
231 | hasChanges(currentValues: Record<string, string>): ParameterChanges;
|
232 | }
|
233 | export type ParameterChanges = boolean | 'ssm';
|
234 | export {};
|