aws-cdk 2.1001.0 → 2.1002.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -0
- package/THIRD_PARTY_LICENSES +41 -41
- package/build-info.json +2 -2
- package/lib/api/bootstrap/bootstrap-template.yaml +3 -1
- package/lib/api/deployments/deploy-stack.d.ts +0 -20
- package/lib/api/deployments/deploy-stack.js +25 -20
- package/lib/api/deployments/deployments.d.ts +0 -27
- package/lib/api/deployments/deployments.js +13 -13
- package/lib/api/resource-import/importer.d.ts +0 -8
- package/lib/api/resource-import/importer.js +1 -1
- package/lib/api/resource-import/migrator.js +1 -2
- package/lib/api/stack-events/stack-activity-monitor.d.ts +87 -165
- package/lib/api/stack-events/stack-activity-monitor.js +61 -445
- package/lib/api/stack-events/stack-event-poller.d.ts +6 -0
- package/lib/api/stack-events/stack-event-poller.js +1 -1
- package/lib/api/stack-events/stack-progress-monitor.d.ts +61 -0
- package/lib/api/stack-events/stack-progress-monitor.js +94 -0
- package/lib/api/work-graph/work-graph-builder.js +4 -4
- package/lib/cli/activity-printer/base.d.ts +51 -0
- package/lib/cli/activity-printer/base.js +115 -0
- package/lib/cli/activity-printer/current.d.ts +25 -0
- package/lib/cli/activity-printer/current.js +122 -0
- package/lib/cli/activity-printer/history.d.ts +31 -0
- package/lib/cli/activity-printer/history.js +109 -0
- package/lib/cli/activity-printer/index.d.ts +3 -0
- package/lib/cli/activity-printer/index.js +20 -0
- package/lib/cli/cdk-toolkit.d.ts +1 -1
- package/lib/cli/cdk-toolkit.js +10 -9
- package/lib/cli/cli-config.js +5 -4
- package/lib/cli/cli.js +3 -1
- package/lib/cli/convert-to-user-input.js +18 -16
- package/lib/cli/parse-command-line-arguments.js +7 -1
- package/lib/cli/user-input.d.ts +8 -0
- package/lib/cli/user-input.js +1 -1
- package/lib/commands/deploy.d.ts +13 -0
- package/lib/commands/deploy.js +18 -0
- package/lib/context-providers/cc-api-provider.js +2 -2
- package/lib/index.js +18101 -16933
- package/lib/init.d.ts +5 -1
- package/lib/init.js +11 -8
- package/lib/legacy-exports-source.d.ts +1 -1
- package/lib/legacy-exports-source.js +2 -2
- package/lib/notices.js +2 -2
- package/lib/toolkit/cli-io-host.d.ts +28 -0
- package/lib/toolkit/cli-io-host.js +74 -2
- package/lib/toolkit/error.d.ts +1 -44
- package/lib/toolkit/error.js +16 -76
- package/lib/util/cloudformation.d.ts +12 -0
- package/lib/util/cloudformation.js +27 -1
- package/lib/util/string-manipulation.d.ts +5 -1
- package/lib/util/string-manipulation.js +11 -5
- package/package.json +25 -24
- /package/lib/{api/stack-events → cli/activity-printer}/display.d.ts +0 -0
- /package/lib/{api/stack-events → cli/activity-printer}/display.js +0 -0
|
@@ -1,62 +1,88 @@
|
|
|
1
1
|
import { type MetadataEntry } from '@aws-cdk/cloud-assembly-schema';
|
|
2
2
|
import type { CloudFormationStackArtifact } from '@aws-cdk/cx-api';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { StackEvent } from '@aws-sdk/client-cloudformation';
|
|
4
|
+
import { IoMessaging } from '../../toolkit/cli-io-host';
|
|
5
5
|
import type { ICloudFormationClient } from '../aws-auth';
|
|
6
|
-
|
|
6
|
+
import { StackProgress } from './stack-progress-monitor';
|
|
7
|
+
/**
|
|
8
|
+
* Payload when stack monitoring is starting or stopping for a given stack deployment.
|
|
9
|
+
*/
|
|
10
|
+
export interface StackMonitoringControlEvent {
|
|
11
|
+
/**
|
|
12
|
+
* A unique identifier for a specific stack deployment.
|
|
13
|
+
*
|
|
14
|
+
* Use this value to attribute stack activities received for concurrent deployments.
|
|
15
|
+
*/
|
|
16
|
+
readonly deployment: string;
|
|
17
|
+
/**
|
|
18
|
+
* The stack artifact that is getting deployed
|
|
19
|
+
*/
|
|
20
|
+
readonly stack: CloudFormationStackArtifact;
|
|
21
|
+
/**
|
|
22
|
+
* The name of the Stack that is getting deployed
|
|
23
|
+
*/
|
|
24
|
+
readonly stackName: string;
|
|
25
|
+
/**
|
|
26
|
+
* Total number of resources taking part in this deployment
|
|
27
|
+
*
|
|
28
|
+
* The number might not always be known or accurate.
|
|
29
|
+
* Only use for informational purposes and handle the case when it's unavailable.
|
|
30
|
+
*/
|
|
31
|
+
readonly resourcesTotal?: number;
|
|
32
|
+
}
|
|
33
|
+
export interface StackActivity {
|
|
34
|
+
/**
|
|
35
|
+
* A unique identifier for a specific stack deployment.
|
|
36
|
+
*
|
|
37
|
+
* Use this value to attribute stack activities received for concurrent deployments.
|
|
38
|
+
*/
|
|
39
|
+
readonly deployment: string;
|
|
40
|
+
/**
|
|
41
|
+
* The Stack Event as received from CloudFormation
|
|
42
|
+
*/
|
|
43
|
+
readonly event: StackEvent;
|
|
44
|
+
/**
|
|
45
|
+
* Additional resource metadata
|
|
46
|
+
*/
|
|
7
47
|
readonly metadata?: ResourceMetadata;
|
|
48
|
+
/**
|
|
49
|
+
* The stack progress
|
|
50
|
+
*/
|
|
51
|
+
readonly progress: StackProgress;
|
|
8
52
|
}
|
|
9
53
|
export interface ResourceMetadata {
|
|
10
54
|
entry: MetadataEntry;
|
|
11
55
|
constructPath: string;
|
|
12
56
|
}
|
|
13
|
-
|
|
14
|
-
* Supported display modes for stack deployment activity
|
|
15
|
-
*/
|
|
16
|
-
export declare enum StackActivityProgress {
|
|
57
|
+
export interface StackActivityMonitorProps {
|
|
17
58
|
/**
|
|
18
|
-
*
|
|
59
|
+
* The CloudFormation client
|
|
19
60
|
*/
|
|
20
|
-
|
|
61
|
+
readonly cfn: ICloudFormationClient;
|
|
21
62
|
/**
|
|
22
|
-
*
|
|
63
|
+
* The IoHost used for messaging
|
|
23
64
|
*/
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
export interface WithDefaultPrinterProps {
|
|
65
|
+
readonly ioHost: IoMessaging['ioHost'];
|
|
27
66
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* Used to calculate a progress bar.
|
|
31
|
-
*
|
|
32
|
-
* @default - No progress reporting.
|
|
67
|
+
* The current ToolkitAction
|
|
33
68
|
*/
|
|
34
|
-
readonly
|
|
69
|
+
readonly action: IoMessaging['action'];
|
|
35
70
|
/**
|
|
36
|
-
* The
|
|
37
|
-
*
|
|
38
|
-
* If verbose or trace is requested, we'll always use the full history printer.
|
|
39
|
-
*
|
|
40
|
-
* @default - Use value from logging.logLevel
|
|
71
|
+
* The stack artifact that is getting deployed
|
|
41
72
|
*/
|
|
42
|
-
readonly
|
|
73
|
+
readonly stack: CloudFormationStackArtifact;
|
|
43
74
|
/**
|
|
44
|
-
*
|
|
45
|
-
* resource currently being deployed
|
|
46
|
-
*
|
|
47
|
-
* If not set, the stack history with all stack events will be displayed
|
|
48
|
-
*
|
|
49
|
-
* @default false
|
|
75
|
+
* The name of the Stack that is getting deployed
|
|
50
76
|
*/
|
|
51
|
-
|
|
77
|
+
readonly stackName: string;
|
|
52
78
|
/**
|
|
53
|
-
*
|
|
79
|
+
* Total number of resources to update
|
|
54
80
|
*
|
|
55
|
-
*
|
|
81
|
+
* Used to calculate a progress bar.
|
|
56
82
|
*
|
|
57
|
-
* @default
|
|
83
|
+
* @default - No progress reporting.
|
|
58
84
|
*/
|
|
59
|
-
readonly
|
|
85
|
+
readonly resourcesTotal?: number;
|
|
60
86
|
/**
|
|
61
87
|
* Creation time of the change set
|
|
62
88
|
*
|
|
@@ -69,21 +95,28 @@ export interface WithDefaultPrinterProps {
|
|
|
69
95
|
* @default - local machine's current time
|
|
70
96
|
*/
|
|
71
97
|
readonly changeSetCreationTime?: Date;
|
|
98
|
+
/**
|
|
99
|
+
* Time to wait between fetching new activities.
|
|
100
|
+
*
|
|
101
|
+
* Must wait a reasonable amount of time between polls, since we need to consider CloudFormation API limits
|
|
102
|
+
*
|
|
103
|
+
* @default 2_000
|
|
104
|
+
*/
|
|
105
|
+
readonly pollingInterval?: number;
|
|
72
106
|
}
|
|
73
107
|
export declare class StackActivityMonitor {
|
|
74
|
-
private readonly stackName;
|
|
75
|
-
private readonly printer;
|
|
76
|
-
private readonly stack?;
|
|
77
108
|
/**
|
|
78
|
-
*
|
|
109
|
+
* The poller used to read stack events
|
|
79
110
|
*/
|
|
80
|
-
|
|
111
|
+
private readonly poller;
|
|
81
112
|
/**
|
|
82
|
-
*
|
|
113
|
+
* Fetch new activity every 1 second
|
|
114
|
+
* Printers can decide to update a view less frequently if desired
|
|
83
115
|
*/
|
|
84
|
-
readonly
|
|
116
|
+
private readonly pollingInterval;
|
|
85
117
|
readonly errors: string[];
|
|
86
|
-
private
|
|
118
|
+
private monitorId?;
|
|
119
|
+
private readonly progressMonitor;
|
|
87
120
|
/**
|
|
88
121
|
* Current tick timer
|
|
89
122
|
*/
|
|
@@ -92,8 +125,12 @@ export declare class StackActivityMonitor {
|
|
|
92
125
|
* Set to the activity of reading the current events
|
|
93
126
|
*/
|
|
94
127
|
private readPromise?;
|
|
95
|
-
|
|
96
|
-
|
|
128
|
+
private readonly ioHost;
|
|
129
|
+
private readonly action;
|
|
130
|
+
private readonly stackName;
|
|
131
|
+
private readonly stack;
|
|
132
|
+
constructor({ cfn, ioHost, action, stack, stackName, resourcesTotal, changeSetCreationTime, pollingInterval, }: StackActivityMonitorProps);
|
|
133
|
+
start(): Promise<this>;
|
|
97
134
|
stop(): Promise<void>;
|
|
98
135
|
private scheduleNextTick;
|
|
99
136
|
private tick;
|
|
@@ -113,125 +150,10 @@ export declare class StackActivityMonitor {
|
|
|
113
150
|
* reached the last page.
|
|
114
151
|
*/
|
|
115
152
|
private finalPollToEnd;
|
|
116
|
-
private checkForErrors;
|
|
117
|
-
private simplifyConstructPath;
|
|
118
|
-
}
|
|
119
|
-
interface PrinterProps {
|
|
120
|
-
/**
|
|
121
|
-
* Total resources to deploy
|
|
122
|
-
*/
|
|
123
|
-
readonly resourcesTotal?: number;
|
|
124
153
|
/**
|
|
125
|
-
*
|
|
126
|
-
*/
|
|
127
|
-
readonly resourceTypeColumnWidth: number;
|
|
128
|
-
/**
|
|
129
|
-
* Stream to write to
|
|
130
|
-
*/
|
|
131
|
-
readonly stream: NodeJS.WriteStream;
|
|
132
|
-
}
|
|
133
|
-
export interface IActivityPrinter {
|
|
134
|
-
readonly updateSleep: number;
|
|
135
|
-
addActivity(activity: StackActivity): void;
|
|
136
|
-
print(): void;
|
|
137
|
-
start(): void;
|
|
138
|
-
stop(): void;
|
|
139
|
-
}
|
|
140
|
-
declare abstract class ActivityPrinterBase implements IActivityPrinter {
|
|
141
|
-
protected readonly props: PrinterProps;
|
|
142
|
-
/**
|
|
143
|
-
* Fetch new activity every 5 seconds
|
|
144
|
-
*/
|
|
145
|
-
readonly updateSleep: number;
|
|
146
|
-
/**
|
|
147
|
-
* A list of resource IDs which are currently being processed
|
|
148
|
-
*/
|
|
149
|
-
protected resourcesInProgress: Record<string, StackActivity>;
|
|
150
|
-
/**
|
|
151
|
-
* Previous completion state observed by logical ID
|
|
152
|
-
*
|
|
153
|
-
* We use this to detect that if we see a DELETE_COMPLETE after a
|
|
154
|
-
* CREATE_COMPLETE, it's actually a rollback and we should DECREASE
|
|
155
|
-
* resourcesDone instead of increase it
|
|
154
|
+
* Formats a stack activity into a basic string
|
|
156
155
|
*/
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
*/
|
|
161
|
-
protected resourcesDone: number;
|
|
162
|
-
/**
|
|
163
|
-
* How many digits we need to represent the total count (for lining up the status reporting)
|
|
164
|
-
*/
|
|
165
|
-
protected readonly resourceDigits: number;
|
|
166
|
-
protected readonly resourcesTotal?: number;
|
|
167
|
-
protected rollingBack: boolean;
|
|
168
|
-
protected readonly failures: StackActivity[];
|
|
169
|
-
protected hookFailureMap: Map<string, Map<string, string>>;
|
|
170
|
-
constructor(props: PrinterProps);
|
|
171
|
-
failureReason(activity: StackActivity): string;
|
|
172
|
-
addActivity(activity: StackActivity): void;
|
|
173
|
-
abstract print(): void;
|
|
174
|
-
start(): void;
|
|
175
|
-
stop(): void;
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* Activity Printer which shows a full log of all CloudFormation events
|
|
179
|
-
*
|
|
180
|
-
* When there hasn't been activity for a while, it will print the resources
|
|
181
|
-
* that are currently in progress, to show what's holding up the deployment.
|
|
182
|
-
*/
|
|
183
|
-
export declare class HistoryActivityPrinter extends ActivityPrinterBase {
|
|
184
|
-
/**
|
|
185
|
-
* Last time we printed something to the console.
|
|
186
|
-
*
|
|
187
|
-
* Used to measure timeout for progress reporting.
|
|
188
|
-
*/
|
|
189
|
-
private lastPrintTime;
|
|
190
|
-
/**
|
|
191
|
-
* Number of ms of change absence before we tell the user about the resources that are currently in progress.
|
|
192
|
-
*/
|
|
193
|
-
private readonly inProgressDelay;
|
|
194
|
-
private readonly printable;
|
|
195
|
-
constructor(props: PrinterProps);
|
|
196
|
-
addActivity(activity: StackActivity): void;
|
|
197
|
-
print(): void;
|
|
198
|
-
stop(): void;
|
|
199
|
-
private printOne;
|
|
200
|
-
/**
|
|
201
|
-
* Report the current progress as a [34/42] string, or just [34] if the total is unknown
|
|
202
|
-
*/
|
|
203
|
-
private progress;
|
|
204
|
-
/**
|
|
205
|
-
* If some resources are taking a while to create, notify the user about what's currently in progress
|
|
206
|
-
*/
|
|
207
|
-
private printInProgress;
|
|
208
|
-
}
|
|
209
|
-
/**
|
|
210
|
-
* Activity Printer which shows the resources currently being updated
|
|
211
|
-
*
|
|
212
|
-
* It will continuously reupdate the terminal and show only the resources
|
|
213
|
-
* that are currently being updated, in addition to a progress bar which
|
|
214
|
-
* shows how far along the deployment is.
|
|
215
|
-
*
|
|
216
|
-
* Resources that have failed will always be shown, and will be recapitulated
|
|
217
|
-
* along with their stack trace when the monitoring ends.
|
|
218
|
-
*
|
|
219
|
-
* Resources that failed deployment because they have been cancelled are
|
|
220
|
-
* not included.
|
|
221
|
-
*/
|
|
222
|
-
export declare class CurrentActivityPrinter extends ActivityPrinterBase {
|
|
223
|
-
/**
|
|
224
|
-
* This looks very disorienting sleeping for 5 seconds. Update quicker.
|
|
225
|
-
*/
|
|
226
|
-
readonly updateSleep: number;
|
|
227
|
-
private oldLogThreshold;
|
|
228
|
-
private readonly stream;
|
|
229
|
-
private block;
|
|
230
|
-
constructor(props: PrinterProps);
|
|
231
|
-
print(): void;
|
|
232
|
-
start(): void;
|
|
233
|
-
stop(): void;
|
|
234
|
-
private progressBar;
|
|
235
|
-
private failureReasonOnNextLine;
|
|
156
|
+
private formatActivity;
|
|
157
|
+
private checkForErrors;
|
|
158
|
+
private simplifyConstructPath;
|
|
236
159
|
}
|
|
237
|
-
export {};
|