generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 81
Expand file tree
/
Copy pathindex.ts
More file actions
274 lines (235 loc) · 6.49 KB
/
index.ts
File metadata and controls
274 lines (235 loc) · 6.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
import { StackActivityProgress } from '../../api/aws-cdk';
import type { StackSelector } from '../../api/cloud-assembly';
export type DeploymentMethod = DirectDeploymentMethod | ChangeSetDeploymentMethod;
export interface DirectDeploymentMethod {
/**
* Use stack APIs to the deploy stack changes
*/
readonly method: 'direct';
}
export interface ChangeSetDeploymentMethod {
/**
* Use change-set APIS to deploy a stack changes
*/
readonly method: 'change-set';
/**
* Whether to execute the changeset or leave it in review.
*
* @default true
*/
readonly execute?: boolean;
/**
* Optional name to use for the CloudFormation change set.
* If not provided, a name will be generated automatically.
*/
readonly changeSetName?: string;
}
/**
* When to build assets
*/
export enum AssetBuildTime {
/**
* Build all assets before deploying the first stack
*
* This is intended for expensive Docker image builds; so that if the Docker image build
* fails, no stacks are unnecessarily deployed (with the attendant wait time).
*/
ALL_BEFORE_DEPLOY = 'all-before-deploy',
/**
* Build assets just-in-time, before publishing
*/
JUST_IN_TIME = 'just-in-time',
}
export interface Tag {
readonly Key: string;
readonly Value: string;
}
export enum RequireApproval {
NEVER = 'never',
ANY_CHANGE = 'any-change',
BROADENING = 'broadening',
}
export enum HotswapMode {
/**
* Will fall back to CloudFormation when a non-hotswappable change is detected
*/
FALL_BACK = 'fall-back',
/**
* Will not fall back to CloudFormation when a non-hotswappable change is detected
*/
HOTSWAP_ONLY = 'hotswap-only',
/**
* Will not attempt to hotswap anything and instead go straight to CloudFormation
*/
FULL_DEPLOYMENT = 'full-deployment',
}
export class StackParameters {
/**
* Use only existing parameters on the stack.
*/
public static onlyExisting() {
return new StackParameters({}, true);
}
/**
* Use exactly these parameters and remove any other existing parameters from the stack.
*/
public static exactly(params: { [name: string]: string | undefined }) {
return new StackParameters(params, false);
}
/**
* Define additional parameters for the stack, while keeping existing parameters for unspecified values.
*/
public static withExisting(params: { [name: string]: string | undefined }) {
return new StackParameters(params, true);
}
public readonly parameters: Map<string, string | undefined>;
public readonly keepExistingParameters: boolean;
private constructor(params: { [name: string]: string | undefined }, usePreviousParameters = true) {
this.keepExistingParameters = usePreviousParameters;
this.parameters = new Map(Object.entries(params));
}
}
export interface BaseDeployOptions {
/**
* Criteria for selecting stacks to deploy
*
* @default - all stacks
*/
readonly stacks?: StackSelector;
/**
* Role to pass to CloudFormation for deployment
*/
readonly roleArn?: string;
/**
* @TODO can this be part of `DeploymentMethod`
*
* Always deploy, even if templates are identical.
*
* @default false
* @deprecated
*/
readonly force?: boolean;
/**
* Deployment method
*/
readonly deploymentMethod?: DeploymentMethod;
/**
* @TODO can this be part of `DeploymentMethod`
*
* Whether to perform a 'hotswap' deployment.
* A 'hotswap' deployment will attempt to short-circuit CloudFormation
* and update the affected resources like Lambda functions directly.
*
* @default - no hotswap
*/
readonly hotswap?: HotswapMode;
/**
* Rollback failed deployments
*
* @default true
*/
readonly rollback?: boolean;
/**
* Reuse the assets with the given asset IDs
*/
readonly reuseAssets?: string[];
/**
* Maximum number of simultaneous deployments (dependency permitting) to execute.
* The default is '1', which executes all deployments serially.
*
* @default 1
*/
readonly concurrency?: number;
/**
* Whether to send logs from all CloudWatch log groups in the template
* to the IoHost
*
* @default - false
*/
readonly traceLogs?: boolean;
}
export interface DeployOptions extends BaseDeployOptions {
/**
* ARNs of SNS topics that CloudFormation will notify with stack related events
*/
readonly notificationArns?: string[];
/**
* What kind of security changes require approval
*
* @default RequireApproval.NEVER
*/
readonly requireApproval?: RequireApproval;
/**
* Tags to pass to CloudFormation for deployment
*/
readonly tags?: Tag[];
/**
* Stack parameters for CloudFormation used at deploy time
* @default StackParameters.onlyExisting()
*/
readonly parameters?: StackParameters;
/**
* Path to file where stack outputs will be written after a successful deploy as JSON
* @default - Outputs are not written to any file
*/
readonly outputsFile?: string;
/**
* Build/publish assets for a single stack in parallel
*
* Independent of whether stacks are being done in parallel or no.
*
* @default true
*/
readonly assetParallelism?: boolean;
/**
* When to build assets
*
* The default is the Docker-friendly default.
*
* @default AssetBuildTime.ALL_BEFORE_DEPLOY
*/
readonly assetBuildTime?: AssetBuildTime;
/**
* Change stack watcher output to CI mode.
*
* @deprecated Implement in IoHost instead
*/
readonly ci?: boolean;
/**
* Display mode for stack deployment progress.
*
* @deprecated Implement in IoHost instead
*/
readonly progress?: StackActivityProgress;
/**
* Represents configuration property overrides for hotswap deployments.
* Currently only supported by ECS.
*
* @default - no overrides
*/
readonly hotswapProperties?: HotswapProperties;
}
/**
* Property overrides for ECS hotswaps
*/
export interface EcsHotswapProperties {
/**
* The lower limit on the number of your service's tasks that must remain
* in the RUNNING state during a deployment, as a percentage of the desiredCount.
*/
readonly minimumHealthyPercent: number;
/**
* The upper limit on the number of your service's tasks that are allowed
* in the RUNNING or PENDING state during a deployment, as a percentage of the desiredCount.
*/
readonly maximumHealthyPercent: number;
}
/**
* Property overrides for hotswap deployments.
*/
export interface HotswapProperties {
/**
* ECS specific hotswap property overrides
*/
readonly ecs: EcsHotswapProperties;
}