@aws-cdk/aws-imagebuilder-alpha 2.230.0-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.
package/lib/image.d.ts ADDED
@@ -0,0 +1,339 @@
1
+ import * as cdk from 'aws-cdk-lib';
2
+ import * as ecr from 'aws-cdk-lib/aws-ecr';
3
+ import * as iam from 'aws-cdk-lib/aws-iam';
4
+ import * as logs from 'aws-cdk-lib/aws-logs';
5
+ import { Construct } from 'constructs';
6
+ import { BaseContainerImage, BaseImage } from './base-image';
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
13
+ */
14
+ export interface IImage extends cdk.IResource {
15
+ /**
16
+ * The ARN of the image
17
+ *
18
+ * @attribute
19
+ */
20
+ readonly imageArn: string;
21
+ /**
22
+ * The name of the image
23
+ *
24
+ * @attribute
25
+ */
26
+ readonly imageName: string;
27
+ /**
28
+ * The version of the image
29
+ *
30
+ * @attribute
31
+ */
32
+ readonly imageVersion: string;
33
+ /**
34
+ * Grant custom actions to the given grantee for the image
35
+ *
36
+ * @param grantee The principal
37
+ * @param actions The list of actions
38
+ */
39
+ grant(grantee: iam.IGrantable, ...actions: string[]): iam.Grant;
40
+ /**
41
+ * Grants the default permissions for building an image to the provided execution role.
42
+ *
43
+ * @param grantee The execution role used for the image build.
44
+ */
45
+ grantDefaultExecutionRolePermissions(grantee: iam.IGrantable): iam.Grant[];
46
+ /**
47
+ * Grant read permissions to the given grantee for the image
48
+ *
49
+ * @param grantee The principal
50
+ */
51
+ grantRead(grantee: iam.IGrantable): iam.Grant;
52
+ /**
53
+ * Converts the image to a BaseImage, to use as the parent image in an image recipe
54
+ */
55
+ toBaseImage(): BaseImage;
56
+ /**
57
+ * Converts the image to a ContainerBaseImage, to use as the parent image in a container recipe
58
+ */
59
+ toContainerBaseImage(): BaseContainerImage;
60
+ }
61
+ /**
62
+ * Properties for creating an Image resource
63
+ */
64
+ export interface ImageProps {
65
+ /**
66
+ * The recipe that defines the base image, components, and customizations used to build the image. This can either be
67
+ * an image recipe, or a container recipe.
68
+ */
69
+ readonly recipe: IRecipeBase;
70
+ /**
71
+ * The infrastructure configuration used for building the image.
72
+ *
73
+ * A default infrastructure configuration will be used if one is not provided.
74
+ *
75
+ * The default configuration will create an instance profile and role with minimal permissions needed to build the
76
+ * image, attached to the EC2 instance.
77
+ *
78
+ * IMDSv2 will be required by default on the instances used to build and test the image.
79
+ *
80
+ * @default - an infrastructure configuration will be created with the default settings
81
+ */
82
+ readonly infrastructureConfiguration?: IInfrastructureConfiguration;
83
+ /**
84
+ * The distribution configuration used for distributing the image.
85
+ *
86
+ * @default None
87
+ */
88
+ readonly distributionConfiguration?: IDistributionConfiguration;
89
+ /**
90
+ * The list of workflow configurations used to build the image.
91
+ *
92
+ * @default - Image Builder will use a default set of workflows for the build to build, test, and distribute the
93
+ * image
94
+ */
95
+ readonly workflows?: WorkflowConfiguration[];
96
+ /**
97
+ * The execution role used to perform workflow actions to build the image.
98
+ *
99
+ * By default, the Image Builder Service Linked Role (SLR) will be created automatically and used as the execution
100
+ * role. However, when providing a custom set of image workflows for the image, an execution role will be
101
+ * generated with the minimal permissions needed to execute the workflows.
102
+ *
103
+ * @default - Image Builder will use the SLR if possible. Otherwise, an execution role will be generated
104
+ */
105
+ readonly executionRole?: iam.IRole;
106
+ /**
107
+ * The log group to use for the image. By default, a log group will be created with the format
108
+ * `/aws/imagebuilder/<image-name>`
109
+ *
110
+ * @default - a log group will be created
111
+ */
112
+ readonly logGroup?: logs.ILogGroup;
113
+ /**
114
+ * Indicates whether Image Builder keeps a snapshot of the vulnerability scans that Amazon Inspector runs against the
115
+ * build instance when you create a new image.
116
+ *
117
+ * @default false
118
+ */
119
+ readonly imageScanningEnabled?: boolean;
120
+ /**
121
+ * The container repository that Amazon Inspector scans to identify findings for your container images. If a
122
+ * repository is not provided, Image Builder creates a repository named `image-builder-image-scanning-repository`
123
+ * for vulnerability scanning.
124
+ *
125
+ * @default - if scanning is enabled, a repository will be created by Image Builder if one is not provided
126
+ */
127
+ readonly imageScanningEcrRepository?: ecr.IRepository;
128
+ /**
129
+ * The tags for Image Builder to apply to the output container image that Amazon Inspector scans.
130
+ *
131
+ * @default None
132
+ */
133
+ readonly imageScanningEcrTags?: string[];
134
+ /**
135
+ * If enabled, collects additional information about the image being created, including the operating system (OS)
136
+ * version and package list for the AMI.
137
+ *
138
+ * @default true
139
+ */
140
+ readonly enhancedImageMetadataEnabled?: boolean;
141
+ /**
142
+ * Whether to run tests after building an image.
143
+ *
144
+ * @default true
145
+ */
146
+ readonly imageTestsEnabled?: boolean;
147
+ /**
148
+ * The execution role to use for deleting the image as well as the underlying resources, such as the AMIs, snapshots,
149
+ * and containers. This role should contain resource lifecycle permissions required to delete the underlying
150
+ * AMIs/containers.
151
+ *
152
+ * @default - no execution role. Only the Image Builder image will be deleted.
153
+ */
154
+ readonly deletionExecutionRole?: iam.IRole;
155
+ /**
156
+ * The tags to apply to the image
157
+ *
158
+ * @default None
159
+ */
160
+ readonly tags?: {
161
+ [key: string]: string;
162
+ };
163
+ }
164
+ /**
165
+ * Properties for an EC2 Image Builder image
166
+ */
167
+ export interface ImageAttributes {
168
+ /**
169
+ * The ARN of the image
170
+ *
171
+ * @default - derived from the imageName
172
+ */
173
+ readonly imageArn?: string;
174
+ /**
175
+ * The name of the image
176
+ *
177
+ * @default - derived from the imageArn
178
+ */
179
+ readonly imageName?: string;
180
+ /**
181
+ * The version of the image
182
+ *
183
+ * @default - the latest version of the image, x.x.x
184
+ */
185
+ readonly imageVersion?: string;
186
+ }
187
+ /**
188
+ * The architecture of the image
189
+ */
190
+ export declare enum ImageArchitecture {
191
+ /**
192
+ * 64 bit architecture with the ARM instruction set
193
+ */
194
+ ARM64 = "arm64",
195
+ /**
196
+ * 64 bit architecture with x86 instruction set
197
+ */
198
+ X86_64 = "x86_64"
199
+ }
200
+ /**
201
+ * The type of the image
202
+ */
203
+ export declare enum ImageType {
204
+ /**
205
+ * Indicates the image produced is an AMI
206
+ */
207
+ AMI = "AMI",
208
+ /**
209
+ * Indicates the image produced is a Docker image
210
+ */
211
+ DOCKER = "DOCKER"
212
+ }
213
+ /**
214
+ * A new or imported Image
215
+ */
216
+ declare abstract class ImageBase extends cdk.Resource implements IImage {
217
+ /**
218
+ * The ARN of the image
219
+ */
220
+ abstract readonly imageArn: string;
221
+ /**
222
+ * The name of the image
223
+ */
224
+ abstract readonly imageName: string;
225
+ /**
226
+ * The version of the image
227
+ */
228
+ abstract readonly imageVersion: string;
229
+ /**
230
+ * Grant custom actions to the given grantee for the image
231
+ *
232
+ * @param grantee The principal
233
+ * @param actions The list of actions
234
+ */
235
+ grant(grantee: iam.IGrantable, ...actions: string[]): iam.Grant;
236
+ /**
237
+ * Grants the default permissions for building an image to the provided execution role.
238
+ *
239
+ * @param grantee The execution role used for the image build.
240
+ */
241
+ grantDefaultExecutionRolePermissions(grantee: iam.IGrantable): iam.Grant[];
242
+ /**
243
+ * Grant read permissions to the given grantee for the image
244
+ *
245
+ * @param grantee The principal
246
+ */
247
+ grantRead(grantee: iam.IGrantable): iam.Grant;
248
+ /**
249
+ * Converts the image to a BaseImage, to use as the parent image in an image recipe
250
+ */
251
+ toBaseImage(): BaseImage;
252
+ /**
253
+ * Converts the image to a ContainerBaseImage, to use as the parent image in a container recipe
254
+ */
255
+ toContainerBaseImage(): BaseContainerImage;
256
+ }
257
+ /**
258
+ * Represents an EC2 Image Builder Image.
259
+ *
260
+ * @see https://docs.aws.amazon.com/imagebuilder/latest/userguide/create-images.html
261
+ */
262
+ export declare class Image extends ImageBase {
263
+ /** Uniquely identifies this class. */
264
+ static readonly PROPERTY_INJECTION_ID: string;
265
+ /**
266
+ * Import an existing image given its ARN
267
+ */
268
+ static fromImageArn(scope: Construct, id: string, imageArn: string): IImage;
269
+ /**
270
+ * Import an existing image given its name. The provided name must be normalized by converting all alphabetical
271
+ * characters to lowercase, and replacing all spaces and underscores with hyphens.
272
+ */
273
+ static fromImageName(scope: Construct, id: string, imageName: string): IImage;
274
+ /**
275
+ * Import an existing image by providing its attributes. If the image name is provided as an attribute, it must be
276
+ * normalized by converting all alphabetical characters to lowercase, and replacing all spaces and underscores with
277
+ * hyphens.
278
+ */
279
+ static fromImageAttributes(scope: Construct, id: string, attrs: ImageAttributes): IImage;
280
+ /**
281
+ * Return whether the given object is an Image.
282
+ */
283
+ static isImage(x: any): x is Image;
284
+ /**
285
+ * The ARN of the image
286
+ */
287
+ readonly imageArn: string;
288
+ /**
289
+ * The name of the image
290
+ */
291
+ readonly imageName: string;
292
+ /**
293
+ * The version of the image
294
+ */
295
+ readonly imageVersion: string;
296
+ /**
297
+ * The AMI ID of the EC2 AMI, or URI for the container
298
+ *
299
+ * @attribute
300
+ */
301
+ readonly imageId: string;
302
+ /**
303
+ * The infrastructure configuration used for the image build
304
+ */
305
+ readonly infrastructureConfiguration: IInfrastructureConfiguration;
306
+ /**
307
+ * The execution role used for the image build
308
+ */
309
+ readonly executionRole?: iam.IRole;
310
+ private readonly props;
311
+ constructor(scope: Construct, id: string, props: ImageProps);
312
+ /**
313
+ * Grants the default permissions for building an image to the provided execution role.
314
+ *
315
+ * @param grantee The execution role used for the image build.
316
+ */
317
+ grantDefaultExecutionRolePermissions(grantee: iam.IGrantable): iam.Grant[];
318
+ /**
319
+ * Creates a CfnImage resource from the recipe and props provided.
320
+ *
321
+ * @param props Props input for the construct
322
+ * @private
323
+ */
324
+ private createImageFromRecipe;
325
+ /**
326
+ * Generates the loggingConfiguration property into the `LoggingConfiguration` type in the CloudFormation L1
327
+ * definition.
328
+ *
329
+ * @param props Props input for the construct
330
+ */
331
+ private buildLoggingConfiguration;
332
+ /**
333
+ * Generates the deletionSettings property into the `DeletionSettings` type in the CloudFormation L1 definition.
334
+ *
335
+ * @param props Props input for the construct
336
+ */
337
+ private buildDeletionSettings;
338
+ }
339
+ export {};