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