@ashishpandeyone/cdk-lambda-web-function 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.jsii +936 -116
- package/.jsii.tabl.json +1 -1
- package/API.md +1182 -200
- package/README.md +109 -7
- package/assets/web-function-deployment/index.js +58 -0
- package/assets/web-function-provider/index.js +23 -23
- package/lib/index.d.ts +2 -0
- package/lib/index.js +3 -1
- package/lib/nodejs-web-function.js +1 -1
- package/lib/private/provider-protocol.d.ts +40 -0
- package/lib/private/provider-protocol.js +9 -2
- package/lib/private/provider.js +2 -2
- package/lib/private/revision-cleanup.d.ts +19 -0
- package/lib/private/revision-cleanup.js +38 -0
- package/lib/private/traffic-shift.d.ts +20 -0
- package/lib/private/traffic-shift.js +143 -0
- package/lib/web-function-deployment.d.ts +89 -0
- package/lib/web-function-deployment.js +90 -0
- package/lib/web-function-endpoint.d.ts +122 -19
- package/lib/web-function-endpoint.js +139 -18
- package/lib/web-function-grants.d.ts +2 -2
- package/lib/web-function-grants.js +4 -4
- package/lib/web-function-revision.d.ts +45 -0
- package/lib/web-function-revision.js +40 -0
- package/lib/web-function.d.ts +39 -9
- package/lib/web-function.js +80 -26
- package/package.json +4 -1
package/API.md
CHANGED
|
@@ -51,6 +51,7 @@ 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. |
|
|
54
55
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addEnvironment">addEnvironment</a></code> | Adds an environment variable. |
|
|
55
56
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addToRolePolicy">addToRolePolicy</a></code> | Adds a statement to the execution role's policy. |
|
|
56
57
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.grantInvoke">grantInvoke</a></code> | Allows `grantee` to call the endpoint. |
|
|
@@ -128,6 +129,28 @@ account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
|
|
|
128
129
|
|
|
129
130
|
---
|
|
130
131
|
|
|
132
|
+
##### `addEndpoint` <a name="addEndpoint" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addEndpoint"></a>
|
|
133
|
+
|
|
134
|
+
```typescript
|
|
135
|
+
public addEndpoint(id: string, options: AddWebFunctionEndpointOptions): WebFunctionEndpoint
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Adds an endpoint (up to 10 per function), e.g. a public one next to an IAM-only one, or one pinned to an earlier revision. Each endpoint has its own URL, authentication, regions and limits.
|
|
139
|
+
|
|
140
|
+
###### `id`<sup>Required</sup> <a name="id" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addEndpoint.parameter.id"></a>
|
|
141
|
+
|
|
142
|
+
- *Type:* string
|
|
143
|
+
|
|
144
|
+
the endpoint's construct ID, also used in its generated name (`<id>-<hash>`).
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
###### `options`<sup>Required</sup> <a name="options" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addEndpoint.parameter.options"></a>
|
|
149
|
+
|
|
150
|
+
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions">AddWebFunctionEndpointOptions</a>
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
131
154
|
##### `addEnvironment` <a name="addEnvironment" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addEnvironment"></a>
|
|
132
155
|
|
|
133
156
|
```typescript
|
|
@@ -262,9 +285,10 @@ Check whether the given construct is a Resource.
|
|
|
262
285
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. |
|
|
263
286
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.env">env</a></code> | <code>aws-cdk-lib.interfaces.ResourceEnvironment</code> | The environment this resource belongs to. |
|
|
264
287
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.stack">stack</a></code> | <code>aws-cdk-lib.Stack</code> | The stack in which this resource is defined. |
|
|
265
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.
|
|
288
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.currentRevision">currentRevision</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision">IWebFunctionRevision</a></code> | The revision built from the current code and configuration. |
|
|
289
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.endpoint">endpoint</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint">WebFunctionEndpoint</a></code> | The default endpoint. |
|
|
266
290
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.grantPrincipal">grantPrincipal</a></code> | <code>aws-cdk-lib.aws_iam.IPrincipal</code> | The principal to grant permissions to (the execution role). |
|
|
267
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.grants">grants</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionGrants">WebFunctionGrants</a></code> | Grants on the
|
|
291
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.grants">grants</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionGrants">WebFunctionGrants</a></code> | Grants on the default endpoint (e.g. `grants.invoke(principal)`). Other endpoints have their own `grants`. |
|
|
268
292
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.logGroup">logGroup</a></code> | <code>aws-cdk-lib.aws_logs.ILogGroup</code> | The home-region log group that receives the logs of every region the function serves from. |
|
|
269
293
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.revisionId">revisionId</a></code> | <code>string</code> | The ID of the current revision. |
|
|
270
294
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.role">role</a></code> | <code>aws-cdk-lib.aws_iam.IRole</code> | The execution role. |
|
|
@@ -318,6 +342,18 @@ The stack in which this resource is defined.
|
|
|
318
342
|
|
|
319
343
|
---
|
|
320
344
|
|
|
345
|
+
##### `currentRevision`<sup>Required</sup> <a name="currentRevision" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.currentRevision"></a>
|
|
346
|
+
|
|
347
|
+
```typescript
|
|
348
|
+
public readonly currentRevision: IWebFunctionRevision;
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision">IWebFunctionRevision</a>
|
|
352
|
+
|
|
353
|
+
The revision built from the current code and configuration.
|
|
354
|
+
|
|
355
|
+
---
|
|
356
|
+
|
|
321
357
|
##### `endpoint`<sup>Required</sup> <a name="endpoint" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.endpoint"></a>
|
|
322
358
|
|
|
323
359
|
```typescript
|
|
@@ -326,7 +362,9 @@ public readonly endpoint: WebFunctionEndpoint;
|
|
|
326
362
|
|
|
327
363
|
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint">WebFunctionEndpoint</a>
|
|
328
364
|
|
|
329
|
-
The
|
|
365
|
+
The default endpoint.
|
|
366
|
+
|
|
367
|
+
Add more with `addEndpoint`.
|
|
330
368
|
|
|
331
369
|
---
|
|
332
370
|
|
|
@@ -350,7 +388,7 @@ public readonly grants: WebFunctionGrants;
|
|
|
350
388
|
|
|
351
389
|
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionGrants">WebFunctionGrants</a>
|
|
352
390
|
|
|
353
|
-
Grants on the
|
|
391
|
+
Grants on the default endpoint (e.g. `grants.invoke(principal)`). Other endpoints have their own `grants`.
|
|
354
392
|
|
|
355
393
|
---
|
|
356
394
|
|
|
@@ -378,6 +416,8 @@ public readonly revisionId: string;
|
|
|
378
416
|
|
|
379
417
|
The ID of the current revision.
|
|
380
418
|
|
|
419
|
+
Same as `currentRevision.revisionId`.
|
|
420
|
+
|
|
381
421
|
---
|
|
382
422
|
|
|
383
423
|
##### `role`<sup>Required</sup> <a name="role" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.role"></a>
|
|
@@ -435,8 +475,9 @@ A reference to this function, for APIs that accept `lambda.IWebFunctionRef`.
|
|
|
435
475
|
|
|
436
476
|
A Node.js HTTP server running as an AWS Lambda Web Function, served from one or more regions.
|
|
437
477
|
|
|
438
|
-
Creates the function, its current revision (code and configuration; any change
|
|
439
|
-
|
|
478
|
+
Creates the function, its current revision (code and configuration; any change creates a new one,
|
|
479
|
+
and the newest `revisionRetention` are kept), a default HTTPS endpoint, an execution role, and owns
|
|
480
|
+
the function's log groups in every region its endpoints serve from.
|
|
440
481
|
|
|
441
482
|
Importing existing functions (`fromXxx` methods) is planned after 0.1.
|
|
442
483
|
|
|
@@ -482,6 +523,7 @@ new WebFunction(scope: Construct, id: string, props: WebFunctionProps)
|
|
|
482
523
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.with">with</a></code> | Applies one or more mixins to this construct. |
|
|
483
524
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.applyCrossStackReferenceStrength">applyCrossStackReferenceStrength</a></code> | Override the cross-stack reference strength for this resource. |
|
|
484
525
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.applyRemovalPolicy">applyRemovalPolicy</a></code> | Apply the given removal policy to this resource. |
|
|
526
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEndpoint">addEndpoint</a></code> | Adds an endpoint (up to 10 per function), e.g. a public one next to an IAM-only one, or one pinned to an earlier revision. Each endpoint has its own URL, authentication, regions and limits. |
|
|
485
527
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEnvironment">addEnvironment</a></code> | Adds an environment variable. |
|
|
486
528
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.addToRolePolicy">addToRolePolicy</a></code> | Adds a statement to the execution role's policy. |
|
|
487
529
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.grantInvoke">grantInvoke</a></code> | Allows `grantee` to call the endpoint. |
|
|
@@ -559,6 +601,28 @@ account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
|
|
|
559
601
|
|
|
560
602
|
---
|
|
561
603
|
|
|
604
|
+
##### `addEndpoint` <a name="addEndpoint" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEndpoint"></a>
|
|
605
|
+
|
|
606
|
+
```typescript
|
|
607
|
+
public addEndpoint(id: string, options: AddWebFunctionEndpointOptions): WebFunctionEndpoint
|
|
608
|
+
```
|
|
609
|
+
|
|
610
|
+
Adds an endpoint (up to 10 per function), e.g. a public one next to an IAM-only one, or one pinned to an earlier revision. Each endpoint has its own URL, authentication, regions and limits.
|
|
611
|
+
|
|
612
|
+
###### `id`<sup>Required</sup> <a name="id" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEndpoint.parameter.id"></a>
|
|
613
|
+
|
|
614
|
+
- *Type:* string
|
|
615
|
+
|
|
616
|
+
the endpoint's construct ID, also used in its generated name (`<id>-<hash>`).
|
|
617
|
+
|
|
618
|
+
---
|
|
619
|
+
|
|
620
|
+
###### `options`<sup>Required</sup> <a name="options" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEndpoint.parameter.options"></a>
|
|
621
|
+
|
|
622
|
+
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions">AddWebFunctionEndpointOptions</a>
|
|
623
|
+
|
|
624
|
+
---
|
|
625
|
+
|
|
562
626
|
##### `addEnvironment` <a name="addEnvironment" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEnvironment"></a>
|
|
563
627
|
|
|
564
628
|
```typescript
|
|
@@ -693,9 +757,10 @@ Check whether the given construct is a Resource.
|
|
|
693
757
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. |
|
|
694
758
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.env">env</a></code> | <code>aws-cdk-lib.interfaces.ResourceEnvironment</code> | The environment this resource belongs to. |
|
|
695
759
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.stack">stack</a></code> | <code>aws-cdk-lib.Stack</code> | The stack in which this resource is defined. |
|
|
696
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.
|
|
760
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.currentRevision">currentRevision</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision">IWebFunctionRevision</a></code> | The revision built from the current code and configuration. |
|
|
761
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.endpoint">endpoint</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint">WebFunctionEndpoint</a></code> | The default endpoint. |
|
|
697
762
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.grantPrincipal">grantPrincipal</a></code> | <code>aws-cdk-lib.aws_iam.IPrincipal</code> | The principal to grant permissions to (the execution role). |
|
|
698
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.grants">grants</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionGrants">WebFunctionGrants</a></code> | Grants on the
|
|
763
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.grants">grants</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionGrants">WebFunctionGrants</a></code> | Grants on the default endpoint (e.g. `grants.invoke(principal)`). Other endpoints have their own `grants`. |
|
|
699
764
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.logGroup">logGroup</a></code> | <code>aws-cdk-lib.aws_logs.ILogGroup</code> | The home-region log group that receives the logs of every region the function serves from. |
|
|
700
765
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.revisionId">revisionId</a></code> | <code>string</code> | The ID of the current revision. |
|
|
701
766
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.role">role</a></code> | <code>aws-cdk-lib.aws_iam.IRole</code> | The execution role. |
|
|
@@ -749,6 +814,18 @@ The stack in which this resource is defined.
|
|
|
749
814
|
|
|
750
815
|
---
|
|
751
816
|
|
|
817
|
+
##### `currentRevision`<sup>Required</sup> <a name="currentRevision" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.currentRevision"></a>
|
|
818
|
+
|
|
819
|
+
```typescript
|
|
820
|
+
public readonly currentRevision: IWebFunctionRevision;
|
|
821
|
+
```
|
|
822
|
+
|
|
823
|
+
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision">IWebFunctionRevision</a>
|
|
824
|
+
|
|
825
|
+
The revision built from the current code and configuration.
|
|
826
|
+
|
|
827
|
+
---
|
|
828
|
+
|
|
752
829
|
##### `endpoint`<sup>Required</sup> <a name="endpoint" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.endpoint"></a>
|
|
753
830
|
|
|
754
831
|
```typescript
|
|
@@ -757,7 +834,9 @@ public readonly endpoint: WebFunctionEndpoint;
|
|
|
757
834
|
|
|
758
835
|
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint">WebFunctionEndpoint</a>
|
|
759
836
|
|
|
760
|
-
The
|
|
837
|
+
The default endpoint.
|
|
838
|
+
|
|
839
|
+
Add more with `addEndpoint`.
|
|
761
840
|
|
|
762
841
|
---
|
|
763
842
|
|
|
@@ -781,7 +860,7 @@ public readonly grants: WebFunctionGrants;
|
|
|
781
860
|
|
|
782
861
|
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionGrants">WebFunctionGrants</a>
|
|
783
862
|
|
|
784
|
-
Grants on the
|
|
863
|
+
Grants on the default endpoint (e.g. `grants.invoke(principal)`). Other endpoints have their own `grants`.
|
|
785
864
|
|
|
786
865
|
---
|
|
787
866
|
|
|
@@ -809,6 +888,8 @@ public readonly revisionId: string;
|
|
|
809
888
|
|
|
810
889
|
The ID of the current revision.
|
|
811
890
|
|
|
891
|
+
Same as `currentRevision.revisionId`.
|
|
892
|
+
|
|
812
893
|
---
|
|
813
894
|
|
|
814
895
|
##### `role`<sup>Required</sup> <a name="role" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.role"></a>
|
|
@@ -862,9 +943,9 @@ A reference to this function, for APIs that accept `lambda.IWebFunctionRef`.
|
|
|
862
943
|
|
|
863
944
|
### WebFunctionEndpoint <a name="WebFunctionEndpoint" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint"></a>
|
|
864
945
|
|
|
865
|
-
|
|
946
|
+
An HTTPS endpoint of a Web Function: `fn.endpoint` (the default one) or the result of `fn.addEndpoint()`.
|
|
866
947
|
|
|
867
|
-
|
|
948
|
+
Endpoints are created only through `WebFunction`, which owns their log groups in every region, so the constructor is private.
|
|
868
949
|
|
|
869
950
|
#### Methods <a name="Methods" id="Methods"></a>
|
|
870
951
|
|
|
@@ -872,7 +953,9 @@ Only `WebFunction` creates endpoints in this version (one per function), so the
|
|
|
872
953
|
| --- | --- |
|
|
873
954
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.toString">toString</a></code> | Returns a string representation of this construct. |
|
|
874
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. |
|
|
875
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; |
|
|
876
959
|
|
|
877
960
|
---
|
|
878
961
|
|
|
@@ -905,6 +988,23 @@ The mixins to apply.
|
|
|
905
988
|
|
|
906
989
|
---
|
|
907
990
|
|
|
991
|
+
##### `grantInvoke` <a name="grantInvoke" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.grantInvoke"></a>
|
|
992
|
+
|
|
993
|
+
```typescript
|
|
994
|
+
public grantInvoke(grantee: IGrantable): Grant
|
|
995
|
+
```
|
|
996
|
+
|
|
997
|
+
Allows `grantee` to call this endpoint.
|
|
998
|
+
|
|
999
|
+
Shortcut for `grants.invoke(grantee)`.
|
|
1000
|
+
[disable-awslint:no-grants]
|
|
1001
|
+
|
|
1002
|
+
###### `grantee`<sup>Required</sup> <a name="grantee" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.grantInvoke.parameter.grantee"></a>
|
|
1003
|
+
|
|
1004
|
+
- *Type:* aws-cdk-lib.aws_iam.IGrantable
|
|
1005
|
+
|
|
1006
|
+
---
|
|
1007
|
+
|
|
908
1008
|
##### `regionalUrl` <a name="regionalUrl" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.regionalUrl"></a>
|
|
909
1009
|
|
|
910
1010
|
```typescript
|
|
@@ -923,6 +1023,33 @@ one of `regions`.
|
|
|
923
1023
|
|
|
924
1024
|
---
|
|
925
1025
|
|
|
1026
|
+
##### `routeTraffic` <a name="routeTraffic" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.routeTraffic"></a>
|
|
1027
|
+
|
|
1028
|
+
```typescript
|
|
1029
|
+
public routeTraffic(revision: IWebFunctionRevision, additionalRevisions?: WebFunctionRevisionWeight[]): void
|
|
1030
|
+
```
|
|
1031
|
+
|
|
1032
|
+
Routes the endpoint to `revision` instead of the function's current revision, optionally sharing traffic with one more revision (`additionalRevisions`, which gets its weight;
|
|
1033
|
+
|
|
1034
|
+
`revision` gets the rest).
|
|
1035
|
+
|
|
1036
|
+
Use it to keep an endpoint on an earlier revision (`WebFunctionRevision.fromRevisionAttributes`),
|
|
1037
|
+
or to send part of the traffic to the current revision:
|
|
1038
|
+
`fn.endpoint.routeTraffic(previous, [{ revision: fn.currentRevision, weight: 0.1 }])`.
|
|
1039
|
+
Can be called once per endpoint, and not on one created with `revision` or `additionalRevisions`.
|
|
1040
|
+
|
|
1041
|
+
###### `revision`<sup>Required</sup> <a name="revision" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.routeTraffic.parameter.revision"></a>
|
|
1042
|
+
|
|
1043
|
+
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision">IWebFunctionRevision</a>
|
|
1044
|
+
|
|
1045
|
+
---
|
|
1046
|
+
|
|
1047
|
+
###### `additionalRevisions`<sup>Optional</sup> <a name="additionalRevisions" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.routeTraffic.parameter.additionalRevisions"></a>
|
|
1048
|
+
|
|
1049
|
+
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevisionWeight">WebFunctionRevisionWeight</a>[]
|
|
1050
|
+
|
|
1051
|
+
---
|
|
1052
|
+
|
|
926
1053
|
#### Static Functions <a name="Static Functions" id="Static Functions"></a>
|
|
927
1054
|
|
|
928
1055
|
| **Name** | **Description** |
|
|
@@ -968,10 +1095,12 @@ Any object.
|
|
|
968
1095
|
| **Name** | **Type** | **Description** |
|
|
969
1096
|
| --- | --- | --- |
|
|
970
1097
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. |
|
|
1098
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.authType">authType</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType">WebFunctionAuthType</a></code> | How callers of the endpoint are authenticated. |
|
|
971
1099
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.domainName">domainName</a></code> | <code>string</code> | The endpoint's domain name: the global domain for `MULTI_REGION`, otherwise the home region's. |
|
|
972
1100
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.endpointArn">endpointArn</a></code> | <code>string</code> | The endpoint's ARN. |
|
|
973
1101
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.endpointName">endpointName</a></code> | <code>string</code> | The endpoint's name. |
|
|
974
1102
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.endpointType">endpointType</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointType">WebFunctionEndpointType</a></code> | Where the endpoint serves traffic from. |
|
|
1103
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.grants">grants</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionGrants">WebFunctionGrants</a></code> | Grants on this endpoint (e.g. `grants.invoke(principal)`). |
|
|
975
1104
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.regions">regions</a></code> | <code>string[]</code> | Every region the endpoint serves from: the home region first, then the others in alphabetical order. |
|
|
976
1105
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.url">url</a></code> | <code>string</code> | The endpoint's URL: the global URL for `MULTI_REGION`, otherwise the home region's. |
|
|
977
1106
|
|
|
@@ -989,6 +1118,18 @@ The tree node.
|
|
|
989
1118
|
|
|
990
1119
|
---
|
|
991
1120
|
|
|
1121
|
+
##### `authType`<sup>Required</sup> <a name="authType" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.authType"></a>
|
|
1122
|
+
|
|
1123
|
+
```typescript
|
|
1124
|
+
public readonly authType: WebFunctionAuthType;
|
|
1125
|
+
```
|
|
1126
|
+
|
|
1127
|
+
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType">WebFunctionAuthType</a>
|
|
1128
|
+
|
|
1129
|
+
How callers of the endpoint are authenticated.
|
|
1130
|
+
|
|
1131
|
+
---
|
|
1132
|
+
|
|
992
1133
|
##### `domainName`<sup>Required</sup> <a name="domainName" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.domainName"></a>
|
|
993
1134
|
|
|
994
1135
|
```typescript
|
|
@@ -1037,6 +1178,18 @@ Where the endpoint serves traffic from.
|
|
|
1037
1178
|
|
|
1038
1179
|
---
|
|
1039
1180
|
|
|
1181
|
+
##### `grants`<sup>Required</sup> <a name="grants" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.grants"></a>
|
|
1182
|
+
|
|
1183
|
+
```typescript
|
|
1184
|
+
public readonly grants: WebFunctionGrants;
|
|
1185
|
+
```
|
|
1186
|
+
|
|
1187
|
+
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionGrants">WebFunctionGrants</a>
|
|
1188
|
+
|
|
1189
|
+
Grants on this endpoint (e.g. `grants.invoke(principal)`).
|
|
1190
|
+
|
|
1191
|
+
---
|
|
1192
|
+
|
|
1040
1193
|
##### `regions`<sup>Required</sup> <a name="regions" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint.property.regions"></a>
|
|
1041
1194
|
|
|
1042
1195
|
```typescript
|
|
@@ -1062,207 +1215,564 @@ The endpoint's URL: the global URL for `MULTI_REGION`, otherwise the home region
|
|
|
1062
1215
|
---
|
|
1063
1216
|
|
|
1064
1217
|
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
### NodejsWebFunctionBundlingOptions <a name="NodejsWebFunctionBundlingOptions" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions"></a>
|
|
1068
|
-
|
|
1069
|
-
How `NodejsWebFunction` bundles the server with esbuild.
|
|
1218
|
+
### WebFunctionRevision <a name="WebFunctionRevision" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevision"></a>
|
|
1070
1219
|
|
|
1071
|
-
|
|
1220
|
+
- *Implements:* <a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision">IWebFunctionRevision</a>
|
|
1072
1221
|
|
|
1073
|
-
|
|
1074
|
-
import { NodejsWebFunctionBundlingOptions } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
1222
|
+
A revision of a Web Function.
|
|
1075
1223
|
|
|
1076
|
-
|
|
1077
|
-
|
|
1224
|
+
`WebFunction` creates its current revision (`fn.currentRevision`) from its code and configuration.
|
|
1225
|
+
Use `fromRevisionAttributes` to route an endpoint to an earlier one, which must still exist:
|
|
1226
|
+
only revisions within `revisionRetention`, or that an endpoint routes to, are kept.
|
|
1078
1227
|
|
|
1079
|
-
####
|
|
1228
|
+
#### Methods <a name="Methods" id="Methods"></a>
|
|
1080
1229
|
|
|
1081
|
-
| **Name** | **
|
|
1082
|
-
| --- | --- |
|
|
1083
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.
|
|
1084
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.
|
|
1085
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.dockerImage">dockerImage</a></code> | <code>aws-cdk-lib.DockerImage</code> | Docker image for bundling when esbuild isn't installed locally. |
|
|
1086
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.environment">environment</a></code> | <code>{[ key: string ]: string}</code> | Environment variables while bundling (not at runtime). |
|
|
1087
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.esbuildArgs">esbuildArgs</a></code> | <code>{[ key: string ]: string \| boolean}</code> | Extra esbuild arguments, e.g. `{ '--log-limit': '0', '--tree-shaking': true }`. |
|
|
1088
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.externalModules">externalModules</a></code> | <code>string[]</code> | Modules to leave out of the bundle. |
|
|
1089
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.footer">footer</a></code> | <code>string</code> | Text to append to the bundle. |
|
|
1090
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.forceDockerBundling">forceDockerBundling</a></code> | <code>boolean</code> | Always bundle in Docker, even if esbuild is installed locally. |
|
|
1091
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.format">format</a></code> | <code>aws-cdk-lib.aws_lambda_nodejs.OutputFormat</code> | Output format. |
|
|
1092
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.keepNames">keepNames</a></code> | <code>boolean</code> | Keep function and class names (`--keep-names`). |
|
|
1093
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.loader">loader</a></code> | <code>{[ key: string ]: string}</code> | esbuild loaders by file extension, e.g. `{ '.png': 'dataurl' }`. |
|
|
1094
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.minify">minify</a></code> | <code>boolean</code> | Minify the bundle. |
|
|
1095
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.sourceMap">sourceMap</a></code> | <code>boolean</code> | Generate a source map, and set `NODE_OPTIONS=--enable-source-maps` so stack traces point at your sources. |
|
|
1096
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.target">target</a></code> | <code>string</code> | esbuild target. |
|
|
1097
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.tsconfig">tsconfig</a></code> | <code>string</code> | Path of the tsconfig.json to use, relative to the project root or absolute (inside the project root). |
|
|
1230
|
+
| **Name** | **Description** |
|
|
1231
|
+
| --- | --- |
|
|
1232
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevision.toString">toString</a></code> | Returns a string representation of this construct. |
|
|
1233
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevision.with">with</a></code> | Applies one or more mixins to this construct. |
|
|
1098
1234
|
|
|
1099
1235
|
---
|
|
1100
1236
|
|
|
1101
|
-
##### `
|
|
1237
|
+
##### `toString` <a name="toString" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevision.toString"></a>
|
|
1102
1238
|
|
|
1103
1239
|
```typescript
|
|
1104
|
-
public
|
|
1240
|
+
public toString(): string
|
|
1105
1241
|
```
|
|
1106
1242
|
|
|
1107
|
-
|
|
1108
|
-
- *Default:* none
|
|
1109
|
-
|
|
1110
|
-
Text to prepend to the bundle.
|
|
1111
|
-
|
|
1112
|
-
---
|
|
1243
|
+
Returns a string representation of this construct.
|
|
1113
1244
|
|
|
1114
|
-
##### `
|
|
1245
|
+
##### `with` <a name="with" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevision.with"></a>
|
|
1115
1246
|
|
|
1116
1247
|
```typescript
|
|
1117
|
-
public
|
|
1248
|
+
public with(mixins: ...IMixin[]): IConstruct
|
|
1118
1249
|
```
|
|
1119
1250
|
|
|
1120
|
-
|
|
1121
|
-
- *Default:* none
|
|
1251
|
+
Applies one or more mixins to this construct.
|
|
1122
1252
|
|
|
1123
|
-
|
|
1253
|
+
Mixins are applied in order. The list of constructs is captured at the
|
|
1254
|
+
start of the call, so constructs added by a mixin will not be visited.
|
|
1255
|
+
Use multiple `with()` calls if subsequent mixins should apply to added
|
|
1256
|
+
constructs.
|
|
1124
1257
|
|
|
1125
|
-
|
|
1258
|
+
###### `mixins`<sup>Required</sup> <a name="mixins" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevision.with.parameter.mixins"></a>
|
|
1126
1259
|
|
|
1127
|
-
|
|
1260
|
+
- *Type:* ...constructs.IMixin[]
|
|
1128
1261
|
|
|
1129
|
-
|
|
1130
|
-
public readonly dockerImage: DockerImage;
|
|
1131
|
-
```
|
|
1262
|
+
The mixins to apply.
|
|
1132
1263
|
|
|
1133
|
-
|
|
1134
|
-
- *Default:* the arm64 AWS SAM build image for the runtime, e.g. `public.ecr.aws/sam/build-nodejs24.x:latest-arm64`
|
|
1264
|
+
---
|
|
1135
1265
|
|
|
1136
|
-
|
|
1266
|
+
#### Static Functions <a name="Static Functions" id="Static Functions"></a>
|
|
1267
|
+
|
|
1268
|
+
| **Name** | **Description** |
|
|
1269
|
+
| --- | --- |
|
|
1270
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevision.isConstruct">isConstruct</a></code> | Checks if `x` is a construct. |
|
|
1271
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevision.fromRevisionAttributes">fromRevisionAttributes</a></code> | References an existing revision of `webFunction`, e.g. to pin an endpoint to it or split traffic with it. |
|
|
1137
1272
|
|
|
1138
1273
|
---
|
|
1139
1274
|
|
|
1140
|
-
##### `
|
|
1275
|
+
##### `isConstruct` <a name="isConstruct" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevision.isConstruct"></a>
|
|
1141
1276
|
|
|
1142
1277
|
```typescript
|
|
1143
|
-
|
|
1144
|
-
```
|
|
1278
|
+
import { WebFunctionRevision } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
1145
1279
|
|
|
1146
|
-
|
|
1147
|
-
|
|
1280
|
+
WebFunctionRevision.isConstruct(x: any)
|
|
1281
|
+
```
|
|
1148
1282
|
|
|
1149
|
-
|
|
1283
|
+
Checks if `x` is a construct.
|
|
1150
1284
|
|
|
1151
|
-
|
|
1285
|
+
Use this method instead of `instanceof` to properly detect `Construct`
|
|
1286
|
+
instances, even when the construct library is symlinked.
|
|
1152
1287
|
|
|
1153
|
-
|
|
1288
|
+
Explanation: in JavaScript, multiple copies of the `constructs` library on
|
|
1289
|
+
disk are seen as independent, completely different libraries. As a
|
|
1290
|
+
consequence, the class `Construct` in each copy of the `constructs` library
|
|
1291
|
+
is seen as a different class, and an instance of one class will not test as
|
|
1292
|
+
`instanceof` the other class. `npm install` will not create installations
|
|
1293
|
+
like this, but users may manually symlink construct libraries together or
|
|
1294
|
+
use a monorepo tool: in those cases, multiple copies of the `constructs`
|
|
1295
|
+
library can be accidentally installed, and `instanceof` will behave
|
|
1296
|
+
unpredictably. It is safest to avoid using `instanceof`, and using
|
|
1297
|
+
this type-testing method instead.
|
|
1154
1298
|
|
|
1155
|
-
|
|
1156
|
-
public readonly esbuildArgs: {[ key: string ]: string | boolean};
|
|
1157
|
-
```
|
|
1299
|
+
###### `x`<sup>Required</sup> <a name="x" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevision.isConstruct.parameter.x"></a>
|
|
1158
1300
|
|
|
1159
|
-
- *Type:*
|
|
1160
|
-
- *Default:* none
|
|
1301
|
+
- *Type:* any
|
|
1161
1302
|
|
|
1162
|
-
|
|
1303
|
+
Any object.
|
|
1163
1304
|
|
|
1164
1305
|
---
|
|
1165
1306
|
|
|
1166
|
-
##### `
|
|
1307
|
+
##### `fromRevisionAttributes` <a name="fromRevisionAttributes" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevision.fromRevisionAttributes"></a>
|
|
1167
1308
|
|
|
1168
1309
|
```typescript
|
|
1169
|
-
|
|
1310
|
+
import { WebFunctionRevision } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
1311
|
+
|
|
1312
|
+
WebFunctionRevision.fromRevisionAttributes(scope: Construct, id: string, attrs: WebFunctionRevisionAttributes)
|
|
1170
1313
|
```
|
|
1171
1314
|
|
|
1172
|
-
|
|
1173
|
-
- *Default:* none
|
|
1315
|
+
References an existing revision of `webFunction`, e.g. to pin an endpoint to it or split traffic with it.
|
|
1174
1316
|
|
|
1175
|
-
|
|
1317
|
+
###### `scope`<sup>Required</sup> <a name="scope" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevision.fromRevisionAttributes.parameter.scope"></a>
|
|
1176
1318
|
|
|
1177
|
-
|
|
1178
|
-
any other dependency; only exclude modules you provide another way.
|
|
1319
|
+
- *Type:* constructs.Construct
|
|
1179
1320
|
|
|
1180
1321
|
---
|
|
1181
1322
|
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
```typescript
|
|
1185
|
-
public readonly footer: string;
|
|
1186
|
-
```
|
|
1323
|
+
###### `id`<sup>Required</sup> <a name="id" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevision.fromRevisionAttributes.parameter.id"></a>
|
|
1187
1324
|
|
|
1188
1325
|
- *Type:* string
|
|
1189
|
-
- *Default:* none
|
|
1190
|
-
|
|
1191
|
-
Text to append to the bundle.
|
|
1192
1326
|
|
|
1193
1327
|
---
|
|
1194
1328
|
|
|
1195
|
-
|
|
1329
|
+
###### `attrs`<sup>Required</sup> <a name="attrs" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevision.fromRevisionAttributes.parameter.attrs"></a>
|
|
1196
1330
|
|
|
1197
|
-
|
|
1198
|
-
public readonly forceDockerBundling: boolean;
|
|
1199
|
-
```
|
|
1331
|
+
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevisionAttributes">WebFunctionRevisionAttributes</a>
|
|
1200
1332
|
|
|
1201
|
-
|
|
1202
|
-
- *Default:* false
|
|
1333
|
+
---
|
|
1203
1334
|
|
|
1204
|
-
|
|
1335
|
+
#### Properties <a name="Properties" id="Properties"></a>
|
|
1336
|
+
|
|
1337
|
+
| **Name** | **Type** | **Description** |
|
|
1338
|
+
| --- | --- | --- |
|
|
1339
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevision.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. |
|
|
1340
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevision.property.revisionArn">revisionArn</a></code> | <code>string</code> | The revision's ARN. |
|
|
1341
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevision.property.revisionId">revisionId</a></code> | <code>string</code> | The revision's ID, e.g. `rev-a1b2c`. |
|
|
1342
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevision.property.webFunction">webFunction</a></code> | <code>aws-cdk-lib.interfaces.aws_lambda.IWebFunctionRef</code> | The function the revision belongs to. |
|
|
1205
1343
|
|
|
1206
1344
|
---
|
|
1207
1345
|
|
|
1208
|
-
##### `
|
|
1346
|
+
##### `node`<sup>Required</sup> <a name="node" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevision.property.node"></a>
|
|
1209
1347
|
|
|
1210
1348
|
```typescript
|
|
1211
|
-
public readonly
|
|
1349
|
+
public readonly node: Node;
|
|
1212
1350
|
```
|
|
1213
1351
|
|
|
1214
|
-
- *Type:*
|
|
1215
|
-
- *Default:* OutputFormat.ESM
|
|
1216
|
-
|
|
1217
|
-
Output format.
|
|
1352
|
+
- *Type:* constructs.Node
|
|
1218
1353
|
|
|
1219
|
-
|
|
1220
|
-
such as Express work); CommonJS to `index.js`.
|
|
1354
|
+
The tree node.
|
|
1221
1355
|
|
|
1222
1356
|
---
|
|
1223
1357
|
|
|
1224
|
-
##### `
|
|
1358
|
+
##### `revisionArn`<sup>Required</sup> <a name="revisionArn" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevision.property.revisionArn"></a>
|
|
1225
1359
|
|
|
1226
1360
|
```typescript
|
|
1227
|
-
public readonly
|
|
1361
|
+
public readonly revisionArn: string;
|
|
1228
1362
|
```
|
|
1229
1363
|
|
|
1230
|
-
- *Type:*
|
|
1231
|
-
- *Default:* false
|
|
1364
|
+
- *Type:* string
|
|
1232
1365
|
|
|
1233
|
-
|
|
1366
|
+
The revision's ARN.
|
|
1234
1367
|
|
|
1235
1368
|
---
|
|
1236
1369
|
|
|
1237
|
-
##### `
|
|
1370
|
+
##### `revisionId`<sup>Required</sup> <a name="revisionId" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevision.property.revisionId"></a>
|
|
1238
1371
|
|
|
1239
1372
|
```typescript
|
|
1240
|
-
public readonly
|
|
1373
|
+
public readonly revisionId: string;
|
|
1241
1374
|
```
|
|
1242
1375
|
|
|
1243
|
-
- *Type:*
|
|
1244
|
-
- *Default:* esbuild's defaults
|
|
1376
|
+
- *Type:* string
|
|
1245
1377
|
|
|
1246
|
-
|
|
1378
|
+
The revision's ID, e.g. `rev-a1b2c`.
|
|
1247
1379
|
|
|
1248
1380
|
---
|
|
1249
1381
|
|
|
1250
|
-
##### `
|
|
1382
|
+
##### `webFunction`<sup>Required</sup> <a name="webFunction" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevision.property.webFunction"></a>
|
|
1251
1383
|
|
|
1252
1384
|
```typescript
|
|
1253
|
-
public readonly
|
|
1385
|
+
public readonly webFunction: IWebFunctionRef;
|
|
1254
1386
|
```
|
|
1255
1387
|
|
|
1256
|
-
- *Type:*
|
|
1257
|
-
- *Default:* true
|
|
1388
|
+
- *Type:* aws-cdk-lib.interfaces.aws_lambda.IWebFunctionRef
|
|
1258
1389
|
|
|
1259
|
-
|
|
1390
|
+
The function the revision belongs to.
|
|
1260
1391
|
|
|
1261
1392
|
---
|
|
1262
1393
|
|
|
1263
|
-
##### `sourceMap`<sup>Optional</sup> <a name="sourceMap" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.sourceMap"></a>
|
|
1264
1394
|
|
|
1265
|
-
|
|
1395
|
+
## Structs <a name="Structs" id="Structs"></a>
|
|
1396
|
+
|
|
1397
|
+
### AddWebFunctionEndpointOptions <a name="AddWebFunctionEndpointOptions" id="@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions"></a>
|
|
1398
|
+
|
|
1399
|
+
Options for `WebFunction.addEndpoint`.
|
|
1400
|
+
|
|
1401
|
+
#### Initializer <a name="Initializer" id="@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions.Initializer"></a>
|
|
1402
|
+
|
|
1403
|
+
```typescript
|
|
1404
|
+
import { AddWebFunctionEndpointOptions } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
1405
|
+
|
|
1406
|
+
const addWebFunctionEndpointOptions: AddWebFunctionEndpointOptions = { ... }
|
|
1407
|
+
```
|
|
1408
|
+
|
|
1409
|
+
#### Properties <a name="Properties" id="Properties"></a>
|
|
1410
|
+
|
|
1411
|
+
| **Name** | **Type** | **Description** |
|
|
1412
|
+
| --- | --- | --- |
|
|
1413
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions.property.deployment">deployment</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment">WebFunctionDeployment</a></code> | How the endpoint moves its traffic to a new revision: all at once, or in steps (`WebFunctionDeployment.canary()` or `linear()`) that watch CloudWatch alarms and move the traffic back when one goes into ALARM. |
|
|
1414
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions.property.description">description</a></code> | <code>string</code> | A description of the endpoint. |
|
|
1415
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions.property.endpointName">endpointName</a></code> | <code>string</code> | The endpoint's name, shown in logs (`endpointName`) and in the `lambda-web-endpoint-name` header. Names are unique per function. |
|
|
1416
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions.property.endpointType">endpointType</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointType">WebFunctionEndpointType</a></code> | Where the endpoint serves traffic from. |
|
|
1417
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions.property.maxEnvironments">maxEnvironments</a></code> | <code>number</code> | The most execution environments the endpoint may use (2–10,000). Each one uses 2 vCPUs of the account's quota. |
|
|
1418
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions.property.rateLimit">rateLimit</a></code> | <code>number</code> | The most requests per second the endpoint accepts; |
|
|
1419
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions.property.regions">regions</a></code> | <code>string[]</code> | Regions to serve from in addition to the home region (the stack's region). |
|
|
1420
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions.property.authType">authType</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType">WebFunctionAuthType</a></code> | How callers of this endpoint are authenticated. |
|
|
1421
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions.property.additionalRevisions">additionalRevisions</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevisionWeight">WebFunctionRevisionWeight</a>[]</code> | A second revision and its share of the endpoint's traffic; |
|
|
1422
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions.property.revision">revision</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision">IWebFunctionRevision</a></code> | The revision the endpoint serves, e.g. an earlier one from `WebFunctionRevision.fromRevisionAttributes` to keep this endpoint on it while others move on. Same as calling `routeTraffic`. |
|
|
1423
|
+
|
|
1424
|
+
---
|
|
1425
|
+
|
|
1426
|
+
##### `deployment`<sup>Optional</sup> <a name="deployment" id="@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions.property.deployment"></a>
|
|
1427
|
+
|
|
1428
|
+
```typescript
|
|
1429
|
+
public readonly deployment: WebFunctionDeployment;
|
|
1430
|
+
```
|
|
1431
|
+
|
|
1432
|
+
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment">WebFunctionDeployment</a>
|
|
1433
|
+
- *Default:* WebFunctionDeployment.allAtOnce()
|
|
1434
|
+
|
|
1435
|
+
How the endpoint moves its traffic to a new revision: all at once, or in steps (`WebFunctionDeployment.canary()` or `linear()`) that watch CloudWatch alarms and move the traffic back when one goes into ALARM.
|
|
1436
|
+
|
|
1437
|
+
A deployment in steps can't be combined with `revision`, `additionalRevisions` or `routeTraffic()`.
|
|
1438
|
+
|
|
1439
|
+
---
|
|
1440
|
+
|
|
1441
|
+
##### `description`<sup>Optional</sup> <a name="description" id="@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions.property.description"></a>
|
|
1442
|
+
|
|
1443
|
+
```typescript
|
|
1444
|
+
public readonly description: string;
|
|
1445
|
+
```
|
|
1446
|
+
|
|
1447
|
+
- *Type:* string
|
|
1448
|
+
- *Default:* no description
|
|
1449
|
+
|
|
1450
|
+
A description of the endpoint.
|
|
1451
|
+
|
|
1452
|
+
---
|
|
1453
|
+
|
|
1454
|
+
##### `endpointName`<sup>Optional</sup> <a name="endpointName" id="@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions.property.endpointName"></a>
|
|
1455
|
+
|
|
1456
|
+
```typescript
|
|
1457
|
+
public readonly endpointName: string;
|
|
1458
|
+
```
|
|
1459
|
+
|
|
1460
|
+
- *Type:* string
|
|
1461
|
+
- *Default:* `default-<hash>` for the function's default endpoint, `<id>-<hash>` for endpoints added with `addEndpoint`
|
|
1462
|
+
|
|
1463
|
+
The endpoint's name, shown in logs (`endpointName`) and in the `lambda-web-endpoint-name` header. Names are unique per function.
|
|
1464
|
+
|
|
1465
|
+
When omitted, the name ends in a hash of the endpoint type and regions, so changing either deploys
|
|
1466
|
+
a new endpoint cleanly. When set, changing the endpoint type or regions also requires a new name:
|
|
1467
|
+
two endpoints of one function can't share a name, and CloudFormation creates the replacement
|
|
1468
|
+
before deleting the old one.
|
|
1469
|
+
|
|
1470
|
+
---
|
|
1471
|
+
|
|
1472
|
+
##### `endpointType`<sup>Optional</sup> <a name="endpointType" id="@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions.property.endpointType"></a>
|
|
1473
|
+
|
|
1474
|
+
```typescript
|
|
1475
|
+
public readonly endpointType: WebFunctionEndpointType;
|
|
1476
|
+
```
|
|
1477
|
+
|
|
1478
|
+
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointType">WebFunctionEndpointType</a>
|
|
1479
|
+
- *Default:* WebFunctionEndpointType.HOME_REGION
|
|
1480
|
+
|
|
1481
|
+
Where the endpoint serves traffic from.
|
|
1482
|
+
|
|
1483
|
+
---
|
|
1484
|
+
|
|
1485
|
+
##### `maxEnvironments`<sup>Optional</sup> <a name="maxEnvironments" id="@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions.property.maxEnvironments"></a>
|
|
1486
|
+
|
|
1487
|
+
```typescript
|
|
1488
|
+
public readonly maxEnvironments: number;
|
|
1489
|
+
```
|
|
1490
|
+
|
|
1491
|
+
- *Type:* number
|
|
1492
|
+
- *Default:* scales within the account's vCPU quota
|
|
1493
|
+
|
|
1494
|
+
The most execution environments the endpoint may use (2–10,000). Each one uses 2 vCPUs of the account's quota.
|
|
1495
|
+
|
|
1496
|
+
Enforced separately in each region the endpoint serves from.
|
|
1497
|
+
|
|
1498
|
+
---
|
|
1499
|
+
|
|
1500
|
+
##### `rateLimit`<sup>Optional</sup> <a name="rateLimit" id="@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions.property.rateLimit"></a>
|
|
1501
|
+
|
|
1502
|
+
```typescript
|
|
1503
|
+
public readonly rateLimit: number;
|
|
1504
|
+
```
|
|
1505
|
+
|
|
1506
|
+
- *Type:* number
|
|
1507
|
+
- *Default:* no limit beyond the service quota of 10,000 requests per second per endpoint (per region)
|
|
1508
|
+
|
|
1509
|
+
The most requests per second the endpoint accepts;
|
|
1510
|
+
|
|
1511
|
+
excess requests get HTTP 429.
|
|
1512
|
+
Allowed: 0 (blocks all traffic), 100–1,000 in steps of 100, or 2,000–10,000 in steps of 1,000.
|
|
1513
|
+
|
|
1514
|
+
Enforced separately in each region the endpoint serves from, so a multi-region endpoint
|
|
1515
|
+
can accept this many requests per second in every region.
|
|
1516
|
+
|
|
1517
|
+
---
|
|
1518
|
+
|
|
1519
|
+
##### `regions`<sup>Optional</sup> <a name="regions" id="@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions.property.regions"></a>
|
|
1520
|
+
|
|
1521
|
+
```typescript
|
|
1522
|
+
public readonly regions: string[];
|
|
1523
|
+
```
|
|
1524
|
+
|
|
1525
|
+
- *Type:* string[]
|
|
1526
|
+
- *Default:* no extra regions
|
|
1527
|
+
|
|
1528
|
+
Regions to serve from in addition to the home region (the stack's region).
|
|
1529
|
+
|
|
1530
|
+
Required (at least one) for `MULTI_REGION` and `PER_REGION`; must be empty for `HOME_REGION`.
|
|
1531
|
+
|
|
1532
|
+
Changing this creates a new endpoint with a new URL.
|
|
1533
|
+
|
|
1534
|
+
---
|
|
1535
|
+
|
|
1536
|
+
##### `authType`<sup>Required</sup> <a name="authType" id="@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions.property.authType"></a>
|
|
1537
|
+
|
|
1538
|
+
```typescript
|
|
1539
|
+
public readonly authType: WebFunctionAuthType;
|
|
1540
|
+
```
|
|
1541
|
+
|
|
1542
|
+
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType">WebFunctionAuthType</a>
|
|
1543
|
+
|
|
1544
|
+
How callers of this endpoint are authenticated.
|
|
1545
|
+
|
|
1546
|
+
---
|
|
1547
|
+
|
|
1548
|
+
##### `additionalRevisions`<sup>Optional</sup> <a name="additionalRevisions" id="@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions.property.additionalRevisions"></a>
|
|
1549
|
+
|
|
1550
|
+
```typescript
|
|
1551
|
+
public readonly additionalRevisions: WebFunctionRevisionWeight[];
|
|
1552
|
+
```
|
|
1553
|
+
|
|
1554
|
+
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevisionWeight">WebFunctionRevisionWeight</a>[]
|
|
1555
|
+
- *Default:* all traffic goes to `revision`
|
|
1556
|
+
|
|
1557
|
+
A second revision and its share of the endpoint's traffic;
|
|
1558
|
+
|
|
1559
|
+
`revision` gets the rest.
|
|
1560
|
+
An endpoint routes to at most two revisions.
|
|
1561
|
+
|
|
1562
|
+
---
|
|
1563
|
+
|
|
1564
|
+
##### `revision`<sup>Optional</sup> <a name="revision" id="@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions.property.revision"></a>
|
|
1565
|
+
|
|
1566
|
+
```typescript
|
|
1567
|
+
public readonly revision: IWebFunctionRevision;
|
|
1568
|
+
```
|
|
1569
|
+
|
|
1570
|
+
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision">IWebFunctionRevision</a>
|
|
1571
|
+
- *Default:* the function's current revision (`currentRevision`)
|
|
1572
|
+
|
|
1573
|
+
The revision the endpoint serves, e.g. an earlier one from `WebFunctionRevision.fromRevisionAttributes` to keep this endpoint on it while others move on. Same as calling `routeTraffic`.
|
|
1574
|
+
|
|
1575
|
+
---
|
|
1576
|
+
|
|
1577
|
+
### NodejsWebFunctionBundlingOptions <a name="NodejsWebFunctionBundlingOptions" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions"></a>
|
|
1578
|
+
|
|
1579
|
+
How `NodejsWebFunction` bundles the server with esbuild.
|
|
1580
|
+
|
|
1581
|
+
#### Initializer <a name="Initializer" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.Initializer"></a>
|
|
1582
|
+
|
|
1583
|
+
```typescript
|
|
1584
|
+
import { NodejsWebFunctionBundlingOptions } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
1585
|
+
|
|
1586
|
+
const nodejsWebFunctionBundlingOptions: NodejsWebFunctionBundlingOptions = { ... }
|
|
1587
|
+
```
|
|
1588
|
+
|
|
1589
|
+
#### Properties <a name="Properties" id="Properties"></a>
|
|
1590
|
+
|
|
1591
|
+
| **Name** | **Type** | **Description** |
|
|
1592
|
+
| --- | --- | --- |
|
|
1593
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.banner">banner</a></code> | <code>string</code> | Text to prepend to the bundle. |
|
|
1594
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.define">define</a></code> | <code>{[ key: string ]: string}</code> | Replace global identifiers with constant expressions (esbuild `--define`). |
|
|
1595
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.dockerImage">dockerImage</a></code> | <code>aws-cdk-lib.DockerImage</code> | Docker image for bundling when esbuild isn't installed locally. |
|
|
1596
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.environment">environment</a></code> | <code>{[ key: string ]: string}</code> | Environment variables while bundling (not at runtime). |
|
|
1597
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.esbuildArgs">esbuildArgs</a></code> | <code>{[ key: string ]: string \| boolean}</code> | Extra esbuild arguments, e.g. `{ '--log-limit': '0', '--tree-shaking': true }`. |
|
|
1598
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.externalModules">externalModules</a></code> | <code>string[]</code> | Modules to leave out of the bundle. |
|
|
1599
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.footer">footer</a></code> | <code>string</code> | Text to append to the bundle. |
|
|
1600
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.forceDockerBundling">forceDockerBundling</a></code> | <code>boolean</code> | Always bundle in Docker, even if esbuild is installed locally. |
|
|
1601
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.format">format</a></code> | <code>aws-cdk-lib.aws_lambda_nodejs.OutputFormat</code> | Output format. |
|
|
1602
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.keepNames">keepNames</a></code> | <code>boolean</code> | Keep function and class names (`--keep-names`). |
|
|
1603
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.loader">loader</a></code> | <code>{[ key: string ]: string}</code> | esbuild loaders by file extension, e.g. `{ '.png': 'dataurl' }`. |
|
|
1604
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.minify">minify</a></code> | <code>boolean</code> | Minify the bundle. |
|
|
1605
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.sourceMap">sourceMap</a></code> | <code>boolean</code> | Generate a source map, and set `NODE_OPTIONS=--enable-source-maps` so stack traces point at your sources. |
|
|
1606
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.target">target</a></code> | <code>string</code> | esbuild target. |
|
|
1607
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.tsconfig">tsconfig</a></code> | <code>string</code> | Path of the tsconfig.json to use, relative to the project root or absolute (inside the project root). |
|
|
1608
|
+
|
|
1609
|
+
---
|
|
1610
|
+
|
|
1611
|
+
##### `banner`<sup>Optional</sup> <a name="banner" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.banner"></a>
|
|
1612
|
+
|
|
1613
|
+
```typescript
|
|
1614
|
+
public readonly banner: string;
|
|
1615
|
+
```
|
|
1616
|
+
|
|
1617
|
+
- *Type:* string
|
|
1618
|
+
- *Default:* none
|
|
1619
|
+
|
|
1620
|
+
Text to prepend to the bundle.
|
|
1621
|
+
|
|
1622
|
+
---
|
|
1623
|
+
|
|
1624
|
+
##### `define`<sup>Optional</sup> <a name="define" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.define"></a>
|
|
1625
|
+
|
|
1626
|
+
```typescript
|
|
1627
|
+
public readonly define: {[ key: string ]: string};
|
|
1628
|
+
```
|
|
1629
|
+
|
|
1630
|
+
- *Type:* {[ key: string ]: string}
|
|
1631
|
+
- *Default:* none
|
|
1632
|
+
|
|
1633
|
+
Replace global identifiers with constant expressions (esbuild `--define`).
|
|
1634
|
+
|
|
1635
|
+
---
|
|
1636
|
+
|
|
1637
|
+
##### `dockerImage`<sup>Optional</sup> <a name="dockerImage" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.dockerImage"></a>
|
|
1638
|
+
|
|
1639
|
+
```typescript
|
|
1640
|
+
public readonly dockerImage: DockerImage;
|
|
1641
|
+
```
|
|
1642
|
+
|
|
1643
|
+
- *Type:* aws-cdk-lib.DockerImage
|
|
1644
|
+
- *Default:* the arm64 AWS SAM build image for the runtime, e.g. `public.ecr.aws/sam/build-nodejs24.x:latest-arm64`
|
|
1645
|
+
|
|
1646
|
+
Docker image for bundling when esbuild isn't installed locally.
|
|
1647
|
+
|
|
1648
|
+
---
|
|
1649
|
+
|
|
1650
|
+
##### `environment`<sup>Optional</sup> <a name="environment" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.environment"></a>
|
|
1651
|
+
|
|
1652
|
+
```typescript
|
|
1653
|
+
public readonly environment: {[ key: string ]: string};
|
|
1654
|
+
```
|
|
1655
|
+
|
|
1656
|
+
- *Type:* {[ key: string ]: string}
|
|
1657
|
+
- *Default:* none
|
|
1658
|
+
|
|
1659
|
+
Environment variables while bundling (not at runtime).
|
|
1660
|
+
|
|
1661
|
+
---
|
|
1662
|
+
|
|
1663
|
+
##### `esbuildArgs`<sup>Optional</sup> <a name="esbuildArgs" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.esbuildArgs"></a>
|
|
1664
|
+
|
|
1665
|
+
```typescript
|
|
1666
|
+
public readonly esbuildArgs: {[ key: string ]: string | boolean};
|
|
1667
|
+
```
|
|
1668
|
+
|
|
1669
|
+
- *Type:* {[ key: string ]: string | boolean}
|
|
1670
|
+
- *Default:* none
|
|
1671
|
+
|
|
1672
|
+
Extra esbuild arguments, e.g. `{ '--log-limit': '0', '--tree-shaking': true }`.
|
|
1673
|
+
|
|
1674
|
+
---
|
|
1675
|
+
|
|
1676
|
+
##### `externalModules`<sup>Optional</sup> <a name="externalModules" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.externalModules"></a>
|
|
1677
|
+
|
|
1678
|
+
```typescript
|
|
1679
|
+
public readonly externalModules: string[];
|
|
1680
|
+
```
|
|
1681
|
+
|
|
1682
|
+
- *Type:* string[]
|
|
1683
|
+
- *Default:* none
|
|
1684
|
+
|
|
1685
|
+
Modules to leave out of the bundle.
|
|
1686
|
+
|
|
1687
|
+
The runtime has no AWS SDK, so `@aws-sdk/*` is bundled like
|
|
1688
|
+
any other dependency; only exclude modules you provide another way.
|
|
1689
|
+
|
|
1690
|
+
---
|
|
1691
|
+
|
|
1692
|
+
##### `footer`<sup>Optional</sup> <a name="footer" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.footer"></a>
|
|
1693
|
+
|
|
1694
|
+
```typescript
|
|
1695
|
+
public readonly footer: string;
|
|
1696
|
+
```
|
|
1697
|
+
|
|
1698
|
+
- *Type:* string
|
|
1699
|
+
- *Default:* none
|
|
1700
|
+
|
|
1701
|
+
Text to append to the bundle.
|
|
1702
|
+
|
|
1703
|
+
---
|
|
1704
|
+
|
|
1705
|
+
##### `forceDockerBundling`<sup>Optional</sup> <a name="forceDockerBundling" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.forceDockerBundling"></a>
|
|
1706
|
+
|
|
1707
|
+
```typescript
|
|
1708
|
+
public readonly forceDockerBundling: boolean;
|
|
1709
|
+
```
|
|
1710
|
+
|
|
1711
|
+
- *Type:* boolean
|
|
1712
|
+
- *Default:* false
|
|
1713
|
+
|
|
1714
|
+
Always bundle in Docker, even if esbuild is installed locally.
|
|
1715
|
+
|
|
1716
|
+
---
|
|
1717
|
+
|
|
1718
|
+
##### `format`<sup>Optional</sup> <a name="format" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.format"></a>
|
|
1719
|
+
|
|
1720
|
+
```typescript
|
|
1721
|
+
public readonly format: OutputFormat;
|
|
1722
|
+
```
|
|
1723
|
+
|
|
1724
|
+
- *Type:* aws-cdk-lib.aws_lambda_nodejs.OutputFormat
|
|
1725
|
+
- *Default:* OutputFormat.ESM
|
|
1726
|
+
|
|
1727
|
+
Output format.
|
|
1728
|
+
|
|
1729
|
+
ESM is written to `index.mjs` (with a `require` shim, so CommonJS dependencies
|
|
1730
|
+
such as Express work); CommonJS to `index.js`.
|
|
1731
|
+
|
|
1732
|
+
---
|
|
1733
|
+
|
|
1734
|
+
##### `keepNames`<sup>Optional</sup> <a name="keepNames" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.keepNames"></a>
|
|
1735
|
+
|
|
1736
|
+
```typescript
|
|
1737
|
+
public readonly keepNames: boolean;
|
|
1738
|
+
```
|
|
1739
|
+
|
|
1740
|
+
- *Type:* boolean
|
|
1741
|
+
- *Default:* false
|
|
1742
|
+
|
|
1743
|
+
Keep function and class names (`--keep-names`).
|
|
1744
|
+
|
|
1745
|
+
---
|
|
1746
|
+
|
|
1747
|
+
##### `loader`<sup>Optional</sup> <a name="loader" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.loader"></a>
|
|
1748
|
+
|
|
1749
|
+
```typescript
|
|
1750
|
+
public readonly loader: {[ key: string ]: string};
|
|
1751
|
+
```
|
|
1752
|
+
|
|
1753
|
+
- *Type:* {[ key: string ]: string}
|
|
1754
|
+
- *Default:* esbuild's defaults
|
|
1755
|
+
|
|
1756
|
+
esbuild loaders by file extension, e.g. `{ '.png': 'dataurl' }`.
|
|
1757
|
+
|
|
1758
|
+
---
|
|
1759
|
+
|
|
1760
|
+
##### `minify`<sup>Optional</sup> <a name="minify" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.minify"></a>
|
|
1761
|
+
|
|
1762
|
+
```typescript
|
|
1763
|
+
public readonly minify: boolean;
|
|
1764
|
+
```
|
|
1765
|
+
|
|
1766
|
+
- *Type:* boolean
|
|
1767
|
+
- *Default:* true
|
|
1768
|
+
|
|
1769
|
+
Minify the bundle.
|
|
1770
|
+
|
|
1771
|
+
---
|
|
1772
|
+
|
|
1773
|
+
##### `sourceMap`<sup>Optional</sup> <a name="sourceMap" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions.property.sourceMap"></a>
|
|
1774
|
+
|
|
1775
|
+
```typescript
|
|
1266
1776
|
public readonly sourceMap: boolean;
|
|
1267
1777
|
```
|
|
1268
1778
|
|
|
@@ -1318,11 +1828,12 @@ const nodejsWebFunctionProps: NodejsWebFunctionProps = { ... }
|
|
|
1318
1828
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.authType">authType</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType">WebFunctionAuthType</a></code> | How callers of the endpoint are authenticated. |
|
|
1319
1829
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.applicationLogLevelV2">applicationLogLevelV2</a></code> | <code>aws-cdk-lib.aws_lambda.ApplicationLogLevel</code> | The minimum level of application logs to keep. |
|
|
1320
1830
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.description">description</a></code> | <code>string</code> | A description of the function's code and configuration. |
|
|
1321
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.endpoint">endpoint</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions">WebFunctionEndpointOptions</a></code> | The endpoint: where it serves from,
|
|
1831
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.endpoint">endpoint</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions">WebFunctionEndpointOptions</a></code> | The default endpoint (`fn.endpoint`): where it serves from, its name and limits. It serves the current revision; route it elsewhere with `fn.endpoint.routeTraffic()`. Add more endpoints with `addEndpoint`. |
|
|
1322
1832
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.environment">environment</a></code> | <code>{[ key: string ]: string}</code> | Environment variables. |
|
|
1323
1833
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.logRemovalPolicy">logRemovalPolicy</a></code> | <code>aws-cdk-lib.RemovalPolicy</code> | What happens to the log groups when the function is removed: RETAIN or DESTROY. |
|
|
1324
1834
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.logRetention">logRetention</a></code> | <code>aws-cdk-lib.aws_logs.RetentionDays</code> | Retention for every log group of the function, in every region it serves from. |
|
|
1325
1835
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.maxConcurrencyPerEnvironment">maxConcurrencyPerEnvironment</a></code> | <code>number</code> | How many requests one execution environment handles at the same time (1-128). |
|
|
1836
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.revisionRetention">revisionRetention</a></code> | <code>number</code> | How many of the newest revisions to keep (1-50). |
|
|
1326
1837
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.role">role</a></code> | <code>aws-cdk-lib.aws_iam.IRole</code> | The execution role. |
|
|
1327
1838
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.systemLogLevelV2">systemLogLevelV2</a></code> | <code>aws-cdk-lib.aws_lambda.SystemLogLevel</code> | The minimum level of platform logs to keep (DEBUG, INFO or WARN). |
|
|
1328
1839
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.timeout">timeout</a></code> | <code>aws-cdk-lib.Duration</code> | How long a single request may run. |
|
|
@@ -1380,9 +1891,9 @@ public readonly endpoint: WebFunctionEndpointOptions;
|
|
|
1380
1891
|
```
|
|
1381
1892
|
|
|
1382
1893
|
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions">WebFunctionEndpointOptions</a>
|
|
1383
|
-
- *Default:* a HOME_REGION endpoint
|
|
1894
|
+
- *Default:* a HOME_REGION endpoint serving the current revision
|
|
1384
1895
|
|
|
1385
|
-
The endpoint: where it serves from,
|
|
1896
|
+
The default endpoint (`fn.endpoint`): where it serves from, its name and limits. It serves the current revision; route it elsewhere with `fn.endpoint.routeTraffic()`. Add more endpoints with `addEndpoint`.
|
|
1386
1897
|
|
|
1387
1898
|
---
|
|
1388
1899
|
|
|
@@ -1444,6 +1955,26 @@ Requests share module-level state, so handlers must be concurrency-safe.
|
|
|
1444
1955
|
|
|
1445
1956
|
---
|
|
1446
1957
|
|
|
1958
|
+
##### `revisionRetention`<sup>Optional</sup> <a name="revisionRetention" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.revisionRetention"></a>
|
|
1959
|
+
|
|
1960
|
+
```typescript
|
|
1961
|
+
public readonly revisionRetention: number;
|
|
1962
|
+
```
|
|
1963
|
+
|
|
1964
|
+
- *Type:* number
|
|
1965
|
+
- *Default:* 20
|
|
1966
|
+
|
|
1967
|
+
How many of the newest revisions to keep (1-50).
|
|
1968
|
+
|
|
1969
|
+
Each deployment that changes the code or
|
|
1970
|
+
configuration creates a revision; older ones stay available to roll back to or route traffic to,
|
|
1971
|
+
and the oldest beyond this count are deleted after each deployment.
|
|
1972
|
+
|
|
1973
|
+
Revisions that an endpoint routes to are never deleted, and neither are those the previous
|
|
1974
|
+
deployment used (a rollback returns to them).
|
|
1975
|
+
|
|
1976
|
+
---
|
|
1977
|
+
|
|
1447
1978
|
##### `role`<sup>Optional</sup> <a name="role" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.role"></a>
|
|
1448
1979
|
|
|
1449
1980
|
```typescript
|
|
@@ -1479,163 +2010,355 @@ The minimum level of platform logs to keep (DEBUG, INFO or WARN).
|
|
|
1479
2010
|
public readonly timeout: Duration;
|
|
1480
2011
|
```
|
|
1481
2012
|
|
|
1482
|
-
- *Type:* aws-cdk-lib.Duration
|
|
1483
|
-
- *Default:* Duration.seconds(30)
|
|
2013
|
+
- *Type:* aws-cdk-lib.Duration
|
|
2014
|
+
- *Default:* Duration.seconds(30)
|
|
2015
|
+
|
|
2016
|
+
How long a single request may run.
|
|
2017
|
+
|
|
2018
|
+
---
|
|
2019
|
+
|
|
2020
|
+
##### `webFunctionName`<sup>Optional</sup> <a name="webFunctionName" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.webFunctionName"></a>
|
|
2021
|
+
|
|
2022
|
+
```typescript
|
|
2023
|
+
public readonly webFunctionName: string;
|
|
2024
|
+
```
|
|
2025
|
+
|
|
2026
|
+
- *Type:* string
|
|
2027
|
+
- *Default:* a unique name generated from the construct path (moving the construct changes it)
|
|
2028
|
+
|
|
2029
|
+
The function's name.
|
|
2030
|
+
|
|
2031
|
+
Renaming a function replaces it, and its endpoint gets a new URL.
|
|
2032
|
+
|
|
2033
|
+
---
|
|
2034
|
+
|
|
2035
|
+
##### `entry`<sup>Required</sup> <a name="entry" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.entry"></a>
|
|
2036
|
+
|
|
2037
|
+
```typescript
|
|
2038
|
+
public readonly entry: string;
|
|
2039
|
+
```
|
|
2040
|
+
|
|
2041
|
+
- *Type:* string
|
|
2042
|
+
|
|
2043
|
+
The file that starts your server (TypeScript or JavaScript).
|
|
2044
|
+
|
|
2045
|
+
It's bundled with its dependencies.
|
|
2046
|
+
|
|
2047
|
+
---
|
|
2048
|
+
|
|
2049
|
+
##### `bundling`<sup>Optional</sup> <a name="bundling" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.bundling"></a>
|
|
2050
|
+
|
|
2051
|
+
```typescript
|
|
2052
|
+
public readonly bundling: NodejsWebFunctionBundlingOptions;
|
|
2053
|
+
```
|
|
2054
|
+
|
|
2055
|
+
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions">NodejsWebFunctionBundlingOptions</a>
|
|
2056
|
+
- *Default:* minified ESM with a source map, targeting the runtime's Node.js version
|
|
2057
|
+
|
|
2058
|
+
How the server is bundled.
|
|
2059
|
+
|
|
2060
|
+
---
|
|
2061
|
+
|
|
2062
|
+
##### `depsLockFilePath`<sup>Optional</sup> <a name="depsLockFilePath" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.depsLockFilePath"></a>
|
|
2063
|
+
|
|
2064
|
+
```typescript
|
|
2065
|
+
public readonly depsLockFilePath: string;
|
|
2066
|
+
```
|
|
2067
|
+
|
|
2068
|
+
- *Type:* string
|
|
2069
|
+
- *Default:* the nearest `package-lock.json`, `yarn.lock`, `pnpm-lock.yaml` or `bun.lock(b)` above the entry
|
|
2070
|
+
|
|
2071
|
+
The lock file that marks the project root (where esbuild resolves `node_modules`).
|
|
2072
|
+
|
|
2073
|
+
---
|
|
2074
|
+
|
|
2075
|
+
##### `projectRoot`<sup>Optional</sup> <a name="projectRoot" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.projectRoot"></a>
|
|
2076
|
+
|
|
2077
|
+
```typescript
|
|
2078
|
+
public readonly projectRoot: string;
|
|
2079
|
+
```
|
|
2080
|
+
|
|
2081
|
+
- *Type:* string
|
|
2082
|
+
- *Default:* the directory of the lock file
|
|
2083
|
+
|
|
2084
|
+
The project root.
|
|
2085
|
+
|
|
2086
|
+
Must contain the entry file.
|
|
2087
|
+
|
|
2088
|
+
---
|
|
2089
|
+
|
|
2090
|
+
##### `runtime`<sup>Optional</sup> <a name="runtime" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps.property.runtime"></a>
|
|
2091
|
+
|
|
2092
|
+
```typescript
|
|
2093
|
+
public readonly runtime: Runtime;
|
|
2094
|
+
```
|
|
2095
|
+
|
|
2096
|
+
- *Type:* aws-cdk-lib.aws_lambda.Runtime
|
|
2097
|
+
- *Default:* lambda.Runtime.NODEJS_24_X
|
|
2098
|
+
|
|
2099
|
+
The Node.js runtime.
|
|
2100
|
+
|
|
2101
|
+
---
|
|
2102
|
+
|
|
2103
|
+
### WebFunctionCanaryDeploymentOptions <a name="WebFunctionCanaryDeploymentOptions" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionCanaryDeploymentOptions"></a>
|
|
2104
|
+
|
|
2105
|
+
Options for a canary deployment.
|
|
2106
|
+
|
|
2107
|
+
#### Initializer <a name="Initializer" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionCanaryDeploymentOptions.Initializer"></a>
|
|
2108
|
+
|
|
2109
|
+
```typescript
|
|
2110
|
+
import { WebFunctionCanaryDeploymentOptions } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
2111
|
+
|
|
2112
|
+
const webFunctionCanaryDeploymentOptions: WebFunctionCanaryDeploymentOptions = { ... }
|
|
2113
|
+
```
|
|
2114
|
+
|
|
2115
|
+
#### Properties <a name="Properties" id="Properties"></a>
|
|
2116
|
+
|
|
2117
|
+
| **Name** | **Type** | **Description** |
|
|
2118
|
+
| --- | --- | --- |
|
|
2119
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionCanaryDeploymentOptions.property.bake">bake</a></code> | <code>aws-cdk-lib.Duration</code> | How long the new revision serves `percent` before it gets all traffic (1-45 minutes). |
|
|
2120
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionCanaryDeploymentOptions.property.percent">percent</a></code> | <code>number</code> | The share of traffic, in whole percent (1-99), that the new revision gets first. |
|
|
2121
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionCanaryDeploymentOptions.property.alarms">alarms</a></code> | <code>aws-cdk-lib.aws_cloudwatch.IAlarm[]</code> | Alarms that stop the deployment: if one is in ALARM, the endpoint goes back to the previous revision and the deployment fails, so CloudFormation rolls the stack back. |
|
|
2122
|
+
|
|
2123
|
+
---
|
|
2124
|
+
|
|
2125
|
+
##### `bake`<sup>Required</sup> <a name="bake" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionCanaryDeploymentOptions.property.bake"></a>
|
|
2126
|
+
|
|
2127
|
+
```typescript
|
|
2128
|
+
public readonly bake: Duration;
|
|
2129
|
+
```
|
|
2130
|
+
|
|
2131
|
+
- *Type:* aws-cdk-lib.Duration
|
|
2132
|
+
|
|
2133
|
+
How long the new revision serves `percent` before it gets all traffic (1-45 minutes).
|
|
2134
|
+
|
|
2135
|
+
Make it longer than the time your alarms need to fire (period × evaluation periods).
|
|
2136
|
+
|
|
2137
|
+
---
|
|
2138
|
+
|
|
2139
|
+
##### `percent`<sup>Required</sup> <a name="percent" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionCanaryDeploymentOptions.property.percent"></a>
|
|
2140
|
+
|
|
2141
|
+
```typescript
|
|
2142
|
+
public readonly percent: number;
|
|
2143
|
+
```
|
|
2144
|
+
|
|
2145
|
+
- *Type:* number
|
|
2146
|
+
|
|
2147
|
+
The share of traffic, in whole percent (1-99), that the new revision gets first.
|
|
2148
|
+
|
|
2149
|
+
---
|
|
2150
|
+
|
|
2151
|
+
##### `alarms`<sup>Optional</sup> <a name="alarms" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionCanaryDeploymentOptions.property.alarms"></a>
|
|
2152
|
+
|
|
2153
|
+
```typescript
|
|
2154
|
+
public readonly alarms: IAlarm[];
|
|
2155
|
+
```
|
|
2156
|
+
|
|
2157
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.IAlarm[]
|
|
2158
|
+
- *Default:* no alarms: traffic moves on a timer
|
|
2159
|
+
|
|
2160
|
+
Alarms that stop the deployment: if one is in ALARM, the endpoint goes back to the previous revision and the deployment fails, so CloudFormation rolls the stack back.
|
|
2161
|
+
|
|
2162
|
+
They're checked before traffic moves, during the bake, and once the new revision has all traffic.
|
|
2163
|
+
Use alarms in any region (by ARN), including composite alarms.
|
|
2164
|
+
|
|
2165
|
+
---
|
|
2166
|
+
|
|
2167
|
+
### WebFunctionEndpointOptions <a name="WebFunctionEndpointOptions" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions"></a>
|
|
2168
|
+
|
|
2169
|
+
Options for a Web Function's endpoint.
|
|
2170
|
+
|
|
2171
|
+
#### Initializer <a name="Initializer" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions.Initializer"></a>
|
|
2172
|
+
|
|
2173
|
+
```typescript
|
|
2174
|
+
import { WebFunctionEndpointOptions } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
2175
|
+
|
|
2176
|
+
const webFunctionEndpointOptions: WebFunctionEndpointOptions = { ... }
|
|
2177
|
+
```
|
|
2178
|
+
|
|
2179
|
+
#### Properties <a name="Properties" id="Properties"></a>
|
|
2180
|
+
|
|
2181
|
+
| **Name** | **Type** | **Description** |
|
|
2182
|
+
| --- | --- | --- |
|
|
2183
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions.property.deployment">deployment</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment">WebFunctionDeployment</a></code> | How the endpoint moves its traffic to a new revision: all at once, or in steps (`WebFunctionDeployment.canary()` or `linear()`) that watch CloudWatch alarms and move the traffic back when one goes into ALARM. |
|
|
2184
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions.property.description">description</a></code> | <code>string</code> | A description of the endpoint. |
|
|
2185
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions.property.endpointName">endpointName</a></code> | <code>string</code> | The endpoint's name, shown in logs (`endpointName`) and in the `lambda-web-endpoint-name` header. Names are unique per function. |
|
|
2186
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions.property.endpointType">endpointType</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointType">WebFunctionEndpointType</a></code> | Where the endpoint serves traffic from. |
|
|
2187
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions.property.maxEnvironments">maxEnvironments</a></code> | <code>number</code> | The most execution environments the endpoint may use (2–10,000). Each one uses 2 vCPUs of the account's quota. |
|
|
2188
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions.property.rateLimit">rateLimit</a></code> | <code>number</code> | The most requests per second the endpoint accepts; |
|
|
2189
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions.property.regions">regions</a></code> | <code>string[]</code> | Regions to serve from in addition to the home region (the stack's region). |
|
|
2190
|
+
|
|
2191
|
+
---
|
|
2192
|
+
|
|
2193
|
+
##### `deployment`<sup>Optional</sup> <a name="deployment" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions.property.deployment"></a>
|
|
2194
|
+
|
|
2195
|
+
```typescript
|
|
2196
|
+
public readonly deployment: WebFunctionDeployment;
|
|
2197
|
+
```
|
|
2198
|
+
|
|
2199
|
+
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment">WebFunctionDeployment</a>
|
|
2200
|
+
- *Default:* WebFunctionDeployment.allAtOnce()
|
|
1484
2201
|
|
|
1485
|
-
How
|
|
2202
|
+
How the endpoint moves its traffic to a new revision: all at once, or in steps (`WebFunctionDeployment.canary()` or `linear()`) that watch CloudWatch alarms and move the traffic back when one goes into ALARM.
|
|
2203
|
+
|
|
2204
|
+
A deployment in steps can't be combined with `revision`, `additionalRevisions` or `routeTraffic()`.
|
|
1486
2205
|
|
|
1487
2206
|
---
|
|
1488
2207
|
|
|
1489
|
-
##### `
|
|
2208
|
+
##### `description`<sup>Optional</sup> <a name="description" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions.property.description"></a>
|
|
1490
2209
|
|
|
1491
2210
|
```typescript
|
|
1492
|
-
public readonly
|
|
2211
|
+
public readonly description: string;
|
|
1493
2212
|
```
|
|
1494
2213
|
|
|
1495
2214
|
- *Type:* string
|
|
1496
|
-
- *Default:*
|
|
1497
|
-
|
|
1498
|
-
The function's name.
|
|
2215
|
+
- *Default:* no description
|
|
1499
2216
|
|
|
1500
|
-
|
|
2217
|
+
A description of the endpoint.
|
|
1501
2218
|
|
|
1502
2219
|
---
|
|
1503
2220
|
|
|
1504
|
-
##### `
|
|
2221
|
+
##### `endpointName`<sup>Optional</sup> <a name="endpointName" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions.property.endpointName"></a>
|
|
1505
2222
|
|
|
1506
2223
|
```typescript
|
|
1507
|
-
public readonly
|
|
2224
|
+
public readonly endpointName: string;
|
|
1508
2225
|
```
|
|
1509
2226
|
|
|
1510
2227
|
- *Type:* string
|
|
2228
|
+
- *Default:* `default-<hash>` for the function's default endpoint, `<id>-<hash>` for endpoints added with `addEndpoint`
|
|
1511
2229
|
|
|
1512
|
-
The
|
|
2230
|
+
The endpoint's name, shown in logs (`endpointName`) and in the `lambda-web-endpoint-name` header. Names are unique per function.
|
|
1513
2231
|
|
|
1514
|
-
|
|
2232
|
+
When omitted, the name ends in a hash of the endpoint type and regions, so changing either deploys
|
|
2233
|
+
a new endpoint cleanly. When set, changing the endpoint type or regions also requires a new name:
|
|
2234
|
+
two endpoints of one function can't share a name, and CloudFormation creates the replacement
|
|
2235
|
+
before deleting the old one.
|
|
1515
2236
|
|
|
1516
2237
|
---
|
|
1517
2238
|
|
|
1518
|
-
##### `
|
|
2239
|
+
##### `endpointType`<sup>Optional</sup> <a name="endpointType" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions.property.endpointType"></a>
|
|
1519
2240
|
|
|
1520
2241
|
```typescript
|
|
1521
|
-
public readonly
|
|
2242
|
+
public readonly endpointType: WebFunctionEndpointType;
|
|
1522
2243
|
```
|
|
1523
2244
|
|
|
1524
|
-
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.
|
|
1525
|
-
- *Default:*
|
|
2245
|
+
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointType">WebFunctionEndpointType</a>
|
|
2246
|
+
- *Default:* WebFunctionEndpointType.HOME_REGION
|
|
1526
2247
|
|
|
1527
|
-
|
|
2248
|
+
Where the endpoint serves traffic from.
|
|
1528
2249
|
|
|
1529
2250
|
---
|
|
1530
2251
|
|
|
1531
|
-
##### `
|
|
2252
|
+
##### `maxEnvironments`<sup>Optional</sup> <a name="maxEnvironments" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions.property.maxEnvironments"></a>
|
|
1532
2253
|
|
|
1533
2254
|
```typescript
|
|
1534
|
-
public readonly
|
|
2255
|
+
public readonly maxEnvironments: number;
|
|
1535
2256
|
```
|
|
1536
2257
|
|
|
1537
|
-
- *Type:*
|
|
1538
|
-
- *Default:*
|
|
2258
|
+
- *Type:* number
|
|
2259
|
+
- *Default:* scales within the account's vCPU quota
|
|
1539
2260
|
|
|
1540
|
-
The
|
|
2261
|
+
The most execution environments the endpoint may use (2–10,000). Each one uses 2 vCPUs of the account's quota.
|
|
2262
|
+
|
|
2263
|
+
Enforced separately in each region the endpoint serves from.
|
|
1541
2264
|
|
|
1542
2265
|
---
|
|
1543
2266
|
|
|
1544
|
-
##### `
|
|
2267
|
+
##### `rateLimit`<sup>Optional</sup> <a name="rateLimit" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions.property.rateLimit"></a>
|
|
1545
2268
|
|
|
1546
2269
|
```typescript
|
|
1547
|
-
public readonly
|
|
2270
|
+
public readonly rateLimit: number;
|
|
1548
2271
|
```
|
|
1549
2272
|
|
|
1550
|
-
- *Type:*
|
|
1551
|
-
- *Default:* the
|
|
2273
|
+
- *Type:* number
|
|
2274
|
+
- *Default:* no limit beyond the service quota of 10,000 requests per second per endpoint (per region)
|
|
1552
2275
|
|
|
1553
|
-
The
|
|
2276
|
+
The most requests per second the endpoint accepts;
|
|
1554
2277
|
|
|
1555
|
-
|
|
2278
|
+
excess requests get HTTP 429.
|
|
2279
|
+
Allowed: 0 (blocks all traffic), 100–1,000 in steps of 100, or 2,000–10,000 in steps of 1,000.
|
|
2280
|
+
|
|
2281
|
+
Enforced separately in each region the endpoint serves from, so a multi-region endpoint
|
|
2282
|
+
can accept this many requests per second in every region.
|
|
1556
2283
|
|
|
1557
2284
|
---
|
|
1558
2285
|
|
|
1559
|
-
##### `
|
|
2286
|
+
##### `regions`<sup>Optional</sup> <a name="regions" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions.property.regions"></a>
|
|
1560
2287
|
|
|
1561
2288
|
```typescript
|
|
1562
|
-
public readonly
|
|
2289
|
+
public readonly regions: string[];
|
|
1563
2290
|
```
|
|
1564
2291
|
|
|
1565
|
-
- *Type:*
|
|
1566
|
-
- *Default:*
|
|
2292
|
+
- *Type:* string[]
|
|
2293
|
+
- *Default:* no extra regions
|
|
1567
2294
|
|
|
1568
|
-
|
|
2295
|
+
Regions to serve from in addition to the home region (the stack's region).
|
|
2296
|
+
|
|
2297
|
+
Required (at least one) for `MULTI_REGION` and `PER_REGION`; must be empty for `HOME_REGION`.
|
|
2298
|
+
|
|
2299
|
+
Changing this creates a new endpoint with a new URL.
|
|
1569
2300
|
|
|
1570
2301
|
---
|
|
1571
2302
|
|
|
1572
|
-
###
|
|
2303
|
+
### WebFunctionLinearDeploymentOptions <a name="WebFunctionLinearDeploymentOptions" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionLinearDeploymentOptions"></a>
|
|
1573
2304
|
|
|
1574
|
-
Options for a
|
|
2305
|
+
Options for a linear deployment.
|
|
1575
2306
|
|
|
1576
|
-
#### Initializer <a name="Initializer" id="@ashishpandeyone/cdk-lambda-web-function.
|
|
2307
|
+
#### Initializer <a name="Initializer" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionLinearDeploymentOptions.Initializer"></a>
|
|
1577
2308
|
|
|
1578
2309
|
```typescript
|
|
1579
|
-
import {
|
|
2310
|
+
import { WebFunctionLinearDeploymentOptions } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
1580
2311
|
|
|
1581
|
-
const
|
|
2312
|
+
const webFunctionLinearDeploymentOptions: WebFunctionLinearDeploymentOptions = { ... }
|
|
1582
2313
|
```
|
|
1583
2314
|
|
|
1584
2315
|
#### Properties <a name="Properties" id="Properties"></a>
|
|
1585
2316
|
|
|
1586
2317
|
| **Name** | **Type** | **Description** |
|
|
1587
2318
|
| --- | --- | --- |
|
|
1588
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.
|
|
1589
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.
|
|
1590
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.
|
|
2319
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionLinearDeploymentOptions.property.interval">interval</a></code> | <code>aws-cdk-lib.Duration</code> | How long each step serves before the next one (at least 1 minute, and at most 45 minutes in total). |
|
|
2320
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionLinearDeploymentOptions.property.percent">percent</a></code> | <code>number</code> | The share of traffic, in whole percent (5-50), that moves to the new revision at each step. |
|
|
2321
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionLinearDeploymentOptions.property.alarms">alarms</a></code> | <code>aws-cdk-lib.aws_cloudwatch.IAlarm[]</code> | Alarms that stop the deployment: if one is in ALARM, the endpoint goes back to the previous revision and the deployment fails, so CloudFormation rolls the stack back. |
|
|
1591
2322
|
|
|
1592
2323
|
---
|
|
1593
2324
|
|
|
1594
|
-
##### `
|
|
2325
|
+
##### `interval`<sup>Required</sup> <a name="interval" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionLinearDeploymentOptions.property.interval"></a>
|
|
1595
2326
|
|
|
1596
2327
|
```typescript
|
|
1597
|
-
public readonly
|
|
2328
|
+
public readonly interval: Duration;
|
|
1598
2329
|
```
|
|
1599
2330
|
|
|
1600
|
-
- *Type:*
|
|
1601
|
-
- *Default:* `default-<hash of type and regions>`
|
|
1602
|
-
|
|
1603
|
-
The endpoint's name, shown in logs (`endpointName`) and in the `lambda-web-endpoint-name` header.
|
|
2331
|
+
- *Type:* aws-cdk-lib.Duration
|
|
1604
2332
|
|
|
1605
|
-
|
|
1606
|
-
so changing either deploys a new endpoint cleanly. When set, changing the endpoint type or
|
|
1607
|
-
regions also requires a new name: two endpoints of one function can't share a name, and
|
|
1608
|
-
CloudFormation creates the replacement before deleting the old one.
|
|
2333
|
+
How long each step serves before the next one (at least 1 minute, and at most 45 minutes in total).
|
|
1609
2334
|
|
|
1610
2335
|
---
|
|
1611
2336
|
|
|
1612
|
-
##### `
|
|
2337
|
+
##### `percent`<sup>Required</sup> <a name="percent" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionLinearDeploymentOptions.property.percent"></a>
|
|
1613
2338
|
|
|
1614
2339
|
```typescript
|
|
1615
|
-
public readonly
|
|
2340
|
+
public readonly percent: number;
|
|
1616
2341
|
```
|
|
1617
2342
|
|
|
1618
|
-
- *Type:*
|
|
1619
|
-
- *Default:* WebFunctionEndpointType.HOME_REGION
|
|
2343
|
+
- *Type:* number
|
|
1620
2344
|
|
|
1621
|
-
|
|
2345
|
+
The share of traffic, in whole percent (5-50), that moves to the new revision at each step.
|
|
1622
2346
|
|
|
1623
2347
|
---
|
|
1624
2348
|
|
|
1625
|
-
##### `
|
|
2349
|
+
##### `alarms`<sup>Optional</sup> <a name="alarms" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionLinearDeploymentOptions.property.alarms"></a>
|
|
1626
2350
|
|
|
1627
2351
|
```typescript
|
|
1628
|
-
public readonly
|
|
2352
|
+
public readonly alarms: IAlarm[];
|
|
1629
2353
|
```
|
|
1630
2354
|
|
|
1631
|
-
- *Type:*
|
|
1632
|
-
- *Default:* no
|
|
1633
|
-
|
|
1634
|
-
Regions to serve from in addition to the home region (the stack's region).
|
|
2355
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.IAlarm[]
|
|
2356
|
+
- *Default:* no alarms: traffic moves on a timer
|
|
1635
2357
|
|
|
1636
|
-
|
|
2358
|
+
Alarms that stop the deployment: if one is in ALARM, the endpoint goes back to the previous revision and the deployment fails, so CloudFormation rolls the stack back.
|
|
1637
2359
|
|
|
1638
|
-
|
|
2360
|
+
They're checked before traffic moves, during every step, and once the new revision has all traffic.
|
|
2361
|
+
Use alarms in any region (by ARN), including composite alarms.
|
|
1639
2362
|
|
|
1640
2363
|
---
|
|
1641
2364
|
|
|
@@ -1658,11 +2381,12 @@ const webFunctionOptions: WebFunctionOptions = { ... }
|
|
|
1658
2381
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.authType">authType</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType">WebFunctionAuthType</a></code> | How callers of the endpoint are authenticated. |
|
|
1659
2382
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.applicationLogLevelV2">applicationLogLevelV2</a></code> | <code>aws-cdk-lib.aws_lambda.ApplicationLogLevel</code> | The minimum level of application logs to keep. |
|
|
1660
2383
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.description">description</a></code> | <code>string</code> | A description of the function's code and configuration. |
|
|
1661
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.endpoint">endpoint</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions">WebFunctionEndpointOptions</a></code> | The endpoint: where it serves from,
|
|
2384
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.endpoint">endpoint</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions">WebFunctionEndpointOptions</a></code> | The default endpoint (`fn.endpoint`): where it serves from, its name and limits. It serves the current revision; route it elsewhere with `fn.endpoint.routeTraffic()`. Add more endpoints with `addEndpoint`. |
|
|
1662
2385
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.environment">environment</a></code> | <code>{[ key: string ]: string}</code> | Environment variables. |
|
|
1663
2386
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.logRemovalPolicy">logRemovalPolicy</a></code> | <code>aws-cdk-lib.RemovalPolicy</code> | What happens to the log groups when the function is removed: RETAIN or DESTROY. |
|
|
1664
2387
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.logRetention">logRetention</a></code> | <code>aws-cdk-lib.aws_logs.RetentionDays</code> | Retention for every log group of the function, in every region it serves from. |
|
|
1665
2388
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.maxConcurrencyPerEnvironment">maxConcurrencyPerEnvironment</a></code> | <code>number</code> | How many requests one execution environment handles at the same time (1-128). |
|
|
2389
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.revisionRetention">revisionRetention</a></code> | <code>number</code> | How many of the newest revisions to keep (1-50). |
|
|
1666
2390
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.role">role</a></code> | <code>aws-cdk-lib.aws_iam.IRole</code> | The execution role. |
|
|
1667
2391
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.systemLogLevelV2">systemLogLevelV2</a></code> | <code>aws-cdk-lib.aws_lambda.SystemLogLevel</code> | The minimum level of platform logs to keep (DEBUG, INFO or WARN). |
|
|
1668
2392
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.timeout">timeout</a></code> | <code>aws-cdk-lib.Duration</code> | How long a single request may run. |
|
|
@@ -1715,9 +2439,9 @@ public readonly endpoint: WebFunctionEndpointOptions;
|
|
|
1715
2439
|
```
|
|
1716
2440
|
|
|
1717
2441
|
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions">WebFunctionEndpointOptions</a>
|
|
1718
|
-
- *Default:* a HOME_REGION endpoint
|
|
2442
|
+
- *Default:* a HOME_REGION endpoint serving the current revision
|
|
1719
2443
|
|
|
1720
|
-
The endpoint: where it serves from,
|
|
2444
|
+
The default endpoint (`fn.endpoint`): where it serves from, its name and limits. It serves the current revision; route it elsewhere with `fn.endpoint.routeTraffic()`. Add more endpoints with `addEndpoint`.
|
|
1721
2445
|
|
|
1722
2446
|
---
|
|
1723
2447
|
|
|
@@ -1779,6 +2503,26 @@ Requests share module-level state, so handlers must be concurrency-safe.
|
|
|
1779
2503
|
|
|
1780
2504
|
---
|
|
1781
2505
|
|
|
2506
|
+
##### `revisionRetention`<sup>Optional</sup> <a name="revisionRetention" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.revisionRetention"></a>
|
|
2507
|
+
|
|
2508
|
+
```typescript
|
|
2509
|
+
public readonly revisionRetention: number;
|
|
2510
|
+
```
|
|
2511
|
+
|
|
2512
|
+
- *Type:* number
|
|
2513
|
+
- *Default:* 20
|
|
2514
|
+
|
|
2515
|
+
How many of the newest revisions to keep (1-50).
|
|
2516
|
+
|
|
2517
|
+
Each deployment that changes the code or
|
|
2518
|
+
configuration creates a revision; older ones stay available to roll back to or route traffic to,
|
|
2519
|
+
and the oldest beyond this count are deleted after each deployment.
|
|
2520
|
+
|
|
2521
|
+
Revisions that an endpoint routes to are never deleted, and neither are those the previous
|
|
2522
|
+
deployment used (a rollback returns to them).
|
|
2523
|
+
|
|
2524
|
+
---
|
|
2525
|
+
|
|
1782
2526
|
##### `role`<sup>Optional</sup> <a name="role" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionOptions.property.role"></a>
|
|
1783
2527
|
|
|
1784
2528
|
```typescript
|
|
@@ -1855,11 +2599,12 @@ const webFunctionProps: WebFunctionProps = { ... }
|
|
|
1855
2599
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps.property.authType">authType</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType">WebFunctionAuthType</a></code> | How callers of the endpoint are authenticated. |
|
|
1856
2600
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps.property.applicationLogLevelV2">applicationLogLevelV2</a></code> | <code>aws-cdk-lib.aws_lambda.ApplicationLogLevel</code> | The minimum level of application logs to keep. |
|
|
1857
2601
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps.property.description">description</a></code> | <code>string</code> | A description of the function's code and configuration. |
|
|
1858
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps.property.endpoint">endpoint</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions">WebFunctionEndpointOptions</a></code> | The endpoint: where it serves from,
|
|
2602
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps.property.endpoint">endpoint</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions">WebFunctionEndpointOptions</a></code> | The default endpoint (`fn.endpoint`): where it serves from, its name and limits. It serves the current revision; route it elsewhere with `fn.endpoint.routeTraffic()`. Add more endpoints with `addEndpoint`. |
|
|
1859
2603
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps.property.environment">environment</a></code> | <code>{[ key: string ]: string}</code> | Environment variables. |
|
|
1860
2604
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps.property.logRemovalPolicy">logRemovalPolicy</a></code> | <code>aws-cdk-lib.RemovalPolicy</code> | What happens to the log groups when the function is removed: RETAIN or DESTROY. |
|
|
1861
2605
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps.property.logRetention">logRetention</a></code> | <code>aws-cdk-lib.aws_logs.RetentionDays</code> | Retention for every log group of the function, in every region it serves from. |
|
|
1862
2606
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps.property.maxConcurrencyPerEnvironment">maxConcurrencyPerEnvironment</a></code> | <code>number</code> | How many requests one execution environment handles at the same time (1-128). |
|
|
2607
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps.property.revisionRetention">revisionRetention</a></code> | <code>number</code> | How many of the newest revisions to keep (1-50). |
|
|
1863
2608
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps.property.role">role</a></code> | <code>aws-cdk-lib.aws_iam.IRole</code> | The execution role. |
|
|
1864
2609
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps.property.systemLogLevelV2">systemLogLevelV2</a></code> | <code>aws-cdk-lib.aws_lambda.SystemLogLevel</code> | The minimum level of platform logs to keep (DEBUG, INFO or WARN). |
|
|
1865
2610
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps.property.timeout">timeout</a></code> | <code>aws-cdk-lib.Duration</code> | How long a single request may run. |
|
|
@@ -1915,9 +2660,9 @@ public readonly endpoint: WebFunctionEndpointOptions;
|
|
|
1915
2660
|
```
|
|
1916
2661
|
|
|
1917
2662
|
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions">WebFunctionEndpointOptions</a>
|
|
1918
|
-
- *Default:* a HOME_REGION endpoint
|
|
2663
|
+
- *Default:* a HOME_REGION endpoint serving the current revision
|
|
1919
2664
|
|
|
1920
|
-
The endpoint: where it serves from,
|
|
2665
|
+
The default endpoint (`fn.endpoint`): where it serves from, its name and limits. It serves the current revision; route it elsewhere with `fn.endpoint.routeTraffic()`. Add more endpoints with `addEndpoint`.
|
|
1921
2666
|
|
|
1922
2667
|
---
|
|
1923
2668
|
|
|
@@ -1979,6 +2724,26 @@ Requests share module-level state, so handlers must be concurrency-safe.
|
|
|
1979
2724
|
|
|
1980
2725
|
---
|
|
1981
2726
|
|
|
2727
|
+
##### `revisionRetention`<sup>Optional</sup> <a name="revisionRetention" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps.property.revisionRetention"></a>
|
|
2728
|
+
|
|
2729
|
+
```typescript
|
|
2730
|
+
public readonly revisionRetention: number;
|
|
2731
|
+
```
|
|
2732
|
+
|
|
2733
|
+
- *Type:* number
|
|
2734
|
+
- *Default:* 20
|
|
2735
|
+
|
|
2736
|
+
How many of the newest revisions to keep (1-50).
|
|
2737
|
+
|
|
2738
|
+
Each deployment that changes the code or
|
|
2739
|
+
configuration creates a revision; older ones stay available to roll back to or route traffic to,
|
|
2740
|
+
and the oldest beyond this count are deleted after each deployment.
|
|
2741
|
+
|
|
2742
|
+
Revisions that an endpoint routes to are never deleted, and neither are those the previous
|
|
2743
|
+
deployment used (a rollback returns to them).
|
|
2744
|
+
|
|
2745
|
+
---
|
|
2746
|
+
|
|
1982
2747
|
##### `role`<sup>Optional</sup> <a name="role" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps.property.role"></a>
|
|
1983
2748
|
|
|
1984
2749
|
```typescript
|
|
@@ -2075,19 +2840,168 @@ The file that starts your server, relative to the root of the code.
|
|
|
2075
2840
|
|
|
2076
2841
|
---
|
|
2077
2842
|
|
|
2843
|
+
### WebFunctionRevisionAttributes <a name="WebFunctionRevisionAttributes" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevisionAttributes"></a>
|
|
2844
|
+
|
|
2845
|
+
Attributes of an existing revision.
|
|
2846
|
+
|
|
2847
|
+
#### Initializer <a name="Initializer" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevisionAttributes.Initializer"></a>
|
|
2848
|
+
|
|
2849
|
+
```typescript
|
|
2850
|
+
import { WebFunctionRevisionAttributes } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
2851
|
+
|
|
2852
|
+
const webFunctionRevisionAttributes: WebFunctionRevisionAttributes = { ... }
|
|
2853
|
+
```
|
|
2854
|
+
|
|
2855
|
+
#### Properties <a name="Properties" id="Properties"></a>
|
|
2856
|
+
|
|
2857
|
+
| **Name** | **Type** | **Description** |
|
|
2858
|
+
| --- | --- | --- |
|
|
2859
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevisionAttributes.property.revisionId">revisionId</a></code> | <code>string</code> | The revision's ID, e.g. `rev-a1b2c` (the `revisionId` of an earlier deployment). |
|
|
2860
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevisionAttributes.property.webFunction">webFunction</a></code> | <code>aws-cdk-lib.interfaces.aws_lambda.IWebFunctionRef</code> | The function the revision belongs to. |
|
|
2861
|
+
|
|
2862
|
+
---
|
|
2863
|
+
|
|
2864
|
+
##### `revisionId`<sup>Required</sup> <a name="revisionId" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevisionAttributes.property.revisionId"></a>
|
|
2865
|
+
|
|
2866
|
+
```typescript
|
|
2867
|
+
public readonly revisionId: string;
|
|
2868
|
+
```
|
|
2869
|
+
|
|
2870
|
+
- *Type:* string
|
|
2871
|
+
|
|
2872
|
+
The revision's ID, e.g. `rev-a1b2c` (the `revisionId` of an earlier deployment).
|
|
2873
|
+
|
|
2874
|
+
---
|
|
2875
|
+
|
|
2876
|
+
##### `webFunction`<sup>Required</sup> <a name="webFunction" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevisionAttributes.property.webFunction"></a>
|
|
2877
|
+
|
|
2878
|
+
```typescript
|
|
2879
|
+
public readonly webFunction: IWebFunctionRef;
|
|
2880
|
+
```
|
|
2881
|
+
|
|
2882
|
+
- *Type:* aws-cdk-lib.interfaces.aws_lambda.IWebFunctionRef
|
|
2883
|
+
|
|
2884
|
+
The function the revision belongs to.
|
|
2885
|
+
|
|
2886
|
+
---
|
|
2887
|
+
|
|
2888
|
+
### WebFunctionRevisionWeight <a name="WebFunctionRevisionWeight" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevisionWeight"></a>
|
|
2889
|
+
|
|
2890
|
+
A revision and the share of an endpoint's traffic it receives.
|
|
2891
|
+
|
|
2892
|
+
#### Initializer <a name="Initializer" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevisionWeight.Initializer"></a>
|
|
2893
|
+
|
|
2894
|
+
```typescript
|
|
2895
|
+
import { WebFunctionRevisionWeight } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
2896
|
+
|
|
2897
|
+
const webFunctionRevisionWeight: WebFunctionRevisionWeight = { ... }
|
|
2898
|
+
```
|
|
2899
|
+
|
|
2900
|
+
#### Properties <a name="Properties" id="Properties"></a>
|
|
2901
|
+
|
|
2902
|
+
| **Name** | **Type** | **Description** |
|
|
2903
|
+
| --- | --- | --- |
|
|
2904
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevisionWeight.property.revision">revision</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision">IWebFunctionRevision</a></code> | The revision. |
|
|
2905
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevisionWeight.property.weight">weight</a></code> | <code>number</code> | The revision's share of the endpoint's traffic, as a fraction (like `lambda.Alias` `additionalVersions`). Must be a whole percentage from 0.01 to 0.99. |
|
|
2906
|
+
|
|
2907
|
+
---
|
|
2908
|
+
|
|
2909
|
+
##### `revision`<sup>Required</sup> <a name="revision" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevisionWeight.property.revision"></a>
|
|
2910
|
+
|
|
2911
|
+
```typescript
|
|
2912
|
+
public readonly revision: IWebFunctionRevision;
|
|
2913
|
+
```
|
|
2914
|
+
|
|
2915
|
+
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision">IWebFunctionRevision</a>
|
|
2916
|
+
|
|
2917
|
+
The revision.
|
|
2918
|
+
|
|
2919
|
+
---
|
|
2920
|
+
|
|
2921
|
+
##### `weight`<sup>Required</sup> <a name="weight" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevisionWeight.property.weight"></a>
|
|
2922
|
+
|
|
2923
|
+
```typescript
|
|
2924
|
+
public readonly weight: number;
|
|
2925
|
+
```
|
|
2926
|
+
|
|
2927
|
+
- *Type:* number
|
|
2928
|
+
|
|
2929
|
+
The revision's share of the endpoint's traffic, as a fraction (like `lambda.Alias` `additionalVersions`). Must be a whole percentage from 0.01 to 0.99.
|
|
2930
|
+
|
|
2931
|
+
---
|
|
2932
|
+
|
|
2078
2933
|
## Classes <a name="Classes" id="Classes"></a>
|
|
2079
2934
|
|
|
2935
|
+
### WebFunctionDeployment <a name="WebFunctionDeployment" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment"></a>
|
|
2936
|
+
|
|
2937
|
+
How an endpoint moves its traffic to a new revision.
|
|
2938
|
+
|
|
2939
|
+
|
|
2940
|
+
#### Static Functions <a name="Static Functions" id="Static Functions"></a>
|
|
2941
|
+
|
|
2942
|
+
| **Name** | **Description** |
|
|
2943
|
+
| --- | --- |
|
|
2944
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment.allAtOnce">allAtOnce</a></code> | All traffic moves to the new revision at once, as soon as it's ready (the default). |
|
|
2945
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment.canary">canary</a></code> | The new revision first gets `percent` of the traffic for `bake`, then all of it. |
|
|
2946
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment.linear">linear</a></code> | The new revision gets `percent` more of the traffic every `interval` until it has all of it. |
|
|
2947
|
+
|
|
2948
|
+
---
|
|
2949
|
+
|
|
2950
|
+
##### `allAtOnce` <a name="allAtOnce" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment.allAtOnce"></a>
|
|
2951
|
+
|
|
2952
|
+
```typescript
|
|
2953
|
+
import { WebFunctionDeployment } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
2954
|
+
|
|
2955
|
+
WebFunctionDeployment.allAtOnce()
|
|
2956
|
+
```
|
|
2957
|
+
|
|
2958
|
+
All traffic moves to the new revision at once, as soon as it's ready (the default).
|
|
2959
|
+
|
|
2960
|
+
##### `canary` <a name="canary" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment.canary"></a>
|
|
2961
|
+
|
|
2962
|
+
```typescript
|
|
2963
|
+
import { WebFunctionDeployment } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
2964
|
+
|
|
2965
|
+
WebFunctionDeployment.canary(options: WebFunctionCanaryDeploymentOptions)
|
|
2966
|
+
```
|
|
2967
|
+
|
|
2968
|
+
The new revision first gets `percent` of the traffic for `bake`, then all of it.
|
|
2969
|
+
|
|
2970
|
+
###### `options`<sup>Required</sup> <a name="options" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment.canary.parameter.options"></a>
|
|
2971
|
+
|
|
2972
|
+
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionCanaryDeploymentOptions">WebFunctionCanaryDeploymentOptions</a>
|
|
2973
|
+
|
|
2974
|
+
---
|
|
2975
|
+
|
|
2976
|
+
##### `linear` <a name="linear" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment.linear"></a>
|
|
2977
|
+
|
|
2978
|
+
```typescript
|
|
2979
|
+
import { WebFunctionDeployment } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
2980
|
+
|
|
2981
|
+
WebFunctionDeployment.linear(options: WebFunctionLinearDeploymentOptions)
|
|
2982
|
+
```
|
|
2983
|
+
|
|
2984
|
+
The new revision gets `percent` more of the traffic every `interval` until it has all of it.
|
|
2985
|
+
|
|
2986
|
+
###### `options`<sup>Required</sup> <a name="options" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment.linear.parameter.options"></a>
|
|
2987
|
+
|
|
2988
|
+
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionLinearDeploymentOptions">WebFunctionLinearDeploymentOptions</a>
|
|
2989
|
+
|
|
2990
|
+
---
|
|
2991
|
+
|
|
2992
|
+
|
|
2993
|
+
|
|
2080
2994
|
### WebFunctionGrants <a name="WebFunctionGrants" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionGrants"></a>
|
|
2081
2995
|
|
|
2082
|
-
Grants on a Web Function.
|
|
2996
|
+
Grants on a Web Function endpoint.
|
|
2083
2997
|
|
|
2084
|
-
Access
|
|
2998
|
+
Access them as `fn.grants` (the default endpoint) or `endpoint.grants`.
|
|
2085
2999
|
|
|
2086
3000
|
#### Methods <a name="Methods" id="Methods"></a>
|
|
2087
3001
|
|
|
2088
3002
|
| **Name** | **Description** |
|
|
2089
3003
|
| --- | --- |
|
|
2090
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionGrants.invoke">invoke</a></code> | Allows `grantee` to call the
|
|
3004
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionGrants.invoke">invoke</a></code> | Allows `grantee` to call the endpoint (`lambda:InvokeWebFunctionEndpoint`). |
|
|
2091
3005
|
|
|
2092
3006
|
---
|
|
2093
3007
|
|
|
@@ -2097,7 +3011,7 @@ Access it as `fn.grants`.
|
|
|
2097
3011
|
public invoke(grantee: IGrantable): Grant
|
|
2098
3012
|
```
|
|
2099
3013
|
|
|
2100
|
-
Allows `grantee` to call the
|
|
3014
|
+
Allows `grantee` to call the endpoint (`lambda:InvokeWebFunctionEndpoint`).
|
|
2101
3015
|
|
|
2102
3016
|
The grant is on the endpoint's home-region ARN, which IAM evaluates for every region the
|
|
2103
3017
|
endpoint serves from, including a MULTI_REGION global URL.
|
|
@@ -2215,6 +3129,74 @@ The function's name.
|
|
|
2215
3129
|
|
|
2216
3130
|
---
|
|
2217
3131
|
|
|
3132
|
+
### IWebFunctionRevision <a name="IWebFunctionRevision" id="@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision"></a>
|
|
3133
|
+
|
|
3134
|
+
- *Extends:* constructs.IConstruct
|
|
3135
|
+
|
|
3136
|
+
- *Implemented By:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevision">WebFunctionRevision</a>, <a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision">IWebFunctionRevision</a>
|
|
3137
|
+
|
|
3138
|
+
A revision of a Web Function: an immutable snapshot of its code and configuration.
|
|
3139
|
+
|
|
3140
|
+
|
|
3141
|
+
#### Properties <a name="Properties" id="Properties"></a>
|
|
3142
|
+
|
|
3143
|
+
| **Name** | **Type** | **Description** |
|
|
3144
|
+
| --- | --- | --- |
|
|
3145
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. |
|
|
3146
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision.property.revisionArn">revisionArn</a></code> | <code>string</code> | The revision's ARN. |
|
|
3147
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision.property.revisionId">revisionId</a></code> | <code>string</code> | The revision's ID, e.g. `rev-a1b2c`. |
|
|
3148
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision.property.webFunction">webFunction</a></code> | <code>aws-cdk-lib.interfaces.aws_lambda.IWebFunctionRef</code> | The function the revision belongs to. |
|
|
3149
|
+
|
|
3150
|
+
---
|
|
3151
|
+
|
|
3152
|
+
##### `node`<sup>Required</sup> <a name="node" id="@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision.property.node"></a>
|
|
3153
|
+
|
|
3154
|
+
```typescript
|
|
3155
|
+
public readonly node: Node;
|
|
3156
|
+
```
|
|
3157
|
+
|
|
3158
|
+
- *Type:* constructs.Node
|
|
3159
|
+
|
|
3160
|
+
The tree node.
|
|
3161
|
+
|
|
3162
|
+
---
|
|
3163
|
+
|
|
3164
|
+
##### `revisionArn`<sup>Required</sup> <a name="revisionArn" id="@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision.property.revisionArn"></a>
|
|
3165
|
+
|
|
3166
|
+
```typescript
|
|
3167
|
+
public readonly revisionArn: string;
|
|
3168
|
+
```
|
|
3169
|
+
|
|
3170
|
+
- *Type:* string
|
|
3171
|
+
|
|
3172
|
+
The revision's ARN.
|
|
3173
|
+
|
|
3174
|
+
---
|
|
3175
|
+
|
|
3176
|
+
##### `revisionId`<sup>Required</sup> <a name="revisionId" id="@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision.property.revisionId"></a>
|
|
3177
|
+
|
|
3178
|
+
```typescript
|
|
3179
|
+
public readonly revisionId: string;
|
|
3180
|
+
```
|
|
3181
|
+
|
|
3182
|
+
- *Type:* string
|
|
3183
|
+
|
|
3184
|
+
The revision's ID, e.g. `rev-a1b2c`.
|
|
3185
|
+
|
|
3186
|
+
---
|
|
3187
|
+
|
|
3188
|
+
##### `webFunction`<sup>Required</sup> <a name="webFunction" id="@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision.property.webFunction"></a>
|
|
3189
|
+
|
|
3190
|
+
```typescript
|
|
3191
|
+
public readonly webFunction: IWebFunctionRef;
|
|
3192
|
+
```
|
|
3193
|
+
|
|
3194
|
+
- *Type:* aws-cdk-lib.interfaces.aws_lambda.IWebFunctionRef
|
|
3195
|
+
|
|
3196
|
+
The function the revision belongs to.
|
|
3197
|
+
|
|
3198
|
+
---
|
|
3199
|
+
|
|
2218
3200
|
## Enums <a name="Enums" id="Enums"></a>
|
|
2219
3201
|
|
|
2220
3202
|
### WebFunctionAuthType <a name="WebFunctionAuthType" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType"></a>
|