@aws-cdk/aws-imagebuilder-alpha 2.229.1-alpha.0 → 2.231.0-alpha.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.
@@ -0,0 +1,465 @@
1
+ import * as cdk from 'aws-cdk-lib';
2
+ import * as ecr from 'aws-cdk-lib/aws-ecr';
3
+ import * as events from 'aws-cdk-lib/aws-events';
4
+ import * as iam from 'aws-cdk-lib/aws-iam';
5
+ import * as logs from 'aws-cdk-lib/aws-logs';
6
+ import { Construct } from 'constructs';
7
+ import { IDistributionConfiguration } from './distribution-configuration';
8
+ import { IInfrastructureConfiguration } from './infrastructure-configuration';
9
+ import { IRecipeBase } from './recipe-base';
10
+ import { WorkflowConfiguration } from './workflow';
11
+ /**
12
+ * An EC2 Image Builder Image Pipeline.
13
+ */
14
+ export interface IImagePipeline extends cdk.IResource {
15
+ /**
16
+ * The ARN of the image pipeline
17
+ *
18
+ * @attribute
19
+ */
20
+ readonly imagePipelineArn: string;
21
+ /**
22
+ * The name of the image pipeline
23
+ *
24
+ * @attribute
25
+ */
26
+ readonly imagePipelineName: string;
27
+ /**
28
+ * Grant custom actions to the given grantee for the image pipeline
29
+ *
30
+ * @param grantee The principal
31
+ * @param actions The list of actions
32
+ */
33
+ grant(grantee: iam.IGrantable, ...actions: string[]): iam.Grant;
34
+ /**
35
+ * Grants the default permissions for building an image to the provided execution role.
36
+ *
37
+ * @param grantee The execution role used for the image build.
38
+ */
39
+ grantDefaultExecutionRolePermissions(grantee: iam.IGrantable): iam.Grant[];
40
+ /**
41
+ * Grant read permissions to the given grantee for the image pipeline
42
+ *
43
+ * @param grantee The principal
44
+ */
45
+ grantRead(grantee: iam.IGrantable): iam.Grant;
46
+ /**
47
+ * Grant permissions to the given grantee to start an execution of the image pipeline
48
+ *
49
+ * @param grantee The principal
50
+ */
51
+ grantStartExecution(grantee: iam.IGrantable): iam.Grant;
52
+ /**
53
+ * Creates an EventBridge rule for Image Builder events.
54
+ *
55
+ * @param id Unique identifier for the rule
56
+ * @param options Configuration options for the event rule
57
+ *
58
+ * @see https://docs.aws.amazon.com/imagebuilder/latest/userguide/integ-eventbridge.html
59
+ */
60
+ onEvent(id: string, options?: events.OnEventOptions): events.Rule;
61
+ /**
62
+ * Creates an EventBridge rule for Image Builder CVE detected events.
63
+ *
64
+ * @param id Unique identifier for the rule
65
+ * @param options Configuration options for the event rule
66
+ *
67
+ * @see https://docs.aws.amazon.com/imagebuilder/latest/userguide/integ-eventbridge.html
68
+ */
69
+ onCVEDetected(id: string, options?: events.OnEventOptions): events.Rule;
70
+ /**
71
+ * Creates an EventBridge rule for Image Builder image state change events.
72
+ *
73
+ * @param id Unique identifier for the rule
74
+ * @param options Configuration options for the event rule
75
+ *
76
+ * @see https://docs.aws.amazon.com/imagebuilder/latest/userguide/integ-eventbridge.html
77
+ */
78
+ onImageBuildStateChange(id: string, options?: events.OnEventOptions): events.Rule;
79
+ /**
80
+ * Creates an EventBridge rule for Image Builder image build completion events.
81
+ *
82
+ * @param id Unique identifier for the rule
83
+ * @param options Configuration options for the event rule
84
+ *
85
+ * @see https://docs.aws.amazon.com/imagebuilder/latest/userguide/integ-eventbridge.html
86
+ */
87
+ onImageBuildCompleted(id: string, options?: events.OnEventOptions): events.Rule;
88
+ /**
89
+ * Creates an EventBridge rule for Image Builder image build failure events.
90
+ *
91
+ * @param id Unique identifier for the rule
92
+ * @param options Configuration options for the event rule
93
+ *
94
+ * @see https://docs.aws.amazon.com/imagebuilder/latest/userguide/integ-eventbridge.html
95
+ */
96
+ onImageBuildFailed(id: string, options?: events.OnEventOptions): events.Rule;
97
+ /**
98
+ * Creates an EventBridge rule for Image Builder image success events.
99
+ *
100
+ * @param id Unique identifier for the rule
101
+ * @param options Configuration options for the event rule
102
+ *
103
+ * @see https://docs.aws.amazon.com/imagebuilder/latest/userguide/integ-eventbridge.html
104
+ */
105
+ onImageBuildSucceeded(id: string, options?: events.OnEventOptions): events.Rule;
106
+ /**
107
+ * Creates an EventBridge rule for Image Builder image pipeline automatically disabled events.
108
+ *
109
+ * @param id Unique identifier for the rule
110
+ * @param options Configuration options for the event rule
111
+ *
112
+ * @see https://docs.aws.amazon.com/imagebuilder/latest/userguide/integ-eventbridge.html
113
+ */
114
+ onImagePipelineAutoDisabled(id: string, options?: events.OnEventOptions): events.Rule;
115
+ /**
116
+ * Creates an EventBridge rule for Image Builder wait for action events
117
+ *
118
+ * @param id Unique identifier for the rule
119
+ * @param options Configuration options for the event rule
120
+ *
121
+ * @see https://docs.aws.amazon.com/imagebuilder/latest/userguide/integ-eventbridge.html
122
+ */
123
+ onWaitForAction(id: string, options?: events.OnEventOptions): events.Rule;
124
+ }
125
+ /**
126
+ * Properties for creating an Image Pipeline resource
127
+ */
128
+ export interface ImagePipelineProps {
129
+ /**
130
+ * The recipe that defines the base image, components, and customizations used to build the image. This can either be
131
+ * an image recipe, or a container recipe.
132
+ */
133
+ readonly recipe: IRecipeBase;
134
+ /**
135
+ * The name of the image pipeline.
136
+ *
137
+ * @default - a name is generated
138
+ */
139
+ readonly imagePipelineName?: string;
140
+ /**
141
+ * The description of the image pipeline.
142
+ *
143
+ * @default None
144
+ */
145
+ readonly description?: string;
146
+ /**
147
+ * The schedule of the image pipeline. This configures how often and when a pipeline automatically creates a new
148
+ * image.
149
+ *
150
+ * @default - none, a manual image pipeline will be created
151
+ */
152
+ readonly schedule?: ImagePipelineSchedule;
153
+ /**
154
+ * Indicates whether the pipeline is enabled to be triggered by the provided schedule
155
+ *
156
+ * @default ImagePipelineStatus.ENABLED
157
+ */
158
+ readonly status?: ImagePipelineStatus;
159
+ /**
160
+ * The infrastructure configuration used for building the image.
161
+ *
162
+ * A default infrastructure configuration will be used if one is not provided.
163
+ *
164
+ * The default configuration will create an instance profile and role with minimal permissions needed to build the
165
+ * image, attached to the EC2 instance.
166
+ *
167
+ * @default - an infrastructure configuration will be created with the default settings
168
+ */
169
+ readonly infrastructureConfiguration?: IInfrastructureConfiguration;
170
+ /**
171
+ * The distribution configuration used for distributing the image.
172
+ *
173
+ * @default None
174
+ */
175
+ readonly distributionConfiguration?: IDistributionConfiguration;
176
+ /**
177
+ * The list of workflow configurations used to build the image.
178
+ *
179
+ * @default - Image Builder will use a default set of workflows for the build to build, test, and distribute the image
180
+ */
181
+ readonly workflows?: WorkflowConfiguration[];
182
+ /**
183
+ * The execution role used to perform workflow actions to build this image.
184
+ *
185
+ * By default, the Image Builder Service Linked Role (SLR) will be created automatically and used as the execution
186
+ * role. However, when providing a custom set of image workflows for the pipeline, an execution role will be
187
+ * generated with the minimal permissions needed to execute the workflows.
188
+ *
189
+ * @default - Image Builder will use the SLR if possible. Otherwise, an execution role will be generated
190
+ */
191
+ readonly executionRole?: iam.IRole;
192
+ /**
193
+ * The log group to use for the image pipeline. By default, a log group will be created with the format
194
+ * `/aws/imagebuilder/pipeline/<pipeline-name>`
195
+ *
196
+ * @default - a log group will be created
197
+ */
198
+ readonly imagePipelineLogGroup?: logs.ILogGroup;
199
+ /**
200
+ * The log group to use for images created from the image pipeline. By default, a log group will be created with the
201
+ * format `/aws/imagebuilder/<image-name>`.
202
+ *
203
+ * @default - a log group will be created
204
+ */
205
+ readonly imageLogGroup?: logs.ILogGroup;
206
+ /**
207
+ * Indicates whether Image Builder keeps a snapshot of the vulnerability scans that Amazon Inspector runs against the
208
+ * build instance when you create a new image.
209
+ *
210
+ * @default false
211
+ */
212
+ readonly imageScanningEnabled?: boolean;
213
+ /**
214
+ * The container repository that Amazon Inspector scans to identify findings for your container images. If a
215
+ * repository is not provided, Image Builder creates a repository named `image-builder-image-scanning-repository`
216
+ * for vulnerability scanning.
217
+ *
218
+ * @default - if scanning is enabled, a repository will be created by Image Builder if one is not provided
219
+ */
220
+ readonly imageScanningEcrRepository?: ecr.IRepository;
221
+ /**
222
+ * The tags for Image Builder to apply to the output container image that Amazon Inspector scans.
223
+ *
224
+ * @default None
225
+ */
226
+ readonly imageScanningEcrTags?: string[];
227
+ /**
228
+ * If enabled, collects additional information about the image being created, including the operating system (OS)
229
+ * version and package list for the AMI.
230
+ *
231
+ * @default true
232
+ */
233
+ readonly enhancedImageMetadataEnabled?: boolean;
234
+ /**
235
+ * Whether to run tests after building an image.
236
+ *
237
+ * @default true
238
+ */
239
+ readonly imageTestsEnabled?: boolean;
240
+ /**
241
+ * The tags to apply to the image pipeline
242
+ *
243
+ * @default None
244
+ */
245
+ readonly tags?: {
246
+ [key: string]: string;
247
+ };
248
+ }
249
+ /**
250
+ * The schedule settings for the image pipeline, which defines when a pipeline should be triggered
251
+ */
252
+ export interface ImagePipelineSchedule {
253
+ /**
254
+ * The schedule expression to use. This can either be a cron expression or a rate expression.
255
+ */
256
+ readonly expression: events.Schedule;
257
+ /**
258
+ * The number of consecutive failures allowed before the pipeline is automatically disabled. This value must be
259
+ * between 1 and 10.
260
+ *
261
+ * @default - no auto-disable policy is configured and the pipeline is not automatically disabled on consecutive
262
+ * failures
263
+ */
264
+ readonly autoDisableFailureCount?: number;
265
+ /**
266
+ * The start condition for the pipeline, indicating the condition under which a pipeline should be triggered.
267
+ *
268
+ * @default ScheduleStartCondition.EXPRESSION_MATCH_AND_DEPENDENCY_UPDATES_AVAILABLE
269
+ */
270
+ readonly startCondition?: ScheduleStartCondition;
271
+ }
272
+ /**
273
+ * The start condition for the pipeline, indicating the condition under which a pipeline should be triggered.
274
+ */
275
+ export declare enum ScheduleStartCondition {
276
+ /**
277
+ * Indicates to trigger a pipeline whenever its schedule is met
278
+ */
279
+ EXPRESSION_MATCH_ONLY = "EXPRESSION_MATCH_ONLY",
280
+ /**
281
+ * Indicates to trigger a pipeline whenever its schedule is met, and there are matching dependency updates available,
282
+ * such as new versions of components or images to use in the pipeline build.
283
+ */
284
+ EXPRESSION_MATCH_AND_DEPENDENCY_UPDATES_AVAILABLE = "EXPRESSION_MATCH_AND_DEPENDENCY_UPDATES_AVAILABLE"
285
+ }
286
+ /**
287
+ * Indicates whether the pipeline is enabled to be triggered by the provided schedule
288
+ */
289
+ export declare enum ImagePipelineStatus {
290
+ /**
291
+ * Indicates that the pipeline is enabled for scheduling
292
+ */
293
+ ENABLED = "ENABLED",
294
+ /**
295
+ * Indicates that the pipeline is disabled and will not be triggered on the schedule
296
+ */
297
+ DISABLED = "DISABLED"
298
+ }
299
+ /**
300
+ * A new or imported Image Pipeline
301
+ */
302
+ declare abstract class ImagePipelineBase extends cdk.Resource implements IImagePipeline {
303
+ /**
304
+ * The ARN of the image pipeline
305
+ */
306
+ abstract readonly imagePipelineArn: string;
307
+ /**
308
+ * The name of the image pipeline
309
+ */
310
+ abstract readonly imagePipelineName: string;
311
+ /**
312
+ * Grant custom actions to the given grantee for the image pipeline
313
+ *
314
+ * @param grantee The principal
315
+ * @param actions The list of actions
316
+ */
317
+ grant(grantee: iam.IGrantable, ...actions: string[]): iam.Grant;
318
+ /**
319
+ * Grants the default permissions for building an image to the provided execution role.
320
+ *
321
+ * @param grantee The execution role used for the image build.
322
+ */
323
+ grantDefaultExecutionRolePermissions(grantee: iam.IGrantable): iam.Grant[];
324
+ /**
325
+ * Grant read permissions to the given grantee for the image pipeline
326
+ *
327
+ * @param grantee The principal
328
+ */
329
+ grantRead(grantee: iam.IGrantable): iam.Grant;
330
+ /**
331
+ * Grant permissions to the given grantee to start an execution of the image pipeline
332
+ *
333
+ * @param grantee The principal
334
+ */
335
+ grantStartExecution(grantee: iam.IGrantable): iam.Grant;
336
+ /**
337
+ * Creates an EventBridge rule for Image Builder events.
338
+ *
339
+ * @param id Unique identifier for the rule
340
+ * @param options Configuration options for the event rule
341
+ *
342
+ * @see https://docs.aws.amazon.com/imagebuilder/latest/userguide/integ-eventbridge.html
343
+ */
344
+ onEvent(id: string, options?: events.OnEventOptions): events.Rule;
345
+ /**
346
+ * Creates an EventBridge rule for Image Builder CVE detected events.
347
+ *
348
+ * @param id Unique identifier for the rule
349
+ * @param options Configuration options for the event rule
350
+ *
351
+ * @see https://docs.aws.amazon.com/imagebuilder/latest/userguide/integ-eventbridge.html
352
+ */
353
+ onCVEDetected(id: string, options?: events.OnEventOptions): events.Rule;
354
+ /**
355
+ * Creates an EventBridge rule for Image Builder image state change events.
356
+ *
357
+ * @param id Unique identifier for the rule
358
+ * @param options Configuration options for the event rule
359
+ *
360
+ * @see https://docs.aws.amazon.com/imagebuilder/latest/userguide/integ-eventbridge.html
361
+ */
362
+ onImageBuildStateChange(id: string, options?: events.OnEventOptions): events.Rule;
363
+ /**
364
+ * Creates an EventBridge rule for Image Builder image build completion events.
365
+ *
366
+ * @param id Unique identifier for the rule
367
+ * @param options Configuration options for the event rule
368
+ *
369
+ * @see https://docs.aws.amazon.com/imagebuilder/latest/userguide/integ-eventbridge.html
370
+ */
371
+ onImageBuildCompleted(id: string, options?: events.OnEventOptions): events.Rule;
372
+ /**
373
+ * Creates an EventBridge rule for Image Builder image build failure events.
374
+ *
375
+ * @param id Unique identifier for the rule
376
+ * @param options Configuration options for the event rule
377
+ *
378
+ * @see https://docs.aws.amazon.com/imagebuilder/latest/userguide/integ-eventbridge.html
379
+ */
380
+ onImageBuildFailed(id: string, options?: events.OnEventOptions): events.Rule;
381
+ /**
382
+ * Creates an EventBridge rule for Image Builder image success events.
383
+ *
384
+ * @param id Unique identifier for the rule
385
+ * @param options Configuration options for the event rule
386
+ *
387
+ * @see https://docs.aws.amazon.com/imagebuilder/latest/userguide/integ-eventbridge.html
388
+ */
389
+ onImageBuildSucceeded(id: string, options?: events.OnEventOptions): events.Rule;
390
+ /**
391
+ * Creates an EventBridge rule for Image Builder image pipeline automatically disabled events.
392
+ *
393
+ * @param id Unique identifier for the rule
394
+ * @param options Configuration options for the event rule
395
+ *
396
+ * @see https://docs.aws.amazon.com/imagebuilder/latest/userguide/integ-eventbridge.html
397
+ */
398
+ onImagePipelineAutoDisabled(id: string, options?: events.OnEventOptions): events.Rule;
399
+ /**
400
+ * Creates an EventBridge rule for Image Builder wait for action events
401
+ *
402
+ * @param id Unique identifier for the rule
403
+ * @param options Configuration options for the event rule
404
+ *
405
+ * @see https://docs.aws.amazon.com/imagebuilder/latest/userguide/integ-eventbridge.html
406
+ */
407
+ onWaitForAction(id: string, options?: events.OnEventOptions): events.Rule;
408
+ }
409
+ /**
410
+ * Represents an EC2 Image Builder Image Pipeline.
411
+ *
412
+ * @see https://docs.aws.amazon.com/imagebuilder/latest/userguide/manage-pipelines.html
413
+ */
414
+ export declare class ImagePipeline extends ImagePipelineBase {
415
+ /** Uniquely identifies this class. */
416
+ static readonly PROPERTY_INJECTION_ID: string;
417
+ /**
418
+ * Import an existing image pipeline given its ARN.
419
+ */
420
+ static fromImagePipelineArn(scope: Construct, id: string, imagePipelineArn: string): IImagePipeline;
421
+ /**
422
+ * Import an existing image pipeline given its name. The provided name must be normalized by converting all
423
+ * alphabetical characters to lowercase, and replacing all spaces and underscores with hyphens.
424
+ */
425
+ static fromImagePipelineName(scope: Construct, id: string, imagePipelineName: string): IImagePipeline;
426
+ /**
427
+ * Return whether the given object is an ImagePipeline.
428
+ */
429
+ static isImagePipeline(x: any): x is ImagePipeline;
430
+ /**
431
+ * The ARN of the image pipeline
432
+ */
433
+ readonly imagePipelineArn: string;
434
+ /**
435
+ * The name of the image pipeline
436
+ */
437
+ readonly imagePipelineName: string;
438
+ /**
439
+ * The infrastructure configuration used for the image build
440
+ */
441
+ readonly infrastructureConfiguration: IInfrastructureConfiguration;
442
+ /**
443
+ * The execution role used for the image build. If there is no execution role, then the build will be executed with
444
+ * the AWSServiceRoleForImageBuilder service-linked role.
445
+ */
446
+ readonly executionRole?: iam.IRole;
447
+ private readonly props;
448
+ constructor(scope: Construct, id: string, props: ImagePipelineProps);
449
+ /**
450
+ * Grants the default permissions for building an image to the provided execution role.
451
+ *
452
+ * @param grantee The execution role used for the image build.
453
+ */
454
+ grantDefaultExecutionRolePermissions(grantee: iam.IGrantable): iam.Grant[];
455
+ private validateImagePipelineName;
456
+ private buildSchedule;
457
+ /**
458
+ * Generates the loggingConfiguration property into the `LoggingConfiguration` type in the CloudFormation L1
459
+ * definition.
460
+ *
461
+ * @param props Props input for the construct
462
+ */
463
+ private buildLoggingConfiguration;
464
+ }
465
+ export {};