@ashishpandeyone/cdk-lambda-web-function 0.1.3 → 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/API.md CHANGED
@@ -51,9 +51,6 @@ 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.addEndpoint">addEndpoint</a></code> | Adds an endpoint (up to 10 per function), e.g. a public one next to an IAM-only one, or one pinned to an earlier revision. Each endpoint has its own URL, authentication, regions and limits. |
55
- | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addEnvironment">addEnvironment</a></code> | Adds an environment variable. |
56
- | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addToRolePolicy">addToRolePolicy</a></code> | Adds a statement to the execution role's policy. |
57
54
  | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.grantInvoke">grantInvoke</a></code> | Allows `grantee` to call the endpoint. |
58
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. |
59
56
  | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.metricActiveTime">metricActiveTime</a></code> | Time the execution environments were active (`EnvironmentActiveTime`). |
@@ -61,6 +58,9 @@ new NodejsWebFunction(scope: Construct, id: string, props: NodejsWebFunctionProp
61
58
  | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.metricCpuTime">metricCpuTime</a></code> | CPU time the execution environments used (`EnvironmentCPUTime`). |
62
59
  | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.metricMaxMemoryUsage">metricMaxMemoryUsage</a></code> | Peak memory an execution environment used (`EnvironmentMaxMemoryUsage`); |
63
60
  | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.metricResponseBytes">metricResponseBytes</a></code> | Bytes sent in responses (`ResponseBytes`). |
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. |
62
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addEnvironment">addEnvironment</a></code> | Adds an environment variable. |
63
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addToRolePolicy">addToRolePolicy</a></code> | Adds a statement to the execution role's policy. |
64
64
 
65
65
  ---
66
66
 
@@ -135,64 +135,6 @@ account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
135
135
 
136
136
  ---
137
137
 
138
- ##### `addEndpoint` <a name="addEndpoint" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addEndpoint"></a>
139
-
140
- ```typescript
141
- public addEndpoint(id: string, options: AddWebFunctionEndpointOptions): WebFunctionEndpoint
142
- ```
143
-
144
- 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.
145
-
146
- ###### `id`<sup>Required</sup> <a name="id" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addEndpoint.parameter.id"></a>
147
-
148
- - *Type:* string
149
-
150
- the endpoint's construct ID, also used in its generated name (`<id>-<hash>`).
151
-
152
- ---
153
-
154
- ###### `options`<sup>Required</sup> <a name="options" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addEndpoint.parameter.options"></a>
155
-
156
- - *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions">AddWebFunctionEndpointOptions</a>
157
-
158
- ---
159
-
160
- ##### `addEnvironment` <a name="addEnvironment" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addEnvironment"></a>
161
-
162
- ```typescript
163
- public addEnvironment(key: string, value: string): WebFunction
164
- ```
165
-
166
- Adds an environment variable.
167
-
168
- Names starting with `AWS_` are reserved.
169
-
170
- ###### `key`<sup>Required</sup> <a name="key" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addEnvironment.parameter.key"></a>
171
-
172
- - *Type:* string
173
-
174
- ---
175
-
176
- ###### `value`<sup>Required</sup> <a name="value" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addEnvironment.parameter.value"></a>
177
-
178
- - *Type:* string
179
-
180
- ---
181
-
182
- ##### `addToRolePolicy` <a name="addToRolePolicy" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addToRolePolicy"></a>
183
-
184
- ```typescript
185
- public addToRolePolicy(statement: PolicyStatement): void
186
- ```
187
-
188
- Adds a statement to the execution role's policy.
189
-
190
- ###### `statement`<sup>Required</sup> <a name="statement" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addToRolePolicy.parameter.statement"></a>
191
-
192
- - *Type:* aws-cdk-lib.aws_iam.PolicyStatement
193
-
194
- ---
195
-
196
138
  ##### `grantInvoke` <a name="grantInvoke" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.grantInvoke"></a>
197
139
 
198
140
  ```typescript
@@ -307,6 +249,64 @@ Bytes sent in responses (`ResponseBytes`).
307
249
 
308
250
  ---
309
251
 
252
+ ##### `addEndpoint` <a name="addEndpoint" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addEndpoint"></a>
253
+
254
+ ```typescript
255
+ public addEndpoint(id: string, options: AddWebFunctionEndpointOptions): WebFunctionEndpoint
256
+ ```
257
+
258
+ 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.
259
+
260
+ ###### `id`<sup>Required</sup> <a name="id" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addEndpoint.parameter.id"></a>
261
+
262
+ - *Type:* string
263
+
264
+ the endpoint's construct ID, also used in its generated name (`<id>-<hash>`).
265
+
266
+ ---
267
+
268
+ ###### `options`<sup>Required</sup> <a name="options" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addEndpoint.parameter.options"></a>
269
+
270
+ - *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions">AddWebFunctionEndpointOptions</a>
271
+
272
+ ---
273
+
274
+ ##### `addEnvironment` <a name="addEnvironment" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addEnvironment"></a>
275
+
276
+ ```typescript
277
+ public addEnvironment(key: string, value: string): WebFunction
278
+ ```
279
+
280
+ Adds an environment variable.
281
+
282
+ Names starting with `AWS_` are reserved.
283
+
284
+ ###### `key`<sup>Required</sup> <a name="key" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addEnvironment.parameter.key"></a>
285
+
286
+ - *Type:* string
287
+
288
+ ---
289
+
290
+ ###### `value`<sup>Required</sup> <a name="value" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addEnvironment.parameter.value"></a>
291
+
292
+ - *Type:* string
293
+
294
+ ---
295
+
296
+ ##### `addToRolePolicy` <a name="addToRolePolicy" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addToRolePolicy"></a>
297
+
298
+ ```typescript
299
+ public addToRolePolicy(statement: PolicyStatement): void
300
+ ```
301
+
302
+ Adds a statement to the execution role's policy.
303
+
304
+ ###### `statement`<sup>Required</sup> <a name="statement" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addToRolePolicy.parameter.statement"></a>
305
+
306
+ - *Type:* aws-cdk-lib.aws_iam.PolicyStatement
307
+
308
+ ---
309
+
310
310
  #### Static Functions <a name="Static Functions" id="Static Functions"></a>
311
311
 
312
312
  | **Name** | **Description** |
@@ -314,6 +314,9 @@ Bytes sent in responses (`ResponseBytes`).
314
314
  | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.isConstruct">isConstruct</a></code> | Checks if `x` is a construct. |
315
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. |
316
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. |
317
320
 
318
321
  ---
319
322
 
@@ -381,6 +384,90 @@ Check whether the given construct is a Resource.
381
384
 
382
385
  ---
383
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
+
384
471
  #### Properties <a name="Properties" id="Properties"></a>
385
472
 
386
473
  | **Name** | **Type** | **Description** |
@@ -388,6 +475,9 @@ Check whether the given construct is a Resource.
388
475
  | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. |
389
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. |
390
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`. |
391
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. |
392
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. |
393
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). |
@@ -395,9 +485,6 @@ Check whether the given construct is a Resource.
395
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. |
396
486
  | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.revisionId">revisionId</a></code> | <code>string</code> | The ID of the current revision. |
397
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. |
398
- | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.webFunctionArn">webFunctionArn</a></code> | <code>string</code> | The function's ARN. |
399
- | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.webFunctionName">webFunctionName</a></code> | <code>string</code> | The function's name. |
400
- | <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`. |
401
488
 
402
489
  ---
403
490
 
@@ -445,6 +532,42 @@ The stack in which this resource is defined.
445
532
 
446
533
  ---
447
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
+
448
571
  ##### `currentRevision`<sup>Required</sup> <a name="currentRevision" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.currentRevision"></a>
449
572
 
450
573
  ```typescript
@@ -535,68 +658,32 @@ The execution role.
535
658
 
536
659
  ---
537
660
 
538
- ##### `webFunctionArn`<sup>Required</sup> <a name="webFunctionArn" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.webFunctionArn"></a>
539
661
 
540
- ```typescript
541
- public readonly webFunctionArn: string;
542
- ```
662
+ ### WebFunction <a name="WebFunction" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction"></a>
543
663
 
544
- - *Type:* string
664
+ - *Implements:* aws-cdk-lib.aws_iam.IGrantable
545
665
 
546
- The function's ARN.
666
+ A Node.js HTTP server running as an AWS Lambda Web Function, served from one or more regions.
547
667
 
548
- ---
668
+ Creates the function, its current revision (code and configuration; any change creates a new one,
669
+ and the newest `revisionRetention` are kept), a default HTTPS endpoint, an execution role, and owns
670
+ the function's log groups in every region its endpoints serve from.
549
671
 
550
- ##### `webFunctionName`<sup>Required</sup> <a name="webFunctionName" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.webFunctionName"></a>
672
+ Use `fromWebFunctionArn`, `fromWebFunctionName` or `fromWebFunctionAttributes` for a function defined elsewhere.
673
+
674
+ #### Initializers <a name="Initializers" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.Initializer"></a>
551
675
 
552
676
  ```typescript
553
- public readonly webFunctionName: string;
554
- ```
677
+ import { WebFunction } from '@ashishpandeyone/cdk-lambda-web-function'
555
678
 
556
- - *Type:* string
679
+ new WebFunction(scope: Construct, id: string, props: WebFunctionProps)
680
+ ```
557
681
 
558
- The function's name.
559
-
560
- ---
561
-
562
- ##### `webFunctionRef`<sup>Required</sup> <a name="webFunctionRef" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.webFunctionRef"></a>
563
-
564
- ```typescript
565
- public readonly webFunctionRef: WebFunctionReference;
566
- ```
567
-
568
- - *Type:* aws-cdk-lib.interfaces.aws_lambda.WebFunctionReference
569
-
570
- A reference to this function, for APIs that accept `lambda.IWebFunctionRef`.
571
-
572
- ---
573
-
574
-
575
- ### WebFunction <a name="WebFunction" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction"></a>
576
-
577
- - *Implements:* <a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunction">IWebFunction</a>, aws-cdk-lib.aws_iam.IGrantable
578
-
579
- A Node.js HTTP server running as an AWS Lambda Web Function, served from one or more regions.
580
-
581
- Creates the function, its current revision (code and configuration; any change creates a new one,
582
- and the newest `revisionRetention` are kept), a default HTTPS endpoint, an execution role, and owns
583
- the function's log groups in every region its endpoints serve from.
584
-
585
- Importing existing functions (`fromXxx` methods) is planned after 0.1.
586
-
587
- #### Initializers <a name="Initializers" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.Initializer"></a>
588
-
589
- ```typescript
590
- import { WebFunction } from '@ashishpandeyone/cdk-lambda-web-function'
591
-
592
- new WebFunction(scope: Construct, id: string, props: WebFunctionProps)
593
- ```
594
-
595
- | **Name** | **Type** | **Description** |
596
- | --- | --- | --- |
597
- | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.Initializer.parameter.scope">scope</a></code> | <code>constructs.Construct</code> | *No description.* |
598
- | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.Initializer.parameter.id">id</a></code> | <code>string</code> | *No description.* |
599
- | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.Initializer.parameter.props">props</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps">WebFunctionProps</a></code> | *No description.* |
682
+ | **Name** | **Type** | **Description** |
683
+ | --- | --- | --- |
684
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.Initializer.parameter.scope">scope</a></code> | <code>constructs.Construct</code> | *No description.* |
685
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.Initializer.parameter.id">id</a></code> | <code>string</code> | *No description.* |
686
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.Initializer.parameter.props">props</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps">WebFunctionProps</a></code> | *No description.* |
600
687
 
601
688
  ---
602
689
 
@@ -626,9 +713,6 @@ new WebFunction(scope: Construct, id: string, props: WebFunctionProps)
626
713
  | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.with">with</a></code> | Applies one or more mixins to this construct. |
627
714
  | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.applyCrossStackReferenceStrength">applyCrossStackReferenceStrength</a></code> | Override the cross-stack reference strength for this resource. |
628
715
  | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.applyRemovalPolicy">applyRemovalPolicy</a></code> | Apply the given removal policy to this resource. |
629
- | <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. |
630
- | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEnvironment">addEnvironment</a></code> | Adds an environment variable. |
631
- | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.addToRolePolicy">addToRolePolicy</a></code> | Adds a statement to the execution role's policy. |
632
716
  | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.grantInvoke">grantInvoke</a></code> | Allows `grantee` to call the endpoint. |
633
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. |
634
718
  | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.metricActiveTime">metricActiveTime</a></code> | Time the execution environments were active (`EnvironmentActiveTime`). |
@@ -636,6 +720,9 @@ new WebFunction(scope: Construct, id: string, props: WebFunctionProps)
636
720
  | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.metricCpuTime">metricCpuTime</a></code> | CPU time the execution environments used (`EnvironmentCPUTime`). |
637
721
  | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.metricMaxMemoryUsage">metricMaxMemoryUsage</a></code> | Peak memory an execution environment used (`EnvironmentMaxMemoryUsage`); |
638
722
  | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.metricResponseBytes">metricResponseBytes</a></code> | Bytes sent in responses (`ResponseBytes`). |
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. |
724
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEnvironment">addEnvironment</a></code> | Adds an environment variable. |
725
+ | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.addToRolePolicy">addToRolePolicy</a></code> | Adds a statement to the execution role's policy. |
639
726
 
640
727
  ---
641
728
 
@@ -710,64 +797,6 @@ account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
710
797
 
711
798
  ---
712
799
 
713
- ##### `addEndpoint` <a name="addEndpoint" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEndpoint"></a>
714
-
715
- ```typescript
716
- public addEndpoint(id: string, options: AddWebFunctionEndpointOptions): WebFunctionEndpoint
717
- ```
718
-
719
- 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.
720
-
721
- ###### `id`<sup>Required</sup> <a name="id" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEndpoint.parameter.id"></a>
722
-
723
- - *Type:* string
724
-
725
- the endpoint's construct ID, also used in its generated name (`<id>-<hash>`).
726
-
727
- ---
728
-
729
- ###### `options`<sup>Required</sup> <a name="options" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEndpoint.parameter.options"></a>
730
-
731
- - *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions">AddWebFunctionEndpointOptions</a>
732
-
733
- ---
734
-
735
- ##### `addEnvironment` <a name="addEnvironment" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEnvironment"></a>
736
-
737
- ```typescript
738
- public addEnvironment(key: string, value: string): WebFunction
739
- ```
740
-
741
- Adds an environment variable.
742
-
743
- Names starting with `AWS_` are reserved.
744
-
745
- ###### `key`<sup>Required</sup> <a name="key" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEnvironment.parameter.key"></a>
746
-
747
- - *Type:* string
748
-
749
- ---
750
-
751
- ###### `value`<sup>Required</sup> <a name="value" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEnvironment.parameter.value"></a>
752
-
753
- - *Type:* string
754
-
755
- ---
756
-
757
- ##### `addToRolePolicy` <a name="addToRolePolicy" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addToRolePolicy"></a>
758
-
759
- ```typescript
760
- public addToRolePolicy(statement: PolicyStatement): void
761
- ```
762
-
763
- Adds a statement to the execution role's policy.
764
-
765
- ###### `statement`<sup>Required</sup> <a name="statement" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addToRolePolicy.parameter.statement"></a>
766
-
767
- - *Type:* aws-cdk-lib.aws_iam.PolicyStatement
768
-
769
- ---
770
-
771
800
  ##### `grantInvoke` <a name="grantInvoke" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.grantInvoke"></a>
772
801
 
773
802
  ```typescript
@@ -882,6 +911,64 @@ Bytes sent in responses (`ResponseBytes`).
882
911
 
883
912
  ---
884
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>`).
927
+
928
+ ---
929
+
930
+ ###### `options`<sup>Required</sup> <a name="options" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEndpoint.parameter.options"></a>
931
+
932
+ - *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions">AddWebFunctionEndpointOptions</a>
933
+
934
+ ---
935
+
936
+ ##### `addEnvironment` <a name="addEnvironment" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEnvironment"></a>
937
+
938
+ ```typescript
939
+ public addEnvironment(key: string, value: string): WebFunction
940
+ ```
941
+
942
+ Adds an environment variable.
943
+
944
+ Names starting with `AWS_` are reserved.
945
+
946
+ ###### `key`<sup>Required</sup> <a name="key" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEnvironment.parameter.key"></a>
947
+
948
+ - *Type:* string
949
+
950
+ ---
951
+
952
+ ###### `value`<sup>Required</sup> <a name="value" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEnvironment.parameter.value"></a>
953
+
954
+ - *Type:* string
955
+
956
+ ---
957
+
958
+ ##### `addToRolePolicy` <a name="addToRolePolicy" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addToRolePolicy"></a>
959
+
960
+ ```typescript
961
+ public addToRolePolicy(statement: PolicyStatement): void
962
+ ```
963
+
964
+ Adds a statement to the execution role's policy.
965
+
966
+ ###### `statement`<sup>Required</sup> <a name="statement" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addToRolePolicy.parameter.statement"></a>
967
+
968
+ - *Type:* aws-cdk-lib.aws_iam.PolicyStatement
969
+
970
+ ---
971
+
885
972
  #### Static Functions <a name="Static Functions" id="Static Functions"></a>
886
973
 
887
974
  | **Name** | **Description** |
@@ -889,6 +976,9 @@ Bytes sent in responses (`ResponseBytes`).
889
976
  | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.isConstruct">isConstruct</a></code> | Checks if `x` is a construct. |
890
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. |
891
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. |
892
982
 
893
983
  ---
894
984
 
@@ -956,6 +1046,90 @@ Check whether the given construct is a Resource.
956
1046
 
957
1047
  ---
958
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
+
959
1133
  #### Properties <a name="Properties" id="Properties"></a>
960
1134
 
961
1135
  | **Name** | **Type** | **Description** |
@@ -963,6 +1137,9 @@ Check whether the given construct is a Resource.
963
1137
  | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. |
964
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. |
965
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`. |
966
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. |
967
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. |
968
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). |
@@ -970,9 +1147,6 @@ Check whether the given construct is a Resource.
970
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. |
971
1148
  | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.revisionId">revisionId</a></code> | <code>string</code> | The ID of the current revision. |
972
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. |
973
- | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.webFunctionArn">webFunctionArn</a></code> | <code>string</code> | The function's ARN. |
974
- | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.webFunctionName">webFunctionName</a></code> | <code>string</code> | The function's name. |
975
- | <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`. |
976
1150
 
977
1151
  ---
978
1152
 
@@ -984,133 +1158,543 @@ public readonly node: Node;
984
1158
 
985
1159
  - *Type:* constructs.Node
986
1160
 
987
- The tree node.
1161
+ The tree node.
1162
+
1163
+ ---
1164
+
1165
+ ##### `env`<sup>Required</sup> <a name="env" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.env"></a>
1166
+
1167
+ ```typescript
1168
+ public readonly env: ResourceEnvironment;
1169
+ ```
1170
+
1171
+ - *Type:* aws-cdk-lib.interfaces.ResourceEnvironment
1172
+
1173
+ The environment this resource belongs to.
1174
+
1175
+ For resources that are created and managed in a Stack (those created by
1176
+ creating new class instances like `new Role()`, `new Bucket()`, etc.), this
1177
+ is always the same as the environment of the stack they belong to.
1178
+
1179
+ For referenced resources (those obtained from referencing methods like
1180
+ `Role.fromRoleArn()`, `Bucket.fromBucketName()`, etc.), they might be
1181
+ different than the stack they were imported into.
1182
+
1183
+ ---
1184
+
1185
+ ##### `stack`<sup>Required</sup> <a name="stack" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.stack"></a>
1186
+
1187
+ ```typescript
1188
+ public readonly stack: Stack;
1189
+ ```
1190
+
1191
+ - *Type:* aws-cdk-lib.Stack
1192
+
1193
+ The stack in which this resource is defined.
1194
+
1195
+ ---
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
+
1233
+ ##### `currentRevision`<sup>Required</sup> <a name="currentRevision" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.currentRevision"></a>
1234
+
1235
+ ```typescript
1236
+ public readonly currentRevision: IWebFunctionRevision;
1237
+ ```
1238
+
1239
+ - *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision">IWebFunctionRevision</a>
1240
+
1241
+ The revision built from the current code and configuration.
1242
+
1243
+ ---
1244
+
1245
+ ##### `endpoint`<sup>Required</sup> <a name="endpoint" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.endpoint"></a>
1246
+
1247
+ ```typescript
1248
+ public readonly endpoint: WebFunctionEndpoint;
1249
+ ```
1250
+
1251
+ - *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint">WebFunctionEndpoint</a>
1252
+
1253
+ The default endpoint.
1254
+
1255
+ Add more with `addEndpoint`.
1256
+
1257
+ ---
1258
+
1259
+ ##### `grantPrincipal`<sup>Required</sup> <a name="grantPrincipal" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.grantPrincipal"></a>
1260
+
1261
+ ```typescript
1262
+ public readonly grantPrincipal: IPrincipal;
1263
+ ```
1264
+
1265
+ - *Type:* aws-cdk-lib.aws_iam.IPrincipal
1266
+
1267
+ The principal to grant permissions to (the execution role).
1268
+
1269
+ ---
1270
+
1271
+ ##### `grants`<sup>Required</sup> <a name="grants" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.grants"></a>
1272
+
1273
+ ```typescript
1274
+ public readonly grants: WebFunctionGrants;
1275
+ ```
1276
+
1277
+ - *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionGrants">WebFunctionGrants</a>
1278
+
1279
+ Grants on the default endpoint (e.g. `grants.invoke(principal)`). Other endpoints have their own `grants`.
1280
+
1281
+ ---
1282
+
1283
+ ##### `logGroup`<sup>Required</sup> <a name="logGroup" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.logGroup"></a>
1284
+
1285
+ ```typescript
1286
+ public readonly logGroup: ILogGroup;
1287
+ ```
1288
+
1289
+ - *Type:* aws-cdk-lib.aws_logs.ILogGroup
1290
+
1291
+ The home-region log group that receives the logs of every region the function serves from.
1292
+
1293
+ Subscribe to this one only: each region's `.local` group holds a copy of the same events.
1294
+
1295
+ ---
1296
+
1297
+ ##### `revisionId`<sup>Required</sup> <a name="revisionId" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.revisionId"></a>
1298
+
1299
+ ```typescript
1300
+ public readonly revisionId: string;
1301
+ ```
1302
+
1303
+ - *Type:* string
1304
+
1305
+ The ID of the current revision.
1306
+
1307
+ Same as `currentRevision.revisionId`.
1308
+
1309
+ ---
1310
+
1311
+ ##### `role`<sup>Required</sup> <a name="role" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.role"></a>
1312
+
1313
+ ```typescript
1314
+ public readonly role: IRole;
1315
+ ```
1316
+
1317
+ - *Type:* aws-cdk-lib.aws_iam.IRole
1318
+
1319
+ The execution role.
1320
+
1321
+ ---
1322
+
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>
1331
+
1332
+ ```typescript
1333
+ import { WebFunctionBase } from '@ashishpandeyone/cdk-lambda-web-function'
1334
+
1335
+ new WebFunctionBase(scope: Construct, id: string, props?: ResourceProps)
1336
+ ```
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
+
1354
+ - *Type:* string
1355
+
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
1361
+
1362
+ ---
1363
+
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>
1383
+
1384
+ ```typescript
1385
+ public toString(): string
1386
+ ```
1387
+
1388
+ Returns a string representation of this construct.
1389
+
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[]
1406
+
1407
+ ---
1408
+
1409
+ ##### `applyCrossStackReferenceStrength` <a name="applyCrossStackReferenceStrength" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.applyCrossStackReferenceStrength"></a>
1410
+
1411
+ ```typescript
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
988
1533
 
989
1534
  ---
990
1535
 
991
- ##### `env`<sup>Required</sup> <a name="env" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.env"></a>
1536
+ ##### `metricMaxMemoryUsage` <a name="metricMaxMemoryUsage" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.metricMaxMemoryUsage"></a>
992
1537
 
993
1538
  ```typescript
994
- public readonly env: ResourceEnvironment;
1539
+ public metricMaxMemoryUsage(props?: MetricOptions): Metric
995
1540
  ```
996
1541
 
997
- - *Type:* aws-cdk-lib.interfaces.ResourceEnvironment
1542
+ Peak memory an execution environment used (`EnvironmentMaxMemoryUsage`);
998
1543
 
999
- The environment this resource belongs to.
1544
+ each environment has 2 GB.
1000
1545
 
1001
- For resources that are created and managed in a Stack (those created by
1002
- creating new class instances like `new Role()`, `new Bucket()`, etc.), this
1003
- is always the same as the environment of the stack they belong to.
1546
+ ###### `props`<sup>Optional</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.metricMaxMemoryUsage.parameter.props"></a>
1004
1547
 
1005
- For referenced resources (those obtained from referencing methods like
1006
- `Role.fromRoleArn()`, `Bucket.fromBucketName()`, etc.), they might be
1007
- different than the stack they were imported into.
1548
+ - *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
1008
1549
 
1009
1550
  ---
1010
1551
 
1011
- ##### `stack`<sup>Required</sup> <a name="stack" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.stack"></a>
1552
+ ##### `metricResponseBytes` <a name="metricResponseBytes" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.metricResponseBytes"></a>
1012
1553
 
1013
1554
  ```typescript
1014
- public readonly stack: Stack;
1555
+ public metricResponseBytes(props?: MetricOptions): Metric
1015
1556
  ```
1016
1557
 
1017
- - *Type:* aws-cdk-lib.Stack
1018
-
1019
- The stack in which this resource is defined.
1558
+ Bytes sent in responses (`ResponseBytes`).
1020
1559
 
1021
- ---
1560
+ ###### `props`<sup>Optional</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.metricResponseBytes.parameter.props"></a>
1022
1561
 
1023
- ##### `currentRevision`<sup>Required</sup> <a name="currentRevision" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.currentRevision"></a>
1562
+ - *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
1024
1563
 
1025
- ```typescript
1026
- public readonly currentRevision: IWebFunctionRevision;
1027
- ```
1564
+ ---
1028
1565
 
1029
- - *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision">IWebFunctionRevision</a>
1566
+ #### Static Functions <a name="Static Functions" id="Static Functions"></a>
1030
1567
 
1031
- The revision built from the current code and configuration.
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. |
1032
1573
 
1033
1574
  ---
1034
1575
 
1035
- ##### `endpoint`<sup>Required</sup> <a name="endpoint" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.endpoint"></a>
1576
+ ##### `isConstruct` <a name="isConstruct" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.isConstruct"></a>
1036
1577
 
1037
1578
  ```typescript
1038
- public readonly endpoint: WebFunctionEndpoint;
1579
+ import { WebFunctionBase } from '@ashishpandeyone/cdk-lambda-web-function'
1580
+
1581
+ WebFunctionBase.isConstruct(x: any)
1039
1582
  ```
1040
1583
 
1041
- - *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint">WebFunctionEndpoint</a>
1584
+ Checks if `x` is a construct.
1042
1585
 
1043
- The default endpoint.
1586
+ Use this method instead of `instanceof` to properly detect `Construct`
1587
+ instances, even when the construct library is symlinked.
1044
1588
 
1045
- Add more with `addEndpoint`.
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.
1046
1605
 
1047
1606
  ---
1048
1607
 
1049
- ##### `grantPrincipal`<sup>Required</sup> <a name="grantPrincipal" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.grantPrincipal"></a>
1608
+ ##### `isOwnedResource` <a name="isOwnedResource" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.isOwnedResource"></a>
1050
1609
 
1051
1610
  ```typescript
1052
- public readonly grantPrincipal: IPrincipal;
1611
+ import { WebFunctionBase } from '@ashishpandeyone/cdk-lambda-web-function'
1612
+
1613
+ WebFunctionBase.isOwnedResource(construct: IConstruct)
1053
1614
  ```
1054
1615
 
1055
- - *Type:* aws-cdk-lib.aws_iam.IPrincipal
1616
+ Returns true if the construct was created by CDK, and false otherwise.
1056
1617
 
1057
- The principal to grant permissions to (the execution role).
1618
+ ###### `construct`<sup>Required</sup> <a name="construct" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.isOwnedResource.parameter.construct"></a>
1619
+
1620
+ - *Type:* constructs.IConstruct
1058
1621
 
1059
1622
  ---
1060
1623
 
1061
- ##### `grants`<sup>Required</sup> <a name="grants" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.grants"></a>
1624
+ ##### `isResource` <a name="isResource" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.isResource"></a>
1062
1625
 
1063
1626
  ```typescript
1064
- public readonly grants: WebFunctionGrants;
1627
+ import { WebFunctionBase } from '@ashishpandeyone/cdk-lambda-web-function'
1628
+
1629
+ WebFunctionBase.isResource(construct: IConstruct)
1065
1630
  ```
1066
1631
 
1067
- - *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionGrants">WebFunctionGrants</a>
1632
+ Check whether the given construct is a Resource.
1068
1633
 
1069
- Grants on the default endpoint (e.g. `grants.invoke(principal)`). Other endpoints have their own `grants`.
1634
+ ###### `construct`<sup>Required</sup> <a name="construct" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.isResource.parameter.construct"></a>
1635
+
1636
+ - *Type:* constructs.IConstruct
1070
1637
 
1071
1638
  ---
1072
1639
 
1073
- ##### `logGroup`<sup>Required</sup> <a name="logGroup" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.logGroup"></a>
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>
1074
1654
 
1075
1655
  ```typescript
1076
- public readonly logGroup: ILogGroup;
1656
+ public readonly node: Node;
1077
1657
  ```
1078
1658
 
1079
- - *Type:* aws-cdk-lib.aws_logs.ILogGroup
1080
-
1081
- The home-region log group that receives the logs of every region the function serves from.
1659
+ - *Type:* constructs.Node
1082
1660
 
1083
- Subscribe to this one only: each region's `.local` group holds a copy of the same events.
1661
+ The tree node.
1084
1662
 
1085
1663
  ---
1086
1664
 
1087
- ##### `revisionId`<sup>Required</sup> <a name="revisionId" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.revisionId"></a>
1665
+ ##### `env`<sup>Required</sup> <a name="env" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.property.env"></a>
1088
1666
 
1089
1667
  ```typescript
1090
- public readonly revisionId: string;
1668
+ public readonly env: ResourceEnvironment;
1091
1669
  ```
1092
1670
 
1093
- - *Type:* string
1671
+ - *Type:* aws-cdk-lib.interfaces.ResourceEnvironment
1094
1672
 
1095
- The ID of the current revision.
1673
+ The environment this resource belongs to.
1096
1674
 
1097
- Same as `currentRevision.revisionId`.
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.
1098
1682
 
1099
1683
  ---
1100
1684
 
1101
- ##### `role`<sup>Required</sup> <a name="role" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.role"></a>
1685
+ ##### `stack`<sup>Required</sup> <a name="stack" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.property.stack"></a>
1102
1686
 
1103
1687
  ```typescript
1104
- public readonly role: IRole;
1688
+ public readonly stack: Stack;
1105
1689
  ```
1106
1690
 
1107
- - *Type:* aws-cdk-lib.aws_iam.IRole
1691
+ - *Type:* aws-cdk-lib.Stack
1108
1692
 
1109
- The execution role.
1693
+ The stack in which this resource is defined.
1110
1694
 
1111
1695
  ---
1112
1696
 
1113
- ##### `webFunctionArn`<sup>Required</sup> <a name="webFunctionArn" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.webFunctionArn"></a>
1697
+ ##### `webFunctionArn`<sup>Required</sup> <a name="webFunctionArn" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.property.webFunctionArn"></a>
1114
1698
 
1115
1699
  ```typescript
1116
1700
  public readonly webFunctionArn: string;
@@ -1122,7 +1706,7 @@ The function's ARN.
1122
1706
 
1123
1707
  ---
1124
1708
 
1125
- ##### `webFunctionName`<sup>Required</sup> <a name="webFunctionName" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.webFunctionName"></a>
1709
+ ##### `webFunctionName`<sup>Required</sup> <a name="webFunctionName" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.property.webFunctionName"></a>
1126
1710
 
1127
1711
  ```typescript
1128
1712
  public readonly webFunctionName: string;
@@ -1134,7 +1718,7 @@ The function's name.
1134
1718
 
1135
1719
  ---
1136
1720
 
1137
- ##### `webFunctionRef`<sup>Required</sup> <a name="webFunctionRef" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.webFunctionRef"></a>
1721
+ ##### `webFunctionRef`<sup>Required</sup> <a name="webFunctionRef" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.property.webFunctionRef"></a>
1138
1722
 
1139
1723
  ```typescript
1140
1724
  public readonly webFunctionRef: WebFunctionReference;
@@ -2476,6 +3060,69 @@ The Node.js runtime.
2476
3060
 
2477
3061
  ---
2478
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
+
2479
3126
  ### WebFunctionCanaryDeploymentOptions <a name="WebFunctionCanaryDeploymentOptions" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionCanaryDeploymentOptions"></a>
2480
3127
 
2481
3128
  Options for a canary deployment.
@@ -3537,10 +4184,132 @@ endpoint serves from, including a MULTI_REGION global URL.
3537
4184
 
3538
4185
  - *Extends:* aws-cdk-lib.IResource, aws-cdk-lib.interfaces.aws_lambda.IWebFunctionRef
3539
4186
 
3540
- - *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.
4214
+
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>
3541
4273
 
3542
- A Lambda Web Function.
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>
4287
+
4288
+ ```typescript
4289
+ public metricMaxMemoryUsage(props?: MetricOptions): Metric
4290
+ ```
4291
+
4292
+ Peak memory an execution environment used (`EnvironmentMaxMemoryUsage`, maximum).
3543
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
+ ---
3544
4313
 
3545
4314
  #### Properties <a name="Properties" id="Properties"></a>
3546
4315