-
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathtypes.ts
More file actions
224 lines (201 loc) · 5.88 KB
/
Copy pathtypes.ts
File metadata and controls
224 lines (201 loc) · 5.88 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
import { AssetHashType, DockerImage } from 'aws-cdk-lib';
import { Architecture } from 'aws-cdk-lib/aws-lambda';
import {
BundlingFileAccess,
BundlingOutput,
DockerVolume,
ILocalBundling,
} from 'aws-cdk-lib/core/lib/bundling';
/**
* Additional docker options when using docker bundling. Default values here inherit
* from `cdk.BundlingOptions`.
*/
export interface DockerOptions {
/**
* The entrypoint to run in the Docker container.
*
* @see https://docs.docker.com/engine/reference/builder/#entrypoint
*
* @default - run the entrypoint defined in the image
*/
readonly entrypoint?: string[];
/**
* The command to run in the Docker container. This is normally controlled by the `RustFunction`
* but can be overridden here.
*
* @default - a cargo lambda compilation
*/
readonly command?: string[];
/**
* Additional Docker volumes to mount.
*
* @default - no additional volumes are mounted
*/
readonly volumes?: DockerVolume[];
/**
* Where to mount the specified volumes from.
*
* @see https://docs.docker.com/engine/reference/commandline/run/#mount-volumes-from-container---volumes-from
*
* @default - no containers are specified to mount volumes from
*/
readonly volumesFrom?: string[];
/**
* Working directory inside the Docker container.
*
* @default /asset-input
*/
readonly workingDirectory?: string;
/**
* The user to use when running the Docker container.
*
* user | user:group | uid | uid:gid | user:gid | uid:group
*
* @see https://docs.docker.com/engine/reference/run/#user
*
* @default - uid:gid of the current user or 1000:1000 on Windows
*/
readonly user?: string;
/**
* Local bundling provider. This is normally controlled by the `RustFunction`
* but can be overridden here.
*
* @default - bundling will be performed locally if Rust and cargo-lambda are
* installed and `forcedDockerBundling` is not true, otherwise it will be performed
* in the docker container
*/
readonly local?: ILocalBundling;
/**
* The type of output that this bundling operation is producing.
*
* @default BundlingOutput.AUTO_DISCOVER
*/
readonly outputType?: BundlingOutput;
/**
* [Security configuration](https://docs.docker.com/engine/reference/run/#security-configuration)
* when running the docker container.
*
* @default - no security options
*/
readonly securityOpt?: string;
/**
* Docker [Networking options](https://docs.docker.com/engine/reference/commandline/run/#connect-a-container-to-a-network---network)
*
* @default - no networking options
*/
readonly network?: string;
/**
* The access mechanism used to make source files available to the bundling container and to return the bundling
* output back to the host.
*
* @default - BundlingFileAccess.BIND_MOUNT
*/
readonly bundlingFileAccess?: BundlingFileAccess;
}
/**
* Bundling options
*/
export interface BundlingOptions {
/**
* Environment variables defined when Cargo runs.
*
* @default - no environment variables are defined.
*/
readonly environment?: { [key: string]: string };
/**
* Force bundling in a Docker container even if local bundling is
* possible.
*
* @default - false
*/
readonly forcedDockerBundling?: boolean;
/**
* A custom bundling Docker image.
*
* @default - use the Docker image provided by calavera/cargo-lambda:latest
*/
readonly dockerImage?: DockerImage;
/**
* Additional options when using docker bundling.
*
* @default - the same defaults as specified by `cdk.BundlingOptions`
*/
readonly dockerOptions?: DockerOptions;
/**
* Determines how the asset hash is calculated. Assets will
* get rebuilt and uploaded only if their hash has changed.
*
* @default - AssetHashType.OUTPUT. If `assetHash` is also specified,
* the default is `CUSTOM`.
*/
readonly assetHashType?: AssetHashType;
/**
* Specify a custom hash for this asset. If `assetHashType` is set it must
* be set to `AssetHashType.CUSTOM`. For consistency, this custom hash will
* be SHA256 hashed and encoded as hex. The resulting hash will be the asset
* hash.
*
* NOTE: the hash is used in order to identify a specific revision of the asset, and
* used for optimizing and caching deployment activities related to this asset such as
* packaging, uploading to Amazon S3, etc. If you chose to customize the hash, you will
* need to make sure it is updated every time the asset changes, or otherwise it is
* possible that some deployments will not be invalidated.
*
* @default - based on `assetHashType`
*/
readonly assetHash?: string;
/**
* Command hooks
*
* @default - do not run additional commands
*/
readonly commandHooks?: ICommandHooks;
/**
* The system architecture of the lambda function
*
* @default - X86_64
*/
readonly architecture?: Architecture;
/**
* Additional list of flags to pass to `cargo lambda build`.
*/
readonly cargoLambdaFlags?: string[];
/**
* Specify the Cargo Build profile to use.
*
* @default - `release`
*/
readonly profile?: string;
}
/**
* Command hooks
*
* These commands will run in the environment in which bundling occurs: inside
* the container for Docker bundling or on the host OS for local bundling.
*
* Commands are chained with `&&`.
*
* ```text
* {
* // Run tests prior to bundling
* beforeBundling(inputDir: string, outputDir: string): string[] {
* return [`cargo test`];
* }
* // ...
* }
* ```
*/
export interface ICommandHooks {
/**
* Returns commands to run before bundling.
*
* Commands are chained with `&&`.
*/
beforeBundling(inputDir: string, outputDir: string): string[];
/**
* Returns commands to run after bundling.
*
* Commands are chained with `&&`.
*/
afterBundling(inputDir: string, outputDir: string): string[];
}