@ashishpandeyone/cdk-lambda-web-function 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.jsii +1250 -185
- package/.jsii.tabl.json +1 -1
- package/API.md +1406 -131
- package/README.md +70 -8
- package/assets/web-function-provider/index.js +26 -26
- package/lib/nodejs-web-function.js +1 -1
- package/lib/private/code-bucket.d.ts +3 -0
- package/lib/private/code-bucket.js +18 -2
- package/lib/private/metrics.d.ts +23 -0
- package/lib/private/metrics.js +49 -0
- package/lib/private/provider-protocol.d.ts +30 -0
- package/lib/private/provider-protocol.js +13 -2
- package/lib/private/provider.d.ts +4 -3
- package/lib/private/provider.js +36 -5
- package/lib/private/regional-alarm.d.ts +23 -0
- package/lib/private/regional-alarm.js +40 -0
- package/lib/private/rollback.d.ts +9 -0
- package/lib/private/rollback.js +3 -0
- package/lib/private/traffic-shift.d.ts +2 -0
- package/lib/private/traffic-shift.js +3 -2
- package/lib/web-function-deployment.d.ts +64 -0
- package/lib/web-function-deployment.js +41 -6
- package/lib/web-function-endpoint.d.ts +46 -0
- package/lib/web-function-endpoint.js +155 -2
- package/lib/web-function-grants.d.ts +7 -1
- package/lib/web-function-grants.js +15 -7
- package/lib/web-function-revision.js +1 -1
- package/lib/web-function.d.ts +105 -5
- package/lib/web-function.js +126 -9
- package/package.json +2 -3
package/API.md
CHANGED
|
@@ -51,10 +51,16 @@ new NodejsWebFunction(scope: Construct, id: string, props: NodejsWebFunctionProp
|
|
|
51
51
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.with">with</a></code> | Applies one or more mixins to this construct. |
|
|
52
52
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.applyCrossStackReferenceStrength">applyCrossStackReferenceStrength</a></code> | Override the cross-stack reference strength for this resource. |
|
|
53
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.grantInvoke">grantInvoke</a></code> | Allows `grantee` to call the endpoint. |
|
|
55
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.metric">metric</a></code> | A metric of this function's execution environments in `AWS/Lambda/Web` (dimension `FunctionName`), across all endpoints. |
|
|
56
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.metricActiveTime">metricActiveTime</a></code> | Time the execution environments were active (`EnvironmentActiveTime`). |
|
|
57
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.metricConcurrentRequests">metricConcurrentRequests</a></code> | Requests an execution environment handled at once (`EnvironmentConcurrentRequests`), to compare with `maxConcurrencyPerEnvironment`. |
|
|
58
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.metricCpuTime">metricCpuTime</a></code> | CPU time the execution environments used (`EnvironmentCPUTime`). |
|
|
59
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.metricMaxMemoryUsage">metricMaxMemoryUsage</a></code> | Peak memory an execution environment used (`EnvironmentMaxMemoryUsage`); |
|
|
60
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.metricResponseBytes">metricResponseBytes</a></code> | Bytes sent in responses (`ResponseBytes`). |
|
|
54
61
|
| <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
62
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addEnvironment">addEnvironment</a></code> | Adds an environment variable. |
|
|
56
63
|
| <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. |
|
|
58
64
|
|
|
59
65
|
---
|
|
60
66
|
|
|
@@ -129,6 +135,120 @@ account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
|
|
|
129
135
|
|
|
130
136
|
---
|
|
131
137
|
|
|
138
|
+
##### `grantInvoke` <a name="grantInvoke" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.grantInvoke"></a>
|
|
139
|
+
|
|
140
|
+
```typescript
|
|
141
|
+
public grantInvoke(grantee: IGrantable): Grant
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Allows `grantee` to call the endpoint.
|
|
145
|
+
|
|
146
|
+
Shortcut for `grants.invoke(grantee)`, as on `lambda.Function`.
|
|
147
|
+
[disable-awslint:no-grants]
|
|
148
|
+
|
|
149
|
+
###### `grantee`<sup>Required</sup> <a name="grantee" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.grantInvoke.parameter.grantee"></a>
|
|
150
|
+
|
|
151
|
+
- *Type:* aws-cdk-lib.aws_iam.IGrantable
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
##### `metric` <a name="metric" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.metric"></a>
|
|
156
|
+
|
|
157
|
+
```typescript
|
|
158
|
+
public metric(metricName: string, props?: MetricOptions): Metric
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
A metric of this function's execution environments in `AWS/Lambda/Web` (dimension `FunctionName`), across all endpoints.
|
|
162
|
+
|
|
163
|
+
For request and error counts, use the endpoint's metrics (`fn.endpoint.metricRequests()`).
|
|
164
|
+
|
|
165
|
+
Metrics are published in the region that served the request: pass `region` for another serving region.
|
|
166
|
+
An alarm can only use metrics from its own stack's region.
|
|
167
|
+
|
|
168
|
+
###### `metricName`<sup>Required</sup> <a name="metricName" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.metric.parameter.metricName"></a>
|
|
169
|
+
|
|
170
|
+
- *Type:* string
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
###### `props`<sup>Optional</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.metric.parameter.props"></a>
|
|
175
|
+
|
|
176
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
##### `metricActiveTime` <a name="metricActiveTime" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.metricActiveTime"></a>
|
|
181
|
+
|
|
182
|
+
```typescript
|
|
183
|
+
public metricActiveTime(props?: MetricOptions): Metric
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Time the execution environments were active (`EnvironmentActiveTime`).
|
|
187
|
+
|
|
188
|
+
###### `props`<sup>Optional</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.metricActiveTime.parameter.props"></a>
|
|
189
|
+
|
|
190
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
##### `metricConcurrentRequests` <a name="metricConcurrentRequests" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.metricConcurrentRequests"></a>
|
|
195
|
+
|
|
196
|
+
```typescript
|
|
197
|
+
public metricConcurrentRequests(props?: MetricOptions): Metric
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
Requests an execution environment handled at once (`EnvironmentConcurrentRequests`), to compare with `maxConcurrencyPerEnvironment`.
|
|
201
|
+
|
|
202
|
+
###### `props`<sup>Optional</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.metricConcurrentRequests.parameter.props"></a>
|
|
203
|
+
|
|
204
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
##### `metricCpuTime` <a name="metricCpuTime" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.metricCpuTime"></a>
|
|
209
|
+
|
|
210
|
+
```typescript
|
|
211
|
+
public metricCpuTime(props?: MetricOptions): Metric
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
CPU time the execution environments used (`EnvironmentCPUTime`).
|
|
215
|
+
|
|
216
|
+
###### `props`<sup>Optional</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.metricCpuTime.parameter.props"></a>
|
|
217
|
+
|
|
218
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
##### `metricMaxMemoryUsage` <a name="metricMaxMemoryUsage" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.metricMaxMemoryUsage"></a>
|
|
223
|
+
|
|
224
|
+
```typescript
|
|
225
|
+
public metricMaxMemoryUsage(props?: MetricOptions): Metric
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
Peak memory an execution environment used (`EnvironmentMaxMemoryUsage`);
|
|
229
|
+
|
|
230
|
+
each environment has 2 GB.
|
|
231
|
+
|
|
232
|
+
###### `props`<sup>Optional</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.metricMaxMemoryUsage.parameter.props"></a>
|
|
233
|
+
|
|
234
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
##### `metricResponseBytes` <a name="metricResponseBytes" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.metricResponseBytes"></a>
|
|
239
|
+
|
|
240
|
+
```typescript
|
|
241
|
+
public metricResponseBytes(props?: MetricOptions): Metric
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
Bytes sent in responses (`ResponseBytes`).
|
|
245
|
+
|
|
246
|
+
###### `props`<sup>Optional</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.metricResponseBytes.parameter.props"></a>
|
|
247
|
+
|
|
248
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
132
252
|
##### `addEndpoint` <a name="addEndpoint" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addEndpoint"></a>
|
|
133
253
|
|
|
134
254
|
```typescript
|
|
@@ -187,23 +307,6 @@ Adds a statement to the execution role's policy.
|
|
|
187
307
|
|
|
188
308
|
---
|
|
189
309
|
|
|
190
|
-
##### `grantInvoke` <a name="grantInvoke" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.grantInvoke"></a>
|
|
191
|
-
|
|
192
|
-
```typescript
|
|
193
|
-
public grantInvoke(grantee: IGrantable): Grant
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
Allows `grantee` to call the endpoint.
|
|
197
|
-
|
|
198
|
-
Shortcut for `grants.invoke(grantee)`, as on `lambda.Function`.
|
|
199
|
-
[disable-awslint:no-grants]
|
|
200
|
-
|
|
201
|
-
###### `grantee`<sup>Required</sup> <a name="grantee" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.grantInvoke.parameter.grantee"></a>
|
|
202
|
-
|
|
203
|
-
- *Type:* aws-cdk-lib.aws_iam.IGrantable
|
|
204
|
-
|
|
205
|
-
---
|
|
206
|
-
|
|
207
310
|
#### Static Functions <a name="Static Functions" id="Static Functions"></a>
|
|
208
311
|
|
|
209
312
|
| **Name** | **Description** |
|
|
@@ -211,6 +314,9 @@ Shortcut for `grants.invoke(grantee)`, as on `lambda.Function`.
|
|
|
211
314
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.isConstruct">isConstruct</a></code> | Checks if `x` is a construct. |
|
|
212
315
|
| <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
316
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.isResource">isResource</a></code> | Check whether the given construct is a Resource. |
|
|
317
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.fromWebFunctionArn">fromWebFunctionArn</a></code> | Imports an existing Web Function by its ARN (in any region or account). |
|
|
318
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.fromWebFunctionAttributes">fromWebFunctionAttributes</a></code> | Imports an existing Web Function: give its ARN or its name, and optionally the endpoint `grantInvoke` allows. |
|
|
319
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.fromWebFunctionName">fromWebFunctionName</a></code> | Imports an existing Web Function in this stack's account and region by its name. |
|
|
214
320
|
|
|
215
321
|
---
|
|
216
322
|
|
|
@@ -278,6 +384,90 @@ Check whether the given construct is a Resource.
|
|
|
278
384
|
|
|
279
385
|
---
|
|
280
386
|
|
|
387
|
+
##### `fromWebFunctionArn` <a name="fromWebFunctionArn" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.fromWebFunctionArn"></a>
|
|
388
|
+
|
|
389
|
+
```typescript
|
|
390
|
+
import { NodejsWebFunction } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
391
|
+
|
|
392
|
+
NodejsWebFunction.fromWebFunctionArn(scope: Construct, id: string, webFunctionArn: string)
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
Imports an existing Web Function by its ARN (in any region or account).
|
|
396
|
+
|
|
397
|
+
###### `scope`<sup>Required</sup> <a name="scope" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.fromWebFunctionArn.parameter.scope"></a>
|
|
398
|
+
|
|
399
|
+
- *Type:* constructs.Construct
|
|
400
|
+
|
|
401
|
+
---
|
|
402
|
+
|
|
403
|
+
###### `id`<sup>Required</sup> <a name="id" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.fromWebFunctionArn.parameter.id"></a>
|
|
404
|
+
|
|
405
|
+
- *Type:* string
|
|
406
|
+
|
|
407
|
+
---
|
|
408
|
+
|
|
409
|
+
###### `webFunctionArn`<sup>Required</sup> <a name="webFunctionArn" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.fromWebFunctionArn.parameter.webFunctionArn"></a>
|
|
410
|
+
|
|
411
|
+
- *Type:* string
|
|
412
|
+
|
|
413
|
+
---
|
|
414
|
+
|
|
415
|
+
##### `fromWebFunctionAttributes` <a name="fromWebFunctionAttributes" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.fromWebFunctionAttributes"></a>
|
|
416
|
+
|
|
417
|
+
```typescript
|
|
418
|
+
import { NodejsWebFunction } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
419
|
+
|
|
420
|
+
NodejsWebFunction.fromWebFunctionAttributes(scope: Construct, id: string, attrs: WebFunctionAttributes)
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
Imports an existing Web Function: give its ARN or its name, and optionally the endpoint `grantInvoke` allows.
|
|
424
|
+
|
|
425
|
+
###### `scope`<sup>Required</sup> <a name="scope" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.fromWebFunctionAttributes.parameter.scope"></a>
|
|
426
|
+
|
|
427
|
+
- *Type:* constructs.Construct
|
|
428
|
+
|
|
429
|
+
---
|
|
430
|
+
|
|
431
|
+
###### `id`<sup>Required</sup> <a name="id" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.fromWebFunctionAttributes.parameter.id"></a>
|
|
432
|
+
|
|
433
|
+
- *Type:* string
|
|
434
|
+
|
|
435
|
+
---
|
|
436
|
+
|
|
437
|
+
###### `attrs`<sup>Required</sup> <a name="attrs" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.fromWebFunctionAttributes.parameter.attrs"></a>
|
|
438
|
+
|
|
439
|
+
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionAttributes">WebFunctionAttributes</a>
|
|
440
|
+
|
|
441
|
+
---
|
|
442
|
+
|
|
443
|
+
##### `fromWebFunctionName` <a name="fromWebFunctionName" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.fromWebFunctionName"></a>
|
|
444
|
+
|
|
445
|
+
```typescript
|
|
446
|
+
import { NodejsWebFunction } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
447
|
+
|
|
448
|
+
NodejsWebFunction.fromWebFunctionName(scope: Construct, id: string, webFunctionName: string)
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
Imports an existing Web Function in this stack's account and region by its name.
|
|
452
|
+
|
|
453
|
+
###### `scope`<sup>Required</sup> <a name="scope" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.fromWebFunctionName.parameter.scope"></a>
|
|
454
|
+
|
|
455
|
+
- *Type:* constructs.Construct
|
|
456
|
+
|
|
457
|
+
---
|
|
458
|
+
|
|
459
|
+
###### `id`<sup>Required</sup> <a name="id" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.fromWebFunctionName.parameter.id"></a>
|
|
460
|
+
|
|
461
|
+
- *Type:* string
|
|
462
|
+
|
|
463
|
+
---
|
|
464
|
+
|
|
465
|
+
###### `webFunctionName`<sup>Required</sup> <a name="webFunctionName" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.fromWebFunctionName.parameter.webFunctionName"></a>
|
|
466
|
+
|
|
467
|
+
- *Type:* string
|
|
468
|
+
|
|
469
|
+
---
|
|
470
|
+
|
|
281
471
|
#### Properties <a name="Properties" id="Properties"></a>
|
|
282
472
|
|
|
283
473
|
| **Name** | **Type** | **Description** |
|
|
@@ -285,6 +475,9 @@ Check whether the given construct is a Resource.
|
|
|
285
475
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. |
|
|
286
476
|
| <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
477
|
| <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. |
|
|
478
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.webFunctionArn">webFunctionArn</a></code> | <code>string</code> | The function's ARN. |
|
|
479
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.webFunctionName">webFunctionName</a></code> | <code>string</code> | The function's name. |
|
|
480
|
+
| <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`. |
|
|
288
481
|
| <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
482
|
| <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
483
|
| <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). |
|
|
@@ -292,9 +485,6 @@ Check whether the given construct is a Resource.
|
|
|
292
485
|
| <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
486
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.revisionId">revisionId</a></code> | <code>string</code> | The ID of the current revision. |
|
|
294
487
|
| <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`. |
|
|
298
488
|
|
|
299
489
|
---
|
|
300
490
|
|
|
@@ -342,6 +532,42 @@ The stack in which this resource is defined.
|
|
|
342
532
|
|
|
343
533
|
---
|
|
344
534
|
|
|
535
|
+
##### `webFunctionArn`<sup>Required</sup> <a name="webFunctionArn" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.webFunctionArn"></a>
|
|
536
|
+
|
|
537
|
+
```typescript
|
|
538
|
+
public readonly webFunctionArn: string;
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
- *Type:* string
|
|
542
|
+
|
|
543
|
+
The function's ARN.
|
|
544
|
+
|
|
545
|
+
---
|
|
546
|
+
|
|
547
|
+
##### `webFunctionName`<sup>Required</sup> <a name="webFunctionName" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.webFunctionName"></a>
|
|
548
|
+
|
|
549
|
+
```typescript
|
|
550
|
+
public readonly webFunctionName: string;
|
|
551
|
+
```
|
|
552
|
+
|
|
553
|
+
- *Type:* string
|
|
554
|
+
|
|
555
|
+
The function's name.
|
|
556
|
+
|
|
557
|
+
---
|
|
558
|
+
|
|
559
|
+
##### `webFunctionRef`<sup>Required</sup> <a name="webFunctionRef" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.webFunctionRef"></a>
|
|
560
|
+
|
|
561
|
+
```typescript
|
|
562
|
+
public readonly webFunctionRef: WebFunctionReference;
|
|
563
|
+
```
|
|
564
|
+
|
|
565
|
+
- *Type:* aws-cdk-lib.interfaces.aws_lambda.WebFunctionReference
|
|
566
|
+
|
|
567
|
+
A reference to this function, for APIs that accept `lambda.IWebFunctionRef`.
|
|
568
|
+
|
|
569
|
+
---
|
|
570
|
+
|
|
345
571
|
##### `currentRevision`<sup>Required</sup> <a name="currentRevision" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.currentRevision"></a>
|
|
346
572
|
|
|
347
573
|
```typescript
|
|
@@ -432,46 +658,10 @@ The execution role.
|
|
|
432
658
|
|
|
433
659
|
---
|
|
434
660
|
|
|
435
|
-
##### `webFunctionArn`<sup>Required</sup> <a name="webFunctionArn" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.webFunctionArn"></a>
|
|
436
|
-
|
|
437
|
-
```typescript
|
|
438
|
-
public readonly webFunctionArn: string;
|
|
439
|
-
```
|
|
440
|
-
|
|
441
|
-
- *Type:* string
|
|
442
|
-
|
|
443
|
-
The function's ARN.
|
|
444
|
-
|
|
445
|
-
---
|
|
446
|
-
|
|
447
|
-
##### `webFunctionName`<sup>Required</sup> <a name="webFunctionName" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.webFunctionName"></a>
|
|
448
|
-
|
|
449
|
-
```typescript
|
|
450
|
-
public readonly webFunctionName: string;
|
|
451
|
-
```
|
|
452
|
-
|
|
453
|
-
- *Type:* string
|
|
454
|
-
|
|
455
|
-
The function's name.
|
|
456
|
-
|
|
457
|
-
---
|
|
458
|
-
|
|
459
|
-
##### `webFunctionRef`<sup>Required</sup> <a name="webFunctionRef" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.webFunctionRef"></a>
|
|
460
|
-
|
|
461
|
-
```typescript
|
|
462
|
-
public readonly webFunctionRef: WebFunctionReference;
|
|
463
|
-
```
|
|
464
|
-
|
|
465
|
-
- *Type:* aws-cdk-lib.interfaces.aws_lambda.WebFunctionReference
|
|
466
|
-
|
|
467
|
-
A reference to this function, for APIs that accept `lambda.IWebFunctionRef`.
|
|
468
|
-
|
|
469
|
-
---
|
|
470
|
-
|
|
471
661
|
|
|
472
662
|
### WebFunction <a name="WebFunction" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction"></a>
|
|
473
663
|
|
|
474
|
-
- *Implements:*
|
|
664
|
+
- *Implements:* aws-cdk-lib.aws_iam.IGrantable
|
|
475
665
|
|
|
476
666
|
A Node.js HTTP server running as an AWS Lambda Web Function, served from one or more regions.
|
|
477
667
|
|
|
@@ -479,7 +669,7 @@ Creates the function, its current revision (code and configuration; any change c
|
|
|
479
669
|
and the newest `revisionRetention` are kept), a default HTTPS endpoint, an execution role, and owns
|
|
480
670
|
the function's log groups in every region its endpoints serve from.
|
|
481
671
|
|
|
482
|
-
|
|
672
|
+
Use `fromWebFunctionArn`, `fromWebFunctionName` or `fromWebFunctionAttributes` for a function defined elsewhere.
|
|
483
673
|
|
|
484
674
|
#### Initializers <a name="Initializers" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.Initializer"></a>
|
|
485
675
|
|
|
@@ -523,10 +713,16 @@ new WebFunction(scope: Construct, id: string, props: WebFunctionProps)
|
|
|
523
713
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.with">with</a></code> | Applies one or more mixins to this construct. |
|
|
524
714
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.applyCrossStackReferenceStrength">applyCrossStackReferenceStrength</a></code> | Override the cross-stack reference strength for this resource. |
|
|
525
715
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.applyRemovalPolicy">applyRemovalPolicy</a></code> | Apply the given removal policy to this resource. |
|
|
716
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.grantInvoke">grantInvoke</a></code> | Allows `grantee` to call the endpoint. |
|
|
717
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.metric">metric</a></code> | A metric of this function's execution environments in `AWS/Lambda/Web` (dimension `FunctionName`), across all endpoints. |
|
|
718
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.metricActiveTime">metricActiveTime</a></code> | Time the execution environments were active (`EnvironmentActiveTime`). |
|
|
719
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.metricConcurrentRequests">metricConcurrentRequests</a></code> | Requests an execution environment handled at once (`EnvironmentConcurrentRequests`), to compare with `maxConcurrencyPerEnvironment`. |
|
|
720
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.metricCpuTime">metricCpuTime</a></code> | CPU time the execution environments used (`EnvironmentCPUTime`). |
|
|
721
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.metricMaxMemoryUsage">metricMaxMemoryUsage</a></code> | Peak memory an execution environment used (`EnvironmentMaxMemoryUsage`); |
|
|
722
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.metricResponseBytes">metricResponseBytes</a></code> | Bytes sent in responses (`ResponseBytes`). |
|
|
526
723
|
| <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
724
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEnvironment">addEnvironment</a></code> | Adds an environment variable. |
|
|
528
725
|
| <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. |
|
|
530
726
|
|
|
531
727
|
---
|
|
532
728
|
|
|
@@ -601,19 +797,133 @@ account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
|
|
|
601
797
|
|
|
602
798
|
---
|
|
603
799
|
|
|
604
|
-
##### `
|
|
800
|
+
##### `grantInvoke` <a name="grantInvoke" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.grantInvoke"></a>
|
|
605
801
|
|
|
606
802
|
```typescript
|
|
607
|
-
public
|
|
803
|
+
public grantInvoke(grantee: IGrantable): Grant
|
|
608
804
|
```
|
|
609
805
|
|
|
610
|
-
|
|
806
|
+
Allows `grantee` to call the endpoint.
|
|
611
807
|
|
|
612
|
-
|
|
808
|
+
Shortcut for `grants.invoke(grantee)`, as on `lambda.Function`.
|
|
809
|
+
[disable-awslint:no-grants]
|
|
613
810
|
|
|
614
|
-
|
|
811
|
+
###### `grantee`<sup>Required</sup> <a name="grantee" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.grantInvoke.parameter.grantee"></a>
|
|
615
812
|
|
|
616
|
-
|
|
813
|
+
- *Type:* aws-cdk-lib.aws_iam.IGrantable
|
|
814
|
+
|
|
815
|
+
---
|
|
816
|
+
|
|
817
|
+
##### `metric` <a name="metric" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.metric"></a>
|
|
818
|
+
|
|
819
|
+
```typescript
|
|
820
|
+
public metric(metricName: string, props?: MetricOptions): Metric
|
|
821
|
+
```
|
|
822
|
+
|
|
823
|
+
A metric of this function's execution environments in `AWS/Lambda/Web` (dimension `FunctionName`), across all endpoints.
|
|
824
|
+
|
|
825
|
+
For request and error counts, use the endpoint's metrics (`fn.endpoint.metricRequests()`).
|
|
826
|
+
|
|
827
|
+
Metrics are published in the region that served the request: pass `region` for another serving region.
|
|
828
|
+
An alarm can only use metrics from its own stack's region.
|
|
829
|
+
|
|
830
|
+
###### `metricName`<sup>Required</sup> <a name="metricName" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.metric.parameter.metricName"></a>
|
|
831
|
+
|
|
832
|
+
- *Type:* string
|
|
833
|
+
|
|
834
|
+
---
|
|
835
|
+
|
|
836
|
+
###### `props`<sup>Optional</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.metric.parameter.props"></a>
|
|
837
|
+
|
|
838
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
|
|
839
|
+
|
|
840
|
+
---
|
|
841
|
+
|
|
842
|
+
##### `metricActiveTime` <a name="metricActiveTime" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.metricActiveTime"></a>
|
|
843
|
+
|
|
844
|
+
```typescript
|
|
845
|
+
public metricActiveTime(props?: MetricOptions): Metric
|
|
846
|
+
```
|
|
847
|
+
|
|
848
|
+
Time the execution environments were active (`EnvironmentActiveTime`).
|
|
849
|
+
|
|
850
|
+
###### `props`<sup>Optional</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.metricActiveTime.parameter.props"></a>
|
|
851
|
+
|
|
852
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
|
|
853
|
+
|
|
854
|
+
---
|
|
855
|
+
|
|
856
|
+
##### `metricConcurrentRequests` <a name="metricConcurrentRequests" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.metricConcurrentRequests"></a>
|
|
857
|
+
|
|
858
|
+
```typescript
|
|
859
|
+
public metricConcurrentRequests(props?: MetricOptions): Metric
|
|
860
|
+
```
|
|
861
|
+
|
|
862
|
+
Requests an execution environment handled at once (`EnvironmentConcurrentRequests`), to compare with `maxConcurrencyPerEnvironment`.
|
|
863
|
+
|
|
864
|
+
###### `props`<sup>Optional</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.metricConcurrentRequests.parameter.props"></a>
|
|
865
|
+
|
|
866
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
|
|
867
|
+
|
|
868
|
+
---
|
|
869
|
+
|
|
870
|
+
##### `metricCpuTime` <a name="metricCpuTime" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.metricCpuTime"></a>
|
|
871
|
+
|
|
872
|
+
```typescript
|
|
873
|
+
public metricCpuTime(props?: MetricOptions): Metric
|
|
874
|
+
```
|
|
875
|
+
|
|
876
|
+
CPU time the execution environments used (`EnvironmentCPUTime`).
|
|
877
|
+
|
|
878
|
+
###### `props`<sup>Optional</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.metricCpuTime.parameter.props"></a>
|
|
879
|
+
|
|
880
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
|
|
881
|
+
|
|
882
|
+
---
|
|
883
|
+
|
|
884
|
+
##### `metricMaxMemoryUsage` <a name="metricMaxMemoryUsage" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.metricMaxMemoryUsage"></a>
|
|
885
|
+
|
|
886
|
+
```typescript
|
|
887
|
+
public metricMaxMemoryUsage(props?: MetricOptions): Metric
|
|
888
|
+
```
|
|
889
|
+
|
|
890
|
+
Peak memory an execution environment used (`EnvironmentMaxMemoryUsage`);
|
|
891
|
+
|
|
892
|
+
each environment has 2 GB.
|
|
893
|
+
|
|
894
|
+
###### `props`<sup>Optional</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.metricMaxMemoryUsage.parameter.props"></a>
|
|
895
|
+
|
|
896
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
|
|
897
|
+
|
|
898
|
+
---
|
|
899
|
+
|
|
900
|
+
##### `metricResponseBytes` <a name="metricResponseBytes" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.metricResponseBytes"></a>
|
|
901
|
+
|
|
902
|
+
```typescript
|
|
903
|
+
public metricResponseBytes(props?: MetricOptions): Metric
|
|
904
|
+
```
|
|
905
|
+
|
|
906
|
+
Bytes sent in responses (`ResponseBytes`).
|
|
907
|
+
|
|
908
|
+
###### `props`<sup>Optional</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.metricResponseBytes.parameter.props"></a>
|
|
909
|
+
|
|
910
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
|
|
911
|
+
|
|
912
|
+
---
|
|
913
|
+
|
|
914
|
+
##### `addEndpoint` <a name="addEndpoint" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEndpoint"></a>
|
|
915
|
+
|
|
916
|
+
```typescript
|
|
917
|
+
public addEndpoint(id: string, options: AddWebFunctionEndpointOptions): WebFunctionEndpoint
|
|
918
|
+
```
|
|
919
|
+
|
|
920
|
+
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.
|
|
921
|
+
|
|
922
|
+
###### `id`<sup>Required</sup> <a name="id" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEndpoint.parameter.id"></a>
|
|
923
|
+
|
|
924
|
+
- *Type:* string
|
|
925
|
+
|
|
926
|
+
the endpoint's construct ID, also used in its generated name (`<id>-<hash>`).
|
|
617
927
|
|
|
618
928
|
---
|
|
619
929
|
|
|
@@ -659,23 +969,6 @@ Adds a statement to the execution role's policy.
|
|
|
659
969
|
|
|
660
970
|
---
|
|
661
971
|
|
|
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
972
|
#### Static Functions <a name="Static Functions" id="Static Functions"></a>
|
|
680
973
|
|
|
681
974
|
| **Name** | **Description** |
|
|
@@ -683,6 +976,9 @@ Shortcut for `grants.invoke(grantee)`, as on `lambda.Function`.
|
|
|
683
976
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.isConstruct">isConstruct</a></code> | Checks if `x` is a construct. |
|
|
684
977
|
| <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
978
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.isResource">isResource</a></code> | Check whether the given construct is a Resource. |
|
|
979
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.fromWebFunctionArn">fromWebFunctionArn</a></code> | Imports an existing Web Function by its ARN (in any region or account). |
|
|
980
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.fromWebFunctionAttributes">fromWebFunctionAttributes</a></code> | Imports an existing Web Function: give its ARN or its name, and optionally the endpoint `grantInvoke` allows. |
|
|
981
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.fromWebFunctionName">fromWebFunctionName</a></code> | Imports an existing Web Function in this stack's account and region by its name. |
|
|
686
982
|
|
|
687
983
|
---
|
|
688
984
|
|
|
@@ -750,6 +1046,90 @@ Check whether the given construct is a Resource.
|
|
|
750
1046
|
|
|
751
1047
|
---
|
|
752
1048
|
|
|
1049
|
+
##### `fromWebFunctionArn` <a name="fromWebFunctionArn" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.fromWebFunctionArn"></a>
|
|
1050
|
+
|
|
1051
|
+
```typescript
|
|
1052
|
+
import { WebFunction } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
1053
|
+
|
|
1054
|
+
WebFunction.fromWebFunctionArn(scope: Construct, id: string, webFunctionArn: string)
|
|
1055
|
+
```
|
|
1056
|
+
|
|
1057
|
+
Imports an existing Web Function by its ARN (in any region or account).
|
|
1058
|
+
|
|
1059
|
+
###### `scope`<sup>Required</sup> <a name="scope" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.fromWebFunctionArn.parameter.scope"></a>
|
|
1060
|
+
|
|
1061
|
+
- *Type:* constructs.Construct
|
|
1062
|
+
|
|
1063
|
+
---
|
|
1064
|
+
|
|
1065
|
+
###### `id`<sup>Required</sup> <a name="id" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.fromWebFunctionArn.parameter.id"></a>
|
|
1066
|
+
|
|
1067
|
+
- *Type:* string
|
|
1068
|
+
|
|
1069
|
+
---
|
|
1070
|
+
|
|
1071
|
+
###### `webFunctionArn`<sup>Required</sup> <a name="webFunctionArn" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.fromWebFunctionArn.parameter.webFunctionArn"></a>
|
|
1072
|
+
|
|
1073
|
+
- *Type:* string
|
|
1074
|
+
|
|
1075
|
+
---
|
|
1076
|
+
|
|
1077
|
+
##### `fromWebFunctionAttributes` <a name="fromWebFunctionAttributes" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.fromWebFunctionAttributes"></a>
|
|
1078
|
+
|
|
1079
|
+
```typescript
|
|
1080
|
+
import { WebFunction } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
1081
|
+
|
|
1082
|
+
WebFunction.fromWebFunctionAttributes(scope: Construct, id: string, attrs: WebFunctionAttributes)
|
|
1083
|
+
```
|
|
1084
|
+
|
|
1085
|
+
Imports an existing Web Function: give its ARN or its name, and optionally the endpoint `grantInvoke` allows.
|
|
1086
|
+
|
|
1087
|
+
###### `scope`<sup>Required</sup> <a name="scope" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.fromWebFunctionAttributes.parameter.scope"></a>
|
|
1088
|
+
|
|
1089
|
+
- *Type:* constructs.Construct
|
|
1090
|
+
|
|
1091
|
+
---
|
|
1092
|
+
|
|
1093
|
+
###### `id`<sup>Required</sup> <a name="id" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.fromWebFunctionAttributes.parameter.id"></a>
|
|
1094
|
+
|
|
1095
|
+
- *Type:* string
|
|
1096
|
+
|
|
1097
|
+
---
|
|
1098
|
+
|
|
1099
|
+
###### `attrs`<sup>Required</sup> <a name="attrs" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.fromWebFunctionAttributes.parameter.attrs"></a>
|
|
1100
|
+
|
|
1101
|
+
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionAttributes">WebFunctionAttributes</a>
|
|
1102
|
+
|
|
1103
|
+
---
|
|
1104
|
+
|
|
1105
|
+
##### `fromWebFunctionName` <a name="fromWebFunctionName" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.fromWebFunctionName"></a>
|
|
1106
|
+
|
|
1107
|
+
```typescript
|
|
1108
|
+
import { WebFunction } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
1109
|
+
|
|
1110
|
+
WebFunction.fromWebFunctionName(scope: Construct, id: string, webFunctionName: string)
|
|
1111
|
+
```
|
|
1112
|
+
|
|
1113
|
+
Imports an existing Web Function in this stack's account and region by its name.
|
|
1114
|
+
|
|
1115
|
+
###### `scope`<sup>Required</sup> <a name="scope" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.fromWebFunctionName.parameter.scope"></a>
|
|
1116
|
+
|
|
1117
|
+
- *Type:* constructs.Construct
|
|
1118
|
+
|
|
1119
|
+
---
|
|
1120
|
+
|
|
1121
|
+
###### `id`<sup>Required</sup> <a name="id" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.fromWebFunctionName.parameter.id"></a>
|
|
1122
|
+
|
|
1123
|
+
- *Type:* string
|
|
1124
|
+
|
|
1125
|
+
---
|
|
1126
|
+
|
|
1127
|
+
###### `webFunctionName`<sup>Required</sup> <a name="webFunctionName" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.fromWebFunctionName.parameter.webFunctionName"></a>
|
|
1128
|
+
|
|
1129
|
+
- *Type:* string
|
|
1130
|
+
|
|
1131
|
+
---
|
|
1132
|
+
|
|
753
1133
|
#### Properties <a name="Properties" id="Properties"></a>
|
|
754
1134
|
|
|
755
1135
|
| **Name** | **Type** | **Description** |
|
|
@@ -757,6 +1137,9 @@ Check whether the given construct is a Resource.
|
|
|
757
1137
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. |
|
|
758
1138
|
| <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
1139
|
| <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. |
|
|
1140
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.webFunctionArn">webFunctionArn</a></code> | <code>string</code> | The function's ARN. |
|
|
1141
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.webFunctionName">webFunctionName</a></code> | <code>string</code> | The function's name. |
|
|
1142
|
+
| <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`. |
|
|
760
1143
|
| <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
1144
|
| <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
1145
|
| <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). |
|
|
@@ -764,9 +1147,6 @@ Check whether the given construct is a Resource.
|
|
|
764
1147
|
| <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
1148
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.revisionId">revisionId</a></code> | <code>string</code> | The ID of the current revision. |
|
|
766
1149
|
| <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
1150
|
|
|
771
1151
|
---
|
|
772
1152
|
|
|
@@ -814,6 +1194,42 @@ The stack in which this resource is defined.
|
|
|
814
1194
|
|
|
815
1195
|
---
|
|
816
1196
|
|
|
1197
|
+
##### `webFunctionArn`<sup>Required</sup> <a name="webFunctionArn" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.webFunctionArn"></a>
|
|
1198
|
+
|
|
1199
|
+
```typescript
|
|
1200
|
+
public readonly webFunctionArn: string;
|
|
1201
|
+
```
|
|
1202
|
+
|
|
1203
|
+
- *Type:* string
|
|
1204
|
+
|
|
1205
|
+
The function's ARN.
|
|
1206
|
+
|
|
1207
|
+
---
|
|
1208
|
+
|
|
1209
|
+
##### `webFunctionName`<sup>Required</sup> <a name="webFunctionName" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.webFunctionName"></a>
|
|
1210
|
+
|
|
1211
|
+
```typescript
|
|
1212
|
+
public readonly webFunctionName: string;
|
|
1213
|
+
```
|
|
1214
|
+
|
|
1215
|
+
- *Type:* string
|
|
1216
|
+
|
|
1217
|
+
The function's name.
|
|
1218
|
+
|
|
1219
|
+
---
|
|
1220
|
+
|
|
1221
|
+
##### `webFunctionRef`<sup>Required</sup> <a name="webFunctionRef" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.webFunctionRef"></a>
|
|
1222
|
+
|
|
1223
|
+
```typescript
|
|
1224
|
+
public readonly webFunctionRef: WebFunctionReference;
|
|
1225
|
+
```
|
|
1226
|
+
|
|
1227
|
+
- *Type:* aws-cdk-lib.interfaces.aws_lambda.WebFunctionReference
|
|
1228
|
+
|
|
1229
|
+
A reference to this function, for APIs that accept `lambda.IWebFunctionRef`.
|
|
1230
|
+
|
|
1231
|
+
---
|
|
1232
|
+
|
|
817
1233
|
##### `currentRevision`<sup>Required</sup> <a name="currentRevision" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.currentRevision"></a>
|
|
818
1234
|
|
|
819
1235
|
```typescript
|
|
@@ -904,104 +1320,633 @@ The execution role.
|
|
|
904
1320
|
|
|
905
1321
|
---
|
|
906
1322
|
|
|
907
|
-
|
|
1323
|
+
|
|
1324
|
+
### WebFunctionBase <a name="WebFunctionBase" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase"></a>
|
|
1325
|
+
|
|
1326
|
+
- *Implements:* <a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunction">IWebFunction</a>
|
|
1327
|
+
|
|
1328
|
+
What `WebFunction` and imported functions have in common.
|
|
1329
|
+
|
|
1330
|
+
#### Initializers <a name="Initializers" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.Initializer"></a>
|
|
908
1331
|
|
|
909
1332
|
```typescript
|
|
910
|
-
|
|
1333
|
+
import { WebFunctionBase } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
1334
|
+
|
|
1335
|
+
new WebFunctionBase(scope: Construct, id: string, props?: ResourceProps)
|
|
911
1336
|
```
|
|
912
1337
|
|
|
1338
|
+
| **Name** | **Type** | **Description** |
|
|
1339
|
+
| --- | --- | --- |
|
|
1340
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.Initializer.parameter.scope">scope</a></code> | <code>constructs.Construct</code> | *No description.* |
|
|
1341
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.Initializer.parameter.id">id</a></code> | <code>string</code> | *No description.* |
|
|
1342
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.Initializer.parameter.props">props</a></code> | <code>aws-cdk-lib.ResourceProps</code> | *No description.* |
|
|
1343
|
+
|
|
1344
|
+
---
|
|
1345
|
+
|
|
1346
|
+
##### `scope`<sup>Required</sup> <a name="scope" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.Initializer.parameter.scope"></a>
|
|
1347
|
+
|
|
1348
|
+
- *Type:* constructs.Construct
|
|
1349
|
+
|
|
1350
|
+
---
|
|
1351
|
+
|
|
1352
|
+
##### `id`<sup>Required</sup> <a name="id" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.Initializer.parameter.id"></a>
|
|
1353
|
+
|
|
913
1354
|
- *Type:* string
|
|
914
1355
|
|
|
915
|
-
|
|
1356
|
+
---
|
|
1357
|
+
|
|
1358
|
+
##### `props`<sup>Optional</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.Initializer.parameter.props"></a>
|
|
1359
|
+
|
|
1360
|
+
- *Type:* aws-cdk-lib.ResourceProps
|
|
916
1361
|
|
|
917
1362
|
---
|
|
918
1363
|
|
|
919
|
-
|
|
1364
|
+
#### Methods <a name="Methods" id="Methods"></a>
|
|
1365
|
+
|
|
1366
|
+
| **Name** | **Description** |
|
|
1367
|
+
| --- | --- |
|
|
1368
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.toString">toString</a></code> | Returns a string representation of this construct. |
|
|
1369
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.with">with</a></code> | Applies one or more mixins to this construct. |
|
|
1370
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.applyCrossStackReferenceStrength">applyCrossStackReferenceStrength</a></code> | Override the cross-stack reference strength for this resource. |
|
|
1371
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.applyRemovalPolicy">applyRemovalPolicy</a></code> | Apply the given removal policy to this resource. |
|
|
1372
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.grantInvoke">grantInvoke</a></code> | Allows `grantee` to call the function's endpoint. |
|
|
1373
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.metric">metric</a></code> | A metric of this function's execution environments in `AWS/Lambda/Web` (dimension `FunctionName`), across all endpoints. |
|
|
1374
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.metricActiveTime">metricActiveTime</a></code> | Time the execution environments were active (`EnvironmentActiveTime`). |
|
|
1375
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.metricConcurrentRequests">metricConcurrentRequests</a></code> | Requests an execution environment handled at once (`EnvironmentConcurrentRequests`), to compare with `maxConcurrencyPerEnvironment`. |
|
|
1376
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.metricCpuTime">metricCpuTime</a></code> | CPU time the execution environments used (`EnvironmentCPUTime`). |
|
|
1377
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.metricMaxMemoryUsage">metricMaxMemoryUsage</a></code> | Peak memory an execution environment used (`EnvironmentMaxMemoryUsage`); |
|
|
1378
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.metricResponseBytes">metricResponseBytes</a></code> | Bytes sent in responses (`ResponseBytes`). |
|
|
1379
|
+
|
|
1380
|
+
---
|
|
1381
|
+
|
|
1382
|
+
##### `toString` <a name="toString" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.toString"></a>
|
|
920
1383
|
|
|
921
1384
|
```typescript
|
|
922
|
-
public
|
|
1385
|
+
public toString(): string
|
|
923
1386
|
```
|
|
924
1387
|
|
|
925
|
-
|
|
1388
|
+
Returns a string representation of this construct.
|
|
926
1389
|
|
|
927
|
-
|
|
1390
|
+
##### `with` <a name="with" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.with"></a>
|
|
1391
|
+
|
|
1392
|
+
```typescript
|
|
1393
|
+
public with(mixins: ...IMixin[]): IConstruct
|
|
1394
|
+
```
|
|
1395
|
+
|
|
1396
|
+
Applies one or more mixins to this construct.
|
|
1397
|
+
|
|
1398
|
+
Mixins are applied in order. The list of constructs is captured at the
|
|
1399
|
+
start of the call, so constructs added by a mixin will not be visited.
|
|
1400
|
+
Use multiple `with()` calls if subsequent mixins should apply to added
|
|
1401
|
+
constructs.
|
|
1402
|
+
|
|
1403
|
+
###### `mixins`<sup>Required</sup> <a name="mixins" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.with.parameter.mixins"></a>
|
|
1404
|
+
|
|
1405
|
+
- *Type:* ...constructs.IMixin[]
|
|
928
1406
|
|
|
929
1407
|
---
|
|
930
1408
|
|
|
931
|
-
##### `
|
|
1409
|
+
##### `applyCrossStackReferenceStrength` <a name="applyCrossStackReferenceStrength" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.applyCrossStackReferenceStrength"></a>
|
|
932
1410
|
|
|
933
1411
|
```typescript
|
|
934
|
-
public
|
|
1412
|
+
public applyCrossStackReferenceStrength(strength: ReferenceStrength): void
|
|
1413
|
+
```
|
|
1414
|
+
|
|
1415
|
+
Override the cross-stack reference strength for this resource.
|
|
1416
|
+
|
|
1417
|
+
When set, any cross-stack reference to this resource will use the specified
|
|
1418
|
+
mechanism instead of the global default determined by the
|
|
1419
|
+
`@aws-cdk/core:defaultCrossStackReferences` context key. This is useful for
|
|
1420
|
+
selectively weakening specific references to avoid the "deadly embrace" problem
|
|
1421
|
+
without changing the app-wide default.
|
|
1422
|
+
|
|
1423
|
+
###### `strength`<sup>Required</sup> <a name="strength" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.applyCrossStackReferenceStrength.parameter.strength"></a>
|
|
1424
|
+
|
|
1425
|
+
- *Type:* aws-cdk-lib.ReferenceStrength
|
|
1426
|
+
|
|
1427
|
+
The reference strength to use for this resource.
|
|
1428
|
+
|
|
1429
|
+
---
|
|
1430
|
+
|
|
1431
|
+
##### `applyRemovalPolicy` <a name="applyRemovalPolicy" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.applyRemovalPolicy"></a>
|
|
1432
|
+
|
|
1433
|
+
```typescript
|
|
1434
|
+
public applyRemovalPolicy(policy: RemovalPolicy): void
|
|
1435
|
+
```
|
|
1436
|
+
|
|
1437
|
+
Apply the given removal policy to this resource.
|
|
1438
|
+
|
|
1439
|
+
The Removal Policy controls what happens to this resource when it stops
|
|
1440
|
+
being managed by CloudFormation, either because you've removed it from the
|
|
1441
|
+
CDK application or because you've made a change that requires the resource
|
|
1442
|
+
to be replaced.
|
|
1443
|
+
|
|
1444
|
+
The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
|
|
1445
|
+
account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
|
|
1446
|
+
|
|
1447
|
+
###### `policy`<sup>Required</sup> <a name="policy" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.applyRemovalPolicy.parameter.policy"></a>
|
|
1448
|
+
|
|
1449
|
+
- *Type:* aws-cdk-lib.RemovalPolicy
|
|
1450
|
+
|
|
1451
|
+
---
|
|
1452
|
+
|
|
1453
|
+
##### `grantInvoke` <a name="grantInvoke" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.grantInvoke"></a>
|
|
1454
|
+
|
|
1455
|
+
```typescript
|
|
1456
|
+
public grantInvoke(grantee: IGrantable): Grant
|
|
1457
|
+
```
|
|
1458
|
+
|
|
1459
|
+
Allows `grantee` to call the function's endpoint.
|
|
1460
|
+
|
|
1461
|
+
[disable-awslint:no-grants]
|
|
1462
|
+
|
|
1463
|
+
###### `grantee`<sup>Required</sup> <a name="grantee" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.grantInvoke.parameter.grantee"></a>
|
|
1464
|
+
|
|
1465
|
+
- *Type:* aws-cdk-lib.aws_iam.IGrantable
|
|
1466
|
+
|
|
1467
|
+
---
|
|
1468
|
+
|
|
1469
|
+
##### `metric` <a name="metric" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.metric"></a>
|
|
1470
|
+
|
|
1471
|
+
```typescript
|
|
1472
|
+
public metric(metricName: string, props?: MetricOptions): Metric
|
|
1473
|
+
```
|
|
1474
|
+
|
|
1475
|
+
A metric of this function's execution environments in `AWS/Lambda/Web` (dimension `FunctionName`), across all endpoints.
|
|
1476
|
+
|
|
1477
|
+
For request and error counts, use the endpoint's metrics (`fn.endpoint.metricRequests()`).
|
|
1478
|
+
|
|
1479
|
+
Metrics are published in the region that served the request: pass `region` for another serving region.
|
|
1480
|
+
An alarm can only use metrics from its own stack's region.
|
|
1481
|
+
|
|
1482
|
+
###### `metricName`<sup>Required</sup> <a name="metricName" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.metric.parameter.metricName"></a>
|
|
1483
|
+
|
|
1484
|
+
- *Type:* string
|
|
1485
|
+
|
|
1486
|
+
---
|
|
1487
|
+
|
|
1488
|
+
###### `props`<sup>Optional</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.metric.parameter.props"></a>
|
|
1489
|
+
|
|
1490
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
|
|
1491
|
+
|
|
1492
|
+
---
|
|
1493
|
+
|
|
1494
|
+
##### `metricActiveTime` <a name="metricActiveTime" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.metricActiveTime"></a>
|
|
1495
|
+
|
|
1496
|
+
```typescript
|
|
1497
|
+
public metricActiveTime(props?: MetricOptions): Metric
|
|
1498
|
+
```
|
|
1499
|
+
|
|
1500
|
+
Time the execution environments were active (`EnvironmentActiveTime`).
|
|
1501
|
+
|
|
1502
|
+
###### `props`<sup>Optional</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.metricActiveTime.parameter.props"></a>
|
|
1503
|
+
|
|
1504
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
|
|
1505
|
+
|
|
1506
|
+
---
|
|
1507
|
+
|
|
1508
|
+
##### `metricConcurrentRequests` <a name="metricConcurrentRequests" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.metricConcurrentRequests"></a>
|
|
1509
|
+
|
|
1510
|
+
```typescript
|
|
1511
|
+
public metricConcurrentRequests(props?: MetricOptions): Metric
|
|
1512
|
+
```
|
|
1513
|
+
|
|
1514
|
+
Requests an execution environment handled at once (`EnvironmentConcurrentRequests`), to compare with `maxConcurrencyPerEnvironment`.
|
|
1515
|
+
|
|
1516
|
+
###### `props`<sup>Optional</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.metricConcurrentRequests.parameter.props"></a>
|
|
1517
|
+
|
|
1518
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
|
|
1519
|
+
|
|
1520
|
+
---
|
|
1521
|
+
|
|
1522
|
+
##### `metricCpuTime` <a name="metricCpuTime" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.metricCpuTime"></a>
|
|
1523
|
+
|
|
1524
|
+
```typescript
|
|
1525
|
+
public metricCpuTime(props?: MetricOptions): Metric
|
|
1526
|
+
```
|
|
1527
|
+
|
|
1528
|
+
CPU time the execution environments used (`EnvironmentCPUTime`).
|
|
1529
|
+
|
|
1530
|
+
###### `props`<sup>Optional</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.metricCpuTime.parameter.props"></a>
|
|
1531
|
+
|
|
1532
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
|
|
1533
|
+
|
|
1534
|
+
---
|
|
1535
|
+
|
|
1536
|
+
##### `metricMaxMemoryUsage` <a name="metricMaxMemoryUsage" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.metricMaxMemoryUsage"></a>
|
|
1537
|
+
|
|
1538
|
+
```typescript
|
|
1539
|
+
public metricMaxMemoryUsage(props?: MetricOptions): Metric
|
|
1540
|
+
```
|
|
1541
|
+
|
|
1542
|
+
Peak memory an execution environment used (`EnvironmentMaxMemoryUsage`);
|
|
1543
|
+
|
|
1544
|
+
each environment has 2 GB.
|
|
1545
|
+
|
|
1546
|
+
###### `props`<sup>Optional</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.metricMaxMemoryUsage.parameter.props"></a>
|
|
1547
|
+
|
|
1548
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
|
|
1549
|
+
|
|
1550
|
+
---
|
|
1551
|
+
|
|
1552
|
+
##### `metricResponseBytes` <a name="metricResponseBytes" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.metricResponseBytes"></a>
|
|
1553
|
+
|
|
1554
|
+
```typescript
|
|
1555
|
+
public metricResponseBytes(props?: MetricOptions): Metric
|
|
1556
|
+
```
|
|
1557
|
+
|
|
1558
|
+
Bytes sent in responses (`ResponseBytes`).
|
|
1559
|
+
|
|
1560
|
+
###### `props`<sup>Optional</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.metricResponseBytes.parameter.props"></a>
|
|
1561
|
+
|
|
1562
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
|
|
1563
|
+
|
|
1564
|
+
---
|
|
1565
|
+
|
|
1566
|
+
#### Static Functions <a name="Static Functions" id="Static Functions"></a>
|
|
1567
|
+
|
|
1568
|
+
| **Name** | **Description** |
|
|
1569
|
+
| --- | --- |
|
|
1570
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.isConstruct">isConstruct</a></code> | Checks if `x` is a construct. |
|
|
1571
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.isOwnedResource">isOwnedResource</a></code> | Returns true if the construct was created by CDK, and false otherwise. |
|
|
1572
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.isResource">isResource</a></code> | Check whether the given construct is a Resource. |
|
|
1573
|
+
|
|
1574
|
+
---
|
|
1575
|
+
|
|
1576
|
+
##### `isConstruct` <a name="isConstruct" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.isConstruct"></a>
|
|
1577
|
+
|
|
1578
|
+
```typescript
|
|
1579
|
+
import { WebFunctionBase } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
1580
|
+
|
|
1581
|
+
WebFunctionBase.isConstruct(x: any)
|
|
1582
|
+
```
|
|
1583
|
+
|
|
1584
|
+
Checks if `x` is a construct.
|
|
1585
|
+
|
|
1586
|
+
Use this method instead of `instanceof` to properly detect `Construct`
|
|
1587
|
+
instances, even when the construct library is symlinked.
|
|
1588
|
+
|
|
1589
|
+
Explanation: in JavaScript, multiple copies of the `constructs` library on
|
|
1590
|
+
disk are seen as independent, completely different libraries. As a
|
|
1591
|
+
consequence, the class `Construct` in each copy of the `constructs` library
|
|
1592
|
+
is seen as a different class, and an instance of one class will not test as
|
|
1593
|
+
`instanceof` the other class. `npm install` will not create installations
|
|
1594
|
+
like this, but users may manually symlink construct libraries together or
|
|
1595
|
+
use a monorepo tool: in those cases, multiple copies of the `constructs`
|
|
1596
|
+
library can be accidentally installed, and `instanceof` will behave
|
|
1597
|
+
unpredictably. It is safest to avoid using `instanceof`, and using
|
|
1598
|
+
this type-testing method instead.
|
|
1599
|
+
|
|
1600
|
+
###### `x`<sup>Required</sup> <a name="x" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.isConstruct.parameter.x"></a>
|
|
1601
|
+
|
|
1602
|
+
- *Type:* any
|
|
1603
|
+
|
|
1604
|
+
Any object.
|
|
1605
|
+
|
|
1606
|
+
---
|
|
1607
|
+
|
|
1608
|
+
##### `isOwnedResource` <a name="isOwnedResource" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.isOwnedResource"></a>
|
|
1609
|
+
|
|
1610
|
+
```typescript
|
|
1611
|
+
import { WebFunctionBase } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
1612
|
+
|
|
1613
|
+
WebFunctionBase.isOwnedResource(construct: IConstruct)
|
|
1614
|
+
```
|
|
1615
|
+
|
|
1616
|
+
Returns true if the construct was created by CDK, and false otherwise.
|
|
1617
|
+
|
|
1618
|
+
###### `construct`<sup>Required</sup> <a name="construct" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.isOwnedResource.parameter.construct"></a>
|
|
1619
|
+
|
|
1620
|
+
- *Type:* constructs.IConstruct
|
|
1621
|
+
|
|
1622
|
+
---
|
|
1623
|
+
|
|
1624
|
+
##### `isResource` <a name="isResource" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.isResource"></a>
|
|
1625
|
+
|
|
1626
|
+
```typescript
|
|
1627
|
+
import { WebFunctionBase } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
1628
|
+
|
|
1629
|
+
WebFunctionBase.isResource(construct: IConstruct)
|
|
1630
|
+
```
|
|
1631
|
+
|
|
1632
|
+
Check whether the given construct is a Resource.
|
|
1633
|
+
|
|
1634
|
+
###### `construct`<sup>Required</sup> <a name="construct" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.isResource.parameter.construct"></a>
|
|
1635
|
+
|
|
1636
|
+
- *Type:* constructs.IConstruct
|
|
1637
|
+
|
|
1638
|
+
---
|
|
1639
|
+
|
|
1640
|
+
#### Properties <a name="Properties" id="Properties"></a>
|
|
1641
|
+
|
|
1642
|
+
| **Name** | **Type** | **Description** |
|
|
1643
|
+
| --- | --- | --- |
|
|
1644
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. |
|
|
1645
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.property.env">env</a></code> | <code>aws-cdk-lib.interfaces.ResourceEnvironment</code> | The environment this resource belongs to. |
|
|
1646
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.property.stack">stack</a></code> | <code>aws-cdk-lib.Stack</code> | The stack in which this resource is defined. |
|
|
1647
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.property.webFunctionArn">webFunctionArn</a></code> | <code>string</code> | The function's ARN. |
|
|
1648
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.property.webFunctionName">webFunctionName</a></code> | <code>string</code> | The function's name. |
|
|
1649
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.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`. |
|
|
1650
|
+
|
|
1651
|
+
---
|
|
1652
|
+
|
|
1653
|
+
##### `node`<sup>Required</sup> <a name="node" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.property.node"></a>
|
|
1654
|
+
|
|
1655
|
+
```typescript
|
|
1656
|
+
public readonly node: Node;
|
|
1657
|
+
```
|
|
1658
|
+
|
|
1659
|
+
- *Type:* constructs.Node
|
|
1660
|
+
|
|
1661
|
+
The tree node.
|
|
1662
|
+
|
|
1663
|
+
---
|
|
1664
|
+
|
|
1665
|
+
##### `env`<sup>Required</sup> <a name="env" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.property.env"></a>
|
|
1666
|
+
|
|
1667
|
+
```typescript
|
|
1668
|
+
public readonly env: ResourceEnvironment;
|
|
1669
|
+
```
|
|
1670
|
+
|
|
1671
|
+
- *Type:* aws-cdk-lib.interfaces.ResourceEnvironment
|
|
1672
|
+
|
|
1673
|
+
The environment this resource belongs to.
|
|
1674
|
+
|
|
1675
|
+
For resources that are created and managed in a Stack (those created by
|
|
1676
|
+
creating new class instances like `new Role()`, `new Bucket()`, etc.), this
|
|
1677
|
+
is always the same as the environment of the stack they belong to.
|
|
1678
|
+
|
|
1679
|
+
For referenced resources (those obtained from referencing methods like
|
|
1680
|
+
`Role.fromRoleArn()`, `Bucket.fromBucketName()`, etc.), they might be
|
|
1681
|
+
different than the stack they were imported into.
|
|
1682
|
+
|
|
1683
|
+
---
|
|
1684
|
+
|
|
1685
|
+
##### `stack`<sup>Required</sup> <a name="stack" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.property.stack"></a>
|
|
1686
|
+
|
|
1687
|
+
```typescript
|
|
1688
|
+
public readonly stack: Stack;
|
|
1689
|
+
```
|
|
1690
|
+
|
|
1691
|
+
- *Type:* aws-cdk-lib.Stack
|
|
1692
|
+
|
|
1693
|
+
The stack in which this resource is defined.
|
|
1694
|
+
|
|
1695
|
+
---
|
|
1696
|
+
|
|
1697
|
+
##### `webFunctionArn`<sup>Required</sup> <a name="webFunctionArn" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.property.webFunctionArn"></a>
|
|
1698
|
+
|
|
1699
|
+
```typescript
|
|
1700
|
+
public readonly webFunctionArn: string;
|
|
1701
|
+
```
|
|
1702
|
+
|
|
1703
|
+
- *Type:* string
|
|
1704
|
+
|
|
1705
|
+
The function's ARN.
|
|
1706
|
+
|
|
1707
|
+
---
|
|
1708
|
+
|
|
1709
|
+
##### `webFunctionName`<sup>Required</sup> <a name="webFunctionName" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.property.webFunctionName"></a>
|
|
1710
|
+
|
|
1711
|
+
```typescript
|
|
1712
|
+
public readonly webFunctionName: string;
|
|
1713
|
+
```
|
|
1714
|
+
|
|
1715
|
+
- *Type:* string
|
|
1716
|
+
|
|
1717
|
+
The function's name.
|
|
1718
|
+
|
|
1719
|
+
---
|
|
1720
|
+
|
|
1721
|
+
##### `webFunctionRef`<sup>Required</sup> <a name="webFunctionRef" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.property.webFunctionRef"></a>
|
|
1722
|
+
|
|
1723
|
+
```typescript
|
|
1724
|
+
public readonly webFunctionRef: WebFunctionReference;
|
|
1725
|
+
```
|
|
1726
|
+
|
|
1727
|
+
- *Type:* aws-cdk-lib.interfaces.aws_lambda.WebFunctionReference
|
|
1728
|
+
|
|
1729
|
+
A reference to this function, for APIs that accept `lambda.IWebFunctionRef`.
|
|
1730
|
+
|
|
1731
|
+
---
|
|
1732
|
+
|
|
1733
|
+
|
|
1734
|
+
### WebFunctionEndpoint <a name="WebFunctionEndpoint" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint"></a>
|
|
1735
|
+
|
|
1736
|
+
An HTTPS endpoint of a Web Function: `fn.endpoint` (the default one) or the result of `fn.addEndpoint()`.
|
|
1737
|
+
|
|
1738
|
+
Endpoints are created only through `WebFunction`, which owns their log groups in every region, so the constructor is private.
|
|
1739
|
+
|
|
1740
|
+
#### Methods <a name="Methods" id="Methods"></a>
|
|
1741
|
+
|
|
1742
|
+
| **Name** | **Description** |
|
|
1743
|
+
| --- | --- |
|
|
1744
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.toString">toString</a></code> | Returns a string representation of this construct. |
|
|
1745
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.with">with</a></code> | Applies one or more mixins to this construct. |
|
|
1746
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.grantInvoke">grantInvoke</a></code> | Allows `grantee` to call this endpoint. |
|
|
1747
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.metric">metric</a></code> | A metric of this endpoint in `AWS/Lambda/Web` (dimensions `FunctionName` and `EndpointName`). |
|
|
1748
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.metricActiveEnvironments">metricActiveEnvironments</a></code> | Execution environments serving the endpoint (`EndpointActiveEnvironments`), to compare with `maxEnvironments`. |
|
|
1749
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.metricClientErrorRate">metricClientErrorRate</a></code> | The percentage of requests answered with a 4XX status (math expression; |
|
|
1750
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.metricClientErrors">metricClientErrors</a></code> | Requests answered with a 4XX status (`HTTPResponseStatusClass4XX`), including 429s from `rateLimit` and `maxEnvironments`. |
|
|
1751
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.metricEnvironmentThrottles">metricEnvironmentThrottles</a></code> | Requests rejected with 429 because the endpoint reached `maxEnvironments` (`EndpointActiveEnvironmentThrottles`). |
|
|
1752
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.metricRequests">metricRequests</a></code> | Requests the endpoint served (`ExecutedRequests`). |
|
|
1753
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.metricRequestThrottles">metricRequestThrottles</a></code> | Requests rejected with 429 because the endpoint reached its `rateLimit` (`EndpointRequestThrottles`). |
|
|
1754
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.metricServerErrorRate">metricServerErrorRate</a></code> | The percentage of requests answered with a 5XX status (math expression; |
|
|
1755
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.metricServerErrors">metricServerErrors</a></code> | Requests answered with a 5XX status (`HTTPResponseStatusClass5XX`). |
|
|
1756
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.regionalUrl">regionalUrl</a></code> | The URL of this endpoint in one region. |
|
|
1757
|
+
| <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; |
|
|
1758
|
+
|
|
1759
|
+
---
|
|
1760
|
+
|
|
1761
|
+
##### `toString` <a name="toString" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.toString"></a>
|
|
1762
|
+
|
|
1763
|
+
```typescript
|
|
1764
|
+
public toString(): string
|
|
1765
|
+
```
|
|
1766
|
+
|
|
1767
|
+
Returns a string representation of this construct.
|
|
1768
|
+
|
|
1769
|
+
##### `with` <a name="with" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.with"></a>
|
|
1770
|
+
|
|
1771
|
+
```typescript
|
|
1772
|
+
public with(mixins: ...IMixin[]): IConstruct
|
|
1773
|
+
```
|
|
1774
|
+
|
|
1775
|
+
Applies one or more mixins to this construct.
|
|
1776
|
+
|
|
1777
|
+
Mixins are applied in order. The list of constructs is captured at the
|
|
1778
|
+
start of the call, so constructs added by a mixin will not be visited.
|
|
1779
|
+
Use multiple `with()` calls if subsequent mixins should apply to added
|
|
1780
|
+
constructs.
|
|
1781
|
+
|
|
1782
|
+
###### `mixins`<sup>Required</sup> <a name="mixins" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.with.parameter.mixins"></a>
|
|
1783
|
+
|
|
1784
|
+
- *Type:* ...constructs.IMixin[]
|
|
1785
|
+
|
|
1786
|
+
The mixins to apply.
|
|
1787
|
+
|
|
1788
|
+
---
|
|
1789
|
+
|
|
1790
|
+
##### `grantInvoke` <a name="grantInvoke" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.grantInvoke"></a>
|
|
1791
|
+
|
|
1792
|
+
```typescript
|
|
1793
|
+
public grantInvoke(grantee: IGrantable): Grant
|
|
1794
|
+
```
|
|
1795
|
+
|
|
1796
|
+
Allows `grantee` to call this endpoint.
|
|
1797
|
+
|
|
1798
|
+
Shortcut for `grants.invoke(grantee)`.
|
|
1799
|
+
[disable-awslint:no-grants]
|
|
1800
|
+
|
|
1801
|
+
###### `grantee`<sup>Required</sup> <a name="grantee" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.grantInvoke.parameter.grantee"></a>
|
|
1802
|
+
|
|
1803
|
+
- *Type:* aws-cdk-lib.aws_iam.IGrantable
|
|
1804
|
+
|
|
1805
|
+
---
|
|
1806
|
+
|
|
1807
|
+
##### `metric` <a name="metric" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.metric"></a>
|
|
1808
|
+
|
|
1809
|
+
```typescript
|
|
1810
|
+
public metric(metricName: string, props?: MetricOptions): Metric
|
|
1811
|
+
```
|
|
1812
|
+
|
|
1813
|
+
A metric of this endpoint in `AWS/Lambda/Web` (dimensions `FunctionName` and `EndpointName`).
|
|
1814
|
+
|
|
1815
|
+
Metrics are published in the region that served the request: pass `region` for one of the endpoint's
|
|
1816
|
+
other regions. An alarm can only use metrics from its own stack's region.
|
|
1817
|
+
|
|
1818
|
+
###### `metricName`<sup>Required</sup> <a name="metricName" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.metric.parameter.metricName"></a>
|
|
1819
|
+
|
|
1820
|
+
- *Type:* string
|
|
1821
|
+
|
|
1822
|
+
---
|
|
1823
|
+
|
|
1824
|
+
###### `props`<sup>Optional</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.metric.parameter.props"></a>
|
|
1825
|
+
|
|
1826
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
|
|
1827
|
+
|
|
1828
|
+
---
|
|
1829
|
+
|
|
1830
|
+
##### `metricActiveEnvironments` <a name="metricActiveEnvironments" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.metricActiveEnvironments"></a>
|
|
1831
|
+
|
|
1832
|
+
```typescript
|
|
1833
|
+
public metricActiveEnvironments(props?: MetricOptions): Metric
|
|
1834
|
+
```
|
|
1835
|
+
|
|
1836
|
+
Execution environments serving the endpoint (`EndpointActiveEnvironments`), to compare with `maxEnvironments`.
|
|
1837
|
+
|
|
1838
|
+
###### `props`<sup>Optional</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.metricActiveEnvironments.parameter.props"></a>
|
|
1839
|
+
|
|
1840
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
|
|
1841
|
+
|
|
1842
|
+
---
|
|
1843
|
+
|
|
1844
|
+
##### `metricClientErrorRate` <a name="metricClientErrorRate" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.metricClientErrorRate"></a>
|
|
1845
|
+
|
|
1846
|
+
```typescript
|
|
1847
|
+
public metricClientErrorRate(props?: MetricOptions): MathExpression
|
|
1848
|
+
```
|
|
1849
|
+
|
|
1850
|
+
The percentage of requests answered with a 4XX status (math expression;
|
|
1851
|
+
|
|
1852
|
+
periods with no 4XX count as 0).
|
|
1853
|
+
|
|
1854
|
+
###### `props`<sup>Optional</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.metricClientErrorRate.parameter.props"></a>
|
|
1855
|
+
|
|
1856
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
|
|
1857
|
+
|
|
1858
|
+
---
|
|
1859
|
+
|
|
1860
|
+
##### `metricClientErrors` <a name="metricClientErrors" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.metricClientErrors"></a>
|
|
1861
|
+
|
|
1862
|
+
```typescript
|
|
1863
|
+
public metricClientErrors(props?: MetricOptions): Metric
|
|
1864
|
+
```
|
|
1865
|
+
|
|
1866
|
+
Requests answered with a 4XX status (`HTTPResponseStatusClass4XX`), including 429s from `rateLimit` and `maxEnvironments`.
|
|
1867
|
+
|
|
1868
|
+
The metric only exists once it's non-zero, so alarms should treat missing data as not breaching.
|
|
1869
|
+
|
|
1870
|
+
###### `props`<sup>Optional</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.metricClientErrors.parameter.props"></a>
|
|
1871
|
+
|
|
1872
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
|
|
1873
|
+
|
|
1874
|
+
---
|
|
1875
|
+
|
|
1876
|
+
##### `metricEnvironmentThrottles` <a name="metricEnvironmentThrottles" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.metricEnvironmentThrottles"></a>
|
|
1877
|
+
|
|
1878
|
+
```typescript
|
|
1879
|
+
public metricEnvironmentThrottles(props?: MetricOptions): Metric
|
|
935
1880
|
```
|
|
936
1881
|
|
|
937
|
-
|
|
1882
|
+
Requests rejected with 429 because the endpoint reached `maxEnvironments` (`EndpointActiveEnvironmentThrottles`).
|
|
938
1883
|
|
|
939
|
-
|
|
1884
|
+
###### `props`<sup>Optional</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.metricEnvironmentThrottles.parameter.props"></a>
|
|
1885
|
+
|
|
1886
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
|
|
940
1887
|
|
|
941
1888
|
---
|
|
942
1889
|
|
|
1890
|
+
##### `metricRequests` <a name="metricRequests" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.metricRequests"></a>
|
|
943
1891
|
|
|
944
|
-
|
|
1892
|
+
```typescript
|
|
1893
|
+
public metricRequests(props?: MetricOptions): Metric
|
|
1894
|
+
```
|
|
945
1895
|
|
|
946
|
-
|
|
1896
|
+
Requests the endpoint served (`ExecutedRequests`).
|
|
947
1897
|
|
|
948
|
-
|
|
1898
|
+
There's no separate count of successful (2XX) responses.
|
|
949
1899
|
|
|
950
|
-
|
|
1900
|
+
###### `props`<sup>Optional</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.metricRequests.parameter.props"></a>
|
|
951
1901
|
|
|
952
|
-
|
|
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; |
|
|
1902
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
|
|
959
1903
|
|
|
960
1904
|
---
|
|
961
1905
|
|
|
962
|
-
##### `
|
|
1906
|
+
##### `metricRequestThrottles` <a name="metricRequestThrottles" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.metricRequestThrottles"></a>
|
|
963
1907
|
|
|
964
1908
|
```typescript
|
|
965
|
-
public
|
|
1909
|
+
public metricRequestThrottles(props?: MetricOptions): Metric
|
|
966
1910
|
```
|
|
967
1911
|
|
|
968
|
-
|
|
1912
|
+
Requests rejected with 429 because the endpoint reached its `rateLimit` (`EndpointRequestThrottles`).
|
|
969
1913
|
|
|
970
|
-
|
|
1914
|
+
###### `props`<sup>Optional</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.metricRequestThrottles.parameter.props"></a>
|
|
1915
|
+
|
|
1916
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
|
|
1917
|
+
|
|
1918
|
+
---
|
|
1919
|
+
|
|
1920
|
+
##### `metricServerErrorRate` <a name="metricServerErrorRate" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.metricServerErrorRate"></a>
|
|
971
1921
|
|
|
972
1922
|
```typescript
|
|
973
|
-
public
|
|
1923
|
+
public metricServerErrorRate(props?: MetricOptions): MathExpression
|
|
974
1924
|
```
|
|
975
1925
|
|
|
976
|
-
|
|
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.
|
|
1926
|
+
The percentage of requests answered with a 5XX status (math expression;
|
|
982
1927
|
|
|
983
|
-
|
|
1928
|
+
periods with no 5XX count as 0).
|
|
984
1929
|
|
|
985
|
-
|
|
1930
|
+
###### `props`<sup>Optional</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.metricServerErrorRate.parameter.props"></a>
|
|
986
1931
|
|
|
987
|
-
|
|
1932
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
|
|
988
1933
|
|
|
989
1934
|
---
|
|
990
1935
|
|
|
991
|
-
##### `
|
|
1936
|
+
##### `metricServerErrors` <a name="metricServerErrors" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.metricServerErrors"></a>
|
|
992
1937
|
|
|
993
1938
|
```typescript
|
|
994
|
-
public
|
|
1939
|
+
public metricServerErrors(props?: MetricOptions): Metric
|
|
995
1940
|
```
|
|
996
1941
|
|
|
997
|
-
|
|
1942
|
+
Requests answered with a 5XX status (`HTTPResponseStatusClass5XX`).
|
|
998
1943
|
|
|
999
|
-
|
|
1000
|
-
|
|
1944
|
+
Includes the platform's 503s while the endpoint
|
|
1945
|
+
scales up for a sudden burst, not only your application's errors. The metric only exists once it's non-zero.
|
|
1001
1946
|
|
|
1002
|
-
###### `
|
|
1947
|
+
###### `props`<sup>Optional</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.metricServerErrors.parameter.props"></a>
|
|
1003
1948
|
|
|
1004
|
-
- *Type:* aws-cdk-lib.
|
|
1949
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
|
|
1005
1950
|
|
|
1006
1951
|
---
|
|
1007
1952
|
|
|
@@ -1102,6 +2047,7 @@ Any object.
|
|
|
1102
2047
|
| <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
2048
|
| <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
2049
|
| <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. |
|
|
2050
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.rollbackAlarms">rollbackAlarms</a></code> | <code>aws-cdk-lib.aws_cloudwatch.IAlarm[]</code> | The alarms this endpoint created for its deployment's `rollbackOn`, one per threshold in every region it serves from (the home region's first). |
|
|
1105
2051
|
| <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
2052
|
|
|
1107
2053
|
---
|
|
@@ -1202,6 +2148,20 @@ Every region the endpoint serves from: the home region first, then the others in
|
|
|
1202
2148
|
|
|
1203
2149
|
---
|
|
1204
2150
|
|
|
2151
|
+
##### `rollbackAlarms`<sup>Required</sup> <a name="rollbackAlarms" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.rollbackAlarms"></a>
|
|
2152
|
+
|
|
2153
|
+
```typescript
|
|
2154
|
+
public readonly rollbackAlarms: IAlarm[];
|
|
2155
|
+
```
|
|
2156
|
+
|
|
2157
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.IAlarm[]
|
|
2158
|
+
|
|
2159
|
+
The alarms this endpoint created for its deployment's `rollbackOn`, one per threshold in every region it serves from (the home region's first).
|
|
2160
|
+
|
|
2161
|
+
Empty without `rollbackOn`.
|
|
2162
|
+
|
|
2163
|
+
---
|
|
2164
|
+
|
|
1205
2165
|
##### `url`<sup>Required</sup> <a name="url" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.url"></a>
|
|
1206
2166
|
|
|
1207
2167
|
```typescript
|
|
@@ -2100,6 +3060,69 @@ The Node.js runtime.
|
|
|
2100
3060
|
|
|
2101
3061
|
---
|
|
2102
3062
|
|
|
3063
|
+
### WebFunctionAttributes <a name="WebFunctionAttributes" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionAttributes"></a>
|
|
3064
|
+
|
|
3065
|
+
Attributes of an existing Web Function.
|
|
3066
|
+
|
|
3067
|
+
Give its ARN or its name.
|
|
3068
|
+
|
|
3069
|
+
#### Initializer <a name="Initializer" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionAttributes.Initializer"></a>
|
|
3070
|
+
|
|
3071
|
+
```typescript
|
|
3072
|
+
import { WebFunctionAttributes } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
3073
|
+
|
|
3074
|
+
const webFunctionAttributes: WebFunctionAttributes = { ... }
|
|
3075
|
+
```
|
|
3076
|
+
|
|
3077
|
+
#### Properties <a name="Properties" id="Properties"></a>
|
|
3078
|
+
|
|
3079
|
+
| **Name** | **Type** | **Description** |
|
|
3080
|
+
| --- | --- | --- |
|
|
3081
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionAttributes.property.endpointName">endpointName</a></code> | <code>string</code> | The endpoint `grantInvoke` allows calling. |
|
|
3082
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionAttributes.property.webFunctionArn">webFunctionArn</a></code> | <code>string</code> | The function's ARN, e.g. `arn:aws:lambda:us-east-1:111122223333:web-function/orders`. It may be in another region or account; across accounts, `grantInvoke` also needs the function's resource policy to allow the caller. |
|
|
3083
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionAttributes.property.webFunctionName">webFunctionName</a></code> | <code>string</code> | The function's name. |
|
|
3084
|
+
|
|
3085
|
+
---
|
|
3086
|
+
|
|
3087
|
+
##### `endpointName`<sup>Optional</sup> <a name="endpointName" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionAttributes.property.endpointName"></a>
|
|
3088
|
+
|
|
3089
|
+
```typescript
|
|
3090
|
+
public readonly endpointName: string;
|
|
3091
|
+
```
|
|
3092
|
+
|
|
3093
|
+
- *Type:* string
|
|
3094
|
+
- *Default:* every endpoint of the function
|
|
3095
|
+
|
|
3096
|
+
The endpoint `grantInvoke` allows calling.
|
|
3097
|
+
|
|
3098
|
+
---
|
|
3099
|
+
|
|
3100
|
+
##### `webFunctionArn`<sup>Optional</sup> <a name="webFunctionArn" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionAttributes.property.webFunctionArn"></a>
|
|
3101
|
+
|
|
3102
|
+
```typescript
|
|
3103
|
+
public readonly webFunctionArn: string;
|
|
3104
|
+
```
|
|
3105
|
+
|
|
3106
|
+
- *Type:* string
|
|
3107
|
+
- *Default:* built from `webFunctionName`, in this stack's account and region
|
|
3108
|
+
|
|
3109
|
+
The function's ARN, e.g. `arn:aws:lambda:us-east-1:111122223333:web-function/orders`. It may be in another region or account; across accounts, `grantInvoke` also needs the function's resource policy to allow the caller.
|
|
3110
|
+
|
|
3111
|
+
---
|
|
3112
|
+
|
|
3113
|
+
##### `webFunctionName`<sup>Optional</sup> <a name="webFunctionName" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionAttributes.property.webFunctionName"></a>
|
|
3114
|
+
|
|
3115
|
+
```typescript
|
|
3116
|
+
public readonly webFunctionName: string;
|
|
3117
|
+
```
|
|
3118
|
+
|
|
3119
|
+
- *Type:* string
|
|
3120
|
+
- *Default:* taken from `webFunctionArn`
|
|
3121
|
+
|
|
3122
|
+
The function's name.
|
|
3123
|
+
|
|
3124
|
+
---
|
|
3125
|
+
|
|
2103
3126
|
### WebFunctionCanaryDeploymentOptions <a name="WebFunctionCanaryDeploymentOptions" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionCanaryDeploymentOptions"></a>
|
|
2104
3127
|
|
|
2105
3128
|
Options for a canary deployment.
|
|
@@ -2119,6 +3142,7 @@ const webFunctionCanaryDeploymentOptions: WebFunctionCanaryDeploymentOptions = {
|
|
|
2119
3142
|
| <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
3143
|
| <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
3144
|
| <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. |
|
|
3145
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionCanaryDeploymentOptions.property.rollbackOn">rollbackOn</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionRollbackOptions">WebFunctionRollbackOptions</a></code> | Alarms on the endpoint's own error rates, created by the endpoint in every region it serves from. |
|
|
2122
3146
|
|
|
2123
3147
|
---
|
|
2124
3148
|
|
|
@@ -2164,6 +3188,21 @@ Use alarms in any region (by ARN), including composite alarms.
|
|
|
2164
3188
|
|
|
2165
3189
|
---
|
|
2166
3190
|
|
|
3191
|
+
##### `rollbackOn`<sup>Optional</sup> <a name="rollbackOn" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionCanaryDeploymentOptions.property.rollbackOn"></a>
|
|
3192
|
+
|
|
3193
|
+
```typescript
|
|
3194
|
+
public readonly rollbackOn: WebFunctionRollbackOptions;
|
|
3195
|
+
```
|
|
3196
|
+
|
|
3197
|
+
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionRollbackOptions">WebFunctionRollbackOptions</a>
|
|
3198
|
+
- *Default:* no endpoint alarms
|
|
3199
|
+
|
|
3200
|
+
Alarms on the endpoint's own error rates, created by the endpoint in every region it serves from.
|
|
3201
|
+
|
|
3202
|
+
They stop the deployment like `alarms` (both can be used together).
|
|
3203
|
+
|
|
3204
|
+
---
|
|
3205
|
+
|
|
2167
3206
|
### WebFunctionEndpointOptions <a name="WebFunctionEndpointOptions" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions"></a>
|
|
2168
3207
|
|
|
2169
3208
|
Options for a Web Function's endpoint.
|
|
@@ -2319,6 +3358,7 @@ const webFunctionLinearDeploymentOptions: WebFunctionLinearDeploymentOptions = {
|
|
|
2319
3358
|
| <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
3359
|
| <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
3360
|
| <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. |
|
|
3361
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionLinearDeploymentOptions.property.rollbackOn">rollbackOn</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionRollbackOptions">WebFunctionRollbackOptions</a></code> | Alarms on the endpoint's own error rates, created by the endpoint in every region it serves from. |
|
|
2322
3362
|
|
|
2323
3363
|
---
|
|
2324
3364
|
|
|
@@ -2362,6 +3402,21 @@ Use alarms in any region (by ARN), including composite alarms.
|
|
|
2362
3402
|
|
|
2363
3403
|
---
|
|
2364
3404
|
|
|
3405
|
+
##### `rollbackOn`<sup>Optional</sup> <a name="rollbackOn" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionLinearDeploymentOptions.property.rollbackOn"></a>
|
|
3406
|
+
|
|
3407
|
+
```typescript
|
|
3408
|
+
public readonly rollbackOn: WebFunctionRollbackOptions;
|
|
3409
|
+
```
|
|
3410
|
+
|
|
3411
|
+
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionRollbackOptions">WebFunctionRollbackOptions</a>
|
|
3412
|
+
- *Default:* no endpoint alarms
|
|
3413
|
+
|
|
3414
|
+
Alarms on the endpoint's own error rates, created by the endpoint in every region it serves from.
|
|
3415
|
+
|
|
3416
|
+
They stop the deployment like `alarms` (both can be used together).
|
|
3417
|
+
|
|
3418
|
+
---
|
|
3419
|
+
|
|
2365
3420
|
### WebFunctionOptions <a name="WebFunctionOptions" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions"></a>
|
|
2366
3421
|
|
|
2367
3422
|
Options shared by `WebFunction` and `NodejsWebFunction`: everything except how the code is supplied.
|
|
@@ -2930,6 +3985,104 @@ The revision's share of the endpoint's traffic, as a fraction (like `lambda.Alia
|
|
|
2930
3985
|
|
|
2931
3986
|
---
|
|
2932
3987
|
|
|
3988
|
+
### WebFunctionRollbackOptions <a name="WebFunctionRollbackOptions" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRollbackOptions"></a>
|
|
3989
|
+
|
|
3990
|
+
Alarms an endpoint creates on its own metrics to stop a canary or linear deployment.
|
|
3991
|
+
|
|
3992
|
+
The endpoint creates one alarm per threshold in every region it serves from (metrics are published
|
|
3993
|
+
in the region that served the request, and an alarm can only watch metrics in its own region).
|
|
3994
|
+
Lambda Web Function metrics have no revision dimension, so the alarms watch the whole endpoint: while
|
|
3995
|
+
the new revision gets 10% of the traffic, its errors are about a tenth of the endpoint's.
|
|
3996
|
+
|
|
3997
|
+
#### Initializer <a name="Initializer" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRollbackOptions.Initializer"></a>
|
|
3998
|
+
|
|
3999
|
+
```typescript
|
|
4000
|
+
import { WebFunctionRollbackOptions } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
4001
|
+
|
|
4002
|
+
const webFunctionRollbackOptions: WebFunctionRollbackOptions = { ... }
|
|
4003
|
+
```
|
|
4004
|
+
|
|
4005
|
+
#### Properties <a name="Properties" id="Properties"></a>
|
|
4006
|
+
|
|
4007
|
+
| **Name** | **Type** | **Description** |
|
|
4008
|
+
| --- | --- | --- |
|
|
4009
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionRollbackOptions.property.clientErrorRate">clientErrorRate</a></code> | <code>number</code> | Roll back when more than this percent of the endpoint's requests get a 4XX response (0-100). |
|
|
4010
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionRollbackOptions.property.evaluationPeriods">evaluationPeriods</a></code> | <code>number</code> | How many consecutive periods must breach a threshold before the deployment rolls back. |
|
|
4011
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionRollbackOptions.property.minimumRequests">minimumRequests</a></code> | <code>number</code> | Periods with fewer requests than this don't count, so one failed request out of two doesn't roll back. |
|
|
4012
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionRollbackOptions.property.period">period</a></code> | <code>aws-cdk-lib.Duration</code> | The period each rate is measured over (at least 1 minute, in whole minutes). |
|
|
4013
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionRollbackOptions.property.serverErrorRate">serverErrorRate</a></code> | <code>number</code> | Roll back when more than this percent of the endpoint's requests get a 5XX response (0-100). |
|
|
4014
|
+
|
|
4015
|
+
---
|
|
4016
|
+
|
|
4017
|
+
##### `clientErrorRate`<sup>Optional</sup> <a name="clientErrorRate" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRollbackOptions.property.clientErrorRate"></a>
|
|
4018
|
+
|
|
4019
|
+
```typescript
|
|
4020
|
+
public readonly clientErrorRate: number;
|
|
4021
|
+
```
|
|
4022
|
+
|
|
4023
|
+
- *Type:* number
|
|
4024
|
+
- *Default:* no client error alarm
|
|
4025
|
+
|
|
4026
|
+
Roll back when more than this percent of the endpoint's requests get a 4XX response (0-100).
|
|
4027
|
+
|
|
4028
|
+
Requests over `rateLimit` or `maxEnvironments` get 429, which counts here.
|
|
4029
|
+
|
|
4030
|
+
---
|
|
4031
|
+
|
|
4032
|
+
##### `evaluationPeriods`<sup>Optional</sup> <a name="evaluationPeriods" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRollbackOptions.property.evaluationPeriods"></a>
|
|
4033
|
+
|
|
4034
|
+
```typescript
|
|
4035
|
+
public readonly evaluationPeriods: number;
|
|
4036
|
+
```
|
|
4037
|
+
|
|
4038
|
+
- *Type:* number
|
|
4039
|
+
- *Default:* 2
|
|
4040
|
+
|
|
4041
|
+
How many consecutive periods must breach a threshold before the deployment rolls back.
|
|
4042
|
+
|
|
4043
|
+
---
|
|
4044
|
+
|
|
4045
|
+
##### `minimumRequests`<sup>Optional</sup> <a name="minimumRequests" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRollbackOptions.property.minimumRequests"></a>
|
|
4046
|
+
|
|
4047
|
+
```typescript
|
|
4048
|
+
public readonly minimumRequests: number;
|
|
4049
|
+
```
|
|
4050
|
+
|
|
4051
|
+
- *Type:* number
|
|
4052
|
+
- *Default:* 10
|
|
4053
|
+
|
|
4054
|
+
Periods with fewer requests than this don't count, so one failed request out of two doesn't roll back.
|
|
4055
|
+
|
|
4056
|
+
---
|
|
4057
|
+
|
|
4058
|
+
##### `period`<sup>Optional</sup> <a name="period" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRollbackOptions.property.period"></a>
|
|
4059
|
+
|
|
4060
|
+
```typescript
|
|
4061
|
+
public readonly period: Duration;
|
|
4062
|
+
```
|
|
4063
|
+
|
|
4064
|
+
- *Type:* aws-cdk-lib.Duration
|
|
4065
|
+
- *Default:* Duration.minutes(1)
|
|
4066
|
+
|
|
4067
|
+
The period each rate is measured over (at least 1 minute, in whole minutes).
|
|
4068
|
+
|
|
4069
|
+
---
|
|
4070
|
+
|
|
4071
|
+
##### `serverErrorRate`<sup>Optional</sup> <a name="serverErrorRate" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRollbackOptions.property.serverErrorRate"></a>
|
|
4072
|
+
|
|
4073
|
+
```typescript
|
|
4074
|
+
public readonly serverErrorRate: number;
|
|
4075
|
+
```
|
|
4076
|
+
|
|
4077
|
+
- *Type:* number
|
|
4078
|
+
- *Default:* no server error alarm
|
|
4079
|
+
|
|
4080
|
+
Roll back when more than this percent of the endpoint's requests get a 5XX response (0-100).
|
|
4081
|
+
|
|
4082
|
+
5XX includes the platform's 503s while an endpoint scales up for a sudden burst, not only your application's errors.
|
|
4083
|
+
|
|
4084
|
+
---
|
|
4085
|
+
|
|
2933
4086
|
## Classes <a name="Classes" id="Classes"></a>
|
|
2934
4087
|
|
|
2935
4088
|
### WebFunctionDeployment <a name="WebFunctionDeployment" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment"></a>
|
|
@@ -3031,10 +4184,132 @@ endpoint serves from, including a MULTI_REGION global URL.
|
|
|
3031
4184
|
|
|
3032
4185
|
- *Extends:* aws-cdk-lib.IResource, aws-cdk-lib.interfaces.aws_lambda.IWebFunctionRef
|
|
3033
4186
|
|
|
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>
|
|
4187
|
+
- *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.WebFunctionBase">WebFunctionBase</a>, <a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunction">IWebFunction</a>
|
|
4188
|
+
|
|
4189
|
+
A Lambda Web Function, created in this app (`WebFunction`) or imported (`WebFunction.fromWebFunctionArn`).
|
|
4190
|
+
|
|
4191
|
+
#### Methods <a name="Methods" id="Methods"></a>
|
|
4192
|
+
|
|
4193
|
+
| **Name** | **Description** |
|
|
4194
|
+
| --- | --- |
|
|
4195
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunction.grantInvoke">grantInvoke</a></code> | Allows `grantee` to call the function's endpoint (`lambda:InvokeWebFunctionEndpoint`): the default endpoint of a `WebFunction`; |
|
|
4196
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunction.metric">metric</a></code> | A metric of the function's execution environments in `AWS/Lambda/Web` (dimension `FunctionName`). |
|
|
4197
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunction.metricActiveTime">metricActiveTime</a></code> | Time the execution environments were active (`EnvironmentActiveTime`). |
|
|
4198
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunction.metricConcurrentRequests">metricConcurrentRequests</a></code> | Requests an execution environment handled at once (`EnvironmentConcurrentRequests`, maximum). |
|
|
4199
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunction.metricCpuTime">metricCpuTime</a></code> | CPU time the execution environments used (`EnvironmentCPUTime`). |
|
|
4200
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunction.metricMaxMemoryUsage">metricMaxMemoryUsage</a></code> | Peak memory an execution environment used (`EnvironmentMaxMemoryUsage`, maximum). |
|
|
4201
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunction.metricResponseBytes">metricResponseBytes</a></code> | Bytes sent in responses (`ResponseBytes`). |
|
|
4202
|
+
|
|
4203
|
+
---
|
|
4204
|
+
|
|
4205
|
+
##### `grantInvoke` <a name="grantInvoke" id="@ashishpandeyone/cdk-lambda-web-function.IWebFunction.grantInvoke"></a>
|
|
4206
|
+
|
|
4207
|
+
```typescript
|
|
4208
|
+
public grantInvoke(grantee: IGrantable): Grant
|
|
4209
|
+
```
|
|
4210
|
+
|
|
4211
|
+
Allows `grantee` to call the function's endpoint (`lambda:InvokeWebFunctionEndpoint`): the default endpoint of a `WebFunction`;
|
|
4212
|
+
|
|
4213
|
+
for an imported function, the endpoint named in its attributes, or every endpoint.
|
|
3035
4214
|
|
|
3036
|
-
|
|
4215
|
+
This adds to the grantee's IAM policy. For a function in another account, its resource policy must also allow the grantee.
|
|
4216
|
+
[disable-awslint:no-grants]
|
|
4217
|
+
|
|
4218
|
+
###### `grantee`<sup>Required</sup> <a name="grantee" id="@ashishpandeyone/cdk-lambda-web-function.IWebFunction.grantInvoke.parameter.grantee"></a>
|
|
4219
|
+
|
|
4220
|
+
- *Type:* aws-cdk-lib.aws_iam.IGrantable
|
|
4221
|
+
|
|
4222
|
+
---
|
|
4223
|
+
|
|
4224
|
+
##### `metric` <a name="metric" id="@ashishpandeyone/cdk-lambda-web-function.IWebFunction.metric"></a>
|
|
4225
|
+
|
|
4226
|
+
```typescript
|
|
4227
|
+
public metric(metricName: string, props?: MetricOptions): Metric
|
|
4228
|
+
```
|
|
4229
|
+
|
|
4230
|
+
A metric of the function's execution environments in `AWS/Lambda/Web` (dimension `FunctionName`).
|
|
4231
|
+
|
|
4232
|
+
###### `metricName`<sup>Required</sup> <a name="metricName" id="@ashishpandeyone/cdk-lambda-web-function.IWebFunction.metric.parameter.metricName"></a>
|
|
4233
|
+
|
|
4234
|
+
- *Type:* string
|
|
4235
|
+
|
|
4236
|
+
---
|
|
4237
|
+
|
|
4238
|
+
###### `props`<sup>Optional</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.IWebFunction.metric.parameter.props"></a>
|
|
4239
|
+
|
|
4240
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
|
|
4241
|
+
|
|
4242
|
+
---
|
|
4243
|
+
|
|
4244
|
+
##### `metricActiveTime` <a name="metricActiveTime" id="@ashishpandeyone/cdk-lambda-web-function.IWebFunction.metricActiveTime"></a>
|
|
4245
|
+
|
|
4246
|
+
```typescript
|
|
4247
|
+
public metricActiveTime(props?: MetricOptions): Metric
|
|
4248
|
+
```
|
|
4249
|
+
|
|
4250
|
+
Time the execution environments were active (`EnvironmentActiveTime`).
|
|
4251
|
+
|
|
4252
|
+
###### `props`<sup>Optional</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.IWebFunction.metricActiveTime.parameter.props"></a>
|
|
4253
|
+
|
|
4254
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
|
|
4255
|
+
|
|
4256
|
+
---
|
|
4257
|
+
|
|
4258
|
+
##### `metricConcurrentRequests` <a name="metricConcurrentRequests" id="@ashishpandeyone/cdk-lambda-web-function.IWebFunction.metricConcurrentRequests"></a>
|
|
4259
|
+
|
|
4260
|
+
```typescript
|
|
4261
|
+
public metricConcurrentRequests(props?: MetricOptions): Metric
|
|
4262
|
+
```
|
|
4263
|
+
|
|
4264
|
+
Requests an execution environment handled at once (`EnvironmentConcurrentRequests`, maximum).
|
|
4265
|
+
|
|
4266
|
+
###### `props`<sup>Optional</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.IWebFunction.metricConcurrentRequests.parameter.props"></a>
|
|
4267
|
+
|
|
4268
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
|
|
4269
|
+
|
|
4270
|
+
---
|
|
4271
|
+
|
|
4272
|
+
##### `metricCpuTime` <a name="metricCpuTime" id="@ashishpandeyone/cdk-lambda-web-function.IWebFunction.metricCpuTime"></a>
|
|
4273
|
+
|
|
4274
|
+
```typescript
|
|
4275
|
+
public metricCpuTime(props?: MetricOptions): Metric
|
|
4276
|
+
```
|
|
4277
|
+
|
|
4278
|
+
CPU time the execution environments used (`EnvironmentCPUTime`).
|
|
4279
|
+
|
|
4280
|
+
###### `props`<sup>Optional</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.IWebFunction.metricCpuTime.parameter.props"></a>
|
|
4281
|
+
|
|
4282
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
|
|
4283
|
+
|
|
4284
|
+
---
|
|
4285
|
+
|
|
4286
|
+
##### `metricMaxMemoryUsage` <a name="metricMaxMemoryUsage" id="@ashishpandeyone/cdk-lambda-web-function.IWebFunction.metricMaxMemoryUsage"></a>
|
|
3037
4287
|
|
|
4288
|
+
```typescript
|
|
4289
|
+
public metricMaxMemoryUsage(props?: MetricOptions): Metric
|
|
4290
|
+
```
|
|
4291
|
+
|
|
4292
|
+
Peak memory an execution environment used (`EnvironmentMaxMemoryUsage`, maximum).
|
|
4293
|
+
|
|
4294
|
+
###### `props`<sup>Optional</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.IWebFunction.metricMaxMemoryUsage.parameter.props"></a>
|
|
4295
|
+
|
|
4296
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
|
|
4297
|
+
|
|
4298
|
+
---
|
|
4299
|
+
|
|
4300
|
+
##### `metricResponseBytes` <a name="metricResponseBytes" id="@ashishpandeyone/cdk-lambda-web-function.IWebFunction.metricResponseBytes"></a>
|
|
4301
|
+
|
|
4302
|
+
```typescript
|
|
4303
|
+
public metricResponseBytes(props?: MetricOptions): Metric
|
|
4304
|
+
```
|
|
4305
|
+
|
|
4306
|
+
Bytes sent in responses (`ResponseBytes`).
|
|
4307
|
+
|
|
4308
|
+
###### `props`<sup>Optional</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.IWebFunction.metricResponseBytes.parameter.props"></a>
|
|
4309
|
+
|
|
4310
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
|
|
4311
|
+
|
|
4312
|
+
---
|
|
3038
4313
|
|
|
3039
4314
|
#### Properties <a name="Properties" id="Properties"></a>
|
|
3040
4315
|
|