@ashishpandeyone/cdk-lambda-web-function 0.1.0 → 0.1.2

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/API.md CHANGED
@@ -2,48 +2,44 @@
2
2
 
3
3
  ## Constructs <a name="Constructs" id="Constructs"></a>
4
4
 
5
- ### WebFunction <a name="WebFunction" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction"></a>
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
- Creates the function, its current revision (code and configuration; any change replaces it),
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
- Importing existing functions (`fromXxx` methods) is planned after 0.1.
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.WebFunction.Initializer"></a>
12
+ #### Initializers <a name="Initializers" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.Initializer"></a>
17
13
 
18
14
  ```typescript
19
- import { WebFunction } from '@ashishpandeyone/cdk-lambda-web-function'
15
+ import { NodejsWebFunction } from '@ashishpandeyone/cdk-lambda-web-function'
20
16
 
21
- new WebFunction(scope: Construct, id: string, props: WebFunctionProps)
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.WebFunction.Initializer.parameter.scope">scope</a></code> | <code>constructs.Construct</code> | *No description.* |
27
- | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.Initializer.parameter.id">id</a></code> | <code>string</code> | *No description.* |
28
- | <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.* |
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.WebFunction.Initializer.parameter.scope"></a>
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.WebFunction.Initializer.parameter.id"></a>
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.WebFunction.Initializer.parameter.props"></a>
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.WebFunctionProps">WebFunctionProps</a>
42
+ - *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps">NodejsWebFunctionProps</a>
47
43
 
48
44
  ---
49
45
 
@@ -51,17 +47,18 @@ 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.WebFunction.toString">toString</a></code> | Returns a string representation of this construct. |
55
- | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.with">with</a></code> | Applies one or more mixins to this construct. |
56
- | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.applyCrossStackReferenceStrength">applyCrossStackReferenceStrength</a></code> | Override the cross-stack reference strength for this resource. |
57
- | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.applyRemovalPolicy">applyRemovalPolicy</a></code> | Apply the given removal policy to this resource. |
58
- | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEnvironment">addEnvironment</a></code> | Adds an environment variable. |
59
- | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.addToRolePolicy">addToRolePolicy</a></code> | Adds a statement to the execution role's policy. |
60
- | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.grantInvoke">grantInvoke</a></code> | Allows `grantee` to call the endpoint. |
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.addEndpoint">addEndpoint</a></code> | Adds an endpoint (up to 10 per function), e.g. a public one next to an IAM-only one, or one pinned to an earlier revision. Each endpoint has its own URL, authentication, regions and limits. |
55
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addEnvironment">addEnvironment</a></code> | Adds an environment variable. |
56
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addToRolePolicy">addToRolePolicy</a></code> | Adds a statement to the execution role's policy. |
57
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.grantInvoke">grantInvoke</a></code> | Allows `grantee` to call the endpoint. |
61
58
 
62
59
  ---
63
60
 
64
- ##### `toString` <a name="toString" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.toString"></a>
61
+ ##### `toString` <a name="toString" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.toString"></a>
65
62
 
66
63
  ```typescript
67
64
  public toString(): string
@@ -69,7 +66,7 @@ public toString(): string
69
66
 
70
67
  Returns a string representation of this construct.
71
68
 
72
- ##### `with` <a name="with" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.with"></a>
69
+ ##### `with` <a name="with" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.with"></a>
73
70
 
74
71
  ```typescript
75
72
  public with(mixins: ...IMixin[]): IConstruct
@@ -82,13 +79,13 @@ start of the call, so constructs added by a mixin will not be visited.
82
79
  Use multiple `with()` calls if subsequent mixins should apply to added
83
80
  constructs.
84
81
 
85
- ###### `mixins`<sup>Required</sup> <a name="mixins" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.with.parameter.mixins"></a>
82
+ ###### `mixins`<sup>Required</sup> <a name="mixins" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.with.parameter.mixins"></a>
86
83
 
87
84
  - *Type:* ...constructs.IMixin[]
88
85
 
89
86
  ---
90
87
 
91
- ##### `applyCrossStackReferenceStrength` <a name="applyCrossStackReferenceStrength" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.applyCrossStackReferenceStrength"></a>
88
+ ##### `applyCrossStackReferenceStrength` <a name="applyCrossStackReferenceStrength" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.applyCrossStackReferenceStrength"></a>
92
89
 
93
90
  ```typescript
94
91
  public applyCrossStackReferenceStrength(strength: ReferenceStrength): void
@@ -102,7 +99,7 @@ mechanism instead of the global default determined by the
102
99
  selectively weakening specific references to avoid the "deadly embrace" problem
103
100
  without changing the app-wide default.
104
101
 
105
- ###### `strength`<sup>Required</sup> <a name="strength" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.applyCrossStackReferenceStrength.parameter.strength"></a>
102
+ ###### `strength`<sup>Required</sup> <a name="strength" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.applyCrossStackReferenceStrength.parameter.strength"></a>
106
103
 
107
104
  - *Type:* aws-cdk-lib.ReferenceStrength
108
105
 
@@ -110,7 +107,7 @@ The reference strength to use for this resource.
110
107
 
111
108
  ---
112
109
 
113
- ##### `applyRemovalPolicy` <a name="applyRemovalPolicy" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.applyRemovalPolicy"></a>
110
+ ##### `applyRemovalPolicy` <a name="applyRemovalPolicy" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.applyRemovalPolicy"></a>
114
111
 
115
112
  ```typescript
116
113
  public applyRemovalPolicy(policy: RemovalPolicy): void
@@ -126,13 +123,35 @@ to be replaced.
126
123
  The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
127
124
  account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
128
125
 
129
- ###### `policy`<sup>Required</sup> <a name="policy" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.applyRemovalPolicy.parameter.policy"></a>
126
+ ###### `policy`<sup>Required</sup> <a name="policy" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.applyRemovalPolicy.parameter.policy"></a>
130
127
 
131
128
  - *Type:* aws-cdk-lib.RemovalPolicy
132
129
 
133
130
  ---
134
131
 
135
- ##### `addEnvironment` <a name="addEnvironment" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEnvironment"></a>
132
+ ##### `addEndpoint` <a name="addEndpoint" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addEndpoint"></a>
133
+
134
+ ```typescript
135
+ public addEndpoint(id: string, options: AddWebFunctionEndpointOptions): WebFunctionEndpoint
136
+ ```
137
+
138
+ Adds an endpoint (up to 10 per function), e.g. a public one next to an IAM-only one, or one pinned to an earlier revision. Each endpoint has its own URL, authentication, regions and limits.
139
+
140
+ ###### `id`<sup>Required</sup> <a name="id" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addEndpoint.parameter.id"></a>
141
+
142
+ - *Type:* string
143
+
144
+ the endpoint's construct ID, also used in its generated name (`<id>-<hash>`).
145
+
146
+ ---
147
+
148
+ ###### `options`<sup>Required</sup> <a name="options" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addEndpoint.parameter.options"></a>
149
+
150
+ - *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions">AddWebFunctionEndpointOptions</a>
151
+
152
+ ---
153
+
154
+ ##### `addEnvironment` <a name="addEnvironment" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addEnvironment"></a>
136
155
 
137
156
  ```typescript
138
157
  public addEnvironment(key: string, value: string): WebFunction
@@ -142,19 +161,19 @@ Adds an environment variable.
142
161
 
143
162
  Names starting with `AWS_` are reserved.
144
163
 
145
- ###### `key`<sup>Required</sup> <a name="key" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEnvironment.parameter.key"></a>
164
+ ###### `key`<sup>Required</sup> <a name="key" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addEnvironment.parameter.key"></a>
146
165
 
147
166
  - *Type:* string
148
167
 
149
168
  ---
150
169
 
151
- ###### `value`<sup>Required</sup> <a name="value" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEnvironment.parameter.value"></a>
170
+ ###### `value`<sup>Required</sup> <a name="value" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addEnvironment.parameter.value"></a>
152
171
 
153
172
  - *Type:* string
154
173
 
155
174
  ---
156
175
 
157
- ##### `addToRolePolicy` <a name="addToRolePolicy" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addToRolePolicy"></a>
176
+ ##### `addToRolePolicy` <a name="addToRolePolicy" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addToRolePolicy"></a>
158
177
 
159
178
  ```typescript
160
179
  public addToRolePolicy(statement: PolicyStatement): void
@@ -162,13 +181,13 @@ public addToRolePolicy(statement: PolicyStatement): void
162
181
 
163
182
  Adds a statement to the execution role's policy.
164
183
 
165
- ###### `statement`<sup>Required</sup> <a name="statement" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addToRolePolicy.parameter.statement"></a>
184
+ ###### `statement`<sup>Required</sup> <a name="statement" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addToRolePolicy.parameter.statement"></a>
166
185
 
167
186
  - *Type:* aws-cdk-lib.aws_iam.PolicyStatement
168
187
 
169
188
  ---
170
189
 
171
- ##### `grantInvoke` <a name="grantInvoke" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.grantInvoke"></a>
190
+ ##### `grantInvoke` <a name="grantInvoke" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.grantInvoke"></a>
172
191
 
173
192
  ```typescript
174
193
  public grantInvoke(grantee: IGrantable): Grant
@@ -179,7 +198,7 @@ Allows `grantee` to call the endpoint.
179
198
  Shortcut for `grants.invoke(grantee)`, as on `lambda.Function`.
180
199
  [disable-awslint:no-grants]
181
200
 
182
- ###### `grantee`<sup>Required</sup> <a name="grantee" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.grantInvoke.parameter.grantee"></a>
201
+ ###### `grantee`<sup>Required</sup> <a name="grantee" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.grantInvoke.parameter.grantee"></a>
183
202
 
184
203
  - *Type:* aws-cdk-lib.aws_iam.IGrantable
185
204
 
@@ -189,18 +208,18 @@ Shortcut for `grants.invoke(grantee)`, as on `lambda.Function`.
189
208
 
190
209
  | **Name** | **Description** |
191
210
  | --- | --- |
192
- | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.isConstruct">isConstruct</a></code> | Checks if `x` is a construct. |
193
- | <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. |
194
- | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.isResource">isResource</a></code> | Check whether the given construct is a Resource. |
211
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.isConstruct">isConstruct</a></code> | Checks if `x` is a construct. |
212
+ | <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. |
213
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.isResource">isResource</a></code> | Check whether the given construct is a Resource. |
195
214
 
196
215
  ---
197
216
 
198
- ##### `isConstruct` <a name="isConstruct" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.isConstruct"></a>
217
+ ##### `isConstruct` <a name="isConstruct" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.isConstruct"></a>
199
218
 
200
219
  ```typescript
201
- import { WebFunction } from '@ashishpandeyone/cdk-lambda-web-function'
220
+ import { NodejsWebFunction } from '@ashishpandeyone/cdk-lambda-web-function'
202
221
 
203
- WebFunction.isConstruct(x: any)
222
+ NodejsWebFunction.isConstruct(x: any)
204
223
  ```
205
224
 
206
225
  Checks if `x` is a construct.
@@ -219,7 +238,7 @@ library can be accidentally installed, and `instanceof` will behave
219
238
  unpredictably. It is safest to avoid using `instanceof`, and using
220
239
  this type-testing method instead.
221
240
 
222
- ###### `x`<sup>Required</sup> <a name="x" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.isConstruct.parameter.x"></a>
241
+ ###### `x`<sup>Required</sup> <a name="x" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.isConstruct.parameter.x"></a>
223
242
 
224
243
  - *Type:* any
225
244
 
@@ -227,33 +246,33 @@ Any object.
227
246
 
228
247
  ---
229
248
 
230
- ##### `isOwnedResource` <a name="isOwnedResource" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.isOwnedResource"></a>
249
+ ##### `isOwnedResource` <a name="isOwnedResource" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.isOwnedResource"></a>
231
250
 
232
251
  ```typescript
233
- import { WebFunction } from '@ashishpandeyone/cdk-lambda-web-function'
252
+ import { NodejsWebFunction } from '@ashishpandeyone/cdk-lambda-web-function'
234
253
 
235
- WebFunction.isOwnedResource(construct: IConstruct)
254
+ NodejsWebFunction.isOwnedResource(construct: IConstruct)
236
255
  ```
237
256
 
238
257
  Returns true if the construct was created by CDK, and false otherwise.
239
258
 
240
- ###### `construct`<sup>Required</sup> <a name="construct" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.isOwnedResource.parameter.construct"></a>
259
+ ###### `construct`<sup>Required</sup> <a name="construct" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.isOwnedResource.parameter.construct"></a>
241
260
 
242
261
  - *Type:* constructs.IConstruct
243
262
 
244
263
  ---
245
264
 
246
- ##### `isResource` <a name="isResource" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.isResource"></a>
265
+ ##### `isResource` <a name="isResource" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.isResource"></a>
247
266
 
248
267
  ```typescript
249
- import { WebFunction } from '@ashishpandeyone/cdk-lambda-web-function'
268
+ import { NodejsWebFunction } from '@ashishpandeyone/cdk-lambda-web-function'
250
269
 
251
- WebFunction.isResource(construct: IConstruct)
270
+ NodejsWebFunction.isResource(construct: IConstruct)
252
271
  ```
253
272
 
254
273
  Check whether the given construct is a Resource.
255
274
 
256
- ###### `construct`<sup>Required</sup> <a name="construct" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.isResource.parameter.construct"></a>
275
+ ###### `construct`<sup>Required</sup> <a name="construct" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.isResource.parameter.construct"></a>
257
276
 
258
277
  - *Type:* constructs.IConstruct
259
278
 
@@ -263,22 +282,23 @@ Check whether the given construct is a Resource.
263
282
 
264
283
  | **Name** | **Type** | **Description** |
265
284
  | --- | --- | --- |
266
- | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. |
267
- | <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. |
268
- | <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. |
269
- | <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. |
270
- | <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). |
271
- | <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)`). |
272
- | <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. |
273
- | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.revisionId">revisionId</a></code> | <code>string</code> | The ID of the current revision. |
274
- | <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. |
275
- | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.webFunctionArn">webFunctionArn</a></code> | <code>string</code> | The function's ARN. |
276
- | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.webFunctionName">webFunctionName</a></code> | <code>string</code> | The function's name. |
277
- | <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`. |
285
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. |
286
+ | <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. |
287
+ | <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. |
288
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.currentRevision">currentRevision</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision">IWebFunctionRevision</a></code> | The revision built from the current code and configuration. |
289
+ | <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 default endpoint. |
290
+ | <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). |
291
+ | <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 default endpoint (e.g. `grants.invoke(principal)`). Other endpoints have their own `grants`. |
292
+ | <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. |
293
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.revisionId">revisionId</a></code> | <code>string</code> | The ID of the current revision. |
294
+ | <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. |
295
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.webFunctionArn">webFunctionArn</a></code> | <code>string</code> | The function's ARN. |
296
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.webFunctionName">webFunctionName</a></code> | <code>string</code> | The function's name. |
297
+ | <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
298
 
279
299
  ---
280
300
 
281
- ##### `node`<sup>Required</sup> <a name="node" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.node"></a>
301
+ ##### `node`<sup>Required</sup> <a name="node" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.node"></a>
282
302
 
283
303
  ```typescript
284
304
  public readonly node: Node;
@@ -290,7 +310,7 @@ The tree node.
290
310
 
291
311
  ---
292
312
 
293
- ##### `env`<sup>Required</sup> <a name="env" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.env"></a>
313
+ ##### `env`<sup>Required</sup> <a name="env" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.env"></a>
294
314
 
295
315
  ```typescript
296
316
  public readonly env: ResourceEnvironment;
@@ -310,7 +330,7 @@ different than the stack they were imported into.
310
330
 
311
331
  ---
312
332
 
313
- ##### `stack`<sup>Required</sup> <a name="stack" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.stack"></a>
333
+ ##### `stack`<sup>Required</sup> <a name="stack" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.stack"></a>
314
334
 
315
335
  ```typescript
316
336
  public readonly stack: Stack;
@@ -322,7 +342,19 @@ The stack in which this resource is defined.
322
342
 
323
343
  ---
324
344
 
325
- ##### `endpoint`<sup>Required</sup> <a name="endpoint" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.endpoint"></a>
345
+ ##### `currentRevision`<sup>Required</sup> <a name="currentRevision" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.currentRevision"></a>
346
+
347
+ ```typescript
348
+ public readonly currentRevision: IWebFunctionRevision;
349
+ ```
350
+
351
+ - *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision">IWebFunctionRevision</a>
352
+
353
+ The revision built from the current code and configuration.
354
+
355
+ ---
356
+
357
+ ##### `endpoint`<sup>Required</sup> <a name="endpoint" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.endpoint"></a>
326
358
 
327
359
  ```typescript
328
360
  public readonly endpoint: WebFunctionEndpoint;
@@ -330,11 +362,13 @@ public readonly endpoint: WebFunctionEndpoint;
330
362
 
331
363
  - *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint">WebFunctionEndpoint</a>
332
364
 
333
- The function's endpoint.
365
+ The default endpoint.
366
+
367
+ Add more with `addEndpoint`.
334
368
 
335
369
  ---
336
370
 
337
- ##### `grantPrincipal`<sup>Required</sup> <a name="grantPrincipal" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.grantPrincipal"></a>
371
+ ##### `grantPrincipal`<sup>Required</sup> <a name="grantPrincipal" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.grantPrincipal"></a>
338
372
 
339
373
  ```typescript
340
374
  public readonly grantPrincipal: IPrincipal;
@@ -346,7 +380,7 @@ The principal to grant permissions to (the execution role).
346
380
 
347
381
  ---
348
382
 
349
- ##### `grants`<sup>Required</sup> <a name="grants" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.grants"></a>
383
+ ##### `grants`<sup>Required</sup> <a name="grants" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.grants"></a>
350
384
 
351
385
  ```typescript
352
386
  public readonly grants: WebFunctionGrants;
@@ -354,11 +388,11 @@ public readonly grants: WebFunctionGrants;
354
388
 
355
389
  - *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionGrants">WebFunctionGrants</a>
356
390
 
357
- Grants on the function (e.g. `grants.invoke(principal)`).
391
+ Grants on the default endpoint (e.g. `grants.invoke(principal)`). Other endpoints have their own `grants`.
358
392
 
359
393
  ---
360
394
 
361
- ##### `logGroup`<sup>Required</sup> <a name="logGroup" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.logGroup"></a>
395
+ ##### `logGroup`<sup>Required</sup> <a name="logGroup" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.logGroup"></a>
362
396
 
363
397
  ```typescript
364
398
  public readonly logGroup: ILogGroup;
@@ -372,7 +406,7 @@ Subscribe to this one only: each region's `.local` group holds a copy of the sam
372
406
 
373
407
  ---
374
408
 
375
- ##### `revisionId`<sup>Required</sup> <a name="revisionId" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.revisionId"></a>
409
+ ##### `revisionId`<sup>Required</sup> <a name="revisionId" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.revisionId"></a>
376
410
 
377
411
  ```typescript
378
412
  public readonly revisionId: string;
@@ -382,9 +416,11 @@ public readonly revisionId: string;
382
416
 
383
417
  The ID of the current revision.
384
418
 
419
+ Same as `currentRevision.revisionId`.
420
+
385
421
  ---
386
422
 
387
- ##### `role`<sup>Required</sup> <a name="role" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.role"></a>
423
+ ##### `role`<sup>Required</sup> <a name="role" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.role"></a>
388
424
 
389
425
  ```typescript
390
426
  public readonly role: IRole;
@@ -396,7 +432,7 @@ The execution role.
396
432
 
397
433
  ---
398
434
 
399
- ##### `webFunctionArn`<sup>Required</sup> <a name="webFunctionArn" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.webFunctionArn"></a>
435
+ ##### `webFunctionArn`<sup>Required</sup> <a name="webFunctionArn" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.webFunctionArn"></a>
400
436
 
401
437
  ```typescript
402
438
  public readonly webFunctionArn: string;
@@ -408,7 +444,7 @@ The function's ARN.
408
444
 
409
445
  ---
410
446
 
411
- ##### `webFunctionName`<sup>Required</sup> <a name="webFunctionName" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.webFunctionName"></a>
447
+ ##### `webFunctionName`<sup>Required</sup> <a name="webFunctionName" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.webFunctionName"></a>
412
448
 
413
449
  ```typescript
414
450
  public readonly webFunctionName: string;
@@ -420,7 +456,7 @@ The function's name.
420
456
 
421
457
  ---
422
458
 
423
- ##### `webFunctionRef`<sup>Required</sup> <a name="webFunctionRef" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.webFunctionRef"></a>
459
+ ##### `webFunctionRef`<sup>Required</sup> <a name="webFunctionRef" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.webFunctionRef"></a>
424
460
 
425
461
  ```typescript
426
462
  public readonly webFunctionRef: WebFunctionReference;
@@ -433,23 +469,68 @@ A reference to this function, for APIs that accept `lambda.IWebFunctionRef`.
433
469
  ---
434
470
 
435
471
 
436
- ### WebFunctionEndpoint <a name="WebFunctionEndpoint" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint"></a>
472
+ ### WebFunction <a name="WebFunction" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction"></a>
473
+
474
+ - *Implements:* <a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunction">IWebFunction</a>, aws-cdk-lib.aws_iam.IGrantable
475
+
476
+ A Node.js HTTP server running as an AWS Lambda Web Function, served from one or more regions.
477
+
478
+ Creates the function, its current revision (code and configuration; any change creates a new one,
479
+ and the newest `revisionRetention` are kept), a default HTTPS endpoint, an execution role, and owns
480
+ the function's log groups in every region its endpoints serve from.
481
+
482
+ Importing existing functions (`fromXxx` methods) is planned after 0.1.
483
+
484
+ #### Initializers <a name="Initializers" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.Initializer"></a>
485
+
486
+ ```typescript
487
+ import { WebFunction } from '@ashishpandeyone/cdk-lambda-web-function'
488
+
489
+ new WebFunction(scope: Construct, id: string, props: WebFunctionProps)
490
+ ```
491
+
492
+ | **Name** | **Type** | **Description** |
493
+ | --- | --- | --- |
494
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.Initializer.parameter.scope">scope</a></code> | <code>constructs.Construct</code> | *No description.* |
495
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.Initializer.parameter.id">id</a></code> | <code>string</code> | *No description.* |
496
+ | <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.* |
497
+
498
+ ---
499
+
500
+ ##### `scope`<sup>Required</sup> <a name="scope" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.Initializer.parameter.scope"></a>
501
+
502
+ - *Type:* constructs.Construct
437
503
 
438
- The HTTPS endpoint of a Web Function. Created by `WebFunction`; access it as `fn.endpoint`.
504
+ ---
505
+
506
+ ##### `id`<sup>Required</sup> <a name="id" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.Initializer.parameter.id"></a>
507
+
508
+ - *Type:* string
509
+
510
+ ---
511
+
512
+ ##### `props`<sup>Required</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.Initializer.parameter.props"></a>
513
+
514
+ - *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps">WebFunctionProps</a>
439
515
 
440
- Only `WebFunction` creates endpoints in this version (one per function), so the constructor is private.
516
+ ---
441
517
 
442
518
  #### Methods <a name="Methods" id="Methods"></a>
443
519
 
444
520
  | **Name** | **Description** |
445
521
  | --- | --- |
446
- | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.toString">toString</a></code> | Returns a string representation of this construct. |
447
- | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.with">with</a></code> | Applies one or more mixins to this construct. |
448
- | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.regionalUrl">regionalUrl</a></code> | The URL of this endpoint in one region. |
522
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.toString">toString</a></code> | Returns a string representation of this construct. |
523
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.with">with</a></code> | Applies one or more mixins to this construct. |
524
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.applyCrossStackReferenceStrength">applyCrossStackReferenceStrength</a></code> | Override the cross-stack reference strength for this resource. |
525
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.applyRemovalPolicy">applyRemovalPolicy</a></code> | Apply the given removal policy to this resource. |
526
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEndpoint">addEndpoint</a></code> | Adds an endpoint (up to 10 per function), e.g. a public one next to an IAM-only one, or one pinned to an earlier revision. Each endpoint has its own URL, authentication, regions and limits. |
527
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEnvironment">addEnvironment</a></code> | Adds an environment variable. |
528
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.addToRolePolicy">addToRolePolicy</a></code> | Adds a statement to the execution role's policy. |
529
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.grantInvoke">grantInvoke</a></code> | Allows `grantee` to call the endpoint. |
449
530
 
450
531
  ---
451
532
 
452
- ##### `toString` <a name="toString" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.toString"></a>
533
+ ##### `toString` <a name="toString" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.toString"></a>
453
534
 
454
535
  ```typescript
455
536
  public toString(): string
@@ -457,7 +538,7 @@ public toString(): string
457
538
 
458
539
  Returns a string representation of this construct.
459
540
 
460
- ##### `with` <a name="with" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.with"></a>
541
+ ##### `with` <a name="with" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.with"></a>
461
542
 
462
543
  ```typescript
463
544
  public with(mixins: ...IMixin[]): IConstruct
@@ -470,240 +551,2032 @@ start of the call, so constructs added by a mixin will not be visited.
470
551
  Use multiple `with()` calls if subsequent mixins should apply to added
471
552
  constructs.
472
553
 
473
- ###### `mixins`<sup>Required</sup> <a name="mixins" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.with.parameter.mixins"></a>
554
+ ###### `mixins`<sup>Required</sup> <a name="mixins" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.with.parameter.mixins"></a>
474
555
 
475
556
  - *Type:* ...constructs.IMixin[]
476
557
 
477
- The mixins to apply.
478
-
479
558
  ---
480
559
 
481
- ##### `regionalUrl` <a name="regionalUrl" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.regionalUrl"></a>
560
+ ##### `applyCrossStackReferenceStrength` <a name="applyCrossStackReferenceStrength" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.applyCrossStackReferenceStrength"></a>
482
561
 
483
562
  ```typescript
484
- public regionalUrl(region: string): string
563
+ public applyCrossStackReferenceStrength(strength: ReferenceStrength): void
485
564
  ```
486
565
 
487
- The URL of this endpoint in one region.
566
+ Override the cross-stack reference strength for this resource.
488
567
 
489
- Only for `PER_REGION` endpoints.
568
+ When set, any cross-stack reference to this resource will use the specified
569
+ mechanism instead of the global default determined by the
570
+ `@aws-cdk/core:defaultCrossStackReferences` context key. This is useful for
571
+ selectively weakening specific references to avoid the "deadly embrace" problem
572
+ without changing the app-wide default.
490
573
 
491
- ###### `region`<sup>Required</sup> <a name="region" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.regionalUrl.parameter.region"></a>
574
+ ###### `strength`<sup>Required</sup> <a name="strength" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.applyCrossStackReferenceStrength.parameter.strength"></a>
492
575
 
493
- - *Type:* string
576
+ - *Type:* aws-cdk-lib.ReferenceStrength
494
577
 
495
- one of `regions`.
578
+ The reference strength to use for this resource.
496
579
 
497
580
  ---
498
581
 
499
- #### Static Functions <a name="Static Functions" id="Static Functions"></a>
582
+ ##### `applyRemovalPolicy` <a name="applyRemovalPolicy" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.applyRemovalPolicy"></a>
500
583
 
501
- | **Name** | **Description** |
502
- | --- | --- |
503
- | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.isConstruct">isConstruct</a></code> | Checks if `x` is a construct. |
584
+ ```typescript
585
+ public applyRemovalPolicy(policy: RemovalPolicy): void
586
+ ```
504
587
 
505
- ---
588
+ Apply the given removal policy to this resource.
506
589
 
507
- ##### `isConstruct` <a name="isConstruct" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.isConstruct"></a>
590
+ The Removal Policy controls what happens to this resource when it stops
591
+ being managed by CloudFormation, either because you've removed it from the
592
+ CDK application or because you've made a change that requires the resource
593
+ to be replaced.
508
594
 
509
- ```typescript
510
- import { WebFunctionEndpoint } from '@ashishpandeyone/cdk-lambda-web-function'
595
+ The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
596
+ account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
511
597
 
512
- WebFunctionEndpoint.isConstruct(x: any)
513
- ```
598
+ ###### `policy`<sup>Required</sup> <a name="policy" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.applyRemovalPolicy.parameter.policy"></a>
514
599
 
515
- Checks if `x` is a construct.
600
+ - *Type:* aws-cdk-lib.RemovalPolicy
516
601
 
517
- Use this method instead of `instanceof` to properly detect `Construct`
518
- instances, even when the construct library is symlinked.
602
+ ---
519
603
 
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.
604
+ ##### `addEndpoint` <a name="addEndpoint" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEndpoint"></a>
530
605
 
531
- ###### `x`<sup>Required</sup> <a name="x" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.isConstruct.parameter.x"></a>
606
+ ```typescript
607
+ public addEndpoint(id: string, options: AddWebFunctionEndpointOptions): WebFunctionEndpoint
608
+ ```
532
609
 
533
- - *Type:* any
610
+ Adds an endpoint (up to 10 per function), e.g. a public one next to an IAM-only one, or one pinned to an earlier revision. Each endpoint has its own URL, authentication, regions and limits.
534
611
 
535
- Any object.
612
+ ###### `id`<sup>Required</sup> <a name="id" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEndpoint.parameter.id"></a>
613
+
614
+ - *Type:* string
615
+
616
+ the endpoint's construct ID, also used in its generated name (`<id>-<hash>`).
536
617
 
537
618
  ---
538
619
 
539
- #### Properties <a name="Properties" id="Properties"></a>
620
+ ###### `options`<sup>Required</sup> <a name="options" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEndpoint.parameter.options"></a>
540
621
 
541
- | **Name** | **Type** | **Description** |
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. |
622
+ - *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions">AddWebFunctionEndpointOptions</a>
550
623
 
551
624
  ---
552
625
 
553
- ##### `node`<sup>Required</sup> <a name="node" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.node"></a>
626
+ ##### `addEnvironment` <a name="addEnvironment" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEnvironment"></a>
554
627
 
555
628
  ```typescript
556
- public readonly node: Node;
629
+ public addEnvironment(key: string, value: string): WebFunction
557
630
  ```
558
631
 
559
- - *Type:* constructs.Node
632
+ Adds an environment variable.
560
633
 
561
- The tree node.
634
+ Names starting with `AWS_` are reserved.
562
635
 
563
- ---
636
+ ###### `key`<sup>Required</sup> <a name="key" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEnvironment.parameter.key"></a>
564
637
 
565
- ##### `domainName`<sup>Required</sup> <a name="domainName" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.domainName"></a>
638
+ - *Type:* string
566
639
 
567
- ```typescript
568
- public readonly domainName: string;
569
- ```
640
+ ---
570
641
 
571
- - *Type:* string
642
+ ###### `value`<sup>Required</sup> <a name="value" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEnvironment.parameter.value"></a>
572
643
 
573
- The endpoint's domain name: the global domain for `MULTI_REGION`, otherwise the home region's.
644
+ - *Type:* string
574
645
 
575
646
  ---
576
647
 
577
- ##### `endpointArn`<sup>Required</sup> <a name="endpointArn" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.endpointArn"></a>
648
+ ##### `addToRolePolicy` <a name="addToRolePolicy" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addToRolePolicy"></a>
578
649
 
579
650
  ```typescript
580
- public readonly endpointArn: string;
651
+ public addToRolePolicy(statement: PolicyStatement): void
581
652
  ```
582
653
 
583
- - *Type:* string
654
+ Adds a statement to the execution role's policy.
655
+
656
+ ###### `statement`<sup>Required</sup> <a name="statement" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addToRolePolicy.parameter.statement"></a>
657
+
658
+ - *Type:* aws-cdk-lib.aws_iam.PolicyStatement
659
+
660
+ ---
661
+
662
+ ##### `grantInvoke` <a name="grantInvoke" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.grantInvoke"></a>
663
+
664
+ ```typescript
665
+ public grantInvoke(grantee: IGrantable): Grant
666
+ ```
667
+
668
+ Allows `grantee` to call the endpoint.
669
+
670
+ Shortcut for `grants.invoke(grantee)`, as on `lambda.Function`.
671
+ [disable-awslint:no-grants]
672
+
673
+ ###### `grantee`<sup>Required</sup> <a name="grantee" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.grantInvoke.parameter.grantee"></a>
674
+
675
+ - *Type:* aws-cdk-lib.aws_iam.IGrantable
676
+
677
+ ---
678
+
679
+ #### Static Functions <a name="Static Functions" id="Static Functions"></a>
680
+
681
+ | **Name** | **Description** |
682
+ | --- | --- |
683
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.isConstruct">isConstruct</a></code> | Checks if `x` is a construct. |
684
+ | <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. |
685
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.isResource">isResource</a></code> | Check whether the given construct is a Resource. |
686
+
687
+ ---
688
+
689
+ ##### `isConstruct` <a name="isConstruct" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.isConstruct"></a>
690
+
691
+ ```typescript
692
+ import { WebFunction } from '@ashishpandeyone/cdk-lambda-web-function'
693
+
694
+ WebFunction.isConstruct(x: any)
695
+ ```
696
+
697
+ Checks if `x` is a construct.
698
+
699
+ Use this method instead of `instanceof` to properly detect `Construct`
700
+ instances, even when the construct library is symlinked.
701
+
702
+ Explanation: in JavaScript, multiple copies of the `constructs` library on
703
+ disk are seen as independent, completely different libraries. As a
704
+ consequence, the class `Construct` in each copy of the `constructs` library
705
+ is seen as a different class, and an instance of one class will not test as
706
+ `instanceof` the other class. `npm install` will not create installations
707
+ like this, but users may manually symlink construct libraries together or
708
+ use a monorepo tool: in those cases, multiple copies of the `constructs`
709
+ library can be accidentally installed, and `instanceof` will behave
710
+ unpredictably. It is safest to avoid using `instanceof`, and using
711
+ this type-testing method instead.
712
+
713
+ ###### `x`<sup>Required</sup> <a name="x" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.isConstruct.parameter.x"></a>
714
+
715
+ - *Type:* any
716
+
717
+ Any object.
718
+
719
+ ---
720
+
721
+ ##### `isOwnedResource` <a name="isOwnedResource" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.isOwnedResource"></a>
722
+
723
+ ```typescript
724
+ import { WebFunction } from '@ashishpandeyone/cdk-lambda-web-function'
725
+
726
+ WebFunction.isOwnedResource(construct: IConstruct)
727
+ ```
728
+
729
+ Returns true if the construct was created by CDK, and false otherwise.
730
+
731
+ ###### `construct`<sup>Required</sup> <a name="construct" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.isOwnedResource.parameter.construct"></a>
732
+
733
+ - *Type:* constructs.IConstruct
734
+
735
+ ---
736
+
737
+ ##### `isResource` <a name="isResource" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.isResource"></a>
738
+
739
+ ```typescript
740
+ import { WebFunction } from '@ashishpandeyone/cdk-lambda-web-function'
741
+
742
+ WebFunction.isResource(construct: IConstruct)
743
+ ```
744
+
745
+ Check whether the given construct is a Resource.
746
+
747
+ ###### `construct`<sup>Required</sup> <a name="construct" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.isResource.parameter.construct"></a>
748
+
749
+ - *Type:* constructs.IConstruct
750
+
751
+ ---
752
+
753
+ #### Properties <a name="Properties" id="Properties"></a>
754
+
755
+ | **Name** | **Type** | **Description** |
756
+ | --- | --- | --- |
757
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. |
758
+ | <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. |
759
+ | <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. |
760
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.currentRevision">currentRevision</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision">IWebFunctionRevision</a></code> | The revision built from the current code and configuration. |
761
+ | <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 default endpoint. |
762
+ | <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). |
763
+ | <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 default endpoint (e.g. `grants.invoke(principal)`). Other endpoints have their own `grants`. |
764
+ | <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. |
765
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.revisionId">revisionId</a></code> | <code>string</code> | The ID of the current revision. |
766
+ | <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. |
767
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.webFunctionArn">webFunctionArn</a></code> | <code>string</code> | The function's ARN. |
768
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.webFunctionName">webFunctionName</a></code> | <code>string</code> | The function's name. |
769
+ | <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`. |
770
+
771
+ ---
772
+
773
+ ##### `node`<sup>Required</sup> <a name="node" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.node"></a>
774
+
775
+ ```typescript
776
+ public readonly node: Node;
777
+ ```
778
+
779
+ - *Type:* constructs.Node
780
+
781
+ The tree node.
782
+
783
+ ---
784
+
785
+ ##### `env`<sup>Required</sup> <a name="env" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.env"></a>
786
+
787
+ ```typescript
788
+ public readonly env: ResourceEnvironment;
789
+ ```
790
+
791
+ - *Type:* aws-cdk-lib.interfaces.ResourceEnvironment
792
+
793
+ The environment this resource belongs to.
794
+
795
+ For resources that are created and managed in a Stack (those created by
796
+ creating new class instances like `new Role()`, `new Bucket()`, etc.), this
797
+ is always the same as the environment of the stack they belong to.
798
+
799
+ For referenced resources (those obtained from referencing methods like
800
+ `Role.fromRoleArn()`, `Bucket.fromBucketName()`, etc.), they might be
801
+ different than the stack they were imported into.
802
+
803
+ ---
804
+
805
+ ##### `stack`<sup>Required</sup> <a name="stack" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.stack"></a>
806
+
807
+ ```typescript
808
+ public readonly stack: Stack;
809
+ ```
810
+
811
+ - *Type:* aws-cdk-lib.Stack
812
+
813
+ The stack in which this resource is defined.
814
+
815
+ ---
816
+
817
+ ##### `currentRevision`<sup>Required</sup> <a name="currentRevision" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.currentRevision"></a>
818
+
819
+ ```typescript
820
+ public readonly currentRevision: IWebFunctionRevision;
821
+ ```
822
+
823
+ - *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision">IWebFunctionRevision</a>
824
+
825
+ The revision built from the current code and configuration.
826
+
827
+ ---
828
+
829
+ ##### `endpoint`<sup>Required</sup> <a name="endpoint" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.endpoint"></a>
830
+
831
+ ```typescript
832
+ public readonly endpoint: WebFunctionEndpoint;
833
+ ```
834
+
835
+ - *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint">WebFunctionEndpoint</a>
836
+
837
+ The default endpoint.
838
+
839
+ Add more with `addEndpoint`.
840
+
841
+ ---
842
+
843
+ ##### `grantPrincipal`<sup>Required</sup> <a name="grantPrincipal" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.grantPrincipal"></a>
844
+
845
+ ```typescript
846
+ public readonly grantPrincipal: IPrincipal;
847
+ ```
848
+
849
+ - *Type:* aws-cdk-lib.aws_iam.IPrincipal
850
+
851
+ The principal to grant permissions to (the execution role).
852
+
853
+ ---
854
+
855
+ ##### `grants`<sup>Required</sup> <a name="grants" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.grants"></a>
856
+
857
+ ```typescript
858
+ public readonly grants: WebFunctionGrants;
859
+ ```
860
+
861
+ - *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionGrants">WebFunctionGrants</a>
862
+
863
+ Grants on the default endpoint (e.g. `grants.invoke(principal)`). Other endpoints have their own `grants`.
864
+
865
+ ---
866
+
867
+ ##### `logGroup`<sup>Required</sup> <a name="logGroup" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.logGroup"></a>
868
+
869
+ ```typescript
870
+ public readonly logGroup: ILogGroup;
871
+ ```
872
+
873
+ - *Type:* aws-cdk-lib.aws_logs.ILogGroup
874
+
875
+ The home-region log group that receives the logs of every region the function serves from.
876
+
877
+ Subscribe to this one only: each region's `.local` group holds a copy of the same events.
878
+
879
+ ---
880
+
881
+ ##### `revisionId`<sup>Required</sup> <a name="revisionId" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.revisionId"></a>
882
+
883
+ ```typescript
884
+ public readonly revisionId: string;
885
+ ```
886
+
887
+ - *Type:* string
888
+
889
+ The ID of the current revision.
890
+
891
+ Same as `currentRevision.revisionId`.
892
+
893
+ ---
894
+
895
+ ##### `role`<sup>Required</sup> <a name="role" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.role"></a>
896
+
897
+ ```typescript
898
+ public readonly role: IRole;
899
+ ```
900
+
901
+ - *Type:* aws-cdk-lib.aws_iam.IRole
902
+
903
+ The execution role.
904
+
905
+ ---
906
+
907
+ ##### `webFunctionArn`<sup>Required</sup> <a name="webFunctionArn" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.webFunctionArn"></a>
908
+
909
+ ```typescript
910
+ public readonly webFunctionArn: string;
911
+ ```
912
+
913
+ - *Type:* string
914
+
915
+ The function's ARN.
916
+
917
+ ---
918
+
919
+ ##### `webFunctionName`<sup>Required</sup> <a name="webFunctionName" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.webFunctionName"></a>
920
+
921
+ ```typescript
922
+ public readonly webFunctionName: string;
923
+ ```
924
+
925
+ - *Type:* string
926
+
927
+ The function's name.
928
+
929
+ ---
930
+
931
+ ##### `webFunctionRef`<sup>Required</sup> <a name="webFunctionRef" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.webFunctionRef"></a>
932
+
933
+ ```typescript
934
+ public readonly webFunctionRef: WebFunctionReference;
935
+ ```
936
+
937
+ - *Type:* aws-cdk-lib.interfaces.aws_lambda.WebFunctionReference
938
+
939
+ A reference to this function, for APIs that accept `lambda.IWebFunctionRef`.
940
+
941
+ ---
942
+
943
+
944
+ ### WebFunctionEndpoint <a name="WebFunctionEndpoint" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint"></a>
945
+
946
+ An HTTPS endpoint of a Web Function: `fn.endpoint` (the default one) or the result of `fn.addEndpoint()`.
947
+
948
+ Endpoints are created only through `WebFunction`, which owns their log groups in every region, so the constructor is private.
949
+
950
+ #### Methods <a name="Methods" id="Methods"></a>
951
+
952
+ | **Name** | **Description** |
953
+ | --- | --- |
954
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.toString">toString</a></code> | Returns a string representation of this construct. |
955
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.with">with</a></code> | Applies one or more mixins to this construct. |
956
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.grantInvoke">grantInvoke</a></code> | Allows `grantee` to call this endpoint. |
957
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.regionalUrl">regionalUrl</a></code> | The URL of this endpoint in one region. |
958
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.routeTraffic">routeTraffic</a></code> | Routes the endpoint to `revision` instead of the function's current revision, optionally sharing traffic with one more revision (`additionalRevisions`, which gets its weight; |
959
+
960
+ ---
961
+
962
+ ##### `toString` <a name="toString" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.toString"></a>
963
+
964
+ ```typescript
965
+ public toString(): string
966
+ ```
967
+
968
+ Returns a string representation of this construct.
969
+
970
+ ##### `with` <a name="with" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.with"></a>
971
+
972
+ ```typescript
973
+ public with(mixins: ...IMixin[]): IConstruct
974
+ ```
975
+
976
+ Applies one or more mixins to this construct.
977
+
978
+ Mixins are applied in order. The list of constructs is captured at the
979
+ start of the call, so constructs added by a mixin will not be visited.
980
+ Use multiple `with()` calls if subsequent mixins should apply to added
981
+ constructs.
982
+
983
+ ###### `mixins`<sup>Required</sup> <a name="mixins" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.with.parameter.mixins"></a>
984
+
985
+ - *Type:* ...constructs.IMixin[]
986
+
987
+ The mixins to apply.
988
+
989
+ ---
990
+
991
+ ##### `grantInvoke` <a name="grantInvoke" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.grantInvoke"></a>
992
+
993
+ ```typescript
994
+ public grantInvoke(grantee: IGrantable): Grant
995
+ ```
996
+
997
+ Allows `grantee` to call this endpoint.
998
+
999
+ Shortcut for `grants.invoke(grantee)`.
1000
+ [disable-awslint:no-grants]
1001
+
1002
+ ###### `grantee`<sup>Required</sup> <a name="grantee" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.grantInvoke.parameter.grantee"></a>
1003
+
1004
+ - *Type:* aws-cdk-lib.aws_iam.IGrantable
1005
+
1006
+ ---
1007
+
1008
+ ##### `regionalUrl` <a name="regionalUrl" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.regionalUrl"></a>
1009
+
1010
+ ```typescript
1011
+ public regionalUrl(region: string): string
1012
+ ```
1013
+
1014
+ The URL of this endpoint in one region.
1015
+
1016
+ Only for `PER_REGION` endpoints.
1017
+
1018
+ ###### `region`<sup>Required</sup> <a name="region" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.regionalUrl.parameter.region"></a>
1019
+
1020
+ - *Type:* string
1021
+
1022
+ one of `regions`.
1023
+
1024
+ ---
1025
+
1026
+ ##### `routeTraffic` <a name="routeTraffic" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.routeTraffic"></a>
1027
+
1028
+ ```typescript
1029
+ public routeTraffic(revision: IWebFunctionRevision, additionalRevisions?: WebFunctionRevisionWeight[]): void
1030
+ ```
1031
+
1032
+ Routes the endpoint to `revision` instead of the function's current revision, optionally sharing traffic with one more revision (`additionalRevisions`, which gets its weight;
1033
+
1034
+ `revision` gets the rest).
1035
+
1036
+ Use it to keep an endpoint on an earlier revision (`WebFunctionRevision.fromRevisionAttributes`),
1037
+ or to send part of the traffic to the current revision:
1038
+ `fn.endpoint.routeTraffic(previous, [{ revision: fn.currentRevision, weight: 0.1 }])`.
1039
+ Can be called once per endpoint, and not on one created with `revision` or `additionalRevisions`.
1040
+
1041
+ ###### `revision`<sup>Required</sup> <a name="revision" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.routeTraffic.parameter.revision"></a>
1042
+
1043
+ - *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision">IWebFunctionRevision</a>
1044
+
1045
+ ---
1046
+
1047
+ ###### `additionalRevisions`<sup>Optional</sup> <a name="additionalRevisions" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.routeTraffic.parameter.additionalRevisions"></a>
1048
+
1049
+ - *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevisionWeight">WebFunctionRevisionWeight</a>[]
1050
+
1051
+ ---
1052
+
1053
+ #### Static Functions <a name="Static Functions" id="Static Functions"></a>
1054
+
1055
+ | **Name** | **Description** |
1056
+ | --- | --- |
1057
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.isConstruct">isConstruct</a></code> | Checks if `x` is a construct. |
1058
+
1059
+ ---
1060
+
1061
+ ##### `isConstruct` <a name="isConstruct" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.isConstruct"></a>
1062
+
1063
+ ```typescript
1064
+ import { WebFunctionEndpoint } from '@ashishpandeyone/cdk-lambda-web-function'
1065
+
1066
+ WebFunctionEndpoint.isConstruct(x: any)
1067
+ ```
1068
+
1069
+ Checks if `x` is a construct.
1070
+
1071
+ Use this method instead of `instanceof` to properly detect `Construct`
1072
+ instances, even when the construct library is symlinked.
1073
+
1074
+ Explanation: in JavaScript, multiple copies of the `constructs` library on
1075
+ disk are seen as independent, completely different libraries. As a
1076
+ consequence, the class `Construct` in each copy of the `constructs` library
1077
+ is seen as a different class, and an instance of one class will not test as
1078
+ `instanceof` the other class. `npm install` will not create installations
1079
+ like this, but users may manually symlink construct libraries together or
1080
+ use a monorepo tool: in those cases, multiple copies of the `constructs`
1081
+ library can be accidentally installed, and `instanceof` will behave
1082
+ unpredictably. It is safest to avoid using `instanceof`, and using
1083
+ this type-testing method instead.
1084
+
1085
+ ###### `x`<sup>Required</sup> <a name="x" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.isConstruct.parameter.x"></a>
1086
+
1087
+ - *Type:* any
1088
+
1089
+ Any object.
1090
+
1091
+ ---
1092
+
1093
+ #### Properties <a name="Properties" id="Properties"></a>
1094
+
1095
+ | **Name** | **Type** | **Description** |
1096
+ | --- | --- | --- |
1097
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. |
1098
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.authType">authType</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType">WebFunctionAuthType</a></code> | How callers of the endpoint are authenticated. |
1099
+ | <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. |
1100
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.endpointArn">endpointArn</a></code> | <code>string</code> | The endpoint's ARN. |
1101
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.endpointName">endpointName</a></code> | <code>string</code> | The endpoint's name. |
1102
+ | <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. |
1103
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.grants">grants</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionGrants">WebFunctionGrants</a></code> | Grants on this endpoint (e.g. `grants.invoke(principal)`). |
1104
+ | <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. |
1105
+ | <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. |
1106
+
1107
+ ---
1108
+
1109
+ ##### `node`<sup>Required</sup> <a name="node" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.node"></a>
1110
+
1111
+ ```typescript
1112
+ public readonly node: Node;
1113
+ ```
1114
+
1115
+ - *Type:* constructs.Node
1116
+
1117
+ The tree node.
1118
+
1119
+ ---
1120
+
1121
+ ##### `authType`<sup>Required</sup> <a name="authType" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.authType"></a>
1122
+
1123
+ ```typescript
1124
+ public readonly authType: WebFunctionAuthType;
1125
+ ```
1126
+
1127
+ - *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType">WebFunctionAuthType</a>
1128
+
1129
+ How callers of the endpoint are authenticated.
1130
+
1131
+ ---
1132
+
1133
+ ##### `domainName`<sup>Required</sup> <a name="domainName" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.domainName"></a>
1134
+
1135
+ ```typescript
1136
+ public readonly domainName: string;
1137
+ ```
1138
+
1139
+ - *Type:* string
1140
+
1141
+ The endpoint's domain name: the global domain for `MULTI_REGION`, otherwise the home region's.
1142
+
1143
+ ---
1144
+
1145
+ ##### `endpointArn`<sup>Required</sup> <a name="endpointArn" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.endpointArn"></a>
1146
+
1147
+ ```typescript
1148
+ public readonly endpointArn: string;
1149
+ ```
1150
+
1151
+ - *Type:* string
1152
+
1153
+ The endpoint's ARN.
1154
+
1155
+ ---
1156
+
1157
+ ##### `endpointName`<sup>Required</sup> <a name="endpointName" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.endpointName"></a>
1158
+
1159
+ ```typescript
1160
+ public readonly endpointName: string;
1161
+ ```
1162
+
1163
+ - *Type:* string
1164
+
1165
+ The endpoint's name.
1166
+
1167
+ ---
1168
+
1169
+ ##### `endpointType`<sup>Required</sup> <a name="endpointType" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.endpointType"></a>
1170
+
1171
+ ```typescript
1172
+ public readonly endpointType: WebFunctionEndpointType;
1173
+ ```
1174
+
1175
+ - *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointType">WebFunctionEndpointType</a>
1176
+
1177
+ Where the endpoint serves traffic from.
1178
+
1179
+ ---
1180
+
1181
+ ##### `grants`<sup>Required</sup> <a name="grants" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.grants"></a>
1182
+
1183
+ ```typescript
1184
+ public readonly grants: WebFunctionGrants;
1185
+ ```
1186
+
1187
+ - *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionGrants">WebFunctionGrants</a>
1188
+
1189
+ Grants on this endpoint (e.g. `grants.invoke(principal)`).
1190
+
1191
+ ---
1192
+
1193
+ ##### `regions`<sup>Required</sup> <a name="regions" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.regions"></a>
1194
+
1195
+ ```typescript
1196
+ public readonly regions: string[];
1197
+ ```
1198
+
1199
+ - *Type:* string[]
1200
+
1201
+ Every region the endpoint serves from: the home region first, then the others in alphabetical order.
1202
+
1203
+ ---
1204
+
1205
+ ##### `url`<sup>Required</sup> <a name="url" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.url"></a>
1206
+
1207
+ ```typescript
1208
+ public readonly url: string;
1209
+ ```
1210
+
1211
+ - *Type:* string
1212
+
1213
+ The endpoint's URL: the global URL for `MULTI_REGION`, otherwise the home region's.
1214
+
1215
+ ---
1216
+
1217
+
1218
+ ### WebFunctionRevision <a name="WebFunctionRevision" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevision"></a>
1219
+
1220
+ - *Implements:* <a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision">IWebFunctionRevision</a>
1221
+
1222
+ A revision of a Web Function.
1223
+
1224
+ `WebFunction` creates its current revision (`fn.currentRevision`) from its code and configuration.
1225
+ Use `fromRevisionAttributes` to route an endpoint to an earlier one, which must still exist:
1226
+ only revisions within `revisionRetention`, or that an endpoint routes to, are kept.
1227
+
1228
+ #### Methods <a name="Methods" id="Methods"></a>
1229
+
1230
+ | **Name** | **Description** |
1231
+ | --- | --- |
1232
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevision.toString">toString</a></code> | Returns a string representation of this construct. |
1233
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevision.with">with</a></code> | Applies one or more mixins to this construct. |
1234
+
1235
+ ---
1236
+
1237
+ ##### `toString` <a name="toString" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevision.toString"></a>
1238
+
1239
+ ```typescript
1240
+ public toString(): string
1241
+ ```
1242
+
1243
+ Returns a string representation of this construct.
1244
+
1245
+ ##### `with` <a name="with" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevision.with"></a>
1246
+
1247
+ ```typescript
1248
+ public with(mixins: ...IMixin[]): IConstruct
1249
+ ```
1250
+
1251
+ Applies one or more mixins to this construct.
1252
+
1253
+ Mixins are applied in order. The list of constructs is captured at the
1254
+ start of the call, so constructs added by a mixin will not be visited.
1255
+ Use multiple `with()` calls if subsequent mixins should apply to added
1256
+ constructs.
1257
+
1258
+ ###### `mixins`<sup>Required</sup> <a name="mixins" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevision.with.parameter.mixins"></a>
1259
+
1260
+ - *Type:* ...constructs.IMixin[]
1261
+
1262
+ The mixins to apply.
1263
+
1264
+ ---
1265
+
1266
+ #### Static Functions <a name="Static Functions" id="Static Functions"></a>
1267
+
1268
+ | **Name** | **Description** |
1269
+ | --- | --- |
1270
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevision.isConstruct">isConstruct</a></code> | Checks if `x` is a construct. |
1271
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevision.fromRevisionAttributes">fromRevisionAttributes</a></code> | References an existing revision of `webFunction`, e.g. to pin an endpoint to it or split traffic with it. |
1272
+
1273
+ ---
1274
+
1275
+ ##### `isConstruct` <a name="isConstruct" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevision.isConstruct"></a>
1276
+
1277
+ ```typescript
1278
+ import { WebFunctionRevision } from '@ashishpandeyone/cdk-lambda-web-function'
1279
+
1280
+ WebFunctionRevision.isConstruct(x: any)
1281
+ ```
1282
+
1283
+ Checks if `x` is a construct.
1284
+
1285
+ Use this method instead of `instanceof` to properly detect `Construct`
1286
+ instances, even when the construct library is symlinked.
1287
+
1288
+ Explanation: in JavaScript, multiple copies of the `constructs` library on
1289
+ disk are seen as independent, completely different libraries. As a
1290
+ consequence, the class `Construct` in each copy of the `constructs` library
1291
+ is seen as a different class, and an instance of one class will not test as
1292
+ `instanceof` the other class. `npm install` will not create installations
1293
+ like this, but users may manually symlink construct libraries together or
1294
+ use a monorepo tool: in those cases, multiple copies of the `constructs`
1295
+ library can be accidentally installed, and `instanceof` will behave
1296
+ unpredictably. It is safest to avoid using `instanceof`, and using
1297
+ this type-testing method instead.
1298
+
1299
+ ###### `x`<sup>Required</sup> <a name="x" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevision.isConstruct.parameter.x"></a>
1300
+
1301
+ - *Type:* any
1302
+
1303
+ Any object.
1304
+
1305
+ ---
1306
+
1307
+ ##### `fromRevisionAttributes` <a name="fromRevisionAttributes" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevision.fromRevisionAttributes"></a>
1308
+
1309
+ ```typescript
1310
+ import { WebFunctionRevision } from '@ashishpandeyone/cdk-lambda-web-function'
1311
+
1312
+ WebFunctionRevision.fromRevisionAttributes(scope: Construct, id: string, attrs: WebFunctionRevisionAttributes)
1313
+ ```
1314
+
1315
+ References an existing revision of `webFunction`, e.g. to pin an endpoint to it or split traffic with it.
1316
+
1317
+ ###### `scope`<sup>Required</sup> <a name="scope" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevision.fromRevisionAttributes.parameter.scope"></a>
1318
+
1319
+ - *Type:* constructs.Construct
1320
+
1321
+ ---
1322
+
1323
+ ###### `id`<sup>Required</sup> <a name="id" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevision.fromRevisionAttributes.parameter.id"></a>
1324
+
1325
+ - *Type:* string
1326
+
1327
+ ---
1328
+
1329
+ ###### `attrs`<sup>Required</sup> <a name="attrs" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevision.fromRevisionAttributes.parameter.attrs"></a>
1330
+
1331
+ - *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevisionAttributes">WebFunctionRevisionAttributes</a>
1332
+
1333
+ ---
1334
+
1335
+ #### Properties <a name="Properties" id="Properties"></a>
1336
+
1337
+ | **Name** | **Type** | **Description** |
1338
+ | --- | --- | --- |
1339
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevision.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. |
1340
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevision.property.revisionArn">revisionArn</a></code> | <code>string</code> | The revision's ARN. |
1341
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevision.property.revisionId">revisionId</a></code> | <code>string</code> | The revision's ID, e.g. `rev-a1b2c`. |
1342
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevision.property.webFunction">webFunction</a></code> | <code>aws-cdk-lib.interfaces.aws_lambda.IWebFunctionRef</code> | The function the revision belongs to. |
1343
+
1344
+ ---
1345
+
1346
+ ##### `node`<sup>Required</sup> <a name="node" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevision.property.node"></a>
1347
+
1348
+ ```typescript
1349
+ public readonly node: Node;
1350
+ ```
1351
+
1352
+ - *Type:* constructs.Node
1353
+
1354
+ The tree node.
1355
+
1356
+ ---
1357
+
1358
+ ##### `revisionArn`<sup>Required</sup> <a name="revisionArn" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevision.property.revisionArn"></a>
1359
+
1360
+ ```typescript
1361
+ public readonly revisionArn: string;
1362
+ ```
1363
+
1364
+ - *Type:* string
1365
+
1366
+ The revision's ARN.
1367
+
1368
+ ---
1369
+
1370
+ ##### `revisionId`<sup>Required</sup> <a name="revisionId" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevision.property.revisionId"></a>
1371
+
1372
+ ```typescript
1373
+ public readonly revisionId: string;
1374
+ ```
1375
+
1376
+ - *Type:* string
1377
+
1378
+ The revision's ID, e.g. `rev-a1b2c`.
1379
+
1380
+ ---
1381
+
1382
+ ##### `webFunction`<sup>Required</sup> <a name="webFunction" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevision.property.webFunction"></a>
1383
+
1384
+ ```typescript
1385
+ public readonly webFunction: IWebFunctionRef;
1386
+ ```
1387
+
1388
+ - *Type:* aws-cdk-lib.interfaces.aws_lambda.IWebFunctionRef
1389
+
1390
+ The function the revision belongs to.
1391
+
1392
+ ---
1393
+
1394
+
1395
+ ## Structs <a name="Structs" id="Structs"></a>
1396
+
1397
+ ### AddWebFunctionEndpointOptions <a name="AddWebFunctionEndpointOptions" id="@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions"></a>
1398
+
1399
+ Options for `WebFunction.addEndpoint`.
1400
+
1401
+ #### Initializer <a name="Initializer" id="@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions.Initializer"></a>
1402
+
1403
+ ```typescript
1404
+ import { AddWebFunctionEndpointOptions } from '@ashishpandeyone/cdk-lambda-web-function'
1405
+
1406
+ const addWebFunctionEndpointOptions: AddWebFunctionEndpointOptions = { ... }
1407
+ ```
1408
+
1409
+ #### Properties <a name="Properties" id="Properties"></a>
1410
+
1411
+ | **Name** | **Type** | **Description** |
1412
+ | --- | --- | --- |
1413
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions.property.deployment">deployment</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment">WebFunctionDeployment</a></code> | How the endpoint moves its traffic to a new revision: all at once, or in steps (`WebFunctionDeployment.canary()` or `linear()`) that watch CloudWatch alarms and move the traffic back when one goes into ALARM. |
1414
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions.property.description">description</a></code> | <code>string</code> | A description of the endpoint. |
1415
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions.property.endpointName">endpointName</a></code> | <code>string</code> | The endpoint's name, shown in logs (`endpointName`) and in the `lambda-web-endpoint-name` header. Names are unique per function. |
1416
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions.property.endpointType">endpointType</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointType">WebFunctionEndpointType</a></code> | Where the endpoint serves traffic from. |
1417
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions.property.maxEnvironments">maxEnvironments</a></code> | <code>number</code> | The most execution environments the endpoint may use (2–10,000). Each one uses 2 vCPUs of the account's quota. |
1418
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions.property.rateLimit">rateLimit</a></code> | <code>number</code> | The most requests per second the endpoint accepts; |
1419
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions.property.regions">regions</a></code> | <code>string[]</code> | Regions to serve from in addition to the home region (the stack's region). |
1420
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions.property.authType">authType</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType">WebFunctionAuthType</a></code> | How callers of this endpoint are authenticated. |
1421
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions.property.additionalRevisions">additionalRevisions</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevisionWeight">WebFunctionRevisionWeight</a>[]</code> | A second revision and its share of the endpoint's traffic; |
1422
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions.property.revision">revision</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision">IWebFunctionRevision</a></code> | The revision the endpoint serves, e.g. an earlier one from `WebFunctionRevision.fromRevisionAttributes` to keep this endpoint on it while others move on. Same as calling `routeTraffic`. |
1423
+
1424
+ ---
1425
+
1426
+ ##### `deployment`<sup>Optional</sup> <a name="deployment" id="@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions.property.deployment"></a>
1427
+
1428
+ ```typescript
1429
+ public readonly deployment: WebFunctionDeployment;
1430
+ ```
1431
+
1432
+ - *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment">WebFunctionDeployment</a>
1433
+ - *Default:* WebFunctionDeployment.allAtOnce()
1434
+
1435
+ How the endpoint moves its traffic to a new revision: all at once, or in steps (`WebFunctionDeployment.canary()` or `linear()`) that watch CloudWatch alarms and move the traffic back when one goes into ALARM.
1436
+
1437
+ A deployment in steps can't be combined with `revision`, `additionalRevisions` or `routeTraffic()`.
1438
+
1439
+ ---
1440
+
1441
+ ##### `description`<sup>Optional</sup> <a name="description" id="@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions.property.description"></a>
1442
+
1443
+ ```typescript
1444
+ public readonly description: string;
1445
+ ```
1446
+
1447
+ - *Type:* string
1448
+ - *Default:* no description
1449
+
1450
+ A description of the endpoint.
1451
+
1452
+ ---
1453
+
1454
+ ##### `endpointName`<sup>Optional</sup> <a name="endpointName" id="@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions.property.endpointName"></a>
1455
+
1456
+ ```typescript
1457
+ public readonly endpointName: string;
1458
+ ```
1459
+
1460
+ - *Type:* string
1461
+ - *Default:* `default-<hash>` for the function's default endpoint, `<id>-<hash>` for endpoints added with `addEndpoint`
1462
+
1463
+ The endpoint's name, shown in logs (`endpointName`) and in the `lambda-web-endpoint-name` header. Names are unique per function.
1464
+
1465
+ When omitted, the name ends in a hash of the endpoint type and regions, so changing either deploys
1466
+ a new endpoint cleanly. When set, changing the endpoint type or regions also requires a new name:
1467
+ two endpoints of one function can't share a name, and CloudFormation creates the replacement
1468
+ before deleting the old one.
1469
+
1470
+ ---
1471
+
1472
+ ##### `endpointType`<sup>Optional</sup> <a name="endpointType" id="@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions.property.endpointType"></a>
1473
+
1474
+ ```typescript
1475
+ public readonly endpointType: WebFunctionEndpointType;
1476
+ ```
1477
+
1478
+ - *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointType">WebFunctionEndpointType</a>
1479
+ - *Default:* WebFunctionEndpointType.HOME_REGION
1480
+
1481
+ Where the endpoint serves traffic from.
1482
+
1483
+ ---
1484
+
1485
+ ##### `maxEnvironments`<sup>Optional</sup> <a name="maxEnvironments" id="@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions.property.maxEnvironments"></a>
1486
+
1487
+ ```typescript
1488
+ public readonly maxEnvironments: number;
1489
+ ```
1490
+
1491
+ - *Type:* number
1492
+ - *Default:* scales within the account's vCPU quota
1493
+
1494
+ The most execution environments the endpoint may use (2–10,000). Each one uses 2 vCPUs of the account's quota.
1495
+
1496
+ Enforced separately in each region the endpoint serves from.
1497
+
1498
+ ---
1499
+
1500
+ ##### `rateLimit`<sup>Optional</sup> <a name="rateLimit" id="@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions.property.rateLimit"></a>
1501
+
1502
+ ```typescript
1503
+ public readonly rateLimit: number;
1504
+ ```
1505
+
1506
+ - *Type:* number
1507
+ - *Default:* no limit beyond the service quota of 10,000 requests per second per endpoint (per region)
1508
+
1509
+ The most requests per second the endpoint accepts;
1510
+
1511
+ excess requests get HTTP 429.
1512
+ Allowed: 0 (blocks all traffic), 100–1,000 in steps of 100, or 2,000–10,000 in steps of 1,000.
1513
+
1514
+ Enforced separately in each region the endpoint serves from, so a multi-region endpoint
1515
+ can accept this many requests per second in every region.
1516
+
1517
+ ---
1518
+
1519
+ ##### `regions`<sup>Optional</sup> <a name="regions" id="@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions.property.regions"></a>
1520
+
1521
+ ```typescript
1522
+ public readonly regions: string[];
1523
+ ```
1524
+
1525
+ - *Type:* string[]
1526
+ - *Default:* no extra regions
1527
+
1528
+ Regions to serve from in addition to the home region (the stack's region).
1529
+
1530
+ Required (at least one) for `MULTI_REGION` and `PER_REGION`; must be empty for `HOME_REGION`.
1531
+
1532
+ Changing this creates a new endpoint with a new URL.
1533
+
1534
+ ---
1535
+
1536
+ ##### `authType`<sup>Required</sup> <a name="authType" id="@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions.property.authType"></a>
1537
+
1538
+ ```typescript
1539
+ public readonly authType: WebFunctionAuthType;
1540
+ ```
1541
+
1542
+ - *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType">WebFunctionAuthType</a>
1543
+
1544
+ How callers of this endpoint are authenticated.
1545
+
1546
+ ---
1547
+
1548
+ ##### `additionalRevisions`<sup>Optional</sup> <a name="additionalRevisions" id="@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions.property.additionalRevisions"></a>
1549
+
1550
+ ```typescript
1551
+ public readonly additionalRevisions: WebFunctionRevisionWeight[];
1552
+ ```
1553
+
1554
+ - *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevisionWeight">WebFunctionRevisionWeight</a>[]
1555
+ - *Default:* all traffic goes to `revision`
1556
+
1557
+ A second revision and its share of the endpoint's traffic;
1558
+
1559
+ `revision` gets the rest.
1560
+ An endpoint routes to at most two revisions.
1561
+
1562
+ ---
1563
+
1564
+ ##### `revision`<sup>Optional</sup> <a name="revision" id="@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions.property.revision"></a>
1565
+
1566
+ ```typescript
1567
+ public readonly revision: IWebFunctionRevision;
1568
+ ```
1569
+
1570
+ - *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision">IWebFunctionRevision</a>
1571
+ - *Default:* the function's current revision (`currentRevision`)
1572
+
1573
+ The revision the endpoint serves, e.g. an earlier one from `WebFunctionRevision.fromRevisionAttributes` to keep this endpoint on it while others move on. Same as calling `routeTraffic`.
1574
+
1575
+ ---
1576
+
1577
+ ### NodejsWebFunctionBundlingOptions <a name="NodejsWebFunctionBundlingOptions" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions"></a>
1578
+
1579
+ How `NodejsWebFunction` bundles the server with esbuild.
1580
+
1581
+ #### Initializer <a name="Initializer" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.Initializer"></a>
1582
+
1583
+ ```typescript
1584
+ import { NodejsWebFunctionBundlingOptions } from '@ashishpandeyone/cdk-lambda-web-function'
1585
+
1586
+ const nodejsWebFunctionBundlingOptions: NodejsWebFunctionBundlingOptions = { ... }
1587
+ ```
1588
+
1589
+ #### Properties <a name="Properties" id="Properties"></a>
1590
+
1591
+ | **Name** | **Type** | **Description** |
1592
+ | --- | --- | --- |
1593
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.banner">banner</a></code> | <code>string</code> | Text to prepend to the bundle. |
1594
+ | <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`). |
1595
+ | <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. |
1596
+ | <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). |
1597
+ | <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 }`. |
1598
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.externalModules">externalModules</a></code> | <code>string[]</code> | Modules to leave out of the bundle. |
1599
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.footer">footer</a></code> | <code>string</code> | Text to append to the bundle. |
1600
+ | <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. |
1601
+ | <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. |
1602
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.keepNames">keepNames</a></code> | <code>boolean</code> | Keep function and class names (`--keep-names`). |
1603
+ | <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' }`. |
1604
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.minify">minify</a></code> | <code>boolean</code> | Minify the bundle. |
1605
+ | <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. |
1606
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.target">target</a></code> | <code>string</code> | esbuild target. |
1607
+ | <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). |
1608
+
1609
+ ---
1610
+
1611
+ ##### `banner`<sup>Optional</sup> <a name="banner" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.banner"></a>
1612
+
1613
+ ```typescript
1614
+ public readonly banner: string;
1615
+ ```
1616
+
1617
+ - *Type:* string
1618
+ - *Default:* none
1619
+
1620
+ Text to prepend to the bundle.
1621
+
1622
+ ---
1623
+
1624
+ ##### `define`<sup>Optional</sup> <a name="define" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.define"></a>
1625
+
1626
+ ```typescript
1627
+ public readonly define: {[ key: string ]: string};
1628
+ ```
1629
+
1630
+ - *Type:* {[ key: string ]: string}
1631
+ - *Default:* none
1632
+
1633
+ Replace global identifiers with constant expressions (esbuild `--define`).
1634
+
1635
+ ---
1636
+
1637
+ ##### `dockerImage`<sup>Optional</sup> <a name="dockerImage" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.dockerImage"></a>
1638
+
1639
+ ```typescript
1640
+ public readonly dockerImage: DockerImage;
1641
+ ```
1642
+
1643
+ - *Type:* aws-cdk-lib.DockerImage
1644
+ - *Default:* the arm64 AWS SAM build image for the runtime, e.g. `public.ecr.aws/sam/build-nodejs24.x:latest-arm64`
1645
+
1646
+ Docker image for bundling when esbuild isn't installed locally.
1647
+
1648
+ ---
1649
+
1650
+ ##### `environment`<sup>Optional</sup> <a name="environment" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.environment"></a>
1651
+
1652
+ ```typescript
1653
+ public readonly environment: {[ key: string ]: string};
1654
+ ```
1655
+
1656
+ - *Type:* {[ key: string ]: string}
1657
+ - *Default:* none
1658
+
1659
+ Environment variables while bundling (not at runtime).
1660
+
1661
+ ---
1662
+
1663
+ ##### `esbuildArgs`<sup>Optional</sup> <a name="esbuildArgs" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.esbuildArgs"></a>
1664
+
1665
+ ```typescript
1666
+ public readonly esbuildArgs: {[ key: string ]: string | boolean};
1667
+ ```
1668
+
1669
+ - *Type:* {[ key: string ]: string | boolean}
1670
+ - *Default:* none
1671
+
1672
+ Extra esbuild arguments, e.g. `{ '--log-limit': '0', '--tree-shaking': true }`.
1673
+
1674
+ ---
1675
+
1676
+ ##### `externalModules`<sup>Optional</sup> <a name="externalModules" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.externalModules"></a>
1677
+
1678
+ ```typescript
1679
+ public readonly externalModules: string[];
1680
+ ```
1681
+
1682
+ - *Type:* string[]
1683
+ - *Default:* none
1684
+
1685
+ Modules to leave out of the bundle.
1686
+
1687
+ The runtime has no AWS SDK, so `@aws-sdk/*` is bundled like
1688
+ any other dependency; only exclude modules you provide another way.
1689
+
1690
+ ---
1691
+
1692
+ ##### `footer`<sup>Optional</sup> <a name="footer" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.footer"></a>
1693
+
1694
+ ```typescript
1695
+ public readonly footer: string;
1696
+ ```
1697
+
1698
+ - *Type:* string
1699
+ - *Default:* none
1700
+
1701
+ Text to append to the bundle.
1702
+
1703
+ ---
1704
+
1705
+ ##### `forceDockerBundling`<sup>Optional</sup> <a name="forceDockerBundling" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.forceDockerBundling"></a>
1706
+
1707
+ ```typescript
1708
+ public readonly forceDockerBundling: boolean;
1709
+ ```
1710
+
1711
+ - *Type:* boolean
1712
+ - *Default:* false
1713
+
1714
+ Always bundle in Docker, even if esbuild is installed locally.
1715
+
1716
+ ---
1717
+
1718
+ ##### `format`<sup>Optional</sup> <a name="format" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.format"></a>
1719
+
1720
+ ```typescript
1721
+ public readonly format: OutputFormat;
1722
+ ```
1723
+
1724
+ - *Type:* aws-cdk-lib.aws_lambda_nodejs.OutputFormat
1725
+ - *Default:* OutputFormat.ESM
1726
+
1727
+ Output format.
1728
+
1729
+ ESM is written to `index.mjs` (with a `require` shim, so CommonJS dependencies
1730
+ such as Express work); CommonJS to `index.js`.
1731
+
1732
+ ---
1733
+
1734
+ ##### `keepNames`<sup>Optional</sup> <a name="keepNames" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.keepNames"></a>
1735
+
1736
+ ```typescript
1737
+ public readonly keepNames: boolean;
1738
+ ```
1739
+
1740
+ - *Type:* boolean
1741
+ - *Default:* false
1742
+
1743
+ Keep function and class names (`--keep-names`).
1744
+
1745
+ ---
1746
+
1747
+ ##### `loader`<sup>Optional</sup> <a name="loader" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.loader"></a>
1748
+
1749
+ ```typescript
1750
+ public readonly loader: {[ key: string ]: string};
1751
+ ```
1752
+
1753
+ - *Type:* {[ key: string ]: string}
1754
+ - *Default:* esbuild's defaults
1755
+
1756
+ esbuild loaders by file extension, e.g. `{ '.png': 'dataurl' }`.
1757
+
1758
+ ---
1759
+
1760
+ ##### `minify`<sup>Optional</sup> <a name="minify" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.minify"></a>
1761
+
1762
+ ```typescript
1763
+ public readonly minify: boolean;
1764
+ ```
1765
+
1766
+ - *Type:* boolean
1767
+ - *Default:* true
1768
+
1769
+ Minify the bundle.
1770
+
1771
+ ---
1772
+
1773
+ ##### `sourceMap`<sup>Optional</sup> <a name="sourceMap" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.sourceMap"></a>
1774
+
1775
+ ```typescript
1776
+ public readonly sourceMap: boolean;
1777
+ ```
1778
+
1779
+ - *Type:* boolean
1780
+ - *Default:* true
1781
+
1782
+ Generate a source map, and set `NODE_OPTIONS=--enable-source-maps` so stack traces point at your sources.
1783
+
1784
+ ---
1785
+
1786
+ ##### `target`<sup>Optional</sup> <a name="target" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.target"></a>
1787
+
1788
+ ```typescript
1789
+ public readonly target: string;
1790
+ ```
1791
+
1792
+ - *Type:* string
1793
+ - *Default:* the runtime's Node.js version, e.g. `node24`
1794
+
1795
+ esbuild target.
1796
+
1797
+ ---
1798
+
1799
+ ##### `tsconfig`<sup>Optional</sup> <a name="tsconfig" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.tsconfig"></a>
1800
+
1801
+ ```typescript
1802
+ public readonly tsconfig: string;
1803
+ ```
1804
+
1805
+ - *Type:* string
1806
+ - *Default:* esbuild's lookup from the entry file
1807
+
1808
+ Path of the tsconfig.json to use, relative to the project root or absolute (inside the project root).
1809
+
1810
+ ---
1811
+
1812
+ ### NodejsWebFunctionProps <a name="NodejsWebFunctionProps" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps"></a>
1813
+
1814
+ Properties for a `NodejsWebFunction`.
1815
+
1816
+ #### Initializer <a name="Initializer" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.Initializer"></a>
1817
+
1818
+ ```typescript
1819
+ import { NodejsWebFunctionProps } from '@ashishpandeyone/cdk-lambda-web-function'
1820
+
1821
+ const nodejsWebFunctionProps: NodejsWebFunctionProps = { ... }
1822
+ ```
1823
+
1824
+ #### Properties <a name="Properties" id="Properties"></a>
1825
+
1826
+ | **Name** | **Type** | **Description** |
1827
+ | --- | --- | --- |
1828
+ | <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. |
1829
+ | <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. |
1830
+ | <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. |
1831
+ | <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 default endpoint (`fn.endpoint`): where it serves from, its name and limits. It serves the current revision; route it elsewhere with `fn.endpoint.routeTraffic()`. Add more endpoints with `addEndpoint`. |
1832
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.environment">environment</a></code> | <code>{[ key: string ]: string}</code> | Environment variables. |
1833
+ | <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. |
1834
+ | <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. |
1835
+ | <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). |
1836
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.revisionRetention">revisionRetention</a></code> | <code>number</code> | How many of the newest revisions to keep (1-50). |
1837
+ | <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. |
1838
+ | <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). |
1839
+ | <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. |
1840
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.webFunctionName">webFunctionName</a></code> | <code>string</code> | The function's name. |
1841
+ | <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). |
1842
+ | <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. |
1843
+ | <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`). |
1844
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.projectRoot">projectRoot</a></code> | <code>string</code> | The project root. |
1845
+ | <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. |
1846
+
1847
+ ---
1848
+
1849
+ ##### `authType`<sup>Required</sup> <a name="authType" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.authType"></a>
1850
+
1851
+ ```typescript
1852
+ public readonly authType: WebFunctionAuthType;
1853
+ ```
1854
+
1855
+ - *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType">WebFunctionAuthType</a>
1856
+
1857
+ How callers of the endpoint are authenticated.
1858
+
1859
+ ---
1860
+
1861
+ ##### `applicationLogLevelV2`<sup>Optional</sup> <a name="applicationLogLevelV2" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.applicationLogLevelV2"></a>
1862
+
1863
+ ```typescript
1864
+ public readonly applicationLogLevelV2: ApplicationLogLevel;
1865
+ ```
1866
+
1867
+ - *Type:* aws-cdk-lib.aws_lambda.ApplicationLogLevel
1868
+ - *Default:* lambda.ApplicationLogLevel.INFO
1869
+
1870
+ The minimum level of application logs to keep.
1871
+
1872
+ ---
1873
+
1874
+ ##### `description`<sup>Optional</sup> <a name="description" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.description"></a>
1875
+
1876
+ ```typescript
1877
+ public readonly description: string;
1878
+ ```
1879
+
1880
+ - *Type:* string
1881
+ - *Default:* no description
1882
+
1883
+ A description of the function's code and configuration.
1884
+
1885
+ ---
1886
+
1887
+ ##### `endpoint`<sup>Optional</sup> <a name="endpoint" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.endpoint"></a>
1888
+
1889
+ ```typescript
1890
+ public readonly endpoint: WebFunctionEndpointOptions;
1891
+ ```
1892
+
1893
+ - *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions">WebFunctionEndpointOptions</a>
1894
+ - *Default:* a HOME_REGION endpoint serving the current revision
1895
+
1896
+ The default endpoint (`fn.endpoint`): where it serves from, its name and limits. It serves the current revision; route it elsewhere with `fn.endpoint.routeTraffic()`. Add more endpoints with `addEndpoint`.
1897
+
1898
+ ---
1899
+
1900
+ ##### `environment`<sup>Optional</sup> <a name="environment" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.environment"></a>
1901
+
1902
+ ```typescript
1903
+ public readonly environment: {[ key: string ]: string};
1904
+ ```
1905
+
1906
+ - *Type:* {[ key: string ]: string}
1907
+ - *Default:* none
1908
+
1909
+ Environment variables.
1910
+
1911
+ Names starting with `AWS_` are reserved.
1912
+
1913
+ ---
1914
+
1915
+ ##### `logRemovalPolicy`<sup>Optional</sup> <a name="logRemovalPolicy" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.logRemovalPolicy"></a>
1916
+
1917
+ ```typescript
1918
+ public readonly logRemovalPolicy: RemovalPolicy;
1919
+ ```
1920
+
1921
+ - *Type:* aws-cdk-lib.RemovalPolicy
1922
+ - *Default:* RemovalPolicy.RETAIN
1923
+
1924
+ What happens to the log groups when the function is removed: RETAIN or DESTROY.
1925
+
1926
+ With DESTROY, deletion waits about a minute for environments to flush their last lines.
1927
+
1928
+ ---
1929
+
1930
+ ##### `logRetention`<sup>Optional</sup> <a name="logRetention" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.logRetention"></a>
1931
+
1932
+ ```typescript
1933
+ public readonly logRetention: RetentionDays;
1934
+ ```
1935
+
1936
+ - *Type:* aws-cdk-lib.aws_logs.RetentionDays
1937
+ - *Default:* logs.RetentionDays.ONE_MONTH
1938
+
1939
+ Retention for every log group of the function, in every region it serves from.
1940
+
1941
+ ---
1942
+
1943
+ ##### `maxConcurrencyPerEnvironment`<sup>Optional</sup> <a name="maxConcurrencyPerEnvironment" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.maxConcurrencyPerEnvironment"></a>
1944
+
1945
+ ```typescript
1946
+ public readonly maxConcurrencyPerEnvironment: number;
1947
+ ```
1948
+
1949
+ - *Type:* number
1950
+ - *Default:* 64
1951
+
1952
+ How many requests one execution environment handles at the same time (1-128).
1953
+
1954
+ Requests share module-level state, so handlers must be concurrency-safe.
1955
+
1956
+ ---
1957
+
1958
+ ##### `revisionRetention`<sup>Optional</sup> <a name="revisionRetention" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.revisionRetention"></a>
1959
+
1960
+ ```typescript
1961
+ public readonly revisionRetention: number;
1962
+ ```
1963
+
1964
+ - *Type:* number
1965
+ - *Default:* 20
1966
+
1967
+ How many of the newest revisions to keep (1-50).
1968
+
1969
+ Each deployment that changes the code or
1970
+ configuration creates a revision; older ones stay available to roll back to or route traffic to,
1971
+ and the oldest beyond this count are deleted after each deployment.
1972
+
1973
+ Revisions that an endpoint routes to are never deleted, and neither are those the previous
1974
+ deployment used (a rollback returns to them).
1975
+
1976
+ ---
1977
+
1978
+ ##### `role`<sup>Optional</sup> <a name="role" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.role"></a>
1979
+
1980
+ ```typescript
1981
+ public readonly role: IRole;
1982
+ ```
1983
+
1984
+ - *Type:* aws-cdk-lib.aws_iam.IRole
1985
+ - *Default:* a role trusting `lambda.amazonaws.com` with `AWSLambdaBasicExecutionRole`
1986
+
1987
+ The execution role.
1988
+
1989
+ An `iam.IRole` (not `IRoleRef`) because the function adds statements to it and grants through it.
1990
+ [disable-awslint:prefer-ref-interface]
1991
+
1992
+ ---
1993
+
1994
+ ##### `systemLogLevelV2`<sup>Optional</sup> <a name="systemLogLevelV2" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.systemLogLevelV2"></a>
1995
+
1996
+ ```typescript
1997
+ public readonly systemLogLevelV2: SystemLogLevel;
1998
+ ```
1999
+
2000
+ - *Type:* aws-cdk-lib.aws_lambda.SystemLogLevel
2001
+ - *Default:* lambda.SystemLogLevel.INFO
2002
+
2003
+ The minimum level of platform logs to keep (DEBUG, INFO or WARN).
2004
+
2005
+ ---
2006
+
2007
+ ##### `timeout`<sup>Optional</sup> <a name="timeout" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.timeout"></a>
2008
+
2009
+ ```typescript
2010
+ public readonly timeout: Duration;
2011
+ ```
2012
+
2013
+ - *Type:* aws-cdk-lib.Duration
2014
+ - *Default:* Duration.seconds(30)
2015
+
2016
+ How long a single request may run.
2017
+
2018
+ ---
2019
+
2020
+ ##### `webFunctionName`<sup>Optional</sup> <a name="webFunctionName" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.webFunctionName"></a>
2021
+
2022
+ ```typescript
2023
+ public readonly webFunctionName: string;
2024
+ ```
2025
+
2026
+ - *Type:* string
2027
+ - *Default:* a unique name generated from the construct path (moving the construct changes it)
2028
+
2029
+ The function's name.
2030
+
2031
+ Renaming a function replaces it, and its endpoint gets a new URL.
2032
+
2033
+ ---
2034
+
2035
+ ##### `entry`<sup>Required</sup> <a name="entry" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.entry"></a>
2036
+
2037
+ ```typescript
2038
+ public readonly entry: string;
2039
+ ```
2040
+
2041
+ - *Type:* string
2042
+
2043
+ The file that starts your server (TypeScript or JavaScript).
2044
+
2045
+ It's bundled with its dependencies.
2046
+
2047
+ ---
2048
+
2049
+ ##### `bundling`<sup>Optional</sup> <a name="bundling" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.bundling"></a>
2050
+
2051
+ ```typescript
2052
+ public readonly bundling: NodejsWebFunctionBundlingOptions;
2053
+ ```
2054
+
2055
+ - *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions">NodejsWebFunctionBundlingOptions</a>
2056
+ - *Default:* minified ESM with a source map, targeting the runtime's Node.js version
2057
+
2058
+ How the server is bundled.
2059
+
2060
+ ---
2061
+
2062
+ ##### `depsLockFilePath`<sup>Optional</sup> <a name="depsLockFilePath" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.depsLockFilePath"></a>
2063
+
2064
+ ```typescript
2065
+ public readonly depsLockFilePath: string;
2066
+ ```
2067
+
2068
+ - *Type:* string
2069
+ - *Default:* the nearest `package-lock.json`, `yarn.lock`, `pnpm-lock.yaml` or `bun.lock(b)` above the entry
2070
+
2071
+ The lock file that marks the project root (where esbuild resolves `node_modules`).
2072
+
2073
+ ---
2074
+
2075
+ ##### `projectRoot`<sup>Optional</sup> <a name="projectRoot" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.projectRoot"></a>
2076
+
2077
+ ```typescript
2078
+ public readonly projectRoot: string;
2079
+ ```
2080
+
2081
+ - *Type:* string
2082
+ - *Default:* the directory of the lock file
2083
+
2084
+ The project root.
2085
+
2086
+ Must contain the entry file.
2087
+
2088
+ ---
2089
+
2090
+ ##### `runtime`<sup>Optional</sup> <a name="runtime" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.runtime"></a>
2091
+
2092
+ ```typescript
2093
+ public readonly runtime: Runtime;
2094
+ ```
2095
+
2096
+ - *Type:* aws-cdk-lib.aws_lambda.Runtime
2097
+ - *Default:* lambda.Runtime.NODEJS_24_X
2098
+
2099
+ The Node.js runtime.
2100
+
2101
+ ---
2102
+
2103
+ ### WebFunctionCanaryDeploymentOptions <a name="WebFunctionCanaryDeploymentOptions" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionCanaryDeploymentOptions"></a>
2104
+
2105
+ Options for a canary deployment.
2106
+
2107
+ #### Initializer <a name="Initializer" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionCanaryDeploymentOptions.Initializer"></a>
2108
+
2109
+ ```typescript
2110
+ import { WebFunctionCanaryDeploymentOptions } from '@ashishpandeyone/cdk-lambda-web-function'
2111
+
2112
+ const webFunctionCanaryDeploymentOptions: WebFunctionCanaryDeploymentOptions = { ... }
2113
+ ```
2114
+
2115
+ #### Properties <a name="Properties" id="Properties"></a>
2116
+
2117
+ | **Name** | **Type** | **Description** |
2118
+ | --- | --- | --- |
2119
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionCanaryDeploymentOptions.property.bake">bake</a></code> | <code>aws-cdk-lib.Duration</code> | How long the new revision serves `percent` before it gets all traffic (1-45 minutes). |
2120
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionCanaryDeploymentOptions.property.percent">percent</a></code> | <code>number</code> | The share of traffic, in whole percent (1-99), that the new revision gets first. |
2121
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionCanaryDeploymentOptions.property.alarms">alarms</a></code> | <code>aws-cdk-lib.aws_cloudwatch.IAlarm[]</code> | Alarms that stop the deployment: if one is in ALARM, the endpoint goes back to the previous revision and the deployment fails, so CloudFormation rolls the stack back. |
2122
+
2123
+ ---
2124
+
2125
+ ##### `bake`<sup>Required</sup> <a name="bake" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionCanaryDeploymentOptions.property.bake"></a>
2126
+
2127
+ ```typescript
2128
+ public readonly bake: Duration;
2129
+ ```
2130
+
2131
+ - *Type:* aws-cdk-lib.Duration
2132
+
2133
+ How long the new revision serves `percent` before it gets all traffic (1-45 minutes).
2134
+
2135
+ Make it longer than the time your alarms need to fire (period × evaluation periods).
2136
+
2137
+ ---
2138
+
2139
+ ##### `percent`<sup>Required</sup> <a name="percent" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionCanaryDeploymentOptions.property.percent"></a>
2140
+
2141
+ ```typescript
2142
+ public readonly percent: number;
2143
+ ```
2144
+
2145
+ - *Type:* number
2146
+
2147
+ The share of traffic, in whole percent (1-99), that the new revision gets first.
2148
+
2149
+ ---
2150
+
2151
+ ##### `alarms`<sup>Optional</sup> <a name="alarms" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionCanaryDeploymentOptions.property.alarms"></a>
2152
+
2153
+ ```typescript
2154
+ public readonly alarms: IAlarm[];
2155
+ ```
2156
+
2157
+ - *Type:* aws-cdk-lib.aws_cloudwatch.IAlarm[]
2158
+ - *Default:* no alarms: traffic moves on a timer
2159
+
2160
+ Alarms that stop the deployment: if one is in ALARM, the endpoint goes back to the previous revision and the deployment fails, so CloudFormation rolls the stack back.
2161
+
2162
+ They're checked before traffic moves, during the bake, and once the new revision has all traffic.
2163
+ Use alarms in any region (by ARN), including composite alarms.
2164
+
2165
+ ---
2166
+
2167
+ ### WebFunctionEndpointOptions <a name="WebFunctionEndpointOptions" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions"></a>
2168
+
2169
+ Options for a Web Function's endpoint.
584
2170
 
585
- The endpoint's ARN.
2171
+ #### Initializer <a name="Initializer" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions.Initializer"></a>
2172
+
2173
+ ```typescript
2174
+ import { WebFunctionEndpointOptions } from '@ashishpandeyone/cdk-lambda-web-function'
2175
+
2176
+ const webFunctionEndpointOptions: WebFunctionEndpointOptions = { ... }
2177
+ ```
2178
+
2179
+ #### Properties <a name="Properties" id="Properties"></a>
2180
+
2181
+ | **Name** | **Type** | **Description** |
2182
+ | --- | --- | --- |
2183
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions.property.deployment">deployment</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment">WebFunctionDeployment</a></code> | How the endpoint moves its traffic to a new revision: all at once, or in steps (`WebFunctionDeployment.canary()` or `linear()`) that watch CloudWatch alarms and move the traffic back when one goes into ALARM. |
2184
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions.property.description">description</a></code> | <code>string</code> | A description of the endpoint. |
2185
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions.property.endpointName">endpointName</a></code> | <code>string</code> | The endpoint's name, shown in logs (`endpointName`) and in the `lambda-web-endpoint-name` header. Names are unique per function. |
2186
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions.property.endpointType">endpointType</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointType">WebFunctionEndpointType</a></code> | Where the endpoint serves traffic from. |
2187
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions.property.maxEnvironments">maxEnvironments</a></code> | <code>number</code> | The most execution environments the endpoint may use (2–10,000). Each one uses 2 vCPUs of the account's quota. |
2188
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions.property.rateLimit">rateLimit</a></code> | <code>number</code> | The most requests per second the endpoint accepts; |
2189
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions.property.regions">regions</a></code> | <code>string[]</code> | Regions to serve from in addition to the home region (the stack's region). |
586
2190
 
587
2191
  ---
588
2192
 
589
- ##### `endpointName`<sup>Required</sup> <a name="endpointName" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.endpointName"></a>
2193
+ ##### `deployment`<sup>Optional</sup> <a name="deployment" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions.property.deployment"></a>
2194
+
2195
+ ```typescript
2196
+ public readonly deployment: WebFunctionDeployment;
2197
+ ```
2198
+
2199
+ - *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment">WebFunctionDeployment</a>
2200
+ - *Default:* WebFunctionDeployment.allAtOnce()
2201
+
2202
+ How the endpoint moves its traffic to a new revision: all at once, or in steps (`WebFunctionDeployment.canary()` or `linear()`) that watch CloudWatch alarms and move the traffic back when one goes into ALARM.
2203
+
2204
+ A deployment in steps can't be combined with `revision`, `additionalRevisions` or `routeTraffic()`.
2205
+
2206
+ ---
2207
+
2208
+ ##### `description`<sup>Optional</sup> <a name="description" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions.property.description"></a>
2209
+
2210
+ ```typescript
2211
+ public readonly description: string;
2212
+ ```
2213
+
2214
+ - *Type:* string
2215
+ - *Default:* no description
2216
+
2217
+ A description of the endpoint.
2218
+
2219
+ ---
2220
+
2221
+ ##### `endpointName`<sup>Optional</sup> <a name="endpointName" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions.property.endpointName"></a>
590
2222
 
591
2223
  ```typescript
592
2224
  public readonly endpointName: string;
593
2225
  ```
594
2226
 
595
2227
  - *Type:* string
2228
+ - *Default:* `default-<hash>` for the function's default endpoint, `<id>-<hash>` for endpoints added with `addEndpoint`
596
2229
 
597
- The endpoint's name.
2230
+ The endpoint's name, shown in logs (`endpointName`) and in the `lambda-web-endpoint-name` header. Names are unique per function.
2231
+
2232
+ When omitted, the name ends in a hash of the endpoint type and regions, so changing either deploys
2233
+ a new endpoint cleanly. When set, changing the endpoint type or regions also requires a new name:
2234
+ two endpoints of one function can't share a name, and CloudFormation creates the replacement
2235
+ before deleting the old one.
598
2236
 
599
2237
  ---
600
2238
 
601
- ##### `endpointType`<sup>Required</sup> <a name="endpointType" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.endpointType"></a>
2239
+ ##### `endpointType`<sup>Optional</sup> <a name="endpointType" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions.property.endpointType"></a>
602
2240
 
603
2241
  ```typescript
604
2242
  public readonly endpointType: WebFunctionEndpointType;
605
2243
  ```
606
2244
 
607
2245
  - *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointType">WebFunctionEndpointType</a>
2246
+ - *Default:* WebFunctionEndpointType.HOME_REGION
608
2247
 
609
2248
  Where the endpoint serves traffic from.
610
2249
 
611
2250
  ---
612
2251
 
613
- ##### `regions`<sup>Required</sup> <a name="regions" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.regions"></a>
2252
+ ##### `maxEnvironments`<sup>Optional</sup> <a name="maxEnvironments" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions.property.maxEnvironments"></a>
2253
+
2254
+ ```typescript
2255
+ public readonly maxEnvironments: number;
2256
+ ```
2257
+
2258
+ - *Type:* number
2259
+ - *Default:* scales within the account's vCPU quota
2260
+
2261
+ The most execution environments the endpoint may use (2–10,000). Each one uses 2 vCPUs of the account's quota.
2262
+
2263
+ Enforced separately in each region the endpoint serves from.
2264
+
2265
+ ---
2266
+
2267
+ ##### `rateLimit`<sup>Optional</sup> <a name="rateLimit" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions.property.rateLimit"></a>
2268
+
2269
+ ```typescript
2270
+ public readonly rateLimit: number;
2271
+ ```
2272
+
2273
+ - *Type:* number
2274
+ - *Default:* no limit beyond the service quota of 10,000 requests per second per endpoint (per region)
2275
+
2276
+ The most requests per second the endpoint accepts;
2277
+
2278
+ excess requests get HTTP 429.
2279
+ Allowed: 0 (blocks all traffic), 100–1,000 in steps of 100, or 2,000–10,000 in steps of 1,000.
2280
+
2281
+ Enforced separately in each region the endpoint serves from, so a multi-region endpoint
2282
+ can accept this many requests per second in every region.
2283
+
2284
+ ---
2285
+
2286
+ ##### `regions`<sup>Optional</sup> <a name="regions" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions.property.regions"></a>
614
2287
 
615
2288
  ```typescript
616
2289
  public readonly regions: string[];
617
2290
  ```
618
2291
 
619
2292
  - *Type:* string[]
2293
+ - *Default:* no extra regions
620
2294
 
621
- Every region the endpoint serves from: the home region first, then the others in alphabetical order.
2295
+ Regions to serve from in addition to the home region (the stack's region).
2296
+
2297
+ Required (at least one) for `MULTI_REGION` and `PER_REGION`; must be empty for `HOME_REGION`.
2298
+
2299
+ Changing this creates a new endpoint with a new URL.
622
2300
 
623
2301
  ---
624
2302
 
625
- ##### `url`<sup>Required</sup> <a name="url" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.url"></a>
2303
+ ### WebFunctionLinearDeploymentOptions <a name="WebFunctionLinearDeploymentOptions" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionLinearDeploymentOptions"></a>
2304
+
2305
+ Options for a linear deployment.
2306
+
2307
+ #### Initializer <a name="Initializer" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionLinearDeploymentOptions.Initializer"></a>
626
2308
 
627
2309
  ```typescript
628
- public readonly url: string;
2310
+ import { WebFunctionLinearDeploymentOptions } from '@ashishpandeyone/cdk-lambda-web-function'
2311
+
2312
+ const webFunctionLinearDeploymentOptions: WebFunctionLinearDeploymentOptions = { ... }
629
2313
  ```
630
2314
 
631
- - *Type:* string
2315
+ #### Properties <a name="Properties" id="Properties"></a>
632
2316
 
633
- The endpoint's URL: the global URL for `MULTI_REGION`, otherwise the home region's.
2317
+ | **Name** | **Type** | **Description** |
2318
+ | --- | --- | --- |
2319
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionLinearDeploymentOptions.property.interval">interval</a></code> | <code>aws-cdk-lib.Duration</code> | How long each step serves before the next one (at least 1 minute, and at most 45 minutes in total). |
2320
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionLinearDeploymentOptions.property.percent">percent</a></code> | <code>number</code> | The share of traffic, in whole percent (5-50), that moves to the new revision at each step. |
2321
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionLinearDeploymentOptions.property.alarms">alarms</a></code> | <code>aws-cdk-lib.aws_cloudwatch.IAlarm[]</code> | Alarms that stop the deployment: if one is in ALARM, the endpoint goes back to the previous revision and the deployment fails, so CloudFormation rolls the stack back. |
634
2322
 
635
2323
  ---
636
2324
 
2325
+ ##### `interval`<sup>Required</sup> <a name="interval" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionLinearDeploymentOptions.property.interval"></a>
637
2326
 
638
- ## Structs <a name="Structs" id="Structs"></a>
2327
+ ```typescript
2328
+ public readonly interval: Duration;
2329
+ ```
639
2330
 
640
- ### WebFunctionEndpointOptions <a name="WebFunctionEndpointOptions" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions"></a>
2331
+ - *Type:* aws-cdk-lib.Duration
641
2332
 
642
- Options for a Web Function's endpoint.
2333
+ How long each step serves before the next one (at least 1 minute, and at most 45 minutes in total).
643
2334
 
644
- #### Initializer <a name="Initializer" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions.Initializer"></a>
2335
+ ---
2336
+
2337
+ ##### `percent`<sup>Required</sup> <a name="percent" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionLinearDeploymentOptions.property.percent"></a>
645
2338
 
646
2339
  ```typescript
647
- import { WebFunctionEndpointOptions } from '@ashishpandeyone/cdk-lambda-web-function'
2340
+ public readonly percent: number;
2341
+ ```
648
2342
 
649
- const webFunctionEndpointOptions: WebFunctionEndpointOptions = { ... }
2343
+ - *Type:* number
2344
+
2345
+ The share of traffic, in whole percent (5-50), that moves to the new revision at each step.
2346
+
2347
+ ---
2348
+
2349
+ ##### `alarms`<sup>Optional</sup> <a name="alarms" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionLinearDeploymentOptions.property.alarms"></a>
2350
+
2351
+ ```typescript
2352
+ public readonly alarms: IAlarm[];
2353
+ ```
2354
+
2355
+ - *Type:* aws-cdk-lib.aws_cloudwatch.IAlarm[]
2356
+ - *Default:* no alarms: traffic moves on a timer
2357
+
2358
+ Alarms that stop the deployment: if one is in ALARM, the endpoint goes back to the previous revision and the deployment fails, so CloudFormation rolls the stack back.
2359
+
2360
+ They're checked before traffic moves, during every step, and once the new revision has all traffic.
2361
+ Use alarms in any region (by ARN), including composite alarms.
2362
+
2363
+ ---
2364
+
2365
+ ### WebFunctionOptions <a name="WebFunctionOptions" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions"></a>
2366
+
2367
+ Options shared by `WebFunction` and `NodejsWebFunction`: everything except how the code is supplied.
2368
+
2369
+ #### Initializer <a name="Initializer" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.Initializer"></a>
2370
+
2371
+ ```typescript
2372
+ import { WebFunctionOptions } from '@ashishpandeyone/cdk-lambda-web-function'
2373
+
2374
+ const webFunctionOptions: WebFunctionOptions = { ... }
650
2375
  ```
651
2376
 
652
2377
  #### Properties <a name="Properties" id="Properties"></a>
653
2378
 
654
2379
  | **Name** | **Type** | **Description** |
655
2380
  | --- | --- | --- |
656
- | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions.property.endpointName">endpointName</a></code> | <code>string</code> | The endpoint's name, shown in logs (`endpointName`) and in the `lambda-web-endpoint-name` header. |
657
- | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions.property.endpointType">endpointType</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointType">WebFunctionEndpointType</a></code> | Where the endpoint serves traffic from. |
658
- | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions.property.regions">regions</a></code> | <code>string[]</code> | Regions to serve from in addition to the home region (the stack's region). |
2381
+ | <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. |
2382
+ | <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. |
2383
+ | <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. |
2384
+ | <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 default endpoint (`fn.endpoint`): where it serves from, its name and limits. It serves the current revision; route it elsewhere with `fn.endpoint.routeTraffic()`. Add more endpoints with `addEndpoint`. |
2385
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.environment">environment</a></code> | <code>{[ key: string ]: string}</code> | Environment variables. |
2386
+ | <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. |
2387
+ | <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. |
2388
+ | <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). |
2389
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.revisionRetention">revisionRetention</a></code> | <code>number</code> | How many of the newest revisions to keep (1-50). |
2390
+ | <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. |
2391
+ | <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). |
2392
+ | <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. |
2393
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.webFunctionName">webFunctionName</a></code> | <code>string</code> | The function's name. |
659
2394
 
660
2395
  ---
661
2396
 
662
- ##### `endpointName`<sup>Optional</sup> <a name="endpointName" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions.property.endpointName"></a>
2397
+ ##### `authType`<sup>Required</sup> <a name="authType" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.authType"></a>
663
2398
 
664
2399
  ```typescript
665
- public readonly endpointName: string;
2400
+ public readonly authType: WebFunctionAuthType;
2401
+ ```
2402
+
2403
+ - *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType">WebFunctionAuthType</a>
2404
+
2405
+ How callers of the endpoint are authenticated.
2406
+
2407
+ ---
2408
+
2409
+ ##### `applicationLogLevelV2`<sup>Optional</sup> <a name="applicationLogLevelV2" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.applicationLogLevelV2"></a>
2410
+
2411
+ ```typescript
2412
+ public readonly applicationLogLevelV2: ApplicationLogLevel;
2413
+ ```
2414
+
2415
+ - *Type:* aws-cdk-lib.aws_lambda.ApplicationLogLevel
2416
+ - *Default:* lambda.ApplicationLogLevel.INFO
2417
+
2418
+ The minimum level of application logs to keep.
2419
+
2420
+ ---
2421
+
2422
+ ##### `description`<sup>Optional</sup> <a name="description" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.description"></a>
2423
+
2424
+ ```typescript
2425
+ public readonly description: string;
666
2426
  ```
667
2427
 
668
2428
  - *Type:* string
669
- - *Default:* `default-<hash of type and regions>`
2429
+ - *Default:* no description
2430
+
2431
+ A description of the function's code and configuration.
670
2432
 
671
- The endpoint's name, shown in logs (`endpointName`) and in the `lambda-web-endpoint-name` header.
2433
+ ---
2434
+
2435
+ ##### `endpoint`<sup>Optional</sup> <a name="endpoint" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.endpoint"></a>
2436
+
2437
+ ```typescript
2438
+ public readonly endpoint: WebFunctionEndpointOptions;
2439
+ ```
2440
+
2441
+ - *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions">WebFunctionEndpointOptions</a>
2442
+ - *Default:* a HOME_REGION endpoint serving the current revision
672
2443
 
673
- When omitted, the name is `default-<hash>`, with the hash covering the endpoint type and regions,
674
- so changing either deploys a new endpoint cleanly. When set, changing the endpoint type or
675
- regions also requires a new name: two endpoints of one function can't share a name, and
676
- CloudFormation creates the replacement before deleting the old one.
2444
+ The default endpoint (`fn.endpoint`): where it serves from, its name and limits. It serves the current revision; route it elsewhere with `fn.endpoint.routeTraffic()`. Add more endpoints with `addEndpoint`.
677
2445
 
678
2446
  ---
679
2447
 
680
- ##### `endpointType`<sup>Optional</sup> <a name="endpointType" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions.property.endpointType"></a>
2448
+ ##### `environment`<sup>Optional</sup> <a name="environment" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.environment"></a>
681
2449
 
682
2450
  ```typescript
683
- public readonly endpointType: WebFunctionEndpointType;
2451
+ public readonly environment: {[ key: string ]: string};
684
2452
  ```
685
2453
 
686
- - *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointType">WebFunctionEndpointType</a>
687
- - *Default:* WebFunctionEndpointType.HOME_REGION
2454
+ - *Type:* {[ key: string ]: string}
2455
+ - *Default:* none
688
2456
 
689
- Where the endpoint serves traffic from.
2457
+ Environment variables.
2458
+
2459
+ Names starting with `AWS_` are reserved.
690
2460
 
691
2461
  ---
692
2462
 
693
- ##### `regions`<sup>Optional</sup> <a name="regions" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions.property.regions"></a>
2463
+ ##### `logRemovalPolicy`<sup>Optional</sup> <a name="logRemovalPolicy" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.logRemovalPolicy"></a>
694
2464
 
695
2465
  ```typescript
696
- public readonly regions: string[];
2466
+ public readonly logRemovalPolicy: RemovalPolicy;
2467
+ ```
2468
+
2469
+ - *Type:* aws-cdk-lib.RemovalPolicy
2470
+ - *Default:* RemovalPolicy.RETAIN
2471
+
2472
+ What happens to the log groups when the function is removed: RETAIN or DESTROY.
2473
+
2474
+ With DESTROY, deletion waits about a minute for environments to flush their last lines.
2475
+
2476
+ ---
2477
+
2478
+ ##### `logRetention`<sup>Optional</sup> <a name="logRetention" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.logRetention"></a>
2479
+
2480
+ ```typescript
2481
+ public readonly logRetention: RetentionDays;
2482
+ ```
2483
+
2484
+ - *Type:* aws-cdk-lib.aws_logs.RetentionDays
2485
+ - *Default:* logs.RetentionDays.ONE_MONTH
2486
+
2487
+ Retention for every log group of the function, in every region it serves from.
2488
+
2489
+ ---
2490
+
2491
+ ##### `maxConcurrencyPerEnvironment`<sup>Optional</sup> <a name="maxConcurrencyPerEnvironment" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.maxConcurrencyPerEnvironment"></a>
2492
+
2493
+ ```typescript
2494
+ public readonly maxConcurrencyPerEnvironment: number;
2495
+ ```
2496
+
2497
+ - *Type:* number
2498
+ - *Default:* 64
2499
+
2500
+ How many requests one execution environment handles at the same time (1-128).
2501
+
2502
+ Requests share module-level state, so handlers must be concurrency-safe.
2503
+
2504
+ ---
2505
+
2506
+ ##### `revisionRetention`<sup>Optional</sup> <a name="revisionRetention" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.revisionRetention"></a>
2507
+
2508
+ ```typescript
2509
+ public readonly revisionRetention: number;
2510
+ ```
2511
+
2512
+ - *Type:* number
2513
+ - *Default:* 20
2514
+
2515
+ How many of the newest revisions to keep (1-50).
2516
+
2517
+ Each deployment that changes the code or
2518
+ configuration creates a revision; older ones stay available to roll back to or route traffic to,
2519
+ and the oldest beyond this count are deleted after each deployment.
2520
+
2521
+ Revisions that an endpoint routes to are never deleted, and neither are those the previous
2522
+ deployment used (a rollback returns to them).
2523
+
2524
+ ---
2525
+
2526
+ ##### `role`<sup>Optional</sup> <a name="role" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.role"></a>
2527
+
2528
+ ```typescript
2529
+ public readonly role: IRole;
2530
+ ```
2531
+
2532
+ - *Type:* aws-cdk-lib.aws_iam.IRole
2533
+ - *Default:* a role trusting `lambda.amazonaws.com` with `AWSLambdaBasicExecutionRole`
2534
+
2535
+ The execution role.
2536
+
2537
+ An `iam.IRole` (not `IRoleRef`) because the function adds statements to it and grants through it.
2538
+ [disable-awslint:prefer-ref-interface]
2539
+
2540
+ ---
2541
+
2542
+ ##### `systemLogLevelV2`<sup>Optional</sup> <a name="systemLogLevelV2" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.systemLogLevelV2"></a>
2543
+
2544
+ ```typescript
2545
+ public readonly systemLogLevelV2: SystemLogLevel;
2546
+ ```
2547
+
2548
+ - *Type:* aws-cdk-lib.aws_lambda.SystemLogLevel
2549
+ - *Default:* lambda.SystemLogLevel.INFO
2550
+
2551
+ The minimum level of platform logs to keep (DEBUG, INFO or WARN).
2552
+
2553
+ ---
2554
+
2555
+ ##### `timeout`<sup>Optional</sup> <a name="timeout" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.timeout"></a>
2556
+
2557
+ ```typescript
2558
+ public readonly timeout: Duration;
2559
+ ```
2560
+
2561
+ - *Type:* aws-cdk-lib.Duration
2562
+ - *Default:* Duration.seconds(30)
2563
+
2564
+ How long a single request may run.
2565
+
2566
+ ---
2567
+
2568
+ ##### `webFunctionName`<sup>Optional</sup> <a name="webFunctionName" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.webFunctionName"></a>
2569
+
2570
+ ```typescript
2571
+ public readonly webFunctionName: string;
697
2572
  ```
698
2573
 
699
- - *Type:* string[]
700
- - *Default:* no extra regions
701
-
702
- Regions to serve from in addition to the home region (the stack's region).
2574
+ - *Type:* string
2575
+ - *Default:* a unique name generated from the construct path (moving the construct changes it)
703
2576
 
704
- Required (at least one) for `MULTI_REGION` and `PER_REGION`; must be empty for `HOME_REGION`.
2577
+ The function's name.
705
2578
 
706
- Changing this creates a new endpoint with a new URL.
2579
+ Renaming a function replaces it, and its endpoint gets a new URL.
707
2580
 
708
2581
  ---
709
2582
 
@@ -724,20 +2597,21 @@ const webFunctionProps: WebFunctionProps = { ... }
724
2597
  | **Name** | **Type** | **Description** |
725
2598
  | --- | --- | --- |
726
2599
  | <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
2600
  | <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
2601
  | <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
- | <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. |
2602
+ | <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 default endpoint (`fn.endpoint`): where it serves from, its name and limits. It serves the current revision; route it elsewhere with `fn.endpoint.routeTraffic()`. Add more endpoints with `addEndpoint`. |
733
2603
  | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps.property.environment">environment</a></code> | <code>{[ key: string ]: string}</code> | Environment variables. |
734
2604
  | <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
2605
  | <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. |
736
2606
  | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps.property.maxConcurrencyPerEnvironment">maxConcurrencyPerEnvironment</a></code> | <code>number</code> | How many requests one execution environment handles at the same time (1-128). |
2607
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps.property.revisionRetention">revisionRetention</a></code> | <code>number</code> | How many of the newest revisions to keep (1-50). |
737
2608
  | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps.property.role">role</a></code> | <code>aws-cdk-lib.aws_iam.IRole</code> | The execution role. |
738
2609
  | <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
2610
  | <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
2611
  | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps.property.webFunctionName">webFunctionName</a></code> | <code>string</code> | The function's name. |
2612
+ | <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. |
2613
+ | <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`. |
2614
+ | <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
2615
 
742
2616
  ---
743
2617
 
@@ -753,32 +2627,6 @@ How callers of the endpoint are authenticated.
753
2627
 
754
2628
  ---
755
2629
 
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
2630
  ##### `applicationLogLevelV2`<sup>Optional</sup> <a name="applicationLogLevelV2" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps.property.applicationLogLevelV2"></a>
783
2631
 
784
2632
  ```typescript
@@ -812,22 +2660,9 @@ public readonly endpoint: WebFunctionEndpointOptions;
812
2660
  ```
813
2661
 
814
2662
  - *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions">WebFunctionEndpointOptions</a>
815
- - *Default:* a HOME_REGION endpoint
816
-
817
- The endpoint: where it serves from, and its name.
818
-
819
- ---
820
-
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'
2663
+ - *Default:* a HOME_REGION endpoint serving the current revision
829
2664
 
830
- The file that starts your server, relative to the root of the code.
2665
+ The default endpoint (`fn.endpoint`): where it serves from, its name and limits. It serves the current revision; route it elsewhere with `fn.endpoint.routeTraffic()`. Add more endpoints with `addEndpoint`.
831
2666
 
832
2667
  ---
833
2668
 
@@ -889,6 +2724,26 @@ Requests share module-level state, so handlers must be concurrency-safe.
889
2724
 
890
2725
  ---
891
2726
 
2727
+ ##### `revisionRetention`<sup>Optional</sup> <a name="revisionRetention" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps.property.revisionRetention"></a>
2728
+
2729
+ ```typescript
2730
+ public readonly revisionRetention: number;
2731
+ ```
2732
+
2733
+ - *Type:* number
2734
+ - *Default:* 20
2735
+
2736
+ How many of the newest revisions to keep (1-50).
2737
+
2738
+ Each deployment that changes the code or
2739
+ configuration creates a revision; older ones stay available to roll back to or route traffic to,
2740
+ and the oldest beyond this count are deleted after each deployment.
2741
+
2742
+ Revisions that an endpoint routes to are never deleted, and neither are those the previous
2743
+ deployment used (a rollback returns to them).
2744
+
2745
+ ---
2746
+
892
2747
  ##### `role`<sup>Optional</sup> <a name="role" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps.property.role"></a>
893
2748
 
894
2749
  ```typescript
@@ -946,19 +2801,207 @@ Renaming a function replaces it, and its endpoint gets a new URL.
946
2801
 
947
2802
  ---
948
2803
 
2804
+ ##### `code`<sup>Required</sup> <a name="code" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps.property.code"></a>
2805
+
2806
+ ```typescript
2807
+ public readonly code: Code;
2808
+ ```
2809
+
2810
+ - *Type:* aws-cdk-lib.aws_lambda.Code
2811
+
2812
+ The code: a zip in S3 (`Code.fromAsset`, `Code.fromBucket`, `Code.fromCustomCommand`, `Code.fromDockerBuild`). Inline code and container images aren't supported.
2813
+
2814
+ The code is copied into the stack's code bucket, which Lambda Web Functions can read.
2815
+
2816
+ ---
2817
+
2818
+ ##### `runtime`<sup>Required</sup> <a name="runtime" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps.property.runtime"></a>
2819
+
2820
+ ```typescript
2821
+ public readonly runtime: Runtime;
2822
+ ```
2823
+
2824
+ - *Type:* aws-cdk-lib.aws_lambda.Runtime
2825
+
2826
+ The Node.js runtime, e.g. `lambda.Runtime.NODEJS_24_X`.
2827
+
2828
+ ---
2829
+
2830
+ ##### `entrypoint`<sup>Optional</sup> <a name="entrypoint" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps.property.entrypoint"></a>
2831
+
2832
+ ```typescript
2833
+ public readonly entrypoint: string;
2834
+ ```
2835
+
2836
+ - *Type:* string
2837
+ - *Default:* 'index.js'
2838
+
2839
+ The file that starts your server, relative to the root of the code.
2840
+
2841
+ ---
2842
+
2843
+ ### WebFunctionRevisionAttributes <a name="WebFunctionRevisionAttributes" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevisionAttributes"></a>
2844
+
2845
+ Attributes of an existing revision.
2846
+
2847
+ #### Initializer <a name="Initializer" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevisionAttributes.Initializer"></a>
2848
+
2849
+ ```typescript
2850
+ import { WebFunctionRevisionAttributes } from '@ashishpandeyone/cdk-lambda-web-function'
2851
+
2852
+ const webFunctionRevisionAttributes: WebFunctionRevisionAttributes = { ... }
2853
+ ```
2854
+
2855
+ #### Properties <a name="Properties" id="Properties"></a>
2856
+
2857
+ | **Name** | **Type** | **Description** |
2858
+ | --- | --- | --- |
2859
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevisionAttributes.property.revisionId">revisionId</a></code> | <code>string</code> | The revision's ID, e.g. `rev-a1b2c` (the `revisionId` of an earlier deployment). |
2860
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevisionAttributes.property.webFunction">webFunction</a></code> | <code>aws-cdk-lib.interfaces.aws_lambda.IWebFunctionRef</code> | The function the revision belongs to. |
2861
+
2862
+ ---
2863
+
2864
+ ##### `revisionId`<sup>Required</sup> <a name="revisionId" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevisionAttributes.property.revisionId"></a>
2865
+
2866
+ ```typescript
2867
+ public readonly revisionId: string;
2868
+ ```
2869
+
2870
+ - *Type:* string
2871
+
2872
+ The revision's ID, e.g. `rev-a1b2c` (the `revisionId` of an earlier deployment).
2873
+
2874
+ ---
2875
+
2876
+ ##### `webFunction`<sup>Required</sup> <a name="webFunction" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevisionAttributes.property.webFunction"></a>
2877
+
2878
+ ```typescript
2879
+ public readonly webFunction: IWebFunctionRef;
2880
+ ```
2881
+
2882
+ - *Type:* aws-cdk-lib.interfaces.aws_lambda.IWebFunctionRef
2883
+
2884
+ The function the revision belongs to.
2885
+
2886
+ ---
2887
+
2888
+ ### WebFunctionRevisionWeight <a name="WebFunctionRevisionWeight" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevisionWeight"></a>
2889
+
2890
+ A revision and the share of an endpoint's traffic it receives.
2891
+
2892
+ #### Initializer <a name="Initializer" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevisionWeight.Initializer"></a>
2893
+
2894
+ ```typescript
2895
+ import { WebFunctionRevisionWeight } from '@ashishpandeyone/cdk-lambda-web-function'
2896
+
2897
+ const webFunctionRevisionWeight: WebFunctionRevisionWeight = { ... }
2898
+ ```
2899
+
2900
+ #### Properties <a name="Properties" id="Properties"></a>
2901
+
2902
+ | **Name** | **Type** | **Description** |
2903
+ | --- | --- | --- |
2904
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevisionWeight.property.revision">revision</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision">IWebFunctionRevision</a></code> | The revision. |
2905
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevisionWeight.property.weight">weight</a></code> | <code>number</code> | The revision's share of the endpoint's traffic, as a fraction (like `lambda.Alias` `additionalVersions`). Must be a whole percentage from 0.01 to 0.99. |
2906
+
2907
+ ---
2908
+
2909
+ ##### `revision`<sup>Required</sup> <a name="revision" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevisionWeight.property.revision"></a>
2910
+
2911
+ ```typescript
2912
+ public readonly revision: IWebFunctionRevision;
2913
+ ```
2914
+
2915
+ - *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision">IWebFunctionRevision</a>
2916
+
2917
+ The revision.
2918
+
2919
+ ---
2920
+
2921
+ ##### `weight`<sup>Required</sup> <a name="weight" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevisionWeight.property.weight"></a>
2922
+
2923
+ ```typescript
2924
+ public readonly weight: number;
2925
+ ```
2926
+
2927
+ - *Type:* number
2928
+
2929
+ The revision's share of the endpoint's traffic, as a fraction (like `lambda.Alias` `additionalVersions`). Must be a whole percentage from 0.01 to 0.99.
2930
+
2931
+ ---
2932
+
949
2933
  ## Classes <a name="Classes" id="Classes"></a>
950
2934
 
2935
+ ### WebFunctionDeployment <a name="WebFunctionDeployment" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment"></a>
2936
+
2937
+ How an endpoint moves its traffic to a new revision.
2938
+
2939
+
2940
+ #### Static Functions <a name="Static Functions" id="Static Functions"></a>
2941
+
2942
+ | **Name** | **Description** |
2943
+ | --- | --- |
2944
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment.allAtOnce">allAtOnce</a></code> | All traffic moves to the new revision at once, as soon as it's ready (the default). |
2945
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment.canary">canary</a></code> | The new revision first gets `percent` of the traffic for `bake`, then all of it. |
2946
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment.linear">linear</a></code> | The new revision gets `percent` more of the traffic every `interval` until it has all of it. |
2947
+
2948
+ ---
2949
+
2950
+ ##### `allAtOnce` <a name="allAtOnce" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment.allAtOnce"></a>
2951
+
2952
+ ```typescript
2953
+ import { WebFunctionDeployment } from '@ashishpandeyone/cdk-lambda-web-function'
2954
+
2955
+ WebFunctionDeployment.allAtOnce()
2956
+ ```
2957
+
2958
+ All traffic moves to the new revision at once, as soon as it's ready (the default).
2959
+
2960
+ ##### `canary` <a name="canary" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment.canary"></a>
2961
+
2962
+ ```typescript
2963
+ import { WebFunctionDeployment } from '@ashishpandeyone/cdk-lambda-web-function'
2964
+
2965
+ WebFunctionDeployment.canary(options: WebFunctionCanaryDeploymentOptions)
2966
+ ```
2967
+
2968
+ The new revision first gets `percent` of the traffic for `bake`, then all of it.
2969
+
2970
+ ###### `options`<sup>Required</sup> <a name="options" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment.canary.parameter.options"></a>
2971
+
2972
+ - *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionCanaryDeploymentOptions">WebFunctionCanaryDeploymentOptions</a>
2973
+
2974
+ ---
2975
+
2976
+ ##### `linear` <a name="linear" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment.linear"></a>
2977
+
2978
+ ```typescript
2979
+ import { WebFunctionDeployment } from '@ashishpandeyone/cdk-lambda-web-function'
2980
+
2981
+ WebFunctionDeployment.linear(options: WebFunctionLinearDeploymentOptions)
2982
+ ```
2983
+
2984
+ The new revision gets `percent` more of the traffic every `interval` until it has all of it.
2985
+
2986
+ ###### `options`<sup>Required</sup> <a name="options" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment.linear.parameter.options"></a>
2987
+
2988
+ - *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionLinearDeploymentOptions">WebFunctionLinearDeploymentOptions</a>
2989
+
2990
+ ---
2991
+
2992
+
2993
+
951
2994
  ### WebFunctionGrants <a name="WebFunctionGrants" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionGrants"></a>
952
2995
 
953
- Grants on a Web Function.
2996
+ Grants on a Web Function endpoint.
954
2997
 
955
- Access it as `fn.grants`.
2998
+ Access them as `fn.grants` (the default endpoint) or `endpoint.grants`.
956
2999
 
957
3000
  #### Methods <a name="Methods" id="Methods"></a>
958
3001
 
959
3002
  | **Name** | **Description** |
960
3003
  | --- | --- |
961
- | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionGrants.invoke">invoke</a></code> | Allows `grantee` to call the function's endpoint (`lambda:InvokeWebFunctionEndpoint`). |
3004
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionGrants.invoke">invoke</a></code> | Allows `grantee` to call the endpoint (`lambda:InvokeWebFunctionEndpoint`). |
962
3005
 
963
3006
  ---
964
3007
 
@@ -968,7 +3011,7 @@ Access it as `fn.grants`.
968
3011
  public invoke(grantee: IGrantable): Grant
969
3012
  ```
970
3013
 
971
- Allows `grantee` to call the function's endpoint (`lambda:InvokeWebFunctionEndpoint`).
3014
+ Allows `grantee` to call the endpoint (`lambda:InvokeWebFunctionEndpoint`).
972
3015
 
973
3016
  The grant is on the endpoint's home-region ARN, which IAM evaluates for every region the
974
3017
  endpoint serves from, including a MULTI_REGION global URL.
@@ -988,7 +3031,7 @@ endpoint serves from, including a MULTI_REGION global URL.
988
3031
 
989
3032
  - *Extends:* aws-cdk-lib.IResource, aws-cdk-lib.interfaces.aws_lambda.IWebFunctionRef
990
3033
 
991
- - *Implemented By:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction">WebFunction</a>, <a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunction">IWebFunction</a>
3034
+ - *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
3035
 
993
3036
  A Lambda Web Function.
994
3037
 
@@ -1086,6 +3129,74 @@ The function's name.
1086
3129
 
1087
3130
  ---
1088
3131
 
3132
+ ### IWebFunctionRevision <a name="IWebFunctionRevision" id="@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision"></a>
3133
+
3134
+ - *Extends:* constructs.IConstruct
3135
+
3136
+ - *Implemented By:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevision">WebFunctionRevision</a>, <a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision">IWebFunctionRevision</a>
3137
+
3138
+ A revision of a Web Function: an immutable snapshot of its code and configuration.
3139
+
3140
+
3141
+ #### Properties <a name="Properties" id="Properties"></a>
3142
+
3143
+ | **Name** | **Type** | **Description** |
3144
+ | --- | --- | --- |
3145
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. |
3146
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision.property.revisionArn">revisionArn</a></code> | <code>string</code> | The revision's ARN. |
3147
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision.property.revisionId">revisionId</a></code> | <code>string</code> | The revision's ID, e.g. `rev-a1b2c`. |
3148
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision.property.webFunction">webFunction</a></code> | <code>aws-cdk-lib.interfaces.aws_lambda.IWebFunctionRef</code> | The function the revision belongs to. |
3149
+
3150
+ ---
3151
+
3152
+ ##### `node`<sup>Required</sup> <a name="node" id="@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision.property.node"></a>
3153
+
3154
+ ```typescript
3155
+ public readonly node: Node;
3156
+ ```
3157
+
3158
+ - *Type:* constructs.Node
3159
+
3160
+ The tree node.
3161
+
3162
+ ---
3163
+
3164
+ ##### `revisionArn`<sup>Required</sup> <a name="revisionArn" id="@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision.property.revisionArn"></a>
3165
+
3166
+ ```typescript
3167
+ public readonly revisionArn: string;
3168
+ ```
3169
+
3170
+ - *Type:* string
3171
+
3172
+ The revision's ARN.
3173
+
3174
+ ---
3175
+
3176
+ ##### `revisionId`<sup>Required</sup> <a name="revisionId" id="@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision.property.revisionId"></a>
3177
+
3178
+ ```typescript
3179
+ public readonly revisionId: string;
3180
+ ```
3181
+
3182
+ - *Type:* string
3183
+
3184
+ The revision's ID, e.g. `rev-a1b2c`.
3185
+
3186
+ ---
3187
+
3188
+ ##### `webFunction`<sup>Required</sup> <a name="webFunction" id="@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision.property.webFunction"></a>
3189
+
3190
+ ```typescript
3191
+ public readonly webFunction: IWebFunctionRef;
3192
+ ```
3193
+
3194
+ - *Type:* aws-cdk-lib.interfaces.aws_lambda.IWebFunctionRef
3195
+
3196
+ The function the revision belongs to.
3197
+
3198
+ ---
3199
+
1089
3200
  ## Enums <a name="Enums" id="Enums"></a>
1090
3201
 
1091
3202
  ### WebFunctionAuthType <a name="WebFunctionAuthType" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType"></a>