@aws-cdk/aws-imagebuilder-alpha 2.228.0-alpha.0 → 2.229.1-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,337 @@
1
+ import * as cdk from 'aws-cdk-lib';
2
+ import * as ec2 from 'aws-cdk-lib/aws-ec2';
3
+ import * as iam from 'aws-cdk-lib/aws-iam';
4
+ import * as kms from 'aws-cdk-lib/aws-kms';
5
+ import * as s3 from 'aws-cdk-lib/aws-s3';
6
+ import * as s3assets from 'aws-cdk-lib/aws-s3-assets';
7
+ import { Construct } from 'constructs';
8
+ import { BaseContainerImage, ContainerInstanceImage } from './base-image';
9
+ import { Repository } from './distribution-configuration';
10
+ import { IImageRecipe } from './image-recipe';
11
+ import { OSVersion } from './os-version';
12
+ import { ComponentConfiguration, IRecipeBase } from './recipe-base';
13
+ /**
14
+ * An EC2 Image Builder Container Recipe.
15
+ */
16
+ export interface IContainerRecipe extends IRecipeBase {
17
+ /**
18
+ * The ARN of the container recipe
19
+ *
20
+ * @attribute
21
+ */
22
+ readonly containerRecipeArn: string;
23
+ /**
24
+ * The name of the container recipe
25
+ *
26
+ * @attribute
27
+ */
28
+ readonly containerRecipeName: string;
29
+ /**
30
+ * The version of the container recipe
31
+ *
32
+ * @attribute
33
+ */
34
+ readonly containerRecipeVersion: string;
35
+ }
36
+ /**
37
+ * Properties for creating a Container Recipe resource
38
+ */
39
+ export interface ContainerRecipeProps {
40
+ /**
41
+ * The base image for customizations specified in the container recipe.
42
+ */
43
+ readonly baseImage: BaseContainerImage;
44
+ /**
45
+ * The container repository where the output container image is stored.
46
+ */
47
+ readonly targetRepository: Repository;
48
+ /**
49
+ * The name of the container recipe.
50
+ *
51
+ * @default a name is generated
52
+ */
53
+ readonly containerRecipeName?: string;
54
+ /**
55
+ * The version of the container recipe.
56
+ *
57
+ * @default 1.0.x
58
+ */
59
+ readonly containerRecipeVersion?: string;
60
+ /**
61
+ * The description of the container recipe.
62
+ *
63
+ * @default None
64
+ */
65
+ readonly description?: string;
66
+ /**
67
+ * The dockerfile template used to build the container image.
68
+ *
69
+ * @default - a standard dockerfile template will be generated to pull the base image, perform environment setup, and
70
+ * run all components in the recipe
71
+ */
72
+ readonly dockerfile?: DockerfileData;
73
+ /**
74
+ * The list of component configurations to apply in the image build.
75
+ *
76
+ * @default None
77
+ */
78
+ readonly components?: ComponentConfiguration[];
79
+ /**
80
+ * The KMS key used to encrypt the dockerfile template.
81
+ *
82
+ * @default None
83
+ */
84
+ readonly kmsKey?: kms.IKey;
85
+ /**
86
+ * The working directory for use during build and test workflows.
87
+ *
88
+ * @default - the Image Builder default working directory is used. For Linux and macOS builds, this would be /tmp. For
89
+ * Windows builds, this would be C:/
90
+ */
91
+ readonly workingDirectory?: string;
92
+ /**
93
+ * The operating system (OS) version of the base image.
94
+ *
95
+ * @default - Image Builder will determine the OS version of the base image, if sourced from a third-party container
96
+ * registry. Otherwise, the OS version of the base image is required.
97
+ */
98
+ readonly osVersion?: OSVersion;
99
+ /**
100
+ * The block devices to attach to the instance used for building, testing, and distributing the container image.
101
+ *
102
+ * @default the block devices of the instance image will be used
103
+ */
104
+ readonly instanceBlockDevices?: ec2.BlockDevice[];
105
+ /**
106
+ * The image to use to launch the instance used for building, testing, and distributing the container image.
107
+ *
108
+ * @default Image Builder will use the appropriate ECS-optimized AMI
109
+ */
110
+ readonly instanceImage?: ContainerInstanceImage;
111
+ /**
112
+ * The tags to apply to the container recipe
113
+ *
114
+ * @default None
115
+ */
116
+ readonly tags?: {
117
+ [key: string]: string;
118
+ };
119
+ }
120
+ /**
121
+ * The type of the container being used in the container recipe
122
+ */
123
+ export declare enum ContainerType {
124
+ /**
125
+ * Indicates the container recipe uses a Docker container
126
+ */
127
+ DOCKER = "DOCKER"
128
+ }
129
+ /**
130
+ * The rendered Dockerfile value, for use in CloudFormation.
131
+ * - For inline dockerfiles, dockerfileTemplateData is the Dockerfile template text
132
+ * - For S3-backed dockerfiles, dockerfileTemplateUri is the S3 URL
133
+ */
134
+ export interface DockerfileTemplateConfig {
135
+ /**
136
+ * The rendered Dockerfile data, for use in CloudFormation
137
+ *
138
+ * @default - none if dockerfileTemplateUri is set
139
+ */
140
+ readonly dockerfileTemplateData?: string;
141
+ /**
142
+ * The rendered Dockerfile URI, for use in CloudFormation
143
+ *
144
+ * @default - none if dockerfileTemplateData is set
145
+ */
146
+ readonly dockerfileTemplateUri?: string;
147
+ }
148
+ /**
149
+ * Helper class for referencing and uploading dockerfile data for the container recipe
150
+ */
151
+ export declare abstract class DockerfileData {
152
+ /**
153
+ * Uploads dockerfile data from a local file to S3 to use as the dockerfile data
154
+ *
155
+ * @param scope The construct scope
156
+ * @param id Identifier of the construct
157
+ * @param path The local path to the dockerfile data file
158
+ * @param options S3 asset upload options
159
+ */
160
+ static fromAsset(scope: Construct, id: string, path: string, options?: s3assets.AssetOptions): S3DockerfileData;
161
+ /**
162
+ * References dockerfile data from a pre-existing S3 object
163
+ *
164
+ * @param bucket The S3 bucket where the dockerfile data is stored
165
+ * @param key The S3 key of the dockerfile data file
166
+ */
167
+ static fromS3(bucket: s3.IBucket, key: string): S3DockerfileData;
168
+ /**
169
+ * Uses an inline string as the dockerfile data
170
+ *
171
+ * @param data An inline string representing the dockerfile data
172
+ */
173
+ static fromInline(data: string): DockerfileData;
174
+ /**
175
+ * The rendered Dockerfile value, for use in CloudFormation.
176
+ * - For inline dockerfiles, dockerfileTemplateData is the Dockerfile template text
177
+ * - For S3-backed dockerfiles, dockerfileTemplateUri is the S3 URL
178
+ */
179
+ abstract render(): DockerfileTemplateConfig;
180
+ }
181
+ /**
182
+ * Helper class for S3-based dockerfile data references, containing additional permission grant methods on the S3 object
183
+ */
184
+ export declare abstract class S3DockerfileData extends DockerfileData {
185
+ protected readonly bucket: s3.IBucket;
186
+ protected readonly key: string;
187
+ protected constructor(bucket: s3.IBucket, key: string);
188
+ /**
189
+ * The rendered Dockerfile S3 URL, for use in CloudFormation
190
+ */
191
+ render(): DockerfileTemplateConfig;
192
+ /**
193
+ * Grant put permissions to the given grantee for the dockerfile data in S3
194
+ *
195
+ * @param grantee The principal
196
+ */
197
+ grantPut(grantee: iam.IGrantable): iam.Grant;
198
+ /**
199
+ * Grant read permissions to the given grantee for the dockerfile data in S3
200
+ *
201
+ * @param grantee The principal
202
+ */
203
+ grantRead(grantee: iam.IGrantable): iam.Grant;
204
+ }
205
+ /**
206
+ * Properties for an EC2 Image Builder container recipe
207
+ */
208
+ export interface ContainerRecipeAttributes {
209
+ /**
210
+ * The ARN of the container recipe
211
+ *
212
+ * @default - derived from containerRecipeName
213
+ */
214
+ readonly containerRecipeArn?: string;
215
+ /**
216
+ * The name of the container recipe
217
+ *
218
+ * @default - derived from containerRecipeArn
219
+ */
220
+ readonly containerRecipeName?: string;
221
+ /**
222
+ * The version of the container recipe
223
+ *
224
+ * @default - derived from containerRecipeArn. if a containerRecipeName is provided, the latest version, x.x.x, will
225
+ * be used.
226
+ */
227
+ readonly containerRecipeVersion?: string;
228
+ }
229
+ /**
230
+ * A new or imported Container Recipe
231
+ */
232
+ export declare abstract class ContainerRecipeBase extends cdk.Resource implements IContainerRecipe {
233
+ /**
234
+ * The ARN of the container recipe
235
+ */
236
+ abstract readonly containerRecipeArn: string;
237
+ /**
238
+ * The name of the container recipe
239
+ */
240
+ abstract readonly containerRecipeName: string;
241
+ /**
242
+ * The version of the container recipe
243
+ */
244
+ abstract readonly containerRecipeVersion: string;
245
+ /**
246
+ * Grant custom actions to the given grantee for the container recipe
247
+ *
248
+ * @param grantee The principal
249
+ * @param actions The list of actions
250
+ */
251
+ grant(grantee: iam.IGrantable, ...actions: string[]): iam.Grant;
252
+ /**
253
+ * Grant read permissions to the given grantee for the container recipe
254
+ *
255
+ * @param grantee The principal
256
+ */
257
+ grantRead(grantee: iam.IGrantable): iam.Grant;
258
+ /**
259
+ * Indicates whether the recipe is a Container Recipe
260
+ *
261
+ * @internal
262
+ */
263
+ _isContainerRecipe(): this is IContainerRecipe;
264
+ /**
265
+ * Indicates whether the recipe is an Image Recipe
266
+ *
267
+ * @internal
268
+ */
269
+ _isImageRecipe(): this is IImageRecipe;
270
+ }
271
+ /**
272
+ * Represents an EC2 Image Builder Container Recipe.
273
+ *
274
+ * @see https://docs.aws.amazon.com/imagebuilder/latest/userguide/manage-recipes.html
275
+ */
276
+ export declare class ContainerRecipe extends ContainerRecipeBase {
277
+ /** Uniquely identifies this class. */
278
+ static readonly PROPERTY_INJECTION_ID: string;
279
+ /**
280
+ * Import an existing container recipe given its ARN.
281
+ */
282
+ static fromContainerRecipeArn(scope: Construct, id: string, containerRecipeArn: string): IContainerRecipe;
283
+ /**
284
+ * Import the latest version of an existing container recipe given its name. The provided name must be normalized by
285
+ * converting all alphabetical characters to lowercase, and replacing all spaces and underscores with hyphens.
286
+ */
287
+ static fromContainerRecipeName(scope: Construct, id: string, containerRecipeName: string): IContainerRecipe;
288
+ /**
289
+ * Import an existing container recipe by providing its attributes. If the container recipe name is provided as an
290
+ * attribute, it must be normalized by converting all alphabetical characters to lowercase, and replacing all spaces
291
+ * and underscores with hyphens.
292
+ */
293
+ static fromContainerRecipeAttributes(scope: Construct, id: string, attrs: ContainerRecipeAttributes): IContainerRecipe;
294
+ /**
295
+ * Return whether the given object is a ContainerRecipe.
296
+ */
297
+ static isContainerRecipe(x: any): x is ContainerRecipe;
298
+ /**
299
+ * The ARN of the container recipe
300
+ */
301
+ readonly containerRecipeArn: string;
302
+ /**
303
+ * The name of the container recipe
304
+ */
305
+ readonly containerRecipeName: string;
306
+ /**
307
+ * The version of the container recipe
308
+ */
309
+ readonly containerRecipeVersion: string;
310
+ private readonly instanceBlockDevices;
311
+ constructor(scope: Construct, id: string, props: ContainerRecipeProps);
312
+ /**
313
+ * Adds block devices to attach to the instance used for building, testing, and distributing the container image.
314
+ *
315
+ * @param instanceBlockDevices - The list of block devices to attach
316
+ */
317
+ addInstanceBlockDevice(...instanceBlockDevices: ec2.BlockDevice[]): void;
318
+ /**
319
+ * Renders the block devices provided as input to the construct, into the block device mapping structure that
320
+ * CfnContainerRecipe expects to receive.
321
+ *
322
+ * This is rendered at synthesis time, as users can add additional block devices with `addInstanceBlockDevice`, after
323
+ * the construct has been instantiated.
324
+ *
325
+ * @private
326
+ */
327
+ private renderBlockDevices;
328
+ /**
329
+ * Generates the instance configuration property into the `InstanceConfiguration` type in the CloudFormation L1
330
+ * definition.
331
+ *
332
+ * @param props The props passed as input to the construct
333
+ * @private
334
+ */
335
+ private buildInstanceConfiguration;
336
+ private validateContainerRecipeName;
337
+ }