UNPKG

2.29 kBTypeScriptView Raw
1import { IBucket, Location } from '@aws-cdk/aws-s3';
2import { AssetOptions } from '@aws-cdk/aws-s3-assets';
3import { Construct } from '@aws-cdk/core';
4/**
5 * Constructs for types of environment files
6 */
7export declare abstract class EnvironmentFile {
8 /**
9 * Loads the environment file from a local disk path.
10 *
11 * @param path Local disk path
12 * @param options
13 */
14 static fromAsset(path: string, options?: AssetOptions): AssetEnvironmentFile;
15 /**
16 * Loads the environment file from an S3 bucket.
17 *
18 * @returns `S3EnvironmentFile` associated with the specified S3 object.
19 * @param bucket The S3 bucket
20 * @param key The object key
21 * @param objectVersion Optional S3 object version
22 */
23 static fromBucket(bucket: IBucket, key: string, objectVersion?: string): S3EnvironmentFile;
24 /**
25 * Called when the container is initialized to allow this object to bind
26 * to the stack.
27 *
28 * @param scope The binding scope
29 */
30 abstract bind(scope: Construct): EnvironmentFileConfig;
31}
32/**
33 * Environment file from a local directory.
34 */
35export declare class AssetEnvironmentFile extends EnvironmentFile {
36 readonly path: string;
37 private readonly options;
38 private asset?;
39 /**
40 * @param path The path to the asset file or directory.
41 * @param options
42 */
43 constructor(path: string, options?: AssetOptions);
44 bind(scope: Construct): EnvironmentFileConfig;
45}
46/**
47 * Environment file from S3.
48 */
49export declare class S3EnvironmentFile extends EnvironmentFile {
50 private key;
51 private objectVersion?;
52 private readonly bucketName;
53 constructor(bucket: IBucket, key: string, objectVersion?: string | undefined);
54 bind(_scope: Construct): EnvironmentFileConfig;
55}
56/**
57 * Configuration for the environment file
58 */
59export interface EnvironmentFileConfig {
60 /**
61 * The type of environment file
62 */
63 readonly fileType: EnvironmentFileType;
64 /**
65 * The location of the environment file in S3
66 */
67 readonly s3Location: Location;
68}
69/**
70 * Type of environment file to be included in the container definition
71 */
72export declare enum EnvironmentFileType {
73 /**
74 * Environment file hosted on S3, referenced by object ARN
75 */
76 S3 = "s3"
77}