@ashishpandeyone/cdk-lambda-web-function 0.1.0 → 0.1.1
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/.jsii +589 -87
- package/.jsii.tabl.json +1 -1
- package/API.md +1348 -219
- package/README.md +24 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +2 -1
- package/lib/nodejs-web-function.d.ts +153 -0
- package/lib/nodejs-web-function.js +113 -0
- package/lib/private/bundling.d.ts +68 -0
- package/lib/private/bundling.js +192 -0
- package/lib/web-function-endpoint.js +1 -1
- package/lib/web-function-grants.js +1 -1
- package/lib/web-function.d.ts +24 -19
- package/lib/web-function.js +2 -2
- package/package.json +4 -2
package/API.md
CHANGED
|
@@ -2,48 +2,44 @@
|
|
|
2
2
|
|
|
3
3
|
## Constructs <a name="Constructs" id="Constructs"></a>
|
|
4
4
|
|
|
5
|
-
###
|
|
6
|
-
|
|
7
|
-
- *Implements:* <a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunction">IWebFunction</a>, aws-cdk-lib.aws_iam.IGrantable
|
|
8
|
-
|
|
9
|
-
A Node.js HTTP server running as an AWS Lambda Web Function, served from one or more regions.
|
|
5
|
+
### NodejsWebFunction <a name="NodejsWebFunction" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction"></a>
|
|
10
6
|
|
|
11
|
-
|
|
12
|
-
an HTTPS endpoint, an execution role, and owns the function's log groups in every region.
|
|
7
|
+
A `WebFunction` whose code is bundled from a TypeScript or JavaScript entry file with esbuild, like `NodejsFunction` for Lambda functions.
|
|
13
8
|
|
|
14
|
-
|
|
9
|
+
Besides bundling, it sets what a `lambda.Code` alone can't: the entry point that matches the
|
|
10
|
+
bundle, and `NODE_OPTIONS=--enable-source-maps` when source maps are on.
|
|
15
11
|
|
|
16
|
-
#### Initializers <a name="Initializers" id="@ashishpandeyone/cdk-lambda-web-function.
|
|
12
|
+
#### Initializers <a name="Initializers" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.Initializer"></a>
|
|
17
13
|
|
|
18
14
|
```typescript
|
|
19
|
-
import {
|
|
15
|
+
import { NodejsWebFunction } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
20
16
|
|
|
21
|
-
new
|
|
17
|
+
new NodejsWebFunction(scope: Construct, id: string, props: NodejsWebFunctionProps)
|
|
22
18
|
```
|
|
23
19
|
|
|
24
20
|
| **Name** | **Type** | **Description** |
|
|
25
21
|
| --- | --- | --- |
|
|
26
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.
|
|
27
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.
|
|
28
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.
|
|
22
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.Initializer.parameter.scope">scope</a></code> | <code>constructs.Construct</code> | *No description.* |
|
|
23
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.Initializer.parameter.id">id</a></code> | <code>string</code> | *No description.* |
|
|
24
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.Initializer.parameter.props">props</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps">NodejsWebFunctionProps</a></code> | *No description.* |
|
|
29
25
|
|
|
30
26
|
---
|
|
31
27
|
|
|
32
|
-
##### `scope`<sup>Required</sup> <a name="scope" id="@ashishpandeyone/cdk-lambda-web-function.
|
|
28
|
+
##### `scope`<sup>Required</sup> <a name="scope" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.Initializer.parameter.scope"></a>
|
|
33
29
|
|
|
34
30
|
- *Type:* constructs.Construct
|
|
35
31
|
|
|
36
32
|
---
|
|
37
33
|
|
|
38
|
-
##### `id`<sup>Required</sup> <a name="id" id="@ashishpandeyone/cdk-lambda-web-function.
|
|
34
|
+
##### `id`<sup>Required</sup> <a name="id" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.Initializer.parameter.id"></a>
|
|
39
35
|
|
|
40
36
|
- *Type:* string
|
|
41
37
|
|
|
42
38
|
---
|
|
43
39
|
|
|
44
|
-
##### `props`<sup>Required</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.
|
|
40
|
+
##### `props`<sup>Required</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.Initializer.parameter.props"></a>
|
|
45
41
|
|
|
46
|
-
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.
|
|
42
|
+
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps">NodejsWebFunctionProps</a>
|
|
47
43
|
|
|
48
44
|
---
|
|
49
45
|
|
|
@@ -51,17 +47,17 @@ new WebFunction(scope: Construct, id: string, props: WebFunctionProps)
|
|
|
51
47
|
|
|
52
48
|
| **Name** | **Description** |
|
|
53
49
|
| --- | --- |
|
|
54
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.
|
|
55
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.
|
|
56
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.
|
|
57
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.
|
|
58
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.
|
|
59
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.
|
|
60
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.
|
|
50
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.toString">toString</a></code> | Returns a string representation of this construct. |
|
|
51
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.with">with</a></code> | Applies one or more mixins to this construct. |
|
|
52
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.applyCrossStackReferenceStrength">applyCrossStackReferenceStrength</a></code> | Override the cross-stack reference strength for this resource. |
|
|
53
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.applyRemovalPolicy">applyRemovalPolicy</a></code> | Apply the given removal policy to this resource. |
|
|
54
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addEnvironment">addEnvironment</a></code> | Adds an environment variable. |
|
|
55
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addToRolePolicy">addToRolePolicy</a></code> | Adds a statement to the execution role's policy. |
|
|
56
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.grantInvoke">grantInvoke</a></code> | Allows `grantee` to call the endpoint. |
|
|
61
57
|
|
|
62
58
|
---
|
|
63
59
|
|
|
64
|
-
##### `toString` <a name="toString" id="@ashishpandeyone/cdk-lambda-web-function.
|
|
60
|
+
##### `toString` <a name="toString" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.toString"></a>
|
|
65
61
|
|
|
66
62
|
```typescript
|
|
67
63
|
public toString(): string
|
|
@@ -69,7 +65,7 @@ public toString(): string
|
|
|
69
65
|
|
|
70
66
|
Returns a string representation of this construct.
|
|
71
67
|
|
|
72
|
-
##### `with` <a name="with" id="@ashishpandeyone/cdk-lambda-web-function.
|
|
68
|
+
##### `with` <a name="with" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.with"></a>
|
|
73
69
|
|
|
74
70
|
```typescript
|
|
75
71
|
public with(mixins: ...IMixin[]): IConstruct
|
|
@@ -82,13 +78,13 @@ start of the call, so constructs added by a mixin will not be visited.
|
|
|
82
78
|
Use multiple `with()` calls if subsequent mixins should apply to added
|
|
83
79
|
constructs.
|
|
84
80
|
|
|
85
|
-
###### `mixins`<sup>Required</sup> <a name="mixins" id="@ashishpandeyone/cdk-lambda-web-function.
|
|
81
|
+
###### `mixins`<sup>Required</sup> <a name="mixins" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.with.parameter.mixins"></a>
|
|
86
82
|
|
|
87
83
|
- *Type:* ...constructs.IMixin[]
|
|
88
84
|
|
|
89
85
|
---
|
|
90
86
|
|
|
91
|
-
##### `applyCrossStackReferenceStrength` <a name="applyCrossStackReferenceStrength" id="@ashishpandeyone/cdk-lambda-web-function.
|
|
87
|
+
##### `applyCrossStackReferenceStrength` <a name="applyCrossStackReferenceStrength" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.applyCrossStackReferenceStrength"></a>
|
|
92
88
|
|
|
93
89
|
```typescript
|
|
94
90
|
public applyCrossStackReferenceStrength(strength: ReferenceStrength): void
|
|
@@ -102,7 +98,7 @@ mechanism instead of the global default determined by the
|
|
|
102
98
|
selectively weakening specific references to avoid the "deadly embrace" problem
|
|
103
99
|
without changing the app-wide default.
|
|
104
100
|
|
|
105
|
-
###### `strength`<sup>Required</sup> <a name="strength" id="@ashishpandeyone/cdk-lambda-web-function.
|
|
101
|
+
###### `strength`<sup>Required</sup> <a name="strength" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.applyCrossStackReferenceStrength.parameter.strength"></a>
|
|
106
102
|
|
|
107
103
|
- *Type:* aws-cdk-lib.ReferenceStrength
|
|
108
104
|
|
|
@@ -110,7 +106,7 @@ The reference strength to use for this resource.
|
|
|
110
106
|
|
|
111
107
|
---
|
|
112
108
|
|
|
113
|
-
##### `applyRemovalPolicy` <a name="applyRemovalPolicy" id="@ashishpandeyone/cdk-lambda-web-function.
|
|
109
|
+
##### `applyRemovalPolicy` <a name="applyRemovalPolicy" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.applyRemovalPolicy"></a>
|
|
114
110
|
|
|
115
111
|
```typescript
|
|
116
112
|
public applyRemovalPolicy(policy: RemovalPolicy): void
|
|
@@ -126,13 +122,13 @@ to be replaced.
|
|
|
126
122
|
The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
|
|
127
123
|
account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
|
|
128
124
|
|
|
129
|
-
###### `policy`<sup>Required</sup> <a name="policy" id="@ashishpandeyone/cdk-lambda-web-function.
|
|
125
|
+
###### `policy`<sup>Required</sup> <a name="policy" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.applyRemovalPolicy.parameter.policy"></a>
|
|
130
126
|
|
|
131
127
|
- *Type:* aws-cdk-lib.RemovalPolicy
|
|
132
128
|
|
|
133
129
|
---
|
|
134
130
|
|
|
135
|
-
##### `addEnvironment` <a name="addEnvironment" id="@ashishpandeyone/cdk-lambda-web-function.
|
|
131
|
+
##### `addEnvironment` <a name="addEnvironment" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addEnvironment"></a>
|
|
136
132
|
|
|
137
133
|
```typescript
|
|
138
134
|
public addEnvironment(key: string, value: string): WebFunction
|
|
@@ -142,19 +138,19 @@ Adds an environment variable.
|
|
|
142
138
|
|
|
143
139
|
Names starting with `AWS_` are reserved.
|
|
144
140
|
|
|
145
|
-
###### `key`<sup>Required</sup> <a name="key" id="@ashishpandeyone/cdk-lambda-web-function.
|
|
141
|
+
###### `key`<sup>Required</sup> <a name="key" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addEnvironment.parameter.key"></a>
|
|
146
142
|
|
|
147
143
|
- *Type:* string
|
|
148
144
|
|
|
149
145
|
---
|
|
150
146
|
|
|
151
|
-
###### `value`<sup>Required</sup> <a name="value" id="@ashishpandeyone/cdk-lambda-web-function.
|
|
147
|
+
###### `value`<sup>Required</sup> <a name="value" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addEnvironment.parameter.value"></a>
|
|
152
148
|
|
|
153
149
|
- *Type:* string
|
|
154
150
|
|
|
155
151
|
---
|
|
156
152
|
|
|
157
|
-
##### `addToRolePolicy` <a name="addToRolePolicy" id="@ashishpandeyone/cdk-lambda-web-function.
|
|
153
|
+
##### `addToRolePolicy` <a name="addToRolePolicy" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addToRolePolicy"></a>
|
|
158
154
|
|
|
159
155
|
```typescript
|
|
160
156
|
public addToRolePolicy(statement: PolicyStatement): void
|
|
@@ -162,13 +158,13 @@ public addToRolePolicy(statement: PolicyStatement): void
|
|
|
162
158
|
|
|
163
159
|
Adds a statement to the execution role's policy.
|
|
164
160
|
|
|
165
|
-
###### `statement`<sup>Required</sup> <a name="statement" id="@ashishpandeyone/cdk-lambda-web-function.
|
|
161
|
+
###### `statement`<sup>Required</sup> <a name="statement" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addToRolePolicy.parameter.statement"></a>
|
|
166
162
|
|
|
167
163
|
- *Type:* aws-cdk-lib.aws_iam.PolicyStatement
|
|
168
164
|
|
|
169
165
|
---
|
|
170
166
|
|
|
171
|
-
##### `grantInvoke` <a name="grantInvoke" id="@ashishpandeyone/cdk-lambda-web-function.
|
|
167
|
+
##### `grantInvoke` <a name="grantInvoke" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.grantInvoke"></a>
|
|
172
168
|
|
|
173
169
|
```typescript
|
|
174
170
|
public grantInvoke(grantee: IGrantable): Grant
|
|
@@ -179,7 +175,7 @@ Allows `grantee` to call the endpoint.
|
|
|
179
175
|
Shortcut for `grants.invoke(grantee)`, as on `lambda.Function`.
|
|
180
176
|
[disable-awslint:no-grants]
|
|
181
177
|
|
|
182
|
-
###### `grantee`<sup>Required</sup> <a name="grantee" id="@ashishpandeyone/cdk-lambda-web-function.
|
|
178
|
+
###### `grantee`<sup>Required</sup> <a name="grantee" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.grantInvoke.parameter.grantee"></a>
|
|
183
179
|
|
|
184
180
|
- *Type:* aws-cdk-lib.aws_iam.IGrantable
|
|
185
181
|
|
|
@@ -189,18 +185,18 @@ Shortcut for `grants.invoke(grantee)`, as on `lambda.Function`.
|
|
|
189
185
|
|
|
190
186
|
| **Name** | **Description** |
|
|
191
187
|
| --- | --- |
|
|
192
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.
|
|
193
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.
|
|
194
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.
|
|
188
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.isConstruct">isConstruct</a></code> | Checks if `x` is a construct. |
|
|
189
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.isOwnedResource">isOwnedResource</a></code> | Returns true if the construct was created by CDK, and false otherwise. |
|
|
190
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.isResource">isResource</a></code> | Check whether the given construct is a Resource. |
|
|
195
191
|
|
|
196
192
|
---
|
|
197
193
|
|
|
198
|
-
##### `isConstruct` <a name="isConstruct" id="@ashishpandeyone/cdk-lambda-web-function.
|
|
194
|
+
##### `isConstruct` <a name="isConstruct" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.isConstruct"></a>
|
|
199
195
|
|
|
200
196
|
```typescript
|
|
201
|
-
import {
|
|
197
|
+
import { NodejsWebFunction } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
202
198
|
|
|
203
|
-
|
|
199
|
+
NodejsWebFunction.isConstruct(x: any)
|
|
204
200
|
```
|
|
205
201
|
|
|
206
202
|
Checks if `x` is a construct.
|
|
@@ -219,7 +215,7 @@ library can be accidentally installed, and `instanceof` will behave
|
|
|
219
215
|
unpredictably. It is safest to avoid using `instanceof`, and using
|
|
220
216
|
this type-testing method instead.
|
|
221
217
|
|
|
222
|
-
###### `x`<sup>Required</sup> <a name="x" id="@ashishpandeyone/cdk-lambda-web-function.
|
|
218
|
+
###### `x`<sup>Required</sup> <a name="x" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.isConstruct.parameter.x"></a>
|
|
223
219
|
|
|
224
220
|
- *Type:* any
|
|
225
221
|
|
|
@@ -227,33 +223,33 @@ Any object.
|
|
|
227
223
|
|
|
228
224
|
---
|
|
229
225
|
|
|
230
|
-
##### `isOwnedResource` <a name="isOwnedResource" id="@ashishpandeyone/cdk-lambda-web-function.
|
|
226
|
+
##### `isOwnedResource` <a name="isOwnedResource" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.isOwnedResource"></a>
|
|
231
227
|
|
|
232
228
|
```typescript
|
|
233
|
-
import {
|
|
229
|
+
import { NodejsWebFunction } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
234
230
|
|
|
235
|
-
|
|
231
|
+
NodejsWebFunction.isOwnedResource(construct: IConstruct)
|
|
236
232
|
```
|
|
237
233
|
|
|
238
234
|
Returns true if the construct was created by CDK, and false otherwise.
|
|
239
235
|
|
|
240
|
-
###### `construct`<sup>Required</sup> <a name="construct" id="@ashishpandeyone/cdk-lambda-web-function.
|
|
236
|
+
###### `construct`<sup>Required</sup> <a name="construct" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.isOwnedResource.parameter.construct"></a>
|
|
241
237
|
|
|
242
238
|
- *Type:* constructs.IConstruct
|
|
243
239
|
|
|
244
240
|
---
|
|
245
241
|
|
|
246
|
-
##### `isResource` <a name="isResource" id="@ashishpandeyone/cdk-lambda-web-function.
|
|
242
|
+
##### `isResource` <a name="isResource" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.isResource"></a>
|
|
247
243
|
|
|
248
244
|
```typescript
|
|
249
|
-
import {
|
|
245
|
+
import { NodejsWebFunction } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
250
246
|
|
|
251
|
-
|
|
247
|
+
NodejsWebFunction.isResource(construct: IConstruct)
|
|
252
248
|
```
|
|
253
249
|
|
|
254
250
|
Check whether the given construct is a Resource.
|
|
255
251
|
|
|
256
|
-
###### `construct`<sup>Required</sup> <a name="construct" id="@ashishpandeyone/cdk-lambda-web-function.
|
|
252
|
+
###### `construct`<sup>Required</sup> <a name="construct" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.isResource.parameter.construct"></a>
|
|
257
253
|
|
|
258
254
|
- *Type:* constructs.IConstruct
|
|
259
255
|
|
|
@@ -263,22 +259,22 @@ Check whether the given construct is a Resource.
|
|
|
263
259
|
|
|
264
260
|
| **Name** | **Type** | **Description** |
|
|
265
261
|
| --- | --- | --- |
|
|
266
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.
|
|
267
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.
|
|
268
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.
|
|
269
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.
|
|
270
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.
|
|
271
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.
|
|
272
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.
|
|
273
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.
|
|
274
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.
|
|
275
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.
|
|
276
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.
|
|
277
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.
|
|
262
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. |
|
|
263
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.env">env</a></code> | <code>aws-cdk-lib.interfaces.ResourceEnvironment</code> | The environment this resource belongs to. |
|
|
264
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.stack">stack</a></code> | <code>aws-cdk-lib.Stack</code> | The stack in which this resource is defined. |
|
|
265
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.endpoint">endpoint</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint">WebFunctionEndpoint</a></code> | The function's endpoint. |
|
|
266
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.grantPrincipal">grantPrincipal</a></code> | <code>aws-cdk-lib.aws_iam.IPrincipal</code> | The principal to grant permissions to (the execution role). |
|
|
267
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.grants">grants</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionGrants">WebFunctionGrants</a></code> | Grants on the function (e.g. `grants.invoke(principal)`). |
|
|
268
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.logGroup">logGroup</a></code> | <code>aws-cdk-lib.aws_logs.ILogGroup</code> | The home-region log group that receives the logs of every region the function serves from. |
|
|
269
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.revisionId">revisionId</a></code> | <code>string</code> | The ID of the current revision. |
|
|
270
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.role">role</a></code> | <code>aws-cdk-lib.aws_iam.IRole</code> | The execution role. |
|
|
271
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.webFunctionArn">webFunctionArn</a></code> | <code>string</code> | The function's ARN. |
|
|
272
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.webFunctionName">webFunctionName</a></code> | <code>string</code> | The function's name. |
|
|
273
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.webFunctionRef">webFunctionRef</a></code> | <code>aws-cdk-lib.interfaces.aws_lambda.WebFunctionReference</code> | A reference to this function, for APIs that accept `lambda.IWebFunctionRef`. |
|
|
278
274
|
|
|
279
275
|
---
|
|
280
276
|
|
|
281
|
-
##### `node`<sup>Required</sup> <a name="node" id="@ashishpandeyone/cdk-lambda-web-function.
|
|
277
|
+
##### `node`<sup>Required</sup> <a name="node" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.node"></a>
|
|
282
278
|
|
|
283
279
|
```typescript
|
|
284
280
|
public readonly node: Node;
|
|
@@ -290,7 +286,7 @@ The tree node.
|
|
|
290
286
|
|
|
291
287
|
---
|
|
292
288
|
|
|
293
|
-
##### `env`<sup>Required</sup> <a name="env" id="@ashishpandeyone/cdk-lambda-web-function.
|
|
289
|
+
##### `env`<sup>Required</sup> <a name="env" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.env"></a>
|
|
294
290
|
|
|
295
291
|
```typescript
|
|
296
292
|
public readonly env: ResourceEnvironment;
|
|
@@ -310,7 +306,7 @@ different than the stack they were imported into.
|
|
|
310
306
|
|
|
311
307
|
---
|
|
312
308
|
|
|
313
|
-
##### `stack`<sup>Required</sup> <a name="stack" id="@ashishpandeyone/cdk-lambda-web-function.
|
|
309
|
+
##### `stack`<sup>Required</sup> <a name="stack" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.stack"></a>
|
|
314
310
|
|
|
315
311
|
```typescript
|
|
316
312
|
public readonly stack: Stack;
|
|
@@ -322,7 +318,7 @@ The stack in which this resource is defined.
|
|
|
322
318
|
|
|
323
319
|
---
|
|
324
320
|
|
|
325
|
-
##### `endpoint`<sup>Required</sup> <a name="endpoint" id="@ashishpandeyone/cdk-lambda-web-function.
|
|
321
|
+
##### `endpoint`<sup>Required</sup> <a name="endpoint" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.endpoint"></a>
|
|
326
322
|
|
|
327
323
|
```typescript
|
|
328
324
|
public readonly endpoint: WebFunctionEndpoint;
|
|
@@ -334,7 +330,7 @@ The function's endpoint.
|
|
|
334
330
|
|
|
335
331
|
---
|
|
336
332
|
|
|
337
|
-
##### `grantPrincipal`<sup>Required</sup> <a name="grantPrincipal" id="@ashishpandeyone/cdk-lambda-web-function.
|
|
333
|
+
##### `grantPrincipal`<sup>Required</sup> <a name="grantPrincipal" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.grantPrincipal"></a>
|
|
338
334
|
|
|
339
335
|
```typescript
|
|
340
336
|
public readonly grantPrincipal: IPrincipal;
|
|
@@ -346,7 +342,7 @@ The principal to grant permissions to (the execution role).
|
|
|
346
342
|
|
|
347
343
|
---
|
|
348
344
|
|
|
349
|
-
##### `grants`<sup>Required</sup> <a name="grants" id="@ashishpandeyone/cdk-lambda-web-function.
|
|
345
|
+
##### `grants`<sup>Required</sup> <a name="grants" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.grants"></a>
|
|
350
346
|
|
|
351
347
|
```typescript
|
|
352
348
|
public readonly grants: WebFunctionGrants;
|
|
@@ -358,7 +354,7 @@ Grants on the function (e.g. `grants.invoke(principal)`).
|
|
|
358
354
|
|
|
359
355
|
---
|
|
360
356
|
|
|
361
|
-
##### `logGroup`<sup>Required</sup> <a name="logGroup" id="@ashishpandeyone/cdk-lambda-web-function.
|
|
357
|
+
##### `logGroup`<sup>Required</sup> <a name="logGroup" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.logGroup"></a>
|
|
362
358
|
|
|
363
359
|
```typescript
|
|
364
360
|
public readonly logGroup: ILogGroup;
|
|
@@ -372,7 +368,7 @@ Subscribe to this one only: each region's `.local` group holds a copy of the sam
|
|
|
372
368
|
|
|
373
369
|
---
|
|
374
370
|
|
|
375
|
-
##### `revisionId`<sup>Required</sup> <a name="revisionId" id="@ashishpandeyone/cdk-lambda-web-function.
|
|
371
|
+
##### `revisionId`<sup>Required</sup> <a name="revisionId" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.revisionId"></a>
|
|
376
372
|
|
|
377
373
|
```typescript
|
|
378
374
|
public readonly revisionId: string;
|
|
@@ -384,7 +380,7 @@ The ID of the current revision.
|
|
|
384
380
|
|
|
385
381
|
---
|
|
386
382
|
|
|
387
|
-
##### `role`<sup>Required</sup> <a name="role" id="@ashishpandeyone/cdk-lambda-web-function.
|
|
383
|
+
##### `role`<sup>Required</sup> <a name="role" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.role"></a>
|
|
388
384
|
|
|
389
385
|
```typescript
|
|
390
386
|
public readonly role: IRole;
|
|
@@ -396,7 +392,7 @@ The execution role.
|
|
|
396
392
|
|
|
397
393
|
---
|
|
398
394
|
|
|
399
|
-
##### `webFunctionArn`<sup>Required</sup> <a name="webFunctionArn" id="@ashishpandeyone/cdk-lambda-web-function.
|
|
395
|
+
##### `webFunctionArn`<sup>Required</sup> <a name="webFunctionArn" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.webFunctionArn"></a>
|
|
400
396
|
|
|
401
397
|
```typescript
|
|
402
398
|
public readonly webFunctionArn: string;
|
|
@@ -408,7 +404,7 @@ The function's ARN.
|
|
|
408
404
|
|
|
409
405
|
---
|
|
410
406
|
|
|
411
|
-
##### `webFunctionName`<sup>Required</sup> <a name="webFunctionName" id="@ashishpandeyone/cdk-lambda-web-function.
|
|
407
|
+
##### `webFunctionName`<sup>Required</sup> <a name="webFunctionName" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.webFunctionName"></a>
|
|
412
408
|
|
|
413
409
|
```typescript
|
|
414
410
|
public readonly webFunctionName: string;
|
|
@@ -420,7 +416,7 @@ The function's name.
|
|
|
420
416
|
|
|
421
417
|
---
|
|
422
418
|
|
|
423
|
-
##### `webFunctionRef`<sup>Required</sup> <a name="webFunctionRef" id="@ashishpandeyone/cdk-lambda-web-function.
|
|
419
|
+
##### `webFunctionRef`<sup>Required</sup> <a name="webFunctionRef" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.webFunctionRef"></a>
|
|
424
420
|
|
|
425
421
|
```typescript
|
|
426
422
|
public readonly webFunctionRef: WebFunctionReference;
|
|
@@ -433,23 +429,66 @@ A reference to this function, for APIs that accept `lambda.IWebFunctionRef`.
|
|
|
433
429
|
---
|
|
434
430
|
|
|
435
431
|
|
|
436
|
-
###
|
|
432
|
+
### WebFunction <a name="WebFunction" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction"></a>
|
|
437
433
|
|
|
438
|
-
|
|
434
|
+
- *Implements:* <a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunction">IWebFunction</a>, aws-cdk-lib.aws_iam.IGrantable
|
|
439
435
|
|
|
440
|
-
|
|
436
|
+
A Node.js HTTP server running as an AWS Lambda Web Function, served from one or more regions.
|
|
437
|
+
|
|
438
|
+
Creates the function, its current revision (code and configuration; any change replaces it),
|
|
439
|
+
an HTTPS endpoint, an execution role, and owns the function's log groups in every region.
|
|
440
|
+
|
|
441
|
+
Importing existing functions (`fromXxx` methods) is planned after 0.1.
|
|
442
|
+
|
|
443
|
+
#### Initializers <a name="Initializers" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.Initializer"></a>
|
|
444
|
+
|
|
445
|
+
```typescript
|
|
446
|
+
import { WebFunction } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
447
|
+
|
|
448
|
+
new WebFunction(scope: Construct, id: string, props: WebFunctionProps)
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
| **Name** | **Type** | **Description** |
|
|
452
|
+
| --- | --- | --- |
|
|
453
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.Initializer.parameter.scope">scope</a></code> | <code>constructs.Construct</code> | *No description.* |
|
|
454
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.Initializer.parameter.id">id</a></code> | <code>string</code> | *No description.* |
|
|
455
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.Initializer.parameter.props">props</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps">WebFunctionProps</a></code> | *No description.* |
|
|
456
|
+
|
|
457
|
+
---
|
|
458
|
+
|
|
459
|
+
##### `scope`<sup>Required</sup> <a name="scope" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.Initializer.parameter.scope"></a>
|
|
460
|
+
|
|
461
|
+
- *Type:* constructs.Construct
|
|
462
|
+
|
|
463
|
+
---
|
|
464
|
+
|
|
465
|
+
##### `id`<sup>Required</sup> <a name="id" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.Initializer.parameter.id"></a>
|
|
466
|
+
|
|
467
|
+
- *Type:* string
|
|
468
|
+
|
|
469
|
+
---
|
|
470
|
+
|
|
471
|
+
##### `props`<sup>Required</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.Initializer.parameter.props"></a>
|
|
472
|
+
|
|
473
|
+
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps">WebFunctionProps</a>
|
|
474
|
+
|
|
475
|
+
---
|
|
441
476
|
|
|
442
477
|
#### Methods <a name="Methods" id="Methods"></a>
|
|
443
478
|
|
|
444
479
|
| **Name** | **Description** |
|
|
445
480
|
| --- | --- |
|
|
446
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.
|
|
447
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.
|
|
448
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.
|
|
481
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.toString">toString</a></code> | Returns a string representation of this construct. |
|
|
482
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.with">with</a></code> | Applies one or more mixins to this construct. |
|
|
483
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.applyCrossStackReferenceStrength">applyCrossStackReferenceStrength</a></code> | Override the cross-stack reference strength for this resource. |
|
|
484
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.applyRemovalPolicy">applyRemovalPolicy</a></code> | Apply the given removal policy to this resource. |
|
|
485
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEnvironment">addEnvironment</a></code> | Adds an environment variable. |
|
|
486
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.addToRolePolicy">addToRolePolicy</a></code> | Adds a statement to the execution role's policy. |
|
|
487
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.grantInvoke">grantInvoke</a></code> | Allows `grantee` to call the endpoint. |
|
|
449
488
|
|
|
450
489
|
---
|
|
451
490
|
|
|
452
|
-
##### `toString` <a name="toString" id="@ashishpandeyone/cdk-lambda-web-function.
|
|
491
|
+
##### `toString` <a name="toString" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.toString"></a>
|
|
453
492
|
|
|
454
493
|
```typescript
|
|
455
494
|
public toString(): string
|
|
@@ -457,7 +496,7 @@ public toString(): string
|
|
|
457
496
|
|
|
458
497
|
Returns a string representation of this construct.
|
|
459
498
|
|
|
460
|
-
##### `with` <a name="with" id="@ashishpandeyone/cdk-lambda-web-function.
|
|
499
|
+
##### `with` <a name="with" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.with"></a>
|
|
461
500
|
|
|
462
501
|
```typescript
|
|
463
502
|
public with(mixins: ...IMixin[]): IConstruct
|
|
@@ -470,172 +509,1065 @@ start of the call, so constructs added by a mixin will not be visited.
|
|
|
470
509
|
Use multiple `with()` calls if subsequent mixins should apply to added
|
|
471
510
|
constructs.
|
|
472
511
|
|
|
473
|
-
###### `mixins`<sup>Required</sup> <a name="mixins" id="@ashishpandeyone/cdk-lambda-web-function.
|
|
512
|
+
###### `mixins`<sup>Required</sup> <a name="mixins" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.with.parameter.mixins"></a>
|
|
474
513
|
|
|
475
514
|
- *Type:* ...constructs.IMixin[]
|
|
476
515
|
|
|
477
|
-
The mixins to apply.
|
|
478
|
-
|
|
479
516
|
---
|
|
480
517
|
|
|
481
|
-
##### `
|
|
518
|
+
##### `applyCrossStackReferenceStrength` <a name="applyCrossStackReferenceStrength" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.applyCrossStackReferenceStrength"></a>
|
|
482
519
|
|
|
483
520
|
```typescript
|
|
484
|
-
public
|
|
521
|
+
public applyCrossStackReferenceStrength(strength: ReferenceStrength): void
|
|
485
522
|
```
|
|
486
523
|
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
Only for `PER_REGION` endpoints.
|
|
490
|
-
|
|
491
|
-
###### `region`<sup>Required</sup> <a name="region" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.regionalUrl.parameter.region"></a>
|
|
492
|
-
|
|
493
|
-
- *Type:* string
|
|
524
|
+
Override the cross-stack reference strength for this resource.
|
|
494
525
|
|
|
495
|
-
|
|
526
|
+
When set, any cross-stack reference to this resource will use the specified
|
|
527
|
+
mechanism instead of the global default determined by the
|
|
528
|
+
`@aws-cdk/core:defaultCrossStackReferences` context key. This is useful for
|
|
529
|
+
selectively weakening specific references to avoid the "deadly embrace" problem
|
|
530
|
+
without changing the app-wide default.
|
|
496
531
|
|
|
497
|
-
|
|
532
|
+
###### `strength`<sup>Required</sup> <a name="strength" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.applyCrossStackReferenceStrength.parameter.strength"></a>
|
|
498
533
|
|
|
499
|
-
|
|
534
|
+
- *Type:* aws-cdk-lib.ReferenceStrength
|
|
500
535
|
|
|
501
|
-
|
|
502
|
-
| --- | --- |
|
|
503
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.isConstruct">isConstruct</a></code> | Checks if `x` is a construct. |
|
|
536
|
+
The reference strength to use for this resource.
|
|
504
537
|
|
|
505
538
|
---
|
|
506
539
|
|
|
507
|
-
##### `
|
|
540
|
+
##### `applyRemovalPolicy` <a name="applyRemovalPolicy" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.applyRemovalPolicy"></a>
|
|
508
541
|
|
|
509
542
|
```typescript
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
WebFunctionEndpoint.isConstruct(x: any)
|
|
543
|
+
public applyRemovalPolicy(policy: RemovalPolicy): void
|
|
513
544
|
```
|
|
514
545
|
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
Use this method instead of `instanceof` to properly detect `Construct`
|
|
518
|
-
instances, even when the construct library is symlinked.
|
|
519
|
-
|
|
520
|
-
Explanation: in JavaScript, multiple copies of the `constructs` library on
|
|
521
|
-
disk are seen as independent, completely different libraries. As a
|
|
522
|
-
consequence, the class `Construct` in each copy of the `constructs` library
|
|
523
|
-
is seen as a different class, and an instance of one class will not test as
|
|
524
|
-
`instanceof` the other class. `npm install` will not create installations
|
|
525
|
-
like this, but users may manually symlink construct libraries together or
|
|
526
|
-
use a monorepo tool: in those cases, multiple copies of the `constructs`
|
|
527
|
-
library can be accidentally installed, and `instanceof` will behave
|
|
528
|
-
unpredictably. It is safest to avoid using `instanceof`, and using
|
|
529
|
-
this type-testing method instead.
|
|
530
|
-
|
|
531
|
-
###### `x`<sup>Required</sup> <a name="x" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.isConstruct.parameter.x"></a>
|
|
532
|
-
|
|
533
|
-
- *Type:* any
|
|
546
|
+
Apply the given removal policy to this resource.
|
|
534
547
|
|
|
535
|
-
|
|
548
|
+
The Removal Policy controls what happens to this resource when it stops
|
|
549
|
+
being managed by CloudFormation, either because you've removed it from the
|
|
550
|
+
CDK application or because you've made a change that requires the resource
|
|
551
|
+
to be replaced.
|
|
536
552
|
|
|
537
|
-
|
|
553
|
+
The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
|
|
554
|
+
account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
|
|
538
555
|
|
|
539
|
-
|
|
556
|
+
###### `policy`<sup>Required</sup> <a name="policy" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.applyRemovalPolicy.parameter.policy"></a>
|
|
540
557
|
|
|
541
|
-
|
|
542
|
-
| --- | --- | --- |
|
|
543
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. |
|
|
544
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.domainName">domainName</a></code> | <code>string</code> | The endpoint's domain name: the global domain for `MULTI_REGION`, otherwise the home region's. |
|
|
545
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.endpointArn">endpointArn</a></code> | <code>string</code> | The endpoint's ARN. |
|
|
546
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.endpointName">endpointName</a></code> | <code>string</code> | The endpoint's name. |
|
|
547
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.endpointType">endpointType</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointType">WebFunctionEndpointType</a></code> | Where the endpoint serves traffic from. |
|
|
548
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.regions">regions</a></code> | <code>string[]</code> | Every region the endpoint serves from: the home region first, then the others in alphabetical order. |
|
|
549
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.url">url</a></code> | <code>string</code> | The endpoint's URL: the global URL for `MULTI_REGION`, otherwise the home region's. |
|
|
558
|
+
- *Type:* aws-cdk-lib.RemovalPolicy
|
|
550
559
|
|
|
551
560
|
---
|
|
552
561
|
|
|
553
|
-
##### `
|
|
562
|
+
##### `addEnvironment` <a name="addEnvironment" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEnvironment"></a>
|
|
554
563
|
|
|
555
564
|
```typescript
|
|
556
|
-
public
|
|
565
|
+
public addEnvironment(key: string, value: string): WebFunction
|
|
557
566
|
```
|
|
558
567
|
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
The tree node.
|
|
562
|
-
|
|
563
|
-
---
|
|
568
|
+
Adds an environment variable.
|
|
564
569
|
|
|
565
|
-
|
|
570
|
+
Names starting with `AWS_` are reserved.
|
|
566
571
|
|
|
567
|
-
|
|
568
|
-
public readonly domainName: string;
|
|
569
|
-
```
|
|
572
|
+
###### `key`<sup>Required</sup> <a name="key" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEnvironment.parameter.key"></a>
|
|
570
573
|
|
|
571
574
|
- *Type:* string
|
|
572
575
|
|
|
573
|
-
The endpoint's domain name: the global domain for `MULTI_REGION`, otherwise the home region's.
|
|
574
|
-
|
|
575
576
|
---
|
|
576
577
|
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
```typescript
|
|
580
|
-
public readonly endpointArn: string;
|
|
581
|
-
```
|
|
578
|
+
###### `value`<sup>Required</sup> <a name="value" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEnvironment.parameter.value"></a>
|
|
582
579
|
|
|
583
580
|
- *Type:* string
|
|
584
581
|
|
|
585
|
-
The endpoint's ARN.
|
|
586
|
-
|
|
587
582
|
---
|
|
588
583
|
|
|
589
|
-
##### `
|
|
584
|
+
##### `addToRolePolicy` <a name="addToRolePolicy" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addToRolePolicy"></a>
|
|
590
585
|
|
|
591
586
|
```typescript
|
|
592
|
-
public
|
|
587
|
+
public addToRolePolicy(statement: PolicyStatement): void
|
|
593
588
|
```
|
|
594
589
|
|
|
595
|
-
|
|
590
|
+
Adds a statement to the execution role's policy.
|
|
596
591
|
|
|
597
|
-
|
|
592
|
+
###### `statement`<sup>Required</sup> <a name="statement" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addToRolePolicy.parameter.statement"></a>
|
|
593
|
+
|
|
594
|
+
- *Type:* aws-cdk-lib.aws_iam.PolicyStatement
|
|
598
595
|
|
|
599
596
|
---
|
|
600
597
|
|
|
601
|
-
##### `
|
|
598
|
+
##### `grantInvoke` <a name="grantInvoke" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.grantInvoke"></a>
|
|
602
599
|
|
|
603
600
|
```typescript
|
|
604
|
-
public
|
|
601
|
+
public grantInvoke(grantee: IGrantable): Grant
|
|
605
602
|
```
|
|
606
603
|
|
|
607
|
-
|
|
604
|
+
Allows `grantee` to call the endpoint.
|
|
608
605
|
|
|
609
|
-
|
|
606
|
+
Shortcut for `grants.invoke(grantee)`, as on `lambda.Function`.
|
|
607
|
+
[disable-awslint:no-grants]
|
|
608
|
+
|
|
609
|
+
###### `grantee`<sup>Required</sup> <a name="grantee" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.grantInvoke.parameter.grantee"></a>
|
|
610
|
+
|
|
611
|
+
- *Type:* aws-cdk-lib.aws_iam.IGrantable
|
|
612
|
+
|
|
613
|
+
---
|
|
614
|
+
|
|
615
|
+
#### Static Functions <a name="Static Functions" id="Static Functions"></a>
|
|
616
|
+
|
|
617
|
+
| **Name** | **Description** |
|
|
618
|
+
| --- | --- |
|
|
619
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.isConstruct">isConstruct</a></code> | Checks if `x` is a construct. |
|
|
620
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.isOwnedResource">isOwnedResource</a></code> | Returns true if the construct was created by CDK, and false otherwise. |
|
|
621
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.isResource">isResource</a></code> | Check whether the given construct is a Resource. |
|
|
622
|
+
|
|
623
|
+
---
|
|
624
|
+
|
|
625
|
+
##### `isConstruct` <a name="isConstruct" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.isConstruct"></a>
|
|
626
|
+
|
|
627
|
+
```typescript
|
|
628
|
+
import { WebFunction } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
629
|
+
|
|
630
|
+
WebFunction.isConstruct(x: any)
|
|
631
|
+
```
|
|
632
|
+
|
|
633
|
+
Checks if `x` is a construct.
|
|
634
|
+
|
|
635
|
+
Use this method instead of `instanceof` to properly detect `Construct`
|
|
636
|
+
instances, even when the construct library is symlinked.
|
|
637
|
+
|
|
638
|
+
Explanation: in JavaScript, multiple copies of the `constructs` library on
|
|
639
|
+
disk are seen as independent, completely different libraries. As a
|
|
640
|
+
consequence, the class `Construct` in each copy of the `constructs` library
|
|
641
|
+
is seen as a different class, and an instance of one class will not test as
|
|
642
|
+
`instanceof` the other class. `npm install` will not create installations
|
|
643
|
+
like this, but users may manually symlink construct libraries together or
|
|
644
|
+
use a monorepo tool: in those cases, multiple copies of the `constructs`
|
|
645
|
+
library can be accidentally installed, and `instanceof` will behave
|
|
646
|
+
unpredictably. It is safest to avoid using `instanceof`, and using
|
|
647
|
+
this type-testing method instead.
|
|
648
|
+
|
|
649
|
+
###### `x`<sup>Required</sup> <a name="x" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.isConstruct.parameter.x"></a>
|
|
650
|
+
|
|
651
|
+
- *Type:* any
|
|
652
|
+
|
|
653
|
+
Any object.
|
|
654
|
+
|
|
655
|
+
---
|
|
656
|
+
|
|
657
|
+
##### `isOwnedResource` <a name="isOwnedResource" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.isOwnedResource"></a>
|
|
658
|
+
|
|
659
|
+
```typescript
|
|
660
|
+
import { WebFunction } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
661
|
+
|
|
662
|
+
WebFunction.isOwnedResource(construct: IConstruct)
|
|
663
|
+
```
|
|
664
|
+
|
|
665
|
+
Returns true if the construct was created by CDK, and false otherwise.
|
|
666
|
+
|
|
667
|
+
###### `construct`<sup>Required</sup> <a name="construct" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.isOwnedResource.parameter.construct"></a>
|
|
668
|
+
|
|
669
|
+
- *Type:* constructs.IConstruct
|
|
670
|
+
|
|
671
|
+
---
|
|
672
|
+
|
|
673
|
+
##### `isResource` <a name="isResource" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.isResource"></a>
|
|
674
|
+
|
|
675
|
+
```typescript
|
|
676
|
+
import { WebFunction } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
677
|
+
|
|
678
|
+
WebFunction.isResource(construct: IConstruct)
|
|
679
|
+
```
|
|
680
|
+
|
|
681
|
+
Check whether the given construct is a Resource.
|
|
682
|
+
|
|
683
|
+
###### `construct`<sup>Required</sup> <a name="construct" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.isResource.parameter.construct"></a>
|
|
684
|
+
|
|
685
|
+
- *Type:* constructs.IConstruct
|
|
686
|
+
|
|
687
|
+
---
|
|
688
|
+
|
|
689
|
+
#### Properties <a name="Properties" id="Properties"></a>
|
|
690
|
+
|
|
691
|
+
| **Name** | **Type** | **Description** |
|
|
692
|
+
| --- | --- | --- |
|
|
693
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. |
|
|
694
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.env">env</a></code> | <code>aws-cdk-lib.interfaces.ResourceEnvironment</code> | The environment this resource belongs to. |
|
|
695
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.stack">stack</a></code> | <code>aws-cdk-lib.Stack</code> | The stack in which this resource is defined. |
|
|
696
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.endpoint">endpoint</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint">WebFunctionEndpoint</a></code> | The function's endpoint. |
|
|
697
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.grantPrincipal">grantPrincipal</a></code> | <code>aws-cdk-lib.aws_iam.IPrincipal</code> | The principal to grant permissions to (the execution role). |
|
|
698
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.grants">grants</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionGrants">WebFunctionGrants</a></code> | Grants on the function (e.g. `grants.invoke(principal)`). |
|
|
699
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.logGroup">logGroup</a></code> | <code>aws-cdk-lib.aws_logs.ILogGroup</code> | The home-region log group that receives the logs of every region the function serves from. |
|
|
700
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.revisionId">revisionId</a></code> | <code>string</code> | The ID of the current revision. |
|
|
701
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.role">role</a></code> | <code>aws-cdk-lib.aws_iam.IRole</code> | The execution role. |
|
|
702
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.webFunctionArn">webFunctionArn</a></code> | <code>string</code> | The function's ARN. |
|
|
703
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.webFunctionName">webFunctionName</a></code> | <code>string</code> | The function's name. |
|
|
704
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.webFunctionRef">webFunctionRef</a></code> | <code>aws-cdk-lib.interfaces.aws_lambda.WebFunctionReference</code> | A reference to this function, for APIs that accept `lambda.IWebFunctionRef`. |
|
|
705
|
+
|
|
706
|
+
---
|
|
707
|
+
|
|
708
|
+
##### `node`<sup>Required</sup> <a name="node" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.node"></a>
|
|
709
|
+
|
|
710
|
+
```typescript
|
|
711
|
+
public readonly node: Node;
|
|
712
|
+
```
|
|
713
|
+
|
|
714
|
+
- *Type:* constructs.Node
|
|
715
|
+
|
|
716
|
+
The tree node.
|
|
717
|
+
|
|
718
|
+
---
|
|
719
|
+
|
|
720
|
+
##### `env`<sup>Required</sup> <a name="env" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.env"></a>
|
|
721
|
+
|
|
722
|
+
```typescript
|
|
723
|
+
public readonly env: ResourceEnvironment;
|
|
724
|
+
```
|
|
725
|
+
|
|
726
|
+
- *Type:* aws-cdk-lib.interfaces.ResourceEnvironment
|
|
727
|
+
|
|
728
|
+
The environment this resource belongs to.
|
|
729
|
+
|
|
730
|
+
For resources that are created and managed in a Stack (those created by
|
|
731
|
+
creating new class instances like `new Role()`, `new Bucket()`, etc.), this
|
|
732
|
+
is always the same as the environment of the stack they belong to.
|
|
733
|
+
|
|
734
|
+
For referenced resources (those obtained from referencing methods like
|
|
735
|
+
`Role.fromRoleArn()`, `Bucket.fromBucketName()`, etc.), they might be
|
|
736
|
+
different than the stack they were imported into.
|
|
737
|
+
|
|
738
|
+
---
|
|
739
|
+
|
|
740
|
+
##### `stack`<sup>Required</sup> <a name="stack" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.stack"></a>
|
|
741
|
+
|
|
742
|
+
```typescript
|
|
743
|
+
public readonly stack: Stack;
|
|
744
|
+
```
|
|
745
|
+
|
|
746
|
+
- *Type:* aws-cdk-lib.Stack
|
|
747
|
+
|
|
748
|
+
The stack in which this resource is defined.
|
|
749
|
+
|
|
750
|
+
---
|
|
751
|
+
|
|
752
|
+
##### `endpoint`<sup>Required</sup> <a name="endpoint" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.endpoint"></a>
|
|
753
|
+
|
|
754
|
+
```typescript
|
|
755
|
+
public readonly endpoint: WebFunctionEndpoint;
|
|
756
|
+
```
|
|
757
|
+
|
|
758
|
+
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint">WebFunctionEndpoint</a>
|
|
759
|
+
|
|
760
|
+
The function's endpoint.
|
|
761
|
+
|
|
762
|
+
---
|
|
763
|
+
|
|
764
|
+
##### `grantPrincipal`<sup>Required</sup> <a name="grantPrincipal" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.grantPrincipal"></a>
|
|
765
|
+
|
|
766
|
+
```typescript
|
|
767
|
+
public readonly grantPrincipal: IPrincipal;
|
|
768
|
+
```
|
|
769
|
+
|
|
770
|
+
- *Type:* aws-cdk-lib.aws_iam.IPrincipal
|
|
771
|
+
|
|
772
|
+
The principal to grant permissions to (the execution role).
|
|
773
|
+
|
|
774
|
+
---
|
|
775
|
+
|
|
776
|
+
##### `grants`<sup>Required</sup> <a name="grants" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.grants"></a>
|
|
777
|
+
|
|
778
|
+
```typescript
|
|
779
|
+
public readonly grants: WebFunctionGrants;
|
|
780
|
+
```
|
|
781
|
+
|
|
782
|
+
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionGrants">WebFunctionGrants</a>
|
|
783
|
+
|
|
784
|
+
Grants on the function (e.g. `grants.invoke(principal)`).
|
|
785
|
+
|
|
786
|
+
---
|
|
787
|
+
|
|
788
|
+
##### `logGroup`<sup>Required</sup> <a name="logGroup" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.logGroup"></a>
|
|
789
|
+
|
|
790
|
+
```typescript
|
|
791
|
+
public readonly logGroup: ILogGroup;
|
|
792
|
+
```
|
|
793
|
+
|
|
794
|
+
- *Type:* aws-cdk-lib.aws_logs.ILogGroup
|
|
795
|
+
|
|
796
|
+
The home-region log group that receives the logs of every region the function serves from.
|
|
797
|
+
|
|
798
|
+
Subscribe to this one only: each region's `.local` group holds a copy of the same events.
|
|
799
|
+
|
|
800
|
+
---
|
|
801
|
+
|
|
802
|
+
##### `revisionId`<sup>Required</sup> <a name="revisionId" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.revisionId"></a>
|
|
803
|
+
|
|
804
|
+
```typescript
|
|
805
|
+
public readonly revisionId: string;
|
|
806
|
+
```
|
|
807
|
+
|
|
808
|
+
- *Type:* string
|
|
809
|
+
|
|
810
|
+
The ID of the current revision.
|
|
811
|
+
|
|
812
|
+
---
|
|
813
|
+
|
|
814
|
+
##### `role`<sup>Required</sup> <a name="role" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.role"></a>
|
|
815
|
+
|
|
816
|
+
```typescript
|
|
817
|
+
public readonly role: IRole;
|
|
818
|
+
```
|
|
819
|
+
|
|
820
|
+
- *Type:* aws-cdk-lib.aws_iam.IRole
|
|
821
|
+
|
|
822
|
+
The execution role.
|
|
823
|
+
|
|
824
|
+
---
|
|
825
|
+
|
|
826
|
+
##### `webFunctionArn`<sup>Required</sup> <a name="webFunctionArn" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.webFunctionArn"></a>
|
|
827
|
+
|
|
828
|
+
```typescript
|
|
829
|
+
public readonly webFunctionArn: string;
|
|
830
|
+
```
|
|
831
|
+
|
|
832
|
+
- *Type:* string
|
|
833
|
+
|
|
834
|
+
The function's ARN.
|
|
835
|
+
|
|
836
|
+
---
|
|
837
|
+
|
|
838
|
+
##### `webFunctionName`<sup>Required</sup> <a name="webFunctionName" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.webFunctionName"></a>
|
|
839
|
+
|
|
840
|
+
```typescript
|
|
841
|
+
public readonly webFunctionName: string;
|
|
842
|
+
```
|
|
843
|
+
|
|
844
|
+
- *Type:* string
|
|
845
|
+
|
|
846
|
+
The function's name.
|
|
847
|
+
|
|
848
|
+
---
|
|
849
|
+
|
|
850
|
+
##### `webFunctionRef`<sup>Required</sup> <a name="webFunctionRef" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.webFunctionRef"></a>
|
|
851
|
+
|
|
852
|
+
```typescript
|
|
853
|
+
public readonly webFunctionRef: WebFunctionReference;
|
|
854
|
+
```
|
|
855
|
+
|
|
856
|
+
- *Type:* aws-cdk-lib.interfaces.aws_lambda.WebFunctionReference
|
|
857
|
+
|
|
858
|
+
A reference to this function, for APIs that accept `lambda.IWebFunctionRef`.
|
|
859
|
+
|
|
860
|
+
---
|
|
861
|
+
|
|
862
|
+
|
|
863
|
+
### WebFunctionEndpoint <a name="WebFunctionEndpoint" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint"></a>
|
|
864
|
+
|
|
865
|
+
The HTTPS endpoint of a Web Function. Created by `WebFunction`; access it as `fn.endpoint`.
|
|
866
|
+
|
|
867
|
+
Only `WebFunction` creates endpoints in this version (one per function), so the constructor is private.
|
|
868
|
+
|
|
869
|
+
#### Methods <a name="Methods" id="Methods"></a>
|
|
870
|
+
|
|
871
|
+
| **Name** | **Description** |
|
|
872
|
+
| --- | --- |
|
|
873
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.toString">toString</a></code> | Returns a string representation of this construct. |
|
|
874
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.with">with</a></code> | Applies one or more mixins to this construct. |
|
|
875
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.regionalUrl">regionalUrl</a></code> | The URL of this endpoint in one region. |
|
|
876
|
+
|
|
877
|
+
---
|
|
878
|
+
|
|
879
|
+
##### `toString` <a name="toString" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.toString"></a>
|
|
880
|
+
|
|
881
|
+
```typescript
|
|
882
|
+
public toString(): string
|
|
883
|
+
```
|
|
884
|
+
|
|
885
|
+
Returns a string representation of this construct.
|
|
886
|
+
|
|
887
|
+
##### `with` <a name="with" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.with"></a>
|
|
888
|
+
|
|
889
|
+
```typescript
|
|
890
|
+
public with(mixins: ...IMixin[]): IConstruct
|
|
891
|
+
```
|
|
892
|
+
|
|
893
|
+
Applies one or more mixins to this construct.
|
|
894
|
+
|
|
895
|
+
Mixins are applied in order. The list of constructs is captured at the
|
|
896
|
+
start of the call, so constructs added by a mixin will not be visited.
|
|
897
|
+
Use multiple `with()` calls if subsequent mixins should apply to added
|
|
898
|
+
constructs.
|
|
899
|
+
|
|
900
|
+
###### `mixins`<sup>Required</sup> <a name="mixins" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.with.parameter.mixins"></a>
|
|
901
|
+
|
|
902
|
+
- *Type:* ...constructs.IMixin[]
|
|
903
|
+
|
|
904
|
+
The mixins to apply.
|
|
905
|
+
|
|
906
|
+
---
|
|
907
|
+
|
|
908
|
+
##### `regionalUrl` <a name="regionalUrl" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.regionalUrl"></a>
|
|
909
|
+
|
|
910
|
+
```typescript
|
|
911
|
+
public regionalUrl(region: string): string
|
|
912
|
+
```
|
|
913
|
+
|
|
914
|
+
The URL of this endpoint in one region.
|
|
915
|
+
|
|
916
|
+
Only for `PER_REGION` endpoints.
|
|
917
|
+
|
|
918
|
+
###### `region`<sup>Required</sup> <a name="region" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.regionalUrl.parameter.region"></a>
|
|
919
|
+
|
|
920
|
+
- *Type:* string
|
|
921
|
+
|
|
922
|
+
one of `regions`.
|
|
923
|
+
|
|
924
|
+
---
|
|
925
|
+
|
|
926
|
+
#### Static Functions <a name="Static Functions" id="Static Functions"></a>
|
|
927
|
+
|
|
928
|
+
| **Name** | **Description** |
|
|
929
|
+
| --- | --- |
|
|
930
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.isConstruct">isConstruct</a></code> | Checks if `x` is a construct. |
|
|
931
|
+
|
|
932
|
+
---
|
|
933
|
+
|
|
934
|
+
##### `isConstruct` <a name="isConstruct" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.isConstruct"></a>
|
|
935
|
+
|
|
936
|
+
```typescript
|
|
937
|
+
import { WebFunctionEndpoint } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
938
|
+
|
|
939
|
+
WebFunctionEndpoint.isConstruct(x: any)
|
|
940
|
+
```
|
|
941
|
+
|
|
942
|
+
Checks if `x` is a construct.
|
|
943
|
+
|
|
944
|
+
Use this method instead of `instanceof` to properly detect `Construct`
|
|
945
|
+
instances, even when the construct library is symlinked.
|
|
946
|
+
|
|
947
|
+
Explanation: in JavaScript, multiple copies of the `constructs` library on
|
|
948
|
+
disk are seen as independent, completely different libraries. As a
|
|
949
|
+
consequence, the class `Construct` in each copy of the `constructs` library
|
|
950
|
+
is seen as a different class, and an instance of one class will not test as
|
|
951
|
+
`instanceof` the other class. `npm install` will not create installations
|
|
952
|
+
like this, but users may manually symlink construct libraries together or
|
|
953
|
+
use a monorepo tool: in those cases, multiple copies of the `constructs`
|
|
954
|
+
library can be accidentally installed, and `instanceof` will behave
|
|
955
|
+
unpredictably. It is safest to avoid using `instanceof`, and using
|
|
956
|
+
this type-testing method instead.
|
|
957
|
+
|
|
958
|
+
###### `x`<sup>Required</sup> <a name="x" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.isConstruct.parameter.x"></a>
|
|
959
|
+
|
|
960
|
+
- *Type:* any
|
|
961
|
+
|
|
962
|
+
Any object.
|
|
963
|
+
|
|
964
|
+
---
|
|
965
|
+
|
|
966
|
+
#### Properties <a name="Properties" id="Properties"></a>
|
|
967
|
+
|
|
968
|
+
| **Name** | **Type** | **Description** |
|
|
969
|
+
| --- | --- | --- |
|
|
970
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. |
|
|
971
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.domainName">domainName</a></code> | <code>string</code> | The endpoint's domain name: the global domain for `MULTI_REGION`, otherwise the home region's. |
|
|
972
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.endpointArn">endpointArn</a></code> | <code>string</code> | The endpoint's ARN. |
|
|
973
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.endpointName">endpointName</a></code> | <code>string</code> | The endpoint's name. |
|
|
974
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.endpointType">endpointType</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointType">WebFunctionEndpointType</a></code> | Where the endpoint serves traffic from. |
|
|
975
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.regions">regions</a></code> | <code>string[]</code> | Every region the endpoint serves from: the home region first, then the others in alphabetical order. |
|
|
976
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.url">url</a></code> | <code>string</code> | The endpoint's URL: the global URL for `MULTI_REGION`, otherwise the home region's. |
|
|
977
|
+
|
|
978
|
+
---
|
|
979
|
+
|
|
980
|
+
##### `node`<sup>Required</sup> <a name="node" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.node"></a>
|
|
981
|
+
|
|
982
|
+
```typescript
|
|
983
|
+
public readonly node: Node;
|
|
984
|
+
```
|
|
985
|
+
|
|
986
|
+
- *Type:* constructs.Node
|
|
987
|
+
|
|
988
|
+
The tree node.
|
|
989
|
+
|
|
990
|
+
---
|
|
991
|
+
|
|
992
|
+
##### `domainName`<sup>Required</sup> <a name="domainName" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.domainName"></a>
|
|
993
|
+
|
|
994
|
+
```typescript
|
|
995
|
+
public readonly domainName: string;
|
|
996
|
+
```
|
|
997
|
+
|
|
998
|
+
- *Type:* string
|
|
999
|
+
|
|
1000
|
+
The endpoint's domain name: the global domain for `MULTI_REGION`, otherwise the home region's.
|
|
1001
|
+
|
|
1002
|
+
---
|
|
1003
|
+
|
|
1004
|
+
##### `endpointArn`<sup>Required</sup> <a name="endpointArn" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.endpointArn"></a>
|
|
1005
|
+
|
|
1006
|
+
```typescript
|
|
1007
|
+
public readonly endpointArn: string;
|
|
1008
|
+
```
|
|
1009
|
+
|
|
1010
|
+
- *Type:* string
|
|
1011
|
+
|
|
1012
|
+
The endpoint's ARN.
|
|
1013
|
+
|
|
1014
|
+
---
|
|
1015
|
+
|
|
1016
|
+
##### `endpointName`<sup>Required</sup> <a name="endpointName" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.endpointName"></a>
|
|
1017
|
+
|
|
1018
|
+
```typescript
|
|
1019
|
+
public readonly endpointName: string;
|
|
1020
|
+
```
|
|
1021
|
+
|
|
1022
|
+
- *Type:* string
|
|
1023
|
+
|
|
1024
|
+
The endpoint's name.
|
|
1025
|
+
|
|
1026
|
+
---
|
|
1027
|
+
|
|
1028
|
+
##### `endpointType`<sup>Required</sup> <a name="endpointType" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.endpointType"></a>
|
|
1029
|
+
|
|
1030
|
+
```typescript
|
|
1031
|
+
public readonly endpointType: WebFunctionEndpointType;
|
|
1032
|
+
```
|
|
1033
|
+
|
|
1034
|
+
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointType">WebFunctionEndpointType</a>
|
|
1035
|
+
|
|
1036
|
+
Where the endpoint serves traffic from.
|
|
1037
|
+
|
|
1038
|
+
---
|
|
1039
|
+
|
|
1040
|
+
##### `regions`<sup>Required</sup> <a name="regions" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.regions"></a>
|
|
1041
|
+
|
|
1042
|
+
```typescript
|
|
1043
|
+
public readonly regions: string[];
|
|
1044
|
+
```
|
|
1045
|
+
|
|
1046
|
+
- *Type:* string[]
|
|
1047
|
+
|
|
1048
|
+
Every region the endpoint serves from: the home region first, then the others in alphabetical order.
|
|
1049
|
+
|
|
1050
|
+
---
|
|
1051
|
+
|
|
1052
|
+
##### `url`<sup>Required</sup> <a name="url" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.url"></a>
|
|
1053
|
+
|
|
1054
|
+
```typescript
|
|
1055
|
+
public readonly url: string;
|
|
1056
|
+
```
|
|
1057
|
+
|
|
1058
|
+
- *Type:* string
|
|
1059
|
+
|
|
1060
|
+
The endpoint's URL: the global URL for `MULTI_REGION`, otherwise the home region's.
|
|
1061
|
+
|
|
1062
|
+
---
|
|
1063
|
+
|
|
1064
|
+
|
|
1065
|
+
## Structs <a name="Structs" id="Structs"></a>
|
|
1066
|
+
|
|
1067
|
+
### NodejsWebFunctionBundlingOptions <a name="NodejsWebFunctionBundlingOptions" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions"></a>
|
|
1068
|
+
|
|
1069
|
+
How `NodejsWebFunction` bundles the server with esbuild.
|
|
1070
|
+
|
|
1071
|
+
#### Initializer <a name="Initializer" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.Initializer"></a>
|
|
1072
|
+
|
|
1073
|
+
```typescript
|
|
1074
|
+
import { NodejsWebFunctionBundlingOptions } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
1075
|
+
|
|
1076
|
+
const nodejsWebFunctionBundlingOptions: NodejsWebFunctionBundlingOptions = { ... }
|
|
1077
|
+
```
|
|
1078
|
+
|
|
1079
|
+
#### Properties <a name="Properties" id="Properties"></a>
|
|
1080
|
+
|
|
1081
|
+
| **Name** | **Type** | **Description** |
|
|
1082
|
+
| --- | --- | --- |
|
|
1083
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.banner">banner</a></code> | <code>string</code> | Text to prepend to the bundle. |
|
|
1084
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.define">define</a></code> | <code>{[ key: string ]: string}</code> | Replace global identifiers with constant expressions (esbuild `--define`). |
|
|
1085
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.dockerImage">dockerImage</a></code> | <code>aws-cdk-lib.DockerImage</code> | Docker image for bundling when esbuild isn't installed locally. |
|
|
1086
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.environment">environment</a></code> | <code>{[ key: string ]: string}</code> | Environment variables while bundling (not at runtime). |
|
|
1087
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.esbuildArgs">esbuildArgs</a></code> | <code>{[ key: string ]: string \| boolean}</code> | Extra esbuild arguments, e.g. `{ '--log-limit': '0', '--tree-shaking': true }`. |
|
|
1088
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.externalModules">externalModules</a></code> | <code>string[]</code> | Modules to leave out of the bundle. |
|
|
1089
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.footer">footer</a></code> | <code>string</code> | Text to append to the bundle. |
|
|
1090
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.forceDockerBundling">forceDockerBundling</a></code> | <code>boolean</code> | Always bundle in Docker, even if esbuild is installed locally. |
|
|
1091
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.format">format</a></code> | <code>aws-cdk-lib.aws_lambda_nodejs.OutputFormat</code> | Output format. |
|
|
1092
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.keepNames">keepNames</a></code> | <code>boolean</code> | Keep function and class names (`--keep-names`). |
|
|
1093
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.loader">loader</a></code> | <code>{[ key: string ]: string}</code> | esbuild loaders by file extension, e.g. `{ '.png': 'dataurl' }`. |
|
|
1094
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.minify">minify</a></code> | <code>boolean</code> | Minify the bundle. |
|
|
1095
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.sourceMap">sourceMap</a></code> | <code>boolean</code> | Generate a source map, and set `NODE_OPTIONS=--enable-source-maps` so stack traces point at your sources. |
|
|
1096
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.target">target</a></code> | <code>string</code> | esbuild target. |
|
|
1097
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.tsconfig">tsconfig</a></code> | <code>string</code> | Path of the tsconfig.json to use, relative to the project root or absolute (inside the project root). |
|
|
1098
|
+
|
|
1099
|
+
---
|
|
1100
|
+
|
|
1101
|
+
##### `banner`<sup>Optional</sup> <a name="banner" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.banner"></a>
|
|
1102
|
+
|
|
1103
|
+
```typescript
|
|
1104
|
+
public readonly banner: string;
|
|
1105
|
+
```
|
|
1106
|
+
|
|
1107
|
+
- *Type:* string
|
|
1108
|
+
- *Default:* none
|
|
1109
|
+
|
|
1110
|
+
Text to prepend to the bundle.
|
|
1111
|
+
|
|
1112
|
+
---
|
|
1113
|
+
|
|
1114
|
+
##### `define`<sup>Optional</sup> <a name="define" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.define"></a>
|
|
1115
|
+
|
|
1116
|
+
```typescript
|
|
1117
|
+
public readonly define: {[ key: string ]: string};
|
|
1118
|
+
```
|
|
1119
|
+
|
|
1120
|
+
- *Type:* {[ key: string ]: string}
|
|
1121
|
+
- *Default:* none
|
|
1122
|
+
|
|
1123
|
+
Replace global identifiers with constant expressions (esbuild `--define`).
|
|
1124
|
+
|
|
1125
|
+
---
|
|
1126
|
+
|
|
1127
|
+
##### `dockerImage`<sup>Optional</sup> <a name="dockerImage" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.dockerImage"></a>
|
|
1128
|
+
|
|
1129
|
+
```typescript
|
|
1130
|
+
public readonly dockerImage: DockerImage;
|
|
1131
|
+
```
|
|
1132
|
+
|
|
1133
|
+
- *Type:* aws-cdk-lib.DockerImage
|
|
1134
|
+
- *Default:* the arm64 AWS SAM build image for the runtime, e.g. `public.ecr.aws/sam/build-nodejs24.x:latest-arm64`
|
|
1135
|
+
|
|
1136
|
+
Docker image for bundling when esbuild isn't installed locally.
|
|
1137
|
+
|
|
1138
|
+
---
|
|
1139
|
+
|
|
1140
|
+
##### `environment`<sup>Optional</sup> <a name="environment" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.environment"></a>
|
|
1141
|
+
|
|
1142
|
+
```typescript
|
|
1143
|
+
public readonly environment: {[ key: string ]: string};
|
|
1144
|
+
```
|
|
1145
|
+
|
|
1146
|
+
- *Type:* {[ key: string ]: string}
|
|
1147
|
+
- *Default:* none
|
|
1148
|
+
|
|
1149
|
+
Environment variables while bundling (not at runtime).
|
|
1150
|
+
|
|
1151
|
+
---
|
|
1152
|
+
|
|
1153
|
+
##### `esbuildArgs`<sup>Optional</sup> <a name="esbuildArgs" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.esbuildArgs"></a>
|
|
1154
|
+
|
|
1155
|
+
```typescript
|
|
1156
|
+
public readonly esbuildArgs: {[ key: string ]: string | boolean};
|
|
1157
|
+
```
|
|
1158
|
+
|
|
1159
|
+
- *Type:* {[ key: string ]: string | boolean}
|
|
1160
|
+
- *Default:* none
|
|
1161
|
+
|
|
1162
|
+
Extra esbuild arguments, e.g. `{ '--log-limit': '0', '--tree-shaking': true }`.
|
|
1163
|
+
|
|
1164
|
+
---
|
|
1165
|
+
|
|
1166
|
+
##### `externalModules`<sup>Optional</sup> <a name="externalModules" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.externalModules"></a>
|
|
1167
|
+
|
|
1168
|
+
```typescript
|
|
1169
|
+
public readonly externalModules: string[];
|
|
1170
|
+
```
|
|
1171
|
+
|
|
1172
|
+
- *Type:* string[]
|
|
1173
|
+
- *Default:* none
|
|
1174
|
+
|
|
1175
|
+
Modules to leave out of the bundle.
|
|
1176
|
+
|
|
1177
|
+
The runtime has no AWS SDK, so `@aws-sdk/*` is bundled like
|
|
1178
|
+
any other dependency; only exclude modules you provide another way.
|
|
1179
|
+
|
|
1180
|
+
---
|
|
1181
|
+
|
|
1182
|
+
##### `footer`<sup>Optional</sup> <a name="footer" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.footer"></a>
|
|
1183
|
+
|
|
1184
|
+
```typescript
|
|
1185
|
+
public readonly footer: string;
|
|
1186
|
+
```
|
|
1187
|
+
|
|
1188
|
+
- *Type:* string
|
|
1189
|
+
- *Default:* none
|
|
1190
|
+
|
|
1191
|
+
Text to append to the bundle.
|
|
1192
|
+
|
|
1193
|
+
---
|
|
1194
|
+
|
|
1195
|
+
##### `forceDockerBundling`<sup>Optional</sup> <a name="forceDockerBundling" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.forceDockerBundling"></a>
|
|
1196
|
+
|
|
1197
|
+
```typescript
|
|
1198
|
+
public readonly forceDockerBundling: boolean;
|
|
1199
|
+
```
|
|
1200
|
+
|
|
1201
|
+
- *Type:* boolean
|
|
1202
|
+
- *Default:* false
|
|
1203
|
+
|
|
1204
|
+
Always bundle in Docker, even if esbuild is installed locally.
|
|
1205
|
+
|
|
1206
|
+
---
|
|
1207
|
+
|
|
1208
|
+
##### `format`<sup>Optional</sup> <a name="format" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.format"></a>
|
|
1209
|
+
|
|
1210
|
+
```typescript
|
|
1211
|
+
public readonly format: OutputFormat;
|
|
1212
|
+
```
|
|
1213
|
+
|
|
1214
|
+
- *Type:* aws-cdk-lib.aws_lambda_nodejs.OutputFormat
|
|
1215
|
+
- *Default:* OutputFormat.ESM
|
|
1216
|
+
|
|
1217
|
+
Output format.
|
|
1218
|
+
|
|
1219
|
+
ESM is written to `index.mjs` (with a `require` shim, so CommonJS dependencies
|
|
1220
|
+
such as Express work); CommonJS to `index.js`.
|
|
610
1221
|
|
|
611
1222
|
---
|
|
612
1223
|
|
|
613
|
-
##### `
|
|
1224
|
+
##### `keepNames`<sup>Optional</sup> <a name="keepNames" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.keepNames"></a>
|
|
614
1225
|
|
|
615
1226
|
```typescript
|
|
616
|
-
public readonly
|
|
1227
|
+
public readonly keepNames: boolean;
|
|
617
1228
|
```
|
|
618
1229
|
|
|
619
|
-
- *Type:*
|
|
1230
|
+
- *Type:* boolean
|
|
1231
|
+
- *Default:* false
|
|
620
1232
|
|
|
621
|
-
|
|
1233
|
+
Keep function and class names (`--keep-names`).
|
|
622
1234
|
|
|
623
1235
|
---
|
|
624
1236
|
|
|
625
|
-
##### `
|
|
1237
|
+
##### `loader`<sup>Optional</sup> <a name="loader" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.loader"></a>
|
|
626
1238
|
|
|
627
1239
|
```typescript
|
|
628
|
-
public readonly
|
|
1240
|
+
public readonly loader: {[ key: string ]: string};
|
|
1241
|
+
```
|
|
1242
|
+
|
|
1243
|
+
- *Type:* {[ key: string ]: string}
|
|
1244
|
+
- *Default:* esbuild's defaults
|
|
1245
|
+
|
|
1246
|
+
esbuild loaders by file extension, e.g. `{ '.png': 'dataurl' }`.
|
|
1247
|
+
|
|
1248
|
+
---
|
|
1249
|
+
|
|
1250
|
+
##### `minify`<sup>Optional</sup> <a name="minify" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.minify"></a>
|
|
1251
|
+
|
|
1252
|
+
```typescript
|
|
1253
|
+
public readonly minify: boolean;
|
|
1254
|
+
```
|
|
1255
|
+
|
|
1256
|
+
- *Type:* boolean
|
|
1257
|
+
- *Default:* true
|
|
1258
|
+
|
|
1259
|
+
Minify the bundle.
|
|
1260
|
+
|
|
1261
|
+
---
|
|
1262
|
+
|
|
1263
|
+
##### `sourceMap`<sup>Optional</sup> <a name="sourceMap" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.sourceMap"></a>
|
|
1264
|
+
|
|
1265
|
+
```typescript
|
|
1266
|
+
public readonly sourceMap: boolean;
|
|
1267
|
+
```
|
|
1268
|
+
|
|
1269
|
+
- *Type:* boolean
|
|
1270
|
+
- *Default:* true
|
|
1271
|
+
|
|
1272
|
+
Generate a source map, and set `NODE_OPTIONS=--enable-source-maps` so stack traces point at your sources.
|
|
1273
|
+
|
|
1274
|
+
---
|
|
1275
|
+
|
|
1276
|
+
##### `target`<sup>Optional</sup> <a name="target" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.target"></a>
|
|
1277
|
+
|
|
1278
|
+
```typescript
|
|
1279
|
+
public readonly target: string;
|
|
629
1280
|
```
|
|
630
1281
|
|
|
631
1282
|
- *Type:* string
|
|
1283
|
+
- *Default:* the runtime's Node.js version, e.g. `node24`
|
|
632
1284
|
|
|
633
|
-
|
|
1285
|
+
esbuild target.
|
|
1286
|
+
|
|
1287
|
+
---
|
|
1288
|
+
|
|
1289
|
+
##### `tsconfig`<sup>Optional</sup> <a name="tsconfig" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.tsconfig"></a>
|
|
1290
|
+
|
|
1291
|
+
```typescript
|
|
1292
|
+
public readonly tsconfig: string;
|
|
1293
|
+
```
|
|
1294
|
+
|
|
1295
|
+
- *Type:* string
|
|
1296
|
+
- *Default:* esbuild's lookup from the entry file
|
|
1297
|
+
|
|
1298
|
+
Path of the tsconfig.json to use, relative to the project root or absolute (inside the project root).
|
|
1299
|
+
|
|
1300
|
+
---
|
|
1301
|
+
|
|
1302
|
+
### NodejsWebFunctionProps <a name="NodejsWebFunctionProps" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps"></a>
|
|
1303
|
+
|
|
1304
|
+
Properties for a `NodejsWebFunction`.
|
|
1305
|
+
|
|
1306
|
+
#### Initializer <a name="Initializer" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.Initializer"></a>
|
|
1307
|
+
|
|
1308
|
+
```typescript
|
|
1309
|
+
import { NodejsWebFunctionProps } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
1310
|
+
|
|
1311
|
+
const nodejsWebFunctionProps: NodejsWebFunctionProps = { ... }
|
|
1312
|
+
```
|
|
1313
|
+
|
|
1314
|
+
#### Properties <a name="Properties" id="Properties"></a>
|
|
1315
|
+
|
|
1316
|
+
| **Name** | **Type** | **Description** |
|
|
1317
|
+
| --- | --- | --- |
|
|
1318
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.authType">authType</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType">WebFunctionAuthType</a></code> | How callers of the endpoint are authenticated. |
|
|
1319
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.applicationLogLevelV2">applicationLogLevelV2</a></code> | <code>aws-cdk-lib.aws_lambda.ApplicationLogLevel</code> | The minimum level of application logs to keep. |
|
|
1320
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.description">description</a></code> | <code>string</code> | A description of the function's code and configuration. |
|
|
1321
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.endpoint">endpoint</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions">WebFunctionEndpointOptions</a></code> | The endpoint: where it serves from, and its name. |
|
|
1322
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.environment">environment</a></code> | <code>{[ key: string ]: string}</code> | Environment variables. |
|
|
1323
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.logRemovalPolicy">logRemovalPolicy</a></code> | <code>aws-cdk-lib.RemovalPolicy</code> | What happens to the log groups when the function is removed: RETAIN or DESTROY. |
|
|
1324
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.logRetention">logRetention</a></code> | <code>aws-cdk-lib.aws_logs.RetentionDays</code> | Retention for every log group of the function, in every region it serves from. |
|
|
1325
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.maxConcurrencyPerEnvironment">maxConcurrencyPerEnvironment</a></code> | <code>number</code> | How many requests one execution environment handles at the same time (1-128). |
|
|
1326
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.role">role</a></code> | <code>aws-cdk-lib.aws_iam.IRole</code> | The execution role. |
|
|
1327
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.systemLogLevelV2">systemLogLevelV2</a></code> | <code>aws-cdk-lib.aws_lambda.SystemLogLevel</code> | The minimum level of platform logs to keep (DEBUG, INFO or WARN). |
|
|
1328
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.timeout">timeout</a></code> | <code>aws-cdk-lib.Duration</code> | How long a single request may run. |
|
|
1329
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.webFunctionName">webFunctionName</a></code> | <code>string</code> | The function's name. |
|
|
1330
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.entry">entry</a></code> | <code>string</code> | The file that starts your server (TypeScript or JavaScript). |
|
|
1331
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.bundling">bundling</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions">NodejsWebFunctionBundlingOptions</a></code> | How the server is bundled. |
|
|
1332
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.depsLockFilePath">depsLockFilePath</a></code> | <code>string</code> | The lock file that marks the project root (where esbuild resolves `node_modules`). |
|
|
1333
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.projectRoot">projectRoot</a></code> | <code>string</code> | The project root. |
|
|
1334
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.runtime">runtime</a></code> | <code>aws-cdk-lib.aws_lambda.Runtime</code> | The Node.js runtime. |
|
|
1335
|
+
|
|
1336
|
+
---
|
|
1337
|
+
|
|
1338
|
+
##### `authType`<sup>Required</sup> <a name="authType" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.authType"></a>
|
|
1339
|
+
|
|
1340
|
+
```typescript
|
|
1341
|
+
public readonly authType: WebFunctionAuthType;
|
|
1342
|
+
```
|
|
1343
|
+
|
|
1344
|
+
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType">WebFunctionAuthType</a>
|
|
1345
|
+
|
|
1346
|
+
How callers of the endpoint are authenticated.
|
|
1347
|
+
|
|
1348
|
+
---
|
|
1349
|
+
|
|
1350
|
+
##### `applicationLogLevelV2`<sup>Optional</sup> <a name="applicationLogLevelV2" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.applicationLogLevelV2"></a>
|
|
1351
|
+
|
|
1352
|
+
```typescript
|
|
1353
|
+
public readonly applicationLogLevelV2: ApplicationLogLevel;
|
|
1354
|
+
```
|
|
1355
|
+
|
|
1356
|
+
- *Type:* aws-cdk-lib.aws_lambda.ApplicationLogLevel
|
|
1357
|
+
- *Default:* lambda.ApplicationLogLevel.INFO
|
|
1358
|
+
|
|
1359
|
+
The minimum level of application logs to keep.
|
|
1360
|
+
|
|
1361
|
+
---
|
|
1362
|
+
|
|
1363
|
+
##### `description`<sup>Optional</sup> <a name="description" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.description"></a>
|
|
1364
|
+
|
|
1365
|
+
```typescript
|
|
1366
|
+
public readonly description: string;
|
|
1367
|
+
```
|
|
1368
|
+
|
|
1369
|
+
- *Type:* string
|
|
1370
|
+
- *Default:* no description
|
|
1371
|
+
|
|
1372
|
+
A description of the function's code and configuration.
|
|
1373
|
+
|
|
1374
|
+
---
|
|
1375
|
+
|
|
1376
|
+
##### `endpoint`<sup>Optional</sup> <a name="endpoint" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.endpoint"></a>
|
|
1377
|
+
|
|
1378
|
+
```typescript
|
|
1379
|
+
public readonly endpoint: WebFunctionEndpointOptions;
|
|
1380
|
+
```
|
|
1381
|
+
|
|
1382
|
+
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions">WebFunctionEndpointOptions</a>
|
|
1383
|
+
- *Default:* a HOME_REGION endpoint
|
|
1384
|
+
|
|
1385
|
+
The endpoint: where it serves from, and its name.
|
|
1386
|
+
|
|
1387
|
+
---
|
|
1388
|
+
|
|
1389
|
+
##### `environment`<sup>Optional</sup> <a name="environment" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.environment"></a>
|
|
1390
|
+
|
|
1391
|
+
```typescript
|
|
1392
|
+
public readonly environment: {[ key: string ]: string};
|
|
1393
|
+
```
|
|
1394
|
+
|
|
1395
|
+
- *Type:* {[ key: string ]: string}
|
|
1396
|
+
- *Default:* none
|
|
1397
|
+
|
|
1398
|
+
Environment variables.
|
|
1399
|
+
|
|
1400
|
+
Names starting with `AWS_` are reserved.
|
|
1401
|
+
|
|
1402
|
+
---
|
|
1403
|
+
|
|
1404
|
+
##### `logRemovalPolicy`<sup>Optional</sup> <a name="logRemovalPolicy" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.logRemovalPolicy"></a>
|
|
1405
|
+
|
|
1406
|
+
```typescript
|
|
1407
|
+
public readonly logRemovalPolicy: RemovalPolicy;
|
|
1408
|
+
```
|
|
1409
|
+
|
|
1410
|
+
- *Type:* aws-cdk-lib.RemovalPolicy
|
|
1411
|
+
- *Default:* RemovalPolicy.RETAIN
|
|
1412
|
+
|
|
1413
|
+
What happens to the log groups when the function is removed: RETAIN or DESTROY.
|
|
1414
|
+
|
|
1415
|
+
With DESTROY, deletion waits about a minute for environments to flush their last lines.
|
|
1416
|
+
|
|
1417
|
+
---
|
|
1418
|
+
|
|
1419
|
+
##### `logRetention`<sup>Optional</sup> <a name="logRetention" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.logRetention"></a>
|
|
1420
|
+
|
|
1421
|
+
```typescript
|
|
1422
|
+
public readonly logRetention: RetentionDays;
|
|
1423
|
+
```
|
|
1424
|
+
|
|
1425
|
+
- *Type:* aws-cdk-lib.aws_logs.RetentionDays
|
|
1426
|
+
- *Default:* logs.RetentionDays.ONE_MONTH
|
|
1427
|
+
|
|
1428
|
+
Retention for every log group of the function, in every region it serves from.
|
|
1429
|
+
|
|
1430
|
+
---
|
|
1431
|
+
|
|
1432
|
+
##### `maxConcurrencyPerEnvironment`<sup>Optional</sup> <a name="maxConcurrencyPerEnvironment" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.maxConcurrencyPerEnvironment"></a>
|
|
1433
|
+
|
|
1434
|
+
```typescript
|
|
1435
|
+
public readonly maxConcurrencyPerEnvironment: number;
|
|
1436
|
+
```
|
|
1437
|
+
|
|
1438
|
+
- *Type:* number
|
|
1439
|
+
- *Default:* 64
|
|
1440
|
+
|
|
1441
|
+
How many requests one execution environment handles at the same time (1-128).
|
|
1442
|
+
|
|
1443
|
+
Requests share module-level state, so handlers must be concurrency-safe.
|
|
1444
|
+
|
|
1445
|
+
---
|
|
1446
|
+
|
|
1447
|
+
##### `role`<sup>Optional</sup> <a name="role" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.role"></a>
|
|
1448
|
+
|
|
1449
|
+
```typescript
|
|
1450
|
+
public readonly role: IRole;
|
|
1451
|
+
```
|
|
1452
|
+
|
|
1453
|
+
- *Type:* aws-cdk-lib.aws_iam.IRole
|
|
1454
|
+
- *Default:* a role trusting `lambda.amazonaws.com` with `AWSLambdaBasicExecutionRole`
|
|
1455
|
+
|
|
1456
|
+
The execution role.
|
|
1457
|
+
|
|
1458
|
+
An `iam.IRole` (not `IRoleRef`) because the function adds statements to it and grants through it.
|
|
1459
|
+
[disable-awslint:prefer-ref-interface]
|
|
1460
|
+
|
|
1461
|
+
---
|
|
1462
|
+
|
|
1463
|
+
##### `systemLogLevelV2`<sup>Optional</sup> <a name="systemLogLevelV2" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.systemLogLevelV2"></a>
|
|
1464
|
+
|
|
1465
|
+
```typescript
|
|
1466
|
+
public readonly systemLogLevelV2: SystemLogLevel;
|
|
1467
|
+
```
|
|
1468
|
+
|
|
1469
|
+
- *Type:* aws-cdk-lib.aws_lambda.SystemLogLevel
|
|
1470
|
+
- *Default:* lambda.SystemLogLevel.INFO
|
|
1471
|
+
|
|
1472
|
+
The minimum level of platform logs to keep (DEBUG, INFO or WARN).
|
|
1473
|
+
|
|
1474
|
+
---
|
|
1475
|
+
|
|
1476
|
+
##### `timeout`<sup>Optional</sup> <a name="timeout" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.timeout"></a>
|
|
1477
|
+
|
|
1478
|
+
```typescript
|
|
1479
|
+
public readonly timeout: Duration;
|
|
1480
|
+
```
|
|
1481
|
+
|
|
1482
|
+
- *Type:* aws-cdk-lib.Duration
|
|
1483
|
+
- *Default:* Duration.seconds(30)
|
|
1484
|
+
|
|
1485
|
+
How long a single request may run.
|
|
1486
|
+
|
|
1487
|
+
---
|
|
1488
|
+
|
|
1489
|
+
##### `webFunctionName`<sup>Optional</sup> <a name="webFunctionName" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.webFunctionName"></a>
|
|
1490
|
+
|
|
1491
|
+
```typescript
|
|
1492
|
+
public readonly webFunctionName: string;
|
|
1493
|
+
```
|
|
1494
|
+
|
|
1495
|
+
- *Type:* string
|
|
1496
|
+
- *Default:* a unique name generated from the construct path (moving the construct changes it)
|
|
1497
|
+
|
|
1498
|
+
The function's name.
|
|
1499
|
+
|
|
1500
|
+
Renaming a function replaces it, and its endpoint gets a new URL.
|
|
1501
|
+
|
|
1502
|
+
---
|
|
1503
|
+
|
|
1504
|
+
##### `entry`<sup>Required</sup> <a name="entry" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.entry"></a>
|
|
1505
|
+
|
|
1506
|
+
```typescript
|
|
1507
|
+
public readonly entry: string;
|
|
1508
|
+
```
|
|
1509
|
+
|
|
1510
|
+
- *Type:* string
|
|
1511
|
+
|
|
1512
|
+
The file that starts your server (TypeScript or JavaScript).
|
|
1513
|
+
|
|
1514
|
+
It's bundled with its dependencies.
|
|
1515
|
+
|
|
1516
|
+
---
|
|
1517
|
+
|
|
1518
|
+
##### `bundling`<sup>Optional</sup> <a name="bundling" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.bundling"></a>
|
|
1519
|
+
|
|
1520
|
+
```typescript
|
|
1521
|
+
public readonly bundling: NodejsWebFunctionBundlingOptions;
|
|
1522
|
+
```
|
|
1523
|
+
|
|
1524
|
+
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions">NodejsWebFunctionBundlingOptions</a>
|
|
1525
|
+
- *Default:* minified ESM with a source map, targeting the runtime's Node.js version
|
|
1526
|
+
|
|
1527
|
+
How the server is bundled.
|
|
1528
|
+
|
|
1529
|
+
---
|
|
1530
|
+
|
|
1531
|
+
##### `depsLockFilePath`<sup>Optional</sup> <a name="depsLockFilePath" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.depsLockFilePath"></a>
|
|
1532
|
+
|
|
1533
|
+
```typescript
|
|
1534
|
+
public readonly depsLockFilePath: string;
|
|
1535
|
+
```
|
|
1536
|
+
|
|
1537
|
+
- *Type:* string
|
|
1538
|
+
- *Default:* the nearest `package-lock.json`, `yarn.lock`, `pnpm-lock.yaml` or `bun.lock(b)` above the entry
|
|
1539
|
+
|
|
1540
|
+
The lock file that marks the project root (where esbuild resolves `node_modules`).
|
|
1541
|
+
|
|
1542
|
+
---
|
|
1543
|
+
|
|
1544
|
+
##### `projectRoot`<sup>Optional</sup> <a name="projectRoot" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.projectRoot"></a>
|
|
1545
|
+
|
|
1546
|
+
```typescript
|
|
1547
|
+
public readonly projectRoot: string;
|
|
1548
|
+
```
|
|
1549
|
+
|
|
1550
|
+
- *Type:* string
|
|
1551
|
+
- *Default:* the directory of the lock file
|
|
1552
|
+
|
|
1553
|
+
The project root.
|
|
1554
|
+
|
|
1555
|
+
Must contain the entry file.
|
|
1556
|
+
|
|
1557
|
+
---
|
|
1558
|
+
|
|
1559
|
+
##### `runtime`<sup>Optional</sup> <a name="runtime" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.runtime"></a>
|
|
1560
|
+
|
|
1561
|
+
```typescript
|
|
1562
|
+
public readonly runtime: Runtime;
|
|
1563
|
+
```
|
|
634
1564
|
|
|
635
|
-
|
|
1565
|
+
- *Type:* aws-cdk-lib.aws_lambda.Runtime
|
|
1566
|
+
- *Default:* lambda.Runtime.NODEJS_24_X
|
|
636
1567
|
|
|
1568
|
+
The Node.js runtime.
|
|
637
1569
|
|
|
638
|
-
|
|
1570
|
+
---
|
|
639
1571
|
|
|
640
1572
|
### WebFunctionEndpointOptions <a name="WebFunctionEndpointOptions" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions"></a>
|
|
641
1573
|
|
|
@@ -707,6 +1639,203 @@ Changing this creates a new endpoint with a new URL.
|
|
|
707
1639
|
|
|
708
1640
|
---
|
|
709
1641
|
|
|
1642
|
+
### WebFunctionOptions <a name="WebFunctionOptions" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions"></a>
|
|
1643
|
+
|
|
1644
|
+
Options shared by `WebFunction` and `NodejsWebFunction`: everything except how the code is supplied.
|
|
1645
|
+
|
|
1646
|
+
#### Initializer <a name="Initializer" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.Initializer"></a>
|
|
1647
|
+
|
|
1648
|
+
```typescript
|
|
1649
|
+
import { WebFunctionOptions } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
1650
|
+
|
|
1651
|
+
const webFunctionOptions: WebFunctionOptions = { ... }
|
|
1652
|
+
```
|
|
1653
|
+
|
|
1654
|
+
#### Properties <a name="Properties" id="Properties"></a>
|
|
1655
|
+
|
|
1656
|
+
| **Name** | **Type** | **Description** |
|
|
1657
|
+
| --- | --- | --- |
|
|
1658
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.authType">authType</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType">WebFunctionAuthType</a></code> | How callers of the endpoint are authenticated. |
|
|
1659
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.applicationLogLevelV2">applicationLogLevelV2</a></code> | <code>aws-cdk-lib.aws_lambda.ApplicationLogLevel</code> | The minimum level of application logs to keep. |
|
|
1660
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.description">description</a></code> | <code>string</code> | A description of the function's code and configuration. |
|
|
1661
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.endpoint">endpoint</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions">WebFunctionEndpointOptions</a></code> | The endpoint: where it serves from, and its name. |
|
|
1662
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.environment">environment</a></code> | <code>{[ key: string ]: string}</code> | Environment variables. |
|
|
1663
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.logRemovalPolicy">logRemovalPolicy</a></code> | <code>aws-cdk-lib.RemovalPolicy</code> | What happens to the log groups when the function is removed: RETAIN or DESTROY. |
|
|
1664
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.logRetention">logRetention</a></code> | <code>aws-cdk-lib.aws_logs.RetentionDays</code> | Retention for every log group of the function, in every region it serves from. |
|
|
1665
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.maxConcurrencyPerEnvironment">maxConcurrencyPerEnvironment</a></code> | <code>number</code> | How many requests one execution environment handles at the same time (1-128). |
|
|
1666
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.role">role</a></code> | <code>aws-cdk-lib.aws_iam.IRole</code> | The execution role. |
|
|
1667
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.systemLogLevelV2">systemLogLevelV2</a></code> | <code>aws-cdk-lib.aws_lambda.SystemLogLevel</code> | The minimum level of platform logs to keep (DEBUG, INFO or WARN). |
|
|
1668
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.timeout">timeout</a></code> | <code>aws-cdk-lib.Duration</code> | How long a single request may run. |
|
|
1669
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.webFunctionName">webFunctionName</a></code> | <code>string</code> | The function's name. |
|
|
1670
|
+
|
|
1671
|
+
---
|
|
1672
|
+
|
|
1673
|
+
##### `authType`<sup>Required</sup> <a name="authType" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.authType"></a>
|
|
1674
|
+
|
|
1675
|
+
```typescript
|
|
1676
|
+
public readonly authType: WebFunctionAuthType;
|
|
1677
|
+
```
|
|
1678
|
+
|
|
1679
|
+
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType">WebFunctionAuthType</a>
|
|
1680
|
+
|
|
1681
|
+
How callers of the endpoint are authenticated.
|
|
1682
|
+
|
|
1683
|
+
---
|
|
1684
|
+
|
|
1685
|
+
##### `applicationLogLevelV2`<sup>Optional</sup> <a name="applicationLogLevelV2" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.applicationLogLevelV2"></a>
|
|
1686
|
+
|
|
1687
|
+
```typescript
|
|
1688
|
+
public readonly applicationLogLevelV2: ApplicationLogLevel;
|
|
1689
|
+
```
|
|
1690
|
+
|
|
1691
|
+
- *Type:* aws-cdk-lib.aws_lambda.ApplicationLogLevel
|
|
1692
|
+
- *Default:* lambda.ApplicationLogLevel.INFO
|
|
1693
|
+
|
|
1694
|
+
The minimum level of application logs to keep.
|
|
1695
|
+
|
|
1696
|
+
---
|
|
1697
|
+
|
|
1698
|
+
##### `description`<sup>Optional</sup> <a name="description" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.description"></a>
|
|
1699
|
+
|
|
1700
|
+
```typescript
|
|
1701
|
+
public readonly description: string;
|
|
1702
|
+
```
|
|
1703
|
+
|
|
1704
|
+
- *Type:* string
|
|
1705
|
+
- *Default:* no description
|
|
1706
|
+
|
|
1707
|
+
A description of the function's code and configuration.
|
|
1708
|
+
|
|
1709
|
+
---
|
|
1710
|
+
|
|
1711
|
+
##### `endpoint`<sup>Optional</sup> <a name="endpoint" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.endpoint"></a>
|
|
1712
|
+
|
|
1713
|
+
```typescript
|
|
1714
|
+
public readonly endpoint: WebFunctionEndpointOptions;
|
|
1715
|
+
```
|
|
1716
|
+
|
|
1717
|
+
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions">WebFunctionEndpointOptions</a>
|
|
1718
|
+
- *Default:* a HOME_REGION endpoint
|
|
1719
|
+
|
|
1720
|
+
The endpoint: where it serves from, and its name.
|
|
1721
|
+
|
|
1722
|
+
---
|
|
1723
|
+
|
|
1724
|
+
##### `environment`<sup>Optional</sup> <a name="environment" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.environment"></a>
|
|
1725
|
+
|
|
1726
|
+
```typescript
|
|
1727
|
+
public readonly environment: {[ key: string ]: string};
|
|
1728
|
+
```
|
|
1729
|
+
|
|
1730
|
+
- *Type:* {[ key: string ]: string}
|
|
1731
|
+
- *Default:* none
|
|
1732
|
+
|
|
1733
|
+
Environment variables.
|
|
1734
|
+
|
|
1735
|
+
Names starting with `AWS_` are reserved.
|
|
1736
|
+
|
|
1737
|
+
---
|
|
1738
|
+
|
|
1739
|
+
##### `logRemovalPolicy`<sup>Optional</sup> <a name="logRemovalPolicy" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.logRemovalPolicy"></a>
|
|
1740
|
+
|
|
1741
|
+
```typescript
|
|
1742
|
+
public readonly logRemovalPolicy: RemovalPolicy;
|
|
1743
|
+
```
|
|
1744
|
+
|
|
1745
|
+
- *Type:* aws-cdk-lib.RemovalPolicy
|
|
1746
|
+
- *Default:* RemovalPolicy.RETAIN
|
|
1747
|
+
|
|
1748
|
+
What happens to the log groups when the function is removed: RETAIN or DESTROY.
|
|
1749
|
+
|
|
1750
|
+
With DESTROY, deletion waits about a minute for environments to flush their last lines.
|
|
1751
|
+
|
|
1752
|
+
---
|
|
1753
|
+
|
|
1754
|
+
##### `logRetention`<sup>Optional</sup> <a name="logRetention" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.logRetention"></a>
|
|
1755
|
+
|
|
1756
|
+
```typescript
|
|
1757
|
+
public readonly logRetention: RetentionDays;
|
|
1758
|
+
```
|
|
1759
|
+
|
|
1760
|
+
- *Type:* aws-cdk-lib.aws_logs.RetentionDays
|
|
1761
|
+
- *Default:* logs.RetentionDays.ONE_MONTH
|
|
1762
|
+
|
|
1763
|
+
Retention for every log group of the function, in every region it serves from.
|
|
1764
|
+
|
|
1765
|
+
---
|
|
1766
|
+
|
|
1767
|
+
##### `maxConcurrencyPerEnvironment`<sup>Optional</sup> <a name="maxConcurrencyPerEnvironment" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.maxConcurrencyPerEnvironment"></a>
|
|
1768
|
+
|
|
1769
|
+
```typescript
|
|
1770
|
+
public readonly maxConcurrencyPerEnvironment: number;
|
|
1771
|
+
```
|
|
1772
|
+
|
|
1773
|
+
- *Type:* number
|
|
1774
|
+
- *Default:* 64
|
|
1775
|
+
|
|
1776
|
+
How many requests one execution environment handles at the same time (1-128).
|
|
1777
|
+
|
|
1778
|
+
Requests share module-level state, so handlers must be concurrency-safe.
|
|
1779
|
+
|
|
1780
|
+
---
|
|
1781
|
+
|
|
1782
|
+
##### `role`<sup>Optional</sup> <a name="role" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.role"></a>
|
|
1783
|
+
|
|
1784
|
+
```typescript
|
|
1785
|
+
public readonly role: IRole;
|
|
1786
|
+
```
|
|
1787
|
+
|
|
1788
|
+
- *Type:* aws-cdk-lib.aws_iam.IRole
|
|
1789
|
+
- *Default:* a role trusting `lambda.amazonaws.com` with `AWSLambdaBasicExecutionRole`
|
|
1790
|
+
|
|
1791
|
+
The execution role.
|
|
1792
|
+
|
|
1793
|
+
An `iam.IRole` (not `IRoleRef`) because the function adds statements to it and grants through it.
|
|
1794
|
+
[disable-awslint:prefer-ref-interface]
|
|
1795
|
+
|
|
1796
|
+
---
|
|
1797
|
+
|
|
1798
|
+
##### `systemLogLevelV2`<sup>Optional</sup> <a name="systemLogLevelV2" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.systemLogLevelV2"></a>
|
|
1799
|
+
|
|
1800
|
+
```typescript
|
|
1801
|
+
public readonly systemLogLevelV2: SystemLogLevel;
|
|
1802
|
+
```
|
|
1803
|
+
|
|
1804
|
+
- *Type:* aws-cdk-lib.aws_lambda.SystemLogLevel
|
|
1805
|
+
- *Default:* lambda.SystemLogLevel.INFO
|
|
1806
|
+
|
|
1807
|
+
The minimum level of platform logs to keep (DEBUG, INFO or WARN).
|
|
1808
|
+
|
|
1809
|
+
---
|
|
1810
|
+
|
|
1811
|
+
##### `timeout`<sup>Optional</sup> <a name="timeout" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.timeout"></a>
|
|
1812
|
+
|
|
1813
|
+
```typescript
|
|
1814
|
+
public readonly timeout: Duration;
|
|
1815
|
+
```
|
|
1816
|
+
|
|
1817
|
+
- *Type:* aws-cdk-lib.Duration
|
|
1818
|
+
- *Default:* Duration.seconds(30)
|
|
1819
|
+
|
|
1820
|
+
How long a single request may run.
|
|
1821
|
+
|
|
1822
|
+
---
|
|
1823
|
+
|
|
1824
|
+
##### `webFunctionName`<sup>Optional</sup> <a name="webFunctionName" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.webFunctionName"></a>
|
|
1825
|
+
|
|
1826
|
+
```typescript
|
|
1827
|
+
public readonly webFunctionName: string;
|
|
1828
|
+
```
|
|
1829
|
+
|
|
1830
|
+
- *Type:* string
|
|
1831
|
+
- *Default:* a unique name generated from the construct path (moving the construct changes it)
|
|
1832
|
+
|
|
1833
|
+
The function's name.
|
|
1834
|
+
|
|
1835
|
+
Renaming a function replaces it, and its endpoint gets a new URL.
|
|
1836
|
+
|
|
1837
|
+
---
|
|
1838
|
+
|
|
710
1839
|
### WebFunctionProps <a name="WebFunctionProps" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps"></a>
|
|
711
1840
|
|
|
712
1841
|
Properties for a `WebFunction`.
|
|
@@ -724,12 +1853,9 @@ const webFunctionProps: WebFunctionProps = { ... }
|
|
|
724
1853
|
| **Name** | **Type** | **Description** |
|
|
725
1854
|
| --- | --- | --- |
|
|
726
1855
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps.property.authType">authType</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType">WebFunctionAuthType</a></code> | How callers of the endpoint are authenticated. |
|
|
727
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps.property.code">code</a></code> | <code>aws-cdk-lib.aws_lambda.Code</code> | The code: a zip in S3 (`Code.fromAsset`, `Code.fromBucket`, `Code.fromCustomCommand`, `Code.fromDockerBuild`). Inline code and container images aren't supported. |
|
|
728
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps.property.runtime">runtime</a></code> | <code>aws-cdk-lib.aws_lambda.Runtime</code> | The Node.js runtime, e.g. `lambda.Runtime.NODEJS_24_X`. |
|
|
729
1856
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps.property.applicationLogLevelV2">applicationLogLevelV2</a></code> | <code>aws-cdk-lib.aws_lambda.ApplicationLogLevel</code> | The minimum level of application logs to keep. |
|
|
730
1857
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps.property.description">description</a></code> | <code>string</code> | A description of the function's code and configuration. |
|
|
731
1858
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps.property.endpoint">endpoint</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions">WebFunctionEndpointOptions</a></code> | The endpoint: where it serves from, and its name. |
|
|
732
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps.property.entrypoint">entrypoint</a></code> | <code>string</code> | The file that starts your server, relative to the root of the code. |
|
|
733
1859
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps.property.environment">environment</a></code> | <code>{[ key: string ]: string}</code> | Environment variables. |
|
|
734
1860
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps.property.logRemovalPolicy">logRemovalPolicy</a></code> | <code>aws-cdk-lib.RemovalPolicy</code> | What happens to the log groups when the function is removed: RETAIN or DESTROY. |
|
|
735
1861
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps.property.logRetention">logRetention</a></code> | <code>aws-cdk-lib.aws_logs.RetentionDays</code> | Retention for every log group of the function, in every region it serves from. |
|
|
@@ -738,6 +1864,9 @@ const webFunctionProps: WebFunctionProps = { ... }
|
|
|
738
1864
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps.property.systemLogLevelV2">systemLogLevelV2</a></code> | <code>aws-cdk-lib.aws_lambda.SystemLogLevel</code> | The minimum level of platform logs to keep (DEBUG, INFO or WARN). |
|
|
739
1865
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps.property.timeout">timeout</a></code> | <code>aws-cdk-lib.Duration</code> | How long a single request may run. |
|
|
740
1866
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps.property.webFunctionName">webFunctionName</a></code> | <code>string</code> | The function's name. |
|
|
1867
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps.property.code">code</a></code> | <code>aws-cdk-lib.aws_lambda.Code</code> | The code: a zip in S3 (`Code.fromAsset`, `Code.fromBucket`, `Code.fromCustomCommand`, `Code.fromDockerBuild`). Inline code and container images aren't supported. |
|
|
1868
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps.property.runtime">runtime</a></code> | <code>aws-cdk-lib.aws_lambda.Runtime</code> | The Node.js runtime, e.g. `lambda.Runtime.NODEJS_24_X`. |
|
|
1869
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps.property.entrypoint">entrypoint</a></code> | <code>string</code> | The file that starts your server, relative to the root of the code. |
|
|
741
1870
|
|
|
742
1871
|
---
|
|
743
1872
|
|
|
@@ -753,32 +1882,6 @@ How callers of the endpoint are authenticated.
|
|
|
753
1882
|
|
|
754
1883
|
---
|
|
755
1884
|
|
|
756
|
-
##### `code`<sup>Required</sup> <a name="code" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps.property.code"></a>
|
|
757
|
-
|
|
758
|
-
```typescript
|
|
759
|
-
public readonly code: Code;
|
|
760
|
-
```
|
|
761
|
-
|
|
762
|
-
- *Type:* aws-cdk-lib.aws_lambda.Code
|
|
763
|
-
|
|
764
|
-
The code: a zip in S3 (`Code.fromAsset`, `Code.fromBucket`, `Code.fromCustomCommand`, `Code.fromDockerBuild`). Inline code and container images aren't supported.
|
|
765
|
-
|
|
766
|
-
The code is copied into the stack's code bucket, which Lambda Web Functions can read.
|
|
767
|
-
|
|
768
|
-
---
|
|
769
|
-
|
|
770
|
-
##### `runtime`<sup>Required</sup> <a name="runtime" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps.property.runtime"></a>
|
|
771
|
-
|
|
772
|
-
```typescript
|
|
773
|
-
public readonly runtime: Runtime;
|
|
774
|
-
```
|
|
775
|
-
|
|
776
|
-
- *Type:* aws-cdk-lib.aws_lambda.Runtime
|
|
777
|
-
|
|
778
|
-
The Node.js runtime, e.g. `lambda.Runtime.NODEJS_24_X`.
|
|
779
|
-
|
|
780
|
-
---
|
|
781
|
-
|
|
782
1885
|
##### `applicationLogLevelV2`<sup>Optional</sup> <a name="applicationLogLevelV2" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps.property.applicationLogLevelV2"></a>
|
|
783
1886
|
|
|
784
1887
|
```typescript
|
|
@@ -818,19 +1921,6 @@ The endpoint: where it serves from, and its name.
|
|
|
818
1921
|
|
|
819
1922
|
---
|
|
820
1923
|
|
|
821
|
-
##### `entrypoint`<sup>Optional</sup> <a name="entrypoint" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps.property.entrypoint"></a>
|
|
822
|
-
|
|
823
|
-
```typescript
|
|
824
|
-
public readonly entrypoint: string;
|
|
825
|
-
```
|
|
826
|
-
|
|
827
|
-
- *Type:* string
|
|
828
|
-
- *Default:* 'index.js'
|
|
829
|
-
|
|
830
|
-
The file that starts your server, relative to the root of the code.
|
|
831
|
-
|
|
832
|
-
---
|
|
833
|
-
|
|
834
1924
|
##### `environment`<sup>Optional</sup> <a name="environment" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps.property.environment"></a>
|
|
835
1925
|
|
|
836
1926
|
```typescript
|
|
@@ -946,6 +2036,45 @@ Renaming a function replaces it, and its endpoint gets a new URL.
|
|
|
946
2036
|
|
|
947
2037
|
---
|
|
948
2038
|
|
|
2039
|
+
##### `code`<sup>Required</sup> <a name="code" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps.property.code"></a>
|
|
2040
|
+
|
|
2041
|
+
```typescript
|
|
2042
|
+
public readonly code: Code;
|
|
2043
|
+
```
|
|
2044
|
+
|
|
2045
|
+
- *Type:* aws-cdk-lib.aws_lambda.Code
|
|
2046
|
+
|
|
2047
|
+
The code: a zip in S3 (`Code.fromAsset`, `Code.fromBucket`, `Code.fromCustomCommand`, `Code.fromDockerBuild`). Inline code and container images aren't supported.
|
|
2048
|
+
|
|
2049
|
+
The code is copied into the stack's code bucket, which Lambda Web Functions can read.
|
|
2050
|
+
|
|
2051
|
+
---
|
|
2052
|
+
|
|
2053
|
+
##### `runtime`<sup>Required</sup> <a name="runtime" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps.property.runtime"></a>
|
|
2054
|
+
|
|
2055
|
+
```typescript
|
|
2056
|
+
public readonly runtime: Runtime;
|
|
2057
|
+
```
|
|
2058
|
+
|
|
2059
|
+
- *Type:* aws-cdk-lib.aws_lambda.Runtime
|
|
2060
|
+
|
|
2061
|
+
The Node.js runtime, e.g. `lambda.Runtime.NODEJS_24_X`.
|
|
2062
|
+
|
|
2063
|
+
---
|
|
2064
|
+
|
|
2065
|
+
##### `entrypoint`<sup>Optional</sup> <a name="entrypoint" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps.property.entrypoint"></a>
|
|
2066
|
+
|
|
2067
|
+
```typescript
|
|
2068
|
+
public readonly entrypoint: string;
|
|
2069
|
+
```
|
|
2070
|
+
|
|
2071
|
+
- *Type:* string
|
|
2072
|
+
- *Default:* 'index.js'
|
|
2073
|
+
|
|
2074
|
+
The file that starts your server, relative to the root of the code.
|
|
2075
|
+
|
|
2076
|
+
---
|
|
2077
|
+
|
|
949
2078
|
## Classes <a name="Classes" id="Classes"></a>
|
|
950
2079
|
|
|
951
2080
|
### WebFunctionGrants <a name="WebFunctionGrants" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionGrants"></a>
|
|
@@ -988,7 +2117,7 @@ endpoint serves from, including a MULTI_REGION global URL.
|
|
|
988
2117
|
|
|
989
2118
|
- *Extends:* aws-cdk-lib.IResource, aws-cdk-lib.interfaces.aws_lambda.IWebFunctionRef
|
|
990
2119
|
|
|
991
|
-
- *Implemented By:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction">WebFunction</a>, <a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunction">IWebFunction</a>
|
|
2120
|
+
- *Implemented By:* <a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction">NodejsWebFunction</a>, <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction">WebFunction</a>, <a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunction">IWebFunction</a>
|
|
992
2121
|
|
|
993
2122
|
A Lambda Web Function.
|
|
994
2123
|
|