@ashishpandeyone/cdk-lambda-web-function 0.1.3 → 0.1.5
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 +880 -212
- package/.jsii.tabl.json +1 -1
- package/API.md +1155 -196
- package/README.md +64 -7
- package/assets/web-function-provider/index.js +23 -23
- package/lib/nodejs-web-function.js +1 -1
- package/lib/private/code-bucket.d.ts +3 -0
- package/lib/private/code-bucket.js +18 -2
- package/lib/private/provider-protocol.d.ts +13 -0
- package/lib/private/provider-protocol.js +9 -2
- package/lib/private/provider.d.ts +3 -2
- package/lib/private/provider.js +25 -4
- package/lib/private/resource-policy.d.ts +15 -0
- package/lib/private/resource-policy.js +48 -0
- package/lib/web-function-deployment.js +1 -1
- package/lib/web-function-endpoint.js +3 -3
- package/lib/web-function-grants.d.ts +13 -2
- package/lib/web-function-grants.js +24 -12
- package/lib/web-function-revision.js +1 -1
- package/lib/web-function.d.ts +159 -29
- package/lib/web-function.js +184 -47
- package/package.json +1 -2
package/API.md
CHANGED
|
@@ -51,9 +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.
|
|
55
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addEnvironment">addEnvironment</a></code> | Adds an environment variable. |
|
|
56
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addToRolePolicy">addToRolePolicy</a></code> | Adds a statement to the execution role's policy. |
|
|
54
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addToResourcePolicy">addToResourcePolicy</a></code> | Adds a statement to the function's resource policy, e.g. to let another account manage the function. For invoking, prefer `addPermission` or `grantInvoke`. |
|
|
57
55
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.grantInvoke">grantInvoke</a></code> | Allows `grantee` to call the endpoint. |
|
|
58
56
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.metric">metric</a></code> | A metric of this function's execution environments in `AWS/Lambda/Web` (dimension `FunctionName`), across all endpoints. |
|
|
59
57
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.metricActiveTime">metricActiveTime</a></code> | Time the execution environments were active (`EnvironmentActiveTime`). |
|
|
@@ -61,6 +59,10 @@ new NodejsWebFunction(scope: Construct, id: string, props: NodejsWebFunctionProp
|
|
|
61
59
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.metricCpuTime">metricCpuTime</a></code> | CPU time the execution environments used (`EnvironmentCPUTime`). |
|
|
62
60
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.metricMaxMemoryUsage">metricMaxMemoryUsage</a></code> | Peak memory an execution environment used (`EnvironmentMaxMemoryUsage`); |
|
|
63
61
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.metricResponseBytes">metricResponseBytes</a></code> | Bytes sent in responses (`ResponseBytes`). |
|
|
62
|
+
| <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. |
|
|
63
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addEnvironment">addEnvironment</a></code> | Adds an environment variable. |
|
|
64
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addPermission">addPermission</a></code> | Allows a principal in another account, an AWS service or an organization to call the function's endpoints, through the function's resource policy. |
|
|
65
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addToRolePolicy">addToRolePolicy</a></code> | Adds a statement to the execution role's policy. |
|
|
64
66
|
|
|
65
67
|
---
|
|
66
68
|
|
|
@@ -135,59 +137,19 @@ account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
|
|
|
135
137
|
|
|
136
138
|
---
|
|
137
139
|
|
|
138
|
-
##### `
|
|
139
|
-
|
|
140
|
-
```typescript
|
|
141
|
-
public addEndpoint(id: string, options: AddWebFunctionEndpointOptions): WebFunctionEndpoint
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
Adds an endpoint (up to 10 per function), e.g. a public one next to an IAM-only one, or one pinned to an earlier revision. Each endpoint has its own URL, authentication, regions and limits.
|
|
145
|
-
|
|
146
|
-
###### `id`<sup>Required</sup> <a name="id" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addEndpoint.parameter.id"></a>
|
|
147
|
-
|
|
148
|
-
- *Type:* string
|
|
149
|
-
|
|
150
|
-
the endpoint's construct ID, also used in its generated name (`<id>-<hash>`).
|
|
151
|
-
|
|
152
|
-
---
|
|
153
|
-
|
|
154
|
-
###### `options`<sup>Required</sup> <a name="options" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addEndpoint.parameter.options"></a>
|
|
155
|
-
|
|
156
|
-
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions">AddWebFunctionEndpointOptions</a>
|
|
157
|
-
|
|
158
|
-
---
|
|
159
|
-
|
|
160
|
-
##### `addEnvironment` <a name="addEnvironment" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addEnvironment"></a>
|
|
140
|
+
##### `addToResourcePolicy` <a name="addToResourcePolicy" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addToResourcePolicy"></a>
|
|
161
141
|
|
|
162
142
|
```typescript
|
|
163
|
-
public
|
|
143
|
+
public addToResourcePolicy(statement: PolicyStatement): AddToResourcePolicyResult
|
|
164
144
|
```
|
|
165
145
|
|
|
166
|
-
Adds
|
|
167
|
-
|
|
168
|
-
Names starting with `AWS_` are reserved.
|
|
169
|
-
|
|
170
|
-
###### `key`<sup>Required</sup> <a name="key" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addEnvironment.parameter.key"></a>
|
|
171
|
-
|
|
172
|
-
- *Type:* string
|
|
173
|
-
|
|
174
|
-
---
|
|
175
|
-
|
|
176
|
-
###### `value`<sup>Required</sup> <a name="value" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addEnvironment.parameter.value"></a>
|
|
177
|
-
|
|
178
|
-
- *Type:* string
|
|
179
|
-
|
|
180
|
-
---
|
|
181
|
-
|
|
182
|
-
##### `addToRolePolicy` <a name="addToRolePolicy" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addToRolePolicy"></a>
|
|
183
|
-
|
|
184
|
-
```typescript
|
|
185
|
-
public addToRolePolicy(statement: PolicyStatement): void
|
|
186
|
-
```
|
|
146
|
+
Adds a statement to the function's resource policy, e.g. to let another account manage the function. For invoking, prefer `addPermission` or `grantInvoke`.
|
|
187
147
|
|
|
188
|
-
|
|
148
|
+
The function has one resource policy (`AWS::Lambda::ResourcePolicy`), created on the first statement. This stack
|
|
149
|
+
is its only writer: another stack or template can't also attach one, and changes made outside CloudFormation
|
|
150
|
+
are overwritten by the next update of the policy.
|
|
189
151
|
|
|
190
|
-
###### `statement`<sup>Required</sup> <a name="statement" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.
|
|
152
|
+
###### `statement`<sup>Required</sup> <a name="statement" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addToResourcePolicy.parameter.statement"></a>
|
|
191
153
|
|
|
192
154
|
- *Type:* aws-cdk-lib.aws_iam.PolicyStatement
|
|
193
155
|
|
|
@@ -307,6 +269,88 @@ Bytes sent in responses (`ResponseBytes`).
|
|
|
307
269
|
|
|
308
270
|
---
|
|
309
271
|
|
|
272
|
+
##### `addEndpoint` <a name="addEndpoint" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addEndpoint"></a>
|
|
273
|
+
|
|
274
|
+
```typescript
|
|
275
|
+
public addEndpoint(id: string, options: AddWebFunctionEndpointOptions): WebFunctionEndpoint
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
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.
|
|
279
|
+
|
|
280
|
+
###### `id`<sup>Required</sup> <a name="id" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addEndpoint.parameter.id"></a>
|
|
281
|
+
|
|
282
|
+
- *Type:* string
|
|
283
|
+
|
|
284
|
+
the endpoint's construct ID, also used in its generated name (`<id>-<hash>`).
|
|
285
|
+
|
|
286
|
+
---
|
|
287
|
+
|
|
288
|
+
###### `options`<sup>Required</sup> <a name="options" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addEndpoint.parameter.options"></a>
|
|
289
|
+
|
|
290
|
+
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions">AddWebFunctionEndpointOptions</a>
|
|
291
|
+
|
|
292
|
+
---
|
|
293
|
+
|
|
294
|
+
##### `addEnvironment` <a name="addEnvironment" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addEnvironment"></a>
|
|
295
|
+
|
|
296
|
+
```typescript
|
|
297
|
+
public addEnvironment(key: string, value: string): WebFunction
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
Adds an environment variable.
|
|
301
|
+
|
|
302
|
+
Names starting with `AWS_` are reserved.
|
|
303
|
+
|
|
304
|
+
###### `key`<sup>Required</sup> <a name="key" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addEnvironment.parameter.key"></a>
|
|
305
|
+
|
|
306
|
+
- *Type:* string
|
|
307
|
+
|
|
308
|
+
---
|
|
309
|
+
|
|
310
|
+
###### `value`<sup>Required</sup> <a name="value" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addEnvironment.parameter.value"></a>
|
|
311
|
+
|
|
312
|
+
- *Type:* string
|
|
313
|
+
|
|
314
|
+
---
|
|
315
|
+
|
|
316
|
+
##### `addPermission` <a name="addPermission" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addPermission"></a>
|
|
317
|
+
|
|
318
|
+
```typescript
|
|
319
|
+
public addPermission(id: string, permission: WebFunctionPermission): void
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
Allows a principal in another account, an AWS service or an organization to call the function's endpoints, through the function's resource policy.
|
|
323
|
+
|
|
324
|
+
For a role in this account, use `grantInvoke`.
|
|
325
|
+
|
|
326
|
+
###### `id`<sup>Required</sup> <a name="id" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addPermission.parameter.id"></a>
|
|
327
|
+
|
|
328
|
+
- *Type:* string
|
|
329
|
+
|
|
330
|
+
the statement ID (`Sid`): letters and digits, unique within the function.
|
|
331
|
+
|
|
332
|
+
---
|
|
333
|
+
|
|
334
|
+
###### `permission`<sup>Required</sup> <a name="permission" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addPermission.parameter.permission"></a>
|
|
335
|
+
|
|
336
|
+
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionPermission">WebFunctionPermission</a>
|
|
337
|
+
|
|
338
|
+
---
|
|
339
|
+
|
|
340
|
+
##### `addToRolePolicy` <a name="addToRolePolicy" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addToRolePolicy"></a>
|
|
341
|
+
|
|
342
|
+
```typescript
|
|
343
|
+
public addToRolePolicy(statement: PolicyStatement): void
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
Adds a statement to the execution role's policy.
|
|
347
|
+
|
|
348
|
+
###### `statement`<sup>Required</sup> <a name="statement" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.addToRolePolicy.parameter.statement"></a>
|
|
349
|
+
|
|
350
|
+
- *Type:* aws-cdk-lib.aws_iam.PolicyStatement
|
|
351
|
+
|
|
352
|
+
---
|
|
353
|
+
|
|
310
354
|
#### Static Functions <a name="Static Functions" id="Static Functions"></a>
|
|
311
355
|
|
|
312
356
|
| **Name** | **Description** |
|
|
@@ -314,6 +358,9 @@ Bytes sent in responses (`ResponseBytes`).
|
|
|
314
358
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.isConstruct">isConstruct</a></code> | Checks if `x` is a construct. |
|
|
315
359
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.isOwnedResource">isOwnedResource</a></code> | Returns true if the construct was created by CDK, and false otherwise. |
|
|
316
360
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.isResource">isResource</a></code> | Check whether the given construct is a Resource. |
|
|
361
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.fromWebFunctionArn">fromWebFunctionArn</a></code> | Imports an existing Web Function by its ARN (in any region or account). |
|
|
362
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.fromWebFunctionAttributes">fromWebFunctionAttributes</a></code> | Imports an existing Web Function: give its ARN or its name, and optionally the endpoint `grantInvoke` allows. |
|
|
363
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.fromWebFunctionName">fromWebFunctionName</a></code> | Imports an existing Web Function in this stack's account and region by its name. |
|
|
317
364
|
|
|
318
365
|
---
|
|
319
366
|
|
|
@@ -381,6 +428,90 @@ Check whether the given construct is a Resource.
|
|
|
381
428
|
|
|
382
429
|
---
|
|
383
430
|
|
|
431
|
+
##### `fromWebFunctionArn` <a name="fromWebFunctionArn" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.fromWebFunctionArn"></a>
|
|
432
|
+
|
|
433
|
+
```typescript
|
|
434
|
+
import { NodejsWebFunction } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
435
|
+
|
|
436
|
+
NodejsWebFunction.fromWebFunctionArn(scope: Construct, id: string, webFunctionArn: string)
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
Imports an existing Web Function by its ARN (in any region or account).
|
|
440
|
+
|
|
441
|
+
###### `scope`<sup>Required</sup> <a name="scope" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.fromWebFunctionArn.parameter.scope"></a>
|
|
442
|
+
|
|
443
|
+
- *Type:* constructs.Construct
|
|
444
|
+
|
|
445
|
+
---
|
|
446
|
+
|
|
447
|
+
###### `id`<sup>Required</sup> <a name="id" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.fromWebFunctionArn.parameter.id"></a>
|
|
448
|
+
|
|
449
|
+
- *Type:* string
|
|
450
|
+
|
|
451
|
+
---
|
|
452
|
+
|
|
453
|
+
###### `webFunctionArn`<sup>Required</sup> <a name="webFunctionArn" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.fromWebFunctionArn.parameter.webFunctionArn"></a>
|
|
454
|
+
|
|
455
|
+
- *Type:* string
|
|
456
|
+
|
|
457
|
+
---
|
|
458
|
+
|
|
459
|
+
##### `fromWebFunctionAttributes` <a name="fromWebFunctionAttributes" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.fromWebFunctionAttributes"></a>
|
|
460
|
+
|
|
461
|
+
```typescript
|
|
462
|
+
import { NodejsWebFunction } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
463
|
+
|
|
464
|
+
NodejsWebFunction.fromWebFunctionAttributes(scope: Construct, id: string, attrs: WebFunctionAttributes)
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
Imports an existing Web Function: give its ARN or its name, and optionally the endpoint `grantInvoke` allows.
|
|
468
|
+
|
|
469
|
+
###### `scope`<sup>Required</sup> <a name="scope" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.fromWebFunctionAttributes.parameter.scope"></a>
|
|
470
|
+
|
|
471
|
+
- *Type:* constructs.Construct
|
|
472
|
+
|
|
473
|
+
---
|
|
474
|
+
|
|
475
|
+
###### `id`<sup>Required</sup> <a name="id" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.fromWebFunctionAttributes.parameter.id"></a>
|
|
476
|
+
|
|
477
|
+
- *Type:* string
|
|
478
|
+
|
|
479
|
+
---
|
|
480
|
+
|
|
481
|
+
###### `attrs`<sup>Required</sup> <a name="attrs" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.fromWebFunctionAttributes.parameter.attrs"></a>
|
|
482
|
+
|
|
483
|
+
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionAttributes">WebFunctionAttributes</a>
|
|
484
|
+
|
|
485
|
+
---
|
|
486
|
+
|
|
487
|
+
##### `fromWebFunctionName` <a name="fromWebFunctionName" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.fromWebFunctionName"></a>
|
|
488
|
+
|
|
489
|
+
```typescript
|
|
490
|
+
import { NodejsWebFunction } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
491
|
+
|
|
492
|
+
NodejsWebFunction.fromWebFunctionName(scope: Construct, id: string, webFunctionName: string)
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
Imports an existing Web Function in this stack's account and region by its name.
|
|
496
|
+
|
|
497
|
+
###### `scope`<sup>Required</sup> <a name="scope" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.fromWebFunctionName.parameter.scope"></a>
|
|
498
|
+
|
|
499
|
+
- *Type:* constructs.Construct
|
|
500
|
+
|
|
501
|
+
---
|
|
502
|
+
|
|
503
|
+
###### `id`<sup>Required</sup> <a name="id" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.fromWebFunctionName.parameter.id"></a>
|
|
504
|
+
|
|
505
|
+
- *Type:* string
|
|
506
|
+
|
|
507
|
+
---
|
|
508
|
+
|
|
509
|
+
###### `webFunctionName`<sup>Required</sup> <a name="webFunctionName" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.fromWebFunctionName.parameter.webFunctionName"></a>
|
|
510
|
+
|
|
511
|
+
- *Type:* string
|
|
512
|
+
|
|
513
|
+
---
|
|
514
|
+
|
|
384
515
|
#### Properties <a name="Properties" id="Properties"></a>
|
|
385
516
|
|
|
386
517
|
| **Name** | **Type** | **Description** |
|
|
@@ -388,6 +519,9 @@ Check whether the given construct is a Resource.
|
|
|
388
519
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. |
|
|
389
520
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.env">env</a></code> | <code>aws-cdk-lib.interfaces.ResourceEnvironment</code> | The environment this resource belongs to. |
|
|
390
521
|
| <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. |
|
|
522
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.webFunctionArn">webFunctionArn</a></code> | <code>string</code> | The function's ARN. |
|
|
523
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.webFunctionName">webFunctionName</a></code> | <code>string</code> | The function's name. |
|
|
524
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.webFunctionRef">webFunctionRef</a></code> | <code>aws-cdk-lib.interfaces.aws_lambda.WebFunctionReference</code> | A reference to this function, for APIs that accept `lambda.IWebFunctionRef`. |
|
|
391
525
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.currentRevision">currentRevision</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision">IWebFunctionRevision</a></code> | The revision built from the current code and configuration. |
|
|
392
526
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.endpoint">endpoint</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint">WebFunctionEndpoint</a></code> | The default endpoint. |
|
|
393
527
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.grantPrincipal">grantPrincipal</a></code> | <code>aws-cdk-lib.aws_iam.IPrincipal</code> | The principal to grant permissions to (the execution role). |
|
|
@@ -395,9 +529,6 @@ Check whether the given construct is a Resource.
|
|
|
395
529
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.logGroup">logGroup</a></code> | <code>aws-cdk-lib.aws_logs.ILogGroup</code> | The home-region log group that receives the logs of every region the function serves from. |
|
|
396
530
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.revisionId">revisionId</a></code> | <code>string</code> | The ID of the current revision. |
|
|
397
531
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.role">role</a></code> | <code>aws-cdk-lib.aws_iam.IRole</code> | The execution role. |
|
|
398
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.webFunctionArn">webFunctionArn</a></code> | <code>string</code> | The function's ARN. |
|
|
399
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.webFunctionName">webFunctionName</a></code> | <code>string</code> | The function's name. |
|
|
400
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.webFunctionRef">webFunctionRef</a></code> | <code>aws-cdk-lib.interfaces.aws_lambda.WebFunctionReference</code> | A reference to this function, for APIs that accept `lambda.IWebFunctionRef`. |
|
|
401
532
|
|
|
402
533
|
---
|
|
403
534
|
|
|
@@ -445,6 +576,42 @@ The stack in which this resource is defined.
|
|
|
445
576
|
|
|
446
577
|
---
|
|
447
578
|
|
|
579
|
+
##### `webFunctionArn`<sup>Required</sup> <a name="webFunctionArn" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.webFunctionArn"></a>
|
|
580
|
+
|
|
581
|
+
```typescript
|
|
582
|
+
public readonly webFunctionArn: string;
|
|
583
|
+
```
|
|
584
|
+
|
|
585
|
+
- *Type:* string
|
|
586
|
+
|
|
587
|
+
The function's ARN.
|
|
588
|
+
|
|
589
|
+
---
|
|
590
|
+
|
|
591
|
+
##### `webFunctionName`<sup>Required</sup> <a name="webFunctionName" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.webFunctionName"></a>
|
|
592
|
+
|
|
593
|
+
```typescript
|
|
594
|
+
public readonly webFunctionName: string;
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
- *Type:* string
|
|
598
|
+
|
|
599
|
+
The function's name.
|
|
600
|
+
|
|
601
|
+
---
|
|
602
|
+
|
|
603
|
+
##### `webFunctionRef`<sup>Required</sup> <a name="webFunctionRef" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.webFunctionRef"></a>
|
|
604
|
+
|
|
605
|
+
```typescript
|
|
606
|
+
public readonly webFunctionRef: WebFunctionReference;
|
|
607
|
+
```
|
|
608
|
+
|
|
609
|
+
- *Type:* aws-cdk-lib.interfaces.aws_lambda.WebFunctionReference
|
|
610
|
+
|
|
611
|
+
A reference to this function, for APIs that accept `lambda.IWebFunctionRef`.
|
|
612
|
+
|
|
613
|
+
---
|
|
614
|
+
|
|
448
615
|
##### `currentRevision`<sup>Required</sup> <a name="currentRevision" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.currentRevision"></a>
|
|
449
616
|
|
|
450
617
|
```typescript
|
|
@@ -535,62 +702,26 @@ The execution role.
|
|
|
535
702
|
|
|
536
703
|
---
|
|
537
704
|
|
|
538
|
-
##### `webFunctionArn`<sup>Required</sup> <a name="webFunctionArn" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.webFunctionArn"></a>
|
|
539
705
|
|
|
540
|
-
|
|
541
|
-
public readonly webFunctionArn: string;
|
|
542
|
-
```
|
|
706
|
+
### WebFunction <a name="WebFunction" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction"></a>
|
|
543
707
|
|
|
544
|
-
- *
|
|
708
|
+
- *Implements:* aws-cdk-lib.aws_iam.IGrantable
|
|
545
709
|
|
|
546
|
-
|
|
710
|
+
A Node.js HTTP server running as an AWS Lambda Web Function, served from one or more regions.
|
|
547
711
|
|
|
548
|
-
|
|
712
|
+
Creates the function, its current revision (code and configuration; any change creates a new one,
|
|
713
|
+
and the newest `revisionRetention` are kept), a default HTTPS endpoint, an execution role, and owns
|
|
714
|
+
the function's log groups in every region its endpoints serve from.
|
|
549
715
|
|
|
550
|
-
|
|
716
|
+
Use `fromWebFunctionArn`, `fromWebFunctionName` or `fromWebFunctionAttributes` for a function defined elsewhere.
|
|
717
|
+
|
|
718
|
+
#### Initializers <a name="Initializers" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.Initializer"></a>
|
|
551
719
|
|
|
552
720
|
```typescript
|
|
553
|
-
|
|
554
|
-
```
|
|
721
|
+
import { WebFunction } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
555
722
|
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
The function's name.
|
|
559
|
-
|
|
560
|
-
---
|
|
561
|
-
|
|
562
|
-
##### `webFunctionRef`<sup>Required</sup> <a name="webFunctionRef" id="@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction.property.webFunctionRef"></a>
|
|
563
|
-
|
|
564
|
-
```typescript
|
|
565
|
-
public readonly webFunctionRef: WebFunctionReference;
|
|
566
|
-
```
|
|
567
|
-
|
|
568
|
-
- *Type:* aws-cdk-lib.interfaces.aws_lambda.WebFunctionReference
|
|
569
|
-
|
|
570
|
-
A reference to this function, for APIs that accept `lambda.IWebFunctionRef`.
|
|
571
|
-
|
|
572
|
-
---
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
### WebFunction <a name="WebFunction" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction"></a>
|
|
576
|
-
|
|
577
|
-
- *Implements:* <a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunction">IWebFunction</a>, aws-cdk-lib.aws_iam.IGrantable
|
|
578
|
-
|
|
579
|
-
A Node.js HTTP server running as an AWS Lambda Web Function, served from one or more regions.
|
|
580
|
-
|
|
581
|
-
Creates the function, its current revision (code and configuration; any change creates a new one,
|
|
582
|
-
and the newest `revisionRetention` are kept), a default HTTPS endpoint, an execution role, and owns
|
|
583
|
-
the function's log groups in every region its endpoints serve from.
|
|
584
|
-
|
|
585
|
-
Importing existing functions (`fromXxx` methods) is planned after 0.1.
|
|
586
|
-
|
|
587
|
-
#### Initializers <a name="Initializers" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.Initializer"></a>
|
|
588
|
-
|
|
589
|
-
```typescript
|
|
590
|
-
import { WebFunction } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
591
|
-
|
|
592
|
-
new WebFunction(scope: Construct, id: string, props: WebFunctionProps)
|
|
593
|
-
```
|
|
723
|
+
new WebFunction(scope: Construct, id: string, props: WebFunctionProps)
|
|
724
|
+
```
|
|
594
725
|
|
|
595
726
|
| **Name** | **Type** | **Description** |
|
|
596
727
|
| --- | --- | --- |
|
|
@@ -626,9 +757,7 @@ new WebFunction(scope: Construct, id: string, props: WebFunctionProps)
|
|
|
626
757
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.with">with</a></code> | Applies one or more mixins to this construct. |
|
|
627
758
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.applyCrossStackReferenceStrength">applyCrossStackReferenceStrength</a></code> | Override the cross-stack reference strength for this resource. |
|
|
628
759
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.applyRemovalPolicy">applyRemovalPolicy</a></code> | Apply the given removal policy to this resource. |
|
|
629
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.
|
|
630
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEnvironment">addEnvironment</a></code> | Adds an environment variable. |
|
|
631
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.addToRolePolicy">addToRolePolicy</a></code> | Adds a statement to the execution role's policy. |
|
|
760
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.addToResourcePolicy">addToResourcePolicy</a></code> | Adds a statement to the function's resource policy, e.g. to let another account manage the function. For invoking, prefer `addPermission` or `grantInvoke`. |
|
|
632
761
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.grantInvoke">grantInvoke</a></code> | Allows `grantee` to call the endpoint. |
|
|
633
762
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.metric">metric</a></code> | A metric of this function's execution environments in `AWS/Lambda/Web` (dimension `FunctionName`), across all endpoints. |
|
|
634
763
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.metricActiveTime">metricActiveTime</a></code> | Time the execution environments were active (`EnvironmentActiveTime`). |
|
|
@@ -636,6 +765,10 @@ new WebFunction(scope: Construct, id: string, props: WebFunctionProps)
|
|
|
636
765
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.metricCpuTime">metricCpuTime</a></code> | CPU time the execution environments used (`EnvironmentCPUTime`). |
|
|
637
766
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.metricMaxMemoryUsage">metricMaxMemoryUsage</a></code> | Peak memory an execution environment used (`EnvironmentMaxMemoryUsage`); |
|
|
638
767
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.metricResponseBytes">metricResponseBytes</a></code> | Bytes sent in responses (`ResponseBytes`). |
|
|
768
|
+
| <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. |
|
|
769
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEnvironment">addEnvironment</a></code> | Adds an environment variable. |
|
|
770
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.addPermission">addPermission</a></code> | Allows a principal in another account, an AWS service or an organization to call the function's endpoints, through the function's resource policy. |
|
|
771
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.addToRolePolicy">addToRolePolicy</a></code> | Adds a statement to the execution role's policy. |
|
|
639
772
|
|
|
640
773
|
---
|
|
641
774
|
|
|
@@ -710,59 +843,19 @@ account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
|
|
|
710
843
|
|
|
711
844
|
---
|
|
712
845
|
|
|
713
|
-
##### `
|
|
714
|
-
|
|
715
|
-
```typescript
|
|
716
|
-
public addEndpoint(id: string, options: AddWebFunctionEndpointOptions): WebFunctionEndpoint
|
|
717
|
-
```
|
|
718
|
-
|
|
719
|
-
Adds an endpoint (up to 10 per function), e.g. a public one next to an IAM-only one, or one pinned to an earlier revision. Each endpoint has its own URL, authentication, regions and limits.
|
|
720
|
-
|
|
721
|
-
###### `id`<sup>Required</sup> <a name="id" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEndpoint.parameter.id"></a>
|
|
722
|
-
|
|
723
|
-
- *Type:* string
|
|
724
|
-
|
|
725
|
-
the endpoint's construct ID, also used in its generated name (`<id>-<hash>`).
|
|
726
|
-
|
|
727
|
-
---
|
|
728
|
-
|
|
729
|
-
###### `options`<sup>Required</sup> <a name="options" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEndpoint.parameter.options"></a>
|
|
730
|
-
|
|
731
|
-
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions">AddWebFunctionEndpointOptions</a>
|
|
732
|
-
|
|
733
|
-
---
|
|
734
|
-
|
|
735
|
-
##### `addEnvironment` <a name="addEnvironment" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEnvironment"></a>
|
|
846
|
+
##### `addToResourcePolicy` <a name="addToResourcePolicy" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addToResourcePolicy"></a>
|
|
736
847
|
|
|
737
848
|
```typescript
|
|
738
|
-
public
|
|
849
|
+
public addToResourcePolicy(statement: PolicyStatement): AddToResourcePolicyResult
|
|
739
850
|
```
|
|
740
851
|
|
|
741
|
-
Adds
|
|
742
|
-
|
|
743
|
-
Names starting with `AWS_` are reserved.
|
|
744
|
-
|
|
745
|
-
###### `key`<sup>Required</sup> <a name="key" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEnvironment.parameter.key"></a>
|
|
746
|
-
|
|
747
|
-
- *Type:* string
|
|
748
|
-
|
|
749
|
-
---
|
|
750
|
-
|
|
751
|
-
###### `value`<sup>Required</sup> <a name="value" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEnvironment.parameter.value"></a>
|
|
752
|
-
|
|
753
|
-
- *Type:* string
|
|
754
|
-
|
|
755
|
-
---
|
|
756
|
-
|
|
757
|
-
##### `addToRolePolicy` <a name="addToRolePolicy" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addToRolePolicy"></a>
|
|
758
|
-
|
|
759
|
-
```typescript
|
|
760
|
-
public addToRolePolicy(statement: PolicyStatement): void
|
|
761
|
-
```
|
|
852
|
+
Adds a statement to the function's resource policy, e.g. to let another account manage the function. For invoking, prefer `addPermission` or `grantInvoke`.
|
|
762
853
|
|
|
763
|
-
|
|
854
|
+
The function has one resource policy (`AWS::Lambda::ResourcePolicy`), created on the first statement. This stack
|
|
855
|
+
is its only writer: another stack or template can't also attach one, and changes made outside CloudFormation
|
|
856
|
+
are overwritten by the next update of the policy.
|
|
764
857
|
|
|
765
|
-
###### `statement`<sup>Required</sup> <a name="statement" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.
|
|
858
|
+
###### `statement`<sup>Required</sup> <a name="statement" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addToResourcePolicy.parameter.statement"></a>
|
|
766
859
|
|
|
767
860
|
- *Type:* aws-cdk-lib.aws_iam.PolicyStatement
|
|
768
861
|
|
|
@@ -882,6 +975,88 @@ Bytes sent in responses (`ResponseBytes`).
|
|
|
882
975
|
|
|
883
976
|
---
|
|
884
977
|
|
|
978
|
+
##### `addEndpoint` <a name="addEndpoint" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEndpoint"></a>
|
|
979
|
+
|
|
980
|
+
```typescript
|
|
981
|
+
public addEndpoint(id: string, options: AddWebFunctionEndpointOptions): WebFunctionEndpoint
|
|
982
|
+
```
|
|
983
|
+
|
|
984
|
+
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.
|
|
985
|
+
|
|
986
|
+
###### `id`<sup>Required</sup> <a name="id" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEndpoint.parameter.id"></a>
|
|
987
|
+
|
|
988
|
+
- *Type:* string
|
|
989
|
+
|
|
990
|
+
the endpoint's construct ID, also used in its generated name (`<id>-<hash>`).
|
|
991
|
+
|
|
992
|
+
---
|
|
993
|
+
|
|
994
|
+
###### `options`<sup>Required</sup> <a name="options" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEndpoint.parameter.options"></a>
|
|
995
|
+
|
|
996
|
+
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions">AddWebFunctionEndpointOptions</a>
|
|
997
|
+
|
|
998
|
+
---
|
|
999
|
+
|
|
1000
|
+
##### `addEnvironment` <a name="addEnvironment" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEnvironment"></a>
|
|
1001
|
+
|
|
1002
|
+
```typescript
|
|
1003
|
+
public addEnvironment(key: string, value: string): WebFunction
|
|
1004
|
+
```
|
|
1005
|
+
|
|
1006
|
+
Adds an environment variable.
|
|
1007
|
+
|
|
1008
|
+
Names starting with `AWS_` are reserved.
|
|
1009
|
+
|
|
1010
|
+
###### `key`<sup>Required</sup> <a name="key" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEnvironment.parameter.key"></a>
|
|
1011
|
+
|
|
1012
|
+
- *Type:* string
|
|
1013
|
+
|
|
1014
|
+
---
|
|
1015
|
+
|
|
1016
|
+
###### `value`<sup>Required</sup> <a name="value" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addEnvironment.parameter.value"></a>
|
|
1017
|
+
|
|
1018
|
+
- *Type:* string
|
|
1019
|
+
|
|
1020
|
+
---
|
|
1021
|
+
|
|
1022
|
+
##### `addPermission` <a name="addPermission" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addPermission"></a>
|
|
1023
|
+
|
|
1024
|
+
```typescript
|
|
1025
|
+
public addPermission(id: string, permission: WebFunctionPermission): void
|
|
1026
|
+
```
|
|
1027
|
+
|
|
1028
|
+
Allows a principal in another account, an AWS service or an organization to call the function's endpoints, through the function's resource policy.
|
|
1029
|
+
|
|
1030
|
+
For a role in this account, use `grantInvoke`.
|
|
1031
|
+
|
|
1032
|
+
###### `id`<sup>Required</sup> <a name="id" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addPermission.parameter.id"></a>
|
|
1033
|
+
|
|
1034
|
+
- *Type:* string
|
|
1035
|
+
|
|
1036
|
+
the statement ID (`Sid`): letters and digits, unique within the function.
|
|
1037
|
+
|
|
1038
|
+
---
|
|
1039
|
+
|
|
1040
|
+
###### `permission`<sup>Required</sup> <a name="permission" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addPermission.parameter.permission"></a>
|
|
1041
|
+
|
|
1042
|
+
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionPermission">WebFunctionPermission</a>
|
|
1043
|
+
|
|
1044
|
+
---
|
|
1045
|
+
|
|
1046
|
+
##### `addToRolePolicy` <a name="addToRolePolicy" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addToRolePolicy"></a>
|
|
1047
|
+
|
|
1048
|
+
```typescript
|
|
1049
|
+
public addToRolePolicy(statement: PolicyStatement): void
|
|
1050
|
+
```
|
|
1051
|
+
|
|
1052
|
+
Adds a statement to the execution role's policy.
|
|
1053
|
+
|
|
1054
|
+
###### `statement`<sup>Required</sup> <a name="statement" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.addToRolePolicy.parameter.statement"></a>
|
|
1055
|
+
|
|
1056
|
+
- *Type:* aws-cdk-lib.aws_iam.PolicyStatement
|
|
1057
|
+
|
|
1058
|
+
---
|
|
1059
|
+
|
|
885
1060
|
#### Static Functions <a name="Static Functions" id="Static Functions"></a>
|
|
886
1061
|
|
|
887
1062
|
| **Name** | **Description** |
|
|
@@ -889,6 +1064,9 @@ Bytes sent in responses (`ResponseBytes`).
|
|
|
889
1064
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.isConstruct">isConstruct</a></code> | Checks if `x` is a construct. |
|
|
890
1065
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.isOwnedResource">isOwnedResource</a></code> | Returns true if the construct was created by CDK, and false otherwise. |
|
|
891
1066
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.isResource">isResource</a></code> | Check whether the given construct is a Resource. |
|
|
1067
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.fromWebFunctionArn">fromWebFunctionArn</a></code> | Imports an existing Web Function by its ARN (in any region or account). |
|
|
1068
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.fromWebFunctionAttributes">fromWebFunctionAttributes</a></code> | Imports an existing Web Function: give its ARN or its name, and optionally the endpoint `grantInvoke` allows. |
|
|
1069
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.fromWebFunctionName">fromWebFunctionName</a></code> | Imports an existing Web Function in this stack's account and region by its name. |
|
|
892
1070
|
|
|
893
1071
|
---
|
|
894
1072
|
|
|
@@ -956,6 +1134,90 @@ Check whether the given construct is a Resource.
|
|
|
956
1134
|
|
|
957
1135
|
---
|
|
958
1136
|
|
|
1137
|
+
##### `fromWebFunctionArn` <a name="fromWebFunctionArn" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.fromWebFunctionArn"></a>
|
|
1138
|
+
|
|
1139
|
+
```typescript
|
|
1140
|
+
import { WebFunction } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
1141
|
+
|
|
1142
|
+
WebFunction.fromWebFunctionArn(scope: Construct, id: string, webFunctionArn: string)
|
|
1143
|
+
```
|
|
1144
|
+
|
|
1145
|
+
Imports an existing Web Function by its ARN (in any region or account).
|
|
1146
|
+
|
|
1147
|
+
###### `scope`<sup>Required</sup> <a name="scope" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.fromWebFunctionArn.parameter.scope"></a>
|
|
1148
|
+
|
|
1149
|
+
- *Type:* constructs.Construct
|
|
1150
|
+
|
|
1151
|
+
---
|
|
1152
|
+
|
|
1153
|
+
###### `id`<sup>Required</sup> <a name="id" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.fromWebFunctionArn.parameter.id"></a>
|
|
1154
|
+
|
|
1155
|
+
- *Type:* string
|
|
1156
|
+
|
|
1157
|
+
---
|
|
1158
|
+
|
|
1159
|
+
###### `webFunctionArn`<sup>Required</sup> <a name="webFunctionArn" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.fromWebFunctionArn.parameter.webFunctionArn"></a>
|
|
1160
|
+
|
|
1161
|
+
- *Type:* string
|
|
1162
|
+
|
|
1163
|
+
---
|
|
1164
|
+
|
|
1165
|
+
##### `fromWebFunctionAttributes` <a name="fromWebFunctionAttributes" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.fromWebFunctionAttributes"></a>
|
|
1166
|
+
|
|
1167
|
+
```typescript
|
|
1168
|
+
import { WebFunction } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
1169
|
+
|
|
1170
|
+
WebFunction.fromWebFunctionAttributes(scope: Construct, id: string, attrs: WebFunctionAttributes)
|
|
1171
|
+
```
|
|
1172
|
+
|
|
1173
|
+
Imports an existing Web Function: give its ARN or its name, and optionally the endpoint `grantInvoke` allows.
|
|
1174
|
+
|
|
1175
|
+
###### `scope`<sup>Required</sup> <a name="scope" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.fromWebFunctionAttributes.parameter.scope"></a>
|
|
1176
|
+
|
|
1177
|
+
- *Type:* constructs.Construct
|
|
1178
|
+
|
|
1179
|
+
---
|
|
1180
|
+
|
|
1181
|
+
###### `id`<sup>Required</sup> <a name="id" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.fromWebFunctionAttributes.parameter.id"></a>
|
|
1182
|
+
|
|
1183
|
+
- *Type:* string
|
|
1184
|
+
|
|
1185
|
+
---
|
|
1186
|
+
|
|
1187
|
+
###### `attrs`<sup>Required</sup> <a name="attrs" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.fromWebFunctionAttributes.parameter.attrs"></a>
|
|
1188
|
+
|
|
1189
|
+
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionAttributes">WebFunctionAttributes</a>
|
|
1190
|
+
|
|
1191
|
+
---
|
|
1192
|
+
|
|
1193
|
+
##### `fromWebFunctionName` <a name="fromWebFunctionName" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.fromWebFunctionName"></a>
|
|
1194
|
+
|
|
1195
|
+
```typescript
|
|
1196
|
+
import { WebFunction } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
1197
|
+
|
|
1198
|
+
WebFunction.fromWebFunctionName(scope: Construct, id: string, webFunctionName: string)
|
|
1199
|
+
```
|
|
1200
|
+
|
|
1201
|
+
Imports an existing Web Function in this stack's account and region by its name.
|
|
1202
|
+
|
|
1203
|
+
###### `scope`<sup>Required</sup> <a name="scope" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.fromWebFunctionName.parameter.scope"></a>
|
|
1204
|
+
|
|
1205
|
+
- *Type:* constructs.Construct
|
|
1206
|
+
|
|
1207
|
+
---
|
|
1208
|
+
|
|
1209
|
+
###### `id`<sup>Required</sup> <a name="id" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.fromWebFunctionName.parameter.id"></a>
|
|
1210
|
+
|
|
1211
|
+
- *Type:* string
|
|
1212
|
+
|
|
1213
|
+
---
|
|
1214
|
+
|
|
1215
|
+
###### `webFunctionName`<sup>Required</sup> <a name="webFunctionName" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.fromWebFunctionName.parameter.webFunctionName"></a>
|
|
1216
|
+
|
|
1217
|
+
- *Type:* string
|
|
1218
|
+
|
|
1219
|
+
---
|
|
1220
|
+
|
|
959
1221
|
#### Properties <a name="Properties" id="Properties"></a>
|
|
960
1222
|
|
|
961
1223
|
| **Name** | **Type** | **Description** |
|
|
@@ -963,6 +1225,9 @@ Check whether the given construct is a Resource.
|
|
|
963
1225
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. |
|
|
964
1226
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.env">env</a></code> | <code>aws-cdk-lib.interfaces.ResourceEnvironment</code> | The environment this resource belongs to. |
|
|
965
1227
|
| <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. |
|
|
1228
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.webFunctionArn">webFunctionArn</a></code> | <code>string</code> | The function's ARN. |
|
|
1229
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.webFunctionName">webFunctionName</a></code> | <code>string</code> | The function's name. |
|
|
1230
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.webFunctionRef">webFunctionRef</a></code> | <code>aws-cdk-lib.interfaces.aws_lambda.WebFunctionReference</code> | A reference to this function, for APIs that accept `lambda.IWebFunctionRef`. |
|
|
966
1231
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.currentRevision">currentRevision</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision">IWebFunctionRevision</a></code> | The revision built from the current code and configuration. |
|
|
967
1232
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.endpoint">endpoint</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint">WebFunctionEndpoint</a></code> | The default endpoint. |
|
|
968
1233
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.grantPrincipal">grantPrincipal</a></code> | <code>aws-cdk-lib.aws_iam.IPrincipal</code> | The principal to grant permissions to (the execution role). |
|
|
@@ -970,9 +1235,6 @@ Check whether the given construct is a Resource.
|
|
|
970
1235
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.logGroup">logGroup</a></code> | <code>aws-cdk-lib.aws_logs.ILogGroup</code> | The home-region log group that receives the logs of every region the function serves from. |
|
|
971
1236
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.revisionId">revisionId</a></code> | <code>string</code> | The ID of the current revision. |
|
|
972
1237
|
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.role">role</a></code> | <code>aws-cdk-lib.aws_iam.IRole</code> | The execution role. |
|
|
973
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.webFunctionArn">webFunctionArn</a></code> | <code>string</code> | The function's ARN. |
|
|
974
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.webFunctionName">webFunctionName</a></code> | <code>string</code> | The function's name. |
|
|
975
|
-
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.webFunctionRef">webFunctionRef</a></code> | <code>aws-cdk-lib.interfaces.aws_lambda.WebFunctionReference</code> | A reference to this function, for APIs that accept `lambda.IWebFunctionRef`. |
|
|
976
1238
|
|
|
977
1239
|
---
|
|
978
1240
|
|
|
@@ -1020,97 +1282,522 @@ The stack in which this resource is defined.
|
|
|
1020
1282
|
|
|
1021
1283
|
---
|
|
1022
1284
|
|
|
1023
|
-
##### `
|
|
1285
|
+
##### `webFunctionArn`<sup>Required</sup> <a name="webFunctionArn" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.webFunctionArn"></a>
|
|
1024
1286
|
|
|
1025
1287
|
```typescript
|
|
1026
|
-
public readonly
|
|
1288
|
+
public readonly webFunctionArn: string;
|
|
1027
1289
|
```
|
|
1028
1290
|
|
|
1029
|
-
- *Type:*
|
|
1291
|
+
- *Type:* string
|
|
1030
1292
|
|
|
1031
|
-
The
|
|
1293
|
+
The function's ARN.
|
|
1294
|
+
|
|
1295
|
+
---
|
|
1296
|
+
|
|
1297
|
+
##### `webFunctionName`<sup>Required</sup> <a name="webFunctionName" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.webFunctionName"></a>
|
|
1298
|
+
|
|
1299
|
+
```typescript
|
|
1300
|
+
public readonly webFunctionName: string;
|
|
1301
|
+
```
|
|
1302
|
+
|
|
1303
|
+
- *Type:* string
|
|
1304
|
+
|
|
1305
|
+
The function's name.
|
|
1306
|
+
|
|
1307
|
+
---
|
|
1308
|
+
|
|
1309
|
+
##### `webFunctionRef`<sup>Required</sup> <a name="webFunctionRef" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.webFunctionRef"></a>
|
|
1310
|
+
|
|
1311
|
+
```typescript
|
|
1312
|
+
public readonly webFunctionRef: WebFunctionReference;
|
|
1313
|
+
```
|
|
1314
|
+
|
|
1315
|
+
- *Type:* aws-cdk-lib.interfaces.aws_lambda.WebFunctionReference
|
|
1316
|
+
|
|
1317
|
+
A reference to this function, for APIs that accept `lambda.IWebFunctionRef`.
|
|
1318
|
+
|
|
1319
|
+
---
|
|
1320
|
+
|
|
1321
|
+
##### `currentRevision`<sup>Required</sup> <a name="currentRevision" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.currentRevision"></a>
|
|
1322
|
+
|
|
1323
|
+
```typescript
|
|
1324
|
+
public readonly currentRevision: IWebFunctionRevision;
|
|
1325
|
+
```
|
|
1326
|
+
|
|
1327
|
+
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision">IWebFunctionRevision</a>
|
|
1328
|
+
|
|
1329
|
+
The revision built from the current code and configuration.
|
|
1330
|
+
|
|
1331
|
+
---
|
|
1332
|
+
|
|
1333
|
+
##### `endpoint`<sup>Required</sup> <a name="endpoint" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.endpoint"></a>
|
|
1334
|
+
|
|
1335
|
+
```typescript
|
|
1336
|
+
public readonly endpoint: WebFunctionEndpoint;
|
|
1337
|
+
```
|
|
1338
|
+
|
|
1339
|
+
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint">WebFunctionEndpoint</a>
|
|
1340
|
+
|
|
1341
|
+
The default endpoint.
|
|
1342
|
+
|
|
1343
|
+
Add more with `addEndpoint`.
|
|
1344
|
+
|
|
1345
|
+
---
|
|
1346
|
+
|
|
1347
|
+
##### `grantPrincipal`<sup>Required</sup> <a name="grantPrincipal" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.grantPrincipal"></a>
|
|
1348
|
+
|
|
1349
|
+
```typescript
|
|
1350
|
+
public readonly grantPrincipal: IPrincipal;
|
|
1351
|
+
```
|
|
1352
|
+
|
|
1353
|
+
- *Type:* aws-cdk-lib.aws_iam.IPrincipal
|
|
1354
|
+
|
|
1355
|
+
The principal to grant permissions to (the execution role).
|
|
1356
|
+
|
|
1357
|
+
---
|
|
1358
|
+
|
|
1359
|
+
##### `grants`<sup>Required</sup> <a name="grants" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.grants"></a>
|
|
1360
|
+
|
|
1361
|
+
```typescript
|
|
1362
|
+
public readonly grants: WebFunctionGrants;
|
|
1363
|
+
```
|
|
1364
|
+
|
|
1365
|
+
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionGrants">WebFunctionGrants</a>
|
|
1366
|
+
|
|
1367
|
+
Grants on the default endpoint (e.g. `grants.invoke(principal)`). Other endpoints have their own `grants`.
|
|
1368
|
+
|
|
1369
|
+
---
|
|
1370
|
+
|
|
1371
|
+
##### `logGroup`<sup>Required</sup> <a name="logGroup" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.logGroup"></a>
|
|
1372
|
+
|
|
1373
|
+
```typescript
|
|
1374
|
+
public readonly logGroup: ILogGroup;
|
|
1375
|
+
```
|
|
1376
|
+
|
|
1377
|
+
- *Type:* aws-cdk-lib.aws_logs.ILogGroup
|
|
1378
|
+
|
|
1379
|
+
The home-region log group that receives the logs of every region the function serves from.
|
|
1380
|
+
|
|
1381
|
+
Subscribe to this one only: each region's `.local` group holds a copy of the same events.
|
|
1382
|
+
|
|
1383
|
+
---
|
|
1384
|
+
|
|
1385
|
+
##### `revisionId`<sup>Required</sup> <a name="revisionId" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.revisionId"></a>
|
|
1386
|
+
|
|
1387
|
+
```typescript
|
|
1388
|
+
public readonly revisionId: string;
|
|
1389
|
+
```
|
|
1390
|
+
|
|
1391
|
+
- *Type:* string
|
|
1392
|
+
|
|
1393
|
+
The ID of the current revision.
|
|
1394
|
+
|
|
1395
|
+
Same as `currentRevision.revisionId`.
|
|
1396
|
+
|
|
1397
|
+
---
|
|
1398
|
+
|
|
1399
|
+
##### `role`<sup>Required</sup> <a name="role" id="@ashishpandeyone/cdk-lambda-web-function.WebFunction.property.role"></a>
|
|
1400
|
+
|
|
1401
|
+
```typescript
|
|
1402
|
+
public readonly role: IRole;
|
|
1403
|
+
```
|
|
1404
|
+
|
|
1405
|
+
- *Type:* aws-cdk-lib.aws_iam.IRole
|
|
1406
|
+
|
|
1407
|
+
The execution role.
|
|
1408
|
+
|
|
1409
|
+
---
|
|
1410
|
+
|
|
1411
|
+
|
|
1412
|
+
### WebFunctionBase <a name="WebFunctionBase" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase"></a>
|
|
1413
|
+
|
|
1414
|
+
- *Implements:* <a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunction">IWebFunction</a>
|
|
1415
|
+
|
|
1416
|
+
What `WebFunction` and imported functions have in common.
|
|
1417
|
+
|
|
1418
|
+
#### Initializers <a name="Initializers" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.Initializer"></a>
|
|
1419
|
+
|
|
1420
|
+
```typescript
|
|
1421
|
+
import { WebFunctionBase } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
1422
|
+
|
|
1423
|
+
new WebFunctionBase(scope: Construct, id: string, props?: ResourceProps)
|
|
1424
|
+
```
|
|
1425
|
+
|
|
1426
|
+
| **Name** | **Type** | **Description** |
|
|
1427
|
+
| --- | --- | --- |
|
|
1428
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.Initializer.parameter.scope">scope</a></code> | <code>constructs.Construct</code> | *No description.* |
|
|
1429
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.Initializer.parameter.id">id</a></code> | <code>string</code> | *No description.* |
|
|
1430
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.Initializer.parameter.props">props</a></code> | <code>aws-cdk-lib.ResourceProps</code> | *No description.* |
|
|
1431
|
+
|
|
1432
|
+
---
|
|
1433
|
+
|
|
1434
|
+
##### `scope`<sup>Required</sup> <a name="scope" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.Initializer.parameter.scope"></a>
|
|
1435
|
+
|
|
1436
|
+
- *Type:* constructs.Construct
|
|
1437
|
+
|
|
1438
|
+
---
|
|
1439
|
+
|
|
1440
|
+
##### `id`<sup>Required</sup> <a name="id" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.Initializer.parameter.id"></a>
|
|
1441
|
+
|
|
1442
|
+
- *Type:* string
|
|
1443
|
+
|
|
1444
|
+
---
|
|
1445
|
+
|
|
1446
|
+
##### `props`<sup>Optional</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.Initializer.parameter.props"></a>
|
|
1447
|
+
|
|
1448
|
+
- *Type:* aws-cdk-lib.ResourceProps
|
|
1449
|
+
|
|
1450
|
+
---
|
|
1451
|
+
|
|
1452
|
+
#### Methods <a name="Methods" id="Methods"></a>
|
|
1453
|
+
|
|
1454
|
+
| **Name** | **Description** |
|
|
1455
|
+
| --- | --- |
|
|
1456
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.toString">toString</a></code> | Returns a string representation of this construct. |
|
|
1457
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.with">with</a></code> | Applies one or more mixins to this construct. |
|
|
1458
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.applyCrossStackReferenceStrength">applyCrossStackReferenceStrength</a></code> | Override the cross-stack reference strength for this resource. |
|
|
1459
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.applyRemovalPolicy">applyRemovalPolicy</a></code> | Apply the given removal policy to this resource. |
|
|
1460
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.addToResourcePolicy">addToResourcePolicy</a></code> | Adds a statement to the function's resource policy (not added for an imported function). |
|
|
1461
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.grantInvoke">grantInvoke</a></code> | Allows `grantee` to call the function's endpoint. |
|
|
1462
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.metric">metric</a></code> | A metric of this function's execution environments in `AWS/Lambda/Web` (dimension `FunctionName`), across all endpoints. |
|
|
1463
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.metricActiveTime">metricActiveTime</a></code> | Time the execution environments were active (`EnvironmentActiveTime`). |
|
|
1464
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.metricConcurrentRequests">metricConcurrentRequests</a></code> | Requests an execution environment handled at once (`EnvironmentConcurrentRequests`), to compare with `maxConcurrencyPerEnvironment`. |
|
|
1465
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.metricCpuTime">metricCpuTime</a></code> | CPU time the execution environments used (`EnvironmentCPUTime`). |
|
|
1466
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.metricMaxMemoryUsage">metricMaxMemoryUsage</a></code> | Peak memory an execution environment used (`EnvironmentMaxMemoryUsage`); |
|
|
1467
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.metricResponseBytes">metricResponseBytes</a></code> | Bytes sent in responses (`ResponseBytes`). |
|
|
1468
|
+
|
|
1469
|
+
---
|
|
1470
|
+
|
|
1471
|
+
##### `toString` <a name="toString" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.toString"></a>
|
|
1472
|
+
|
|
1473
|
+
```typescript
|
|
1474
|
+
public toString(): string
|
|
1475
|
+
```
|
|
1476
|
+
|
|
1477
|
+
Returns a string representation of this construct.
|
|
1478
|
+
|
|
1479
|
+
##### `with` <a name="with" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.with"></a>
|
|
1480
|
+
|
|
1481
|
+
```typescript
|
|
1482
|
+
public with(mixins: ...IMixin[]): IConstruct
|
|
1483
|
+
```
|
|
1484
|
+
|
|
1485
|
+
Applies one or more mixins to this construct.
|
|
1486
|
+
|
|
1487
|
+
Mixins are applied in order. The list of constructs is captured at the
|
|
1488
|
+
start of the call, so constructs added by a mixin will not be visited.
|
|
1489
|
+
Use multiple `with()` calls if subsequent mixins should apply to added
|
|
1490
|
+
constructs.
|
|
1491
|
+
|
|
1492
|
+
###### `mixins`<sup>Required</sup> <a name="mixins" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.with.parameter.mixins"></a>
|
|
1493
|
+
|
|
1494
|
+
- *Type:* ...constructs.IMixin[]
|
|
1495
|
+
|
|
1496
|
+
---
|
|
1497
|
+
|
|
1498
|
+
##### `applyCrossStackReferenceStrength` <a name="applyCrossStackReferenceStrength" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.applyCrossStackReferenceStrength"></a>
|
|
1499
|
+
|
|
1500
|
+
```typescript
|
|
1501
|
+
public applyCrossStackReferenceStrength(strength: ReferenceStrength): void
|
|
1502
|
+
```
|
|
1503
|
+
|
|
1504
|
+
Override the cross-stack reference strength for this resource.
|
|
1505
|
+
|
|
1506
|
+
When set, any cross-stack reference to this resource will use the specified
|
|
1507
|
+
mechanism instead of the global default determined by the
|
|
1508
|
+
`@aws-cdk/core:defaultCrossStackReferences` context key. This is useful for
|
|
1509
|
+
selectively weakening specific references to avoid the "deadly embrace" problem
|
|
1510
|
+
without changing the app-wide default.
|
|
1511
|
+
|
|
1512
|
+
###### `strength`<sup>Required</sup> <a name="strength" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.applyCrossStackReferenceStrength.parameter.strength"></a>
|
|
1513
|
+
|
|
1514
|
+
- *Type:* aws-cdk-lib.ReferenceStrength
|
|
1515
|
+
|
|
1516
|
+
The reference strength to use for this resource.
|
|
1517
|
+
|
|
1518
|
+
---
|
|
1519
|
+
|
|
1520
|
+
##### `applyRemovalPolicy` <a name="applyRemovalPolicy" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.applyRemovalPolicy"></a>
|
|
1521
|
+
|
|
1522
|
+
```typescript
|
|
1523
|
+
public applyRemovalPolicy(policy: RemovalPolicy): void
|
|
1524
|
+
```
|
|
1525
|
+
|
|
1526
|
+
Apply the given removal policy to this resource.
|
|
1527
|
+
|
|
1528
|
+
The Removal Policy controls what happens to this resource when it stops
|
|
1529
|
+
being managed by CloudFormation, either because you've removed it from the
|
|
1530
|
+
CDK application or because you've made a change that requires the resource
|
|
1531
|
+
to be replaced.
|
|
1532
|
+
|
|
1533
|
+
The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
|
|
1534
|
+
account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
|
|
1535
|
+
|
|
1536
|
+
###### `policy`<sup>Required</sup> <a name="policy" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.applyRemovalPolicy.parameter.policy"></a>
|
|
1537
|
+
|
|
1538
|
+
- *Type:* aws-cdk-lib.RemovalPolicy
|
|
1539
|
+
|
|
1540
|
+
---
|
|
1541
|
+
|
|
1542
|
+
##### `addToResourcePolicy` <a name="addToResourcePolicy" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.addToResourcePolicy"></a>
|
|
1543
|
+
|
|
1544
|
+
```typescript
|
|
1545
|
+
public addToResourcePolicy(statement: PolicyStatement): AddToResourcePolicyResult
|
|
1546
|
+
```
|
|
1547
|
+
|
|
1548
|
+
Adds a statement to the function's resource policy (not added for an imported function).
|
|
1549
|
+
|
|
1550
|
+
###### `statement`<sup>Required</sup> <a name="statement" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.addToResourcePolicy.parameter.statement"></a>
|
|
1551
|
+
|
|
1552
|
+
- *Type:* aws-cdk-lib.aws_iam.PolicyStatement
|
|
1553
|
+
|
|
1554
|
+
---
|
|
1555
|
+
|
|
1556
|
+
##### `grantInvoke` <a name="grantInvoke" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.grantInvoke"></a>
|
|
1557
|
+
|
|
1558
|
+
```typescript
|
|
1559
|
+
public grantInvoke(grantee: IGrantable): Grant
|
|
1560
|
+
```
|
|
1561
|
+
|
|
1562
|
+
Allows `grantee` to call the function's endpoint.
|
|
1563
|
+
|
|
1564
|
+
[disable-awslint:no-grants]
|
|
1565
|
+
|
|
1566
|
+
###### `grantee`<sup>Required</sup> <a name="grantee" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.grantInvoke.parameter.grantee"></a>
|
|
1567
|
+
|
|
1568
|
+
- *Type:* aws-cdk-lib.aws_iam.IGrantable
|
|
1569
|
+
|
|
1570
|
+
---
|
|
1571
|
+
|
|
1572
|
+
##### `metric` <a name="metric" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.metric"></a>
|
|
1573
|
+
|
|
1574
|
+
```typescript
|
|
1575
|
+
public metric(metricName: string, props?: MetricOptions): Metric
|
|
1576
|
+
```
|
|
1577
|
+
|
|
1578
|
+
A metric of this function's execution environments in `AWS/Lambda/Web` (dimension `FunctionName`), across all endpoints.
|
|
1579
|
+
|
|
1580
|
+
For request and error counts, use the endpoint's metrics (`fn.endpoint.metricRequests()`).
|
|
1581
|
+
|
|
1582
|
+
Metrics are published in the region that served the request: pass `region` for another serving region.
|
|
1583
|
+
An alarm can only use metrics from its own stack's region.
|
|
1584
|
+
|
|
1585
|
+
###### `metricName`<sup>Required</sup> <a name="metricName" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.metric.parameter.metricName"></a>
|
|
1586
|
+
|
|
1587
|
+
- *Type:* string
|
|
1588
|
+
|
|
1589
|
+
---
|
|
1590
|
+
|
|
1591
|
+
###### `props`<sup>Optional</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.metric.parameter.props"></a>
|
|
1592
|
+
|
|
1593
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
|
|
1594
|
+
|
|
1595
|
+
---
|
|
1596
|
+
|
|
1597
|
+
##### `metricActiveTime` <a name="metricActiveTime" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.metricActiveTime"></a>
|
|
1598
|
+
|
|
1599
|
+
```typescript
|
|
1600
|
+
public metricActiveTime(props?: MetricOptions): Metric
|
|
1601
|
+
```
|
|
1602
|
+
|
|
1603
|
+
Time the execution environments were active (`EnvironmentActiveTime`).
|
|
1604
|
+
|
|
1605
|
+
###### `props`<sup>Optional</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.metricActiveTime.parameter.props"></a>
|
|
1606
|
+
|
|
1607
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
|
|
1608
|
+
|
|
1609
|
+
---
|
|
1610
|
+
|
|
1611
|
+
##### `metricConcurrentRequests` <a name="metricConcurrentRequests" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.metricConcurrentRequests"></a>
|
|
1612
|
+
|
|
1613
|
+
```typescript
|
|
1614
|
+
public metricConcurrentRequests(props?: MetricOptions): Metric
|
|
1615
|
+
```
|
|
1616
|
+
|
|
1617
|
+
Requests an execution environment handled at once (`EnvironmentConcurrentRequests`), to compare with `maxConcurrencyPerEnvironment`.
|
|
1618
|
+
|
|
1619
|
+
###### `props`<sup>Optional</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.metricConcurrentRequests.parameter.props"></a>
|
|
1620
|
+
|
|
1621
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
|
|
1622
|
+
|
|
1623
|
+
---
|
|
1624
|
+
|
|
1625
|
+
##### `metricCpuTime` <a name="metricCpuTime" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.metricCpuTime"></a>
|
|
1626
|
+
|
|
1627
|
+
```typescript
|
|
1628
|
+
public metricCpuTime(props?: MetricOptions): Metric
|
|
1629
|
+
```
|
|
1630
|
+
|
|
1631
|
+
CPU time the execution environments used (`EnvironmentCPUTime`).
|
|
1632
|
+
|
|
1633
|
+
###### `props`<sup>Optional</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.metricCpuTime.parameter.props"></a>
|
|
1634
|
+
|
|
1635
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
|
|
1636
|
+
|
|
1637
|
+
---
|
|
1638
|
+
|
|
1639
|
+
##### `metricMaxMemoryUsage` <a name="metricMaxMemoryUsage" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.metricMaxMemoryUsage"></a>
|
|
1640
|
+
|
|
1641
|
+
```typescript
|
|
1642
|
+
public metricMaxMemoryUsage(props?: MetricOptions): Metric
|
|
1643
|
+
```
|
|
1644
|
+
|
|
1645
|
+
Peak memory an execution environment used (`EnvironmentMaxMemoryUsage`);
|
|
1646
|
+
|
|
1647
|
+
each environment has 2 GB.
|
|
1648
|
+
|
|
1649
|
+
###### `props`<sup>Optional</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.metricMaxMemoryUsage.parameter.props"></a>
|
|
1650
|
+
|
|
1651
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
|
|
1652
|
+
|
|
1653
|
+
---
|
|
1654
|
+
|
|
1655
|
+
##### `metricResponseBytes` <a name="metricResponseBytes" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.metricResponseBytes"></a>
|
|
1656
|
+
|
|
1657
|
+
```typescript
|
|
1658
|
+
public metricResponseBytes(props?: MetricOptions): Metric
|
|
1659
|
+
```
|
|
1660
|
+
|
|
1661
|
+
Bytes sent in responses (`ResponseBytes`).
|
|
1662
|
+
|
|
1663
|
+
###### `props`<sup>Optional</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.metricResponseBytes.parameter.props"></a>
|
|
1664
|
+
|
|
1665
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
|
|
1666
|
+
|
|
1667
|
+
---
|
|
1668
|
+
|
|
1669
|
+
#### Static Functions <a name="Static Functions" id="Static Functions"></a>
|
|
1670
|
+
|
|
1671
|
+
| **Name** | **Description** |
|
|
1672
|
+
| --- | --- |
|
|
1673
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.isConstruct">isConstruct</a></code> | Checks if `x` is a construct. |
|
|
1674
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.isOwnedResource">isOwnedResource</a></code> | Returns true if the construct was created by CDK, and false otherwise. |
|
|
1675
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.isResource">isResource</a></code> | Check whether the given construct is a Resource. |
|
|
1676
|
+
|
|
1677
|
+
---
|
|
1678
|
+
|
|
1679
|
+
##### `isConstruct` <a name="isConstruct" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.isConstruct"></a>
|
|
1680
|
+
|
|
1681
|
+
```typescript
|
|
1682
|
+
import { WebFunctionBase } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
1683
|
+
|
|
1684
|
+
WebFunctionBase.isConstruct(x: any)
|
|
1685
|
+
```
|
|
1686
|
+
|
|
1687
|
+
Checks if `x` is a construct.
|
|
1688
|
+
|
|
1689
|
+
Use this method instead of `instanceof` to properly detect `Construct`
|
|
1690
|
+
instances, even when the construct library is symlinked.
|
|
1691
|
+
|
|
1692
|
+
Explanation: in JavaScript, multiple copies of the `constructs` library on
|
|
1693
|
+
disk are seen as independent, completely different libraries. As a
|
|
1694
|
+
consequence, the class `Construct` in each copy of the `constructs` library
|
|
1695
|
+
is seen as a different class, and an instance of one class will not test as
|
|
1696
|
+
`instanceof` the other class. `npm install` will not create installations
|
|
1697
|
+
like this, but users may manually symlink construct libraries together or
|
|
1698
|
+
use a monorepo tool: in those cases, multiple copies of the `constructs`
|
|
1699
|
+
library can be accidentally installed, and `instanceof` will behave
|
|
1700
|
+
unpredictably. It is safest to avoid using `instanceof`, and using
|
|
1701
|
+
this type-testing method instead.
|
|
1702
|
+
|
|
1703
|
+
###### `x`<sup>Required</sup> <a name="x" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.isConstruct.parameter.x"></a>
|
|
1704
|
+
|
|
1705
|
+
- *Type:* any
|
|
1706
|
+
|
|
1707
|
+
Any object.
|
|
1032
1708
|
|
|
1033
1709
|
---
|
|
1034
1710
|
|
|
1035
|
-
##### `
|
|
1711
|
+
##### `isOwnedResource` <a name="isOwnedResource" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.isOwnedResource"></a>
|
|
1036
1712
|
|
|
1037
1713
|
```typescript
|
|
1038
|
-
|
|
1714
|
+
import { WebFunctionBase } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
1715
|
+
|
|
1716
|
+
WebFunctionBase.isOwnedResource(construct: IConstruct)
|
|
1039
1717
|
```
|
|
1040
1718
|
|
|
1041
|
-
|
|
1719
|
+
Returns true if the construct was created by CDK, and false otherwise.
|
|
1042
1720
|
|
|
1043
|
-
|
|
1721
|
+
###### `construct`<sup>Required</sup> <a name="construct" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.isOwnedResource.parameter.construct"></a>
|
|
1044
1722
|
|
|
1045
|
-
|
|
1723
|
+
- *Type:* constructs.IConstruct
|
|
1046
1724
|
|
|
1047
1725
|
---
|
|
1048
1726
|
|
|
1049
|
-
##### `
|
|
1727
|
+
##### `isResource` <a name="isResource" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.isResource"></a>
|
|
1050
1728
|
|
|
1051
1729
|
```typescript
|
|
1052
|
-
|
|
1053
|
-
```
|
|
1730
|
+
import { WebFunctionBase } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
1054
1731
|
|
|
1055
|
-
|
|
1732
|
+
WebFunctionBase.isResource(construct: IConstruct)
|
|
1733
|
+
```
|
|
1056
1734
|
|
|
1057
|
-
|
|
1735
|
+
Check whether the given construct is a Resource.
|
|
1058
1736
|
|
|
1059
|
-
|
|
1737
|
+
###### `construct`<sup>Required</sup> <a name="construct" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.isResource.parameter.construct"></a>
|
|
1060
1738
|
|
|
1061
|
-
|
|
1739
|
+
- *Type:* constructs.IConstruct
|
|
1062
1740
|
|
|
1063
|
-
|
|
1064
|
-
public readonly grants: WebFunctionGrants;
|
|
1065
|
-
```
|
|
1741
|
+
---
|
|
1066
1742
|
|
|
1067
|
-
|
|
1743
|
+
#### Properties <a name="Properties" id="Properties"></a>
|
|
1068
1744
|
|
|
1069
|
-
|
|
1745
|
+
| **Name** | **Type** | **Description** |
|
|
1746
|
+
| --- | --- | --- |
|
|
1747
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. |
|
|
1748
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.property.env">env</a></code> | <code>aws-cdk-lib.interfaces.ResourceEnvironment</code> | The environment this resource belongs to. |
|
|
1749
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.property.stack">stack</a></code> | <code>aws-cdk-lib.Stack</code> | The stack in which this resource is defined. |
|
|
1750
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.property.webFunctionArn">webFunctionArn</a></code> | <code>string</code> | The function's ARN. |
|
|
1751
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.property.webFunctionName">webFunctionName</a></code> | <code>string</code> | The function's name. |
|
|
1752
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.property.webFunctionRef">webFunctionRef</a></code> | <code>aws-cdk-lib.interfaces.aws_lambda.WebFunctionReference</code> | A reference to this function, for APIs that accept `lambda.IWebFunctionRef`. |
|
|
1070
1753
|
|
|
1071
1754
|
---
|
|
1072
1755
|
|
|
1073
|
-
##### `
|
|
1756
|
+
##### `node`<sup>Required</sup> <a name="node" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.property.node"></a>
|
|
1074
1757
|
|
|
1075
1758
|
```typescript
|
|
1076
|
-
public readonly
|
|
1759
|
+
public readonly node: Node;
|
|
1077
1760
|
```
|
|
1078
1761
|
|
|
1079
|
-
- *Type:*
|
|
1080
|
-
|
|
1081
|
-
The home-region log group that receives the logs of every region the function serves from.
|
|
1762
|
+
- *Type:* constructs.Node
|
|
1082
1763
|
|
|
1083
|
-
|
|
1764
|
+
The tree node.
|
|
1084
1765
|
|
|
1085
1766
|
---
|
|
1086
1767
|
|
|
1087
|
-
##### `
|
|
1768
|
+
##### `env`<sup>Required</sup> <a name="env" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.property.env"></a>
|
|
1088
1769
|
|
|
1089
1770
|
```typescript
|
|
1090
|
-
public readonly
|
|
1771
|
+
public readonly env: ResourceEnvironment;
|
|
1091
1772
|
```
|
|
1092
1773
|
|
|
1093
|
-
- *Type:*
|
|
1774
|
+
- *Type:* aws-cdk-lib.interfaces.ResourceEnvironment
|
|
1094
1775
|
|
|
1095
|
-
The
|
|
1776
|
+
The environment this resource belongs to.
|
|
1096
1777
|
|
|
1097
|
-
|
|
1778
|
+
For resources that are created and managed in a Stack (those created by
|
|
1779
|
+
creating new class instances like `new Role()`, `new Bucket()`, etc.), this
|
|
1780
|
+
is always the same as the environment of the stack they belong to.
|
|
1781
|
+
|
|
1782
|
+
For referenced resources (those obtained from referencing methods like
|
|
1783
|
+
`Role.fromRoleArn()`, `Bucket.fromBucketName()`, etc.), they might be
|
|
1784
|
+
different than the stack they were imported into.
|
|
1098
1785
|
|
|
1099
1786
|
---
|
|
1100
1787
|
|
|
1101
|
-
##### `
|
|
1788
|
+
##### `stack`<sup>Required</sup> <a name="stack" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.property.stack"></a>
|
|
1102
1789
|
|
|
1103
1790
|
```typescript
|
|
1104
|
-
public readonly
|
|
1791
|
+
public readonly stack: Stack;
|
|
1105
1792
|
```
|
|
1106
1793
|
|
|
1107
|
-
- *Type:* aws-cdk-lib.
|
|
1794
|
+
- *Type:* aws-cdk-lib.Stack
|
|
1108
1795
|
|
|
1109
|
-
The
|
|
1796
|
+
The stack in which this resource is defined.
|
|
1110
1797
|
|
|
1111
1798
|
---
|
|
1112
1799
|
|
|
1113
|
-
##### `webFunctionArn`<sup>Required</sup> <a name="webFunctionArn" id="@ashishpandeyone/cdk-lambda-web-function.
|
|
1800
|
+
##### `webFunctionArn`<sup>Required</sup> <a name="webFunctionArn" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.property.webFunctionArn"></a>
|
|
1114
1801
|
|
|
1115
1802
|
```typescript
|
|
1116
1803
|
public readonly webFunctionArn: string;
|
|
@@ -1122,7 +1809,7 @@ The function's ARN.
|
|
|
1122
1809
|
|
|
1123
1810
|
---
|
|
1124
1811
|
|
|
1125
|
-
##### `webFunctionName`<sup>Required</sup> <a name="webFunctionName" id="@ashishpandeyone/cdk-lambda-web-function.
|
|
1812
|
+
##### `webFunctionName`<sup>Required</sup> <a name="webFunctionName" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.property.webFunctionName"></a>
|
|
1126
1813
|
|
|
1127
1814
|
```typescript
|
|
1128
1815
|
public readonly webFunctionName: string;
|
|
@@ -1134,7 +1821,7 @@ The function's name.
|
|
|
1134
1821
|
|
|
1135
1822
|
---
|
|
1136
1823
|
|
|
1137
|
-
##### `webFunctionRef`<sup>Required</sup> <a name="webFunctionRef" id="@ashishpandeyone/cdk-lambda-web-function.
|
|
1824
|
+
##### `webFunctionRef`<sup>Required</sup> <a name="webFunctionRef" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase.property.webFunctionRef"></a>
|
|
1138
1825
|
|
|
1139
1826
|
```typescript
|
|
1140
1827
|
public readonly webFunctionRef: WebFunctionReference;
|
|
@@ -2476,6 +3163,69 @@ The Node.js runtime.
|
|
|
2476
3163
|
|
|
2477
3164
|
---
|
|
2478
3165
|
|
|
3166
|
+
### WebFunctionAttributes <a name="WebFunctionAttributes" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionAttributes"></a>
|
|
3167
|
+
|
|
3168
|
+
Attributes of an existing Web Function.
|
|
3169
|
+
|
|
3170
|
+
Give its ARN or its name.
|
|
3171
|
+
|
|
3172
|
+
#### Initializer <a name="Initializer" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionAttributes.Initializer"></a>
|
|
3173
|
+
|
|
3174
|
+
```typescript
|
|
3175
|
+
import { WebFunctionAttributes } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
3176
|
+
|
|
3177
|
+
const webFunctionAttributes: WebFunctionAttributes = { ... }
|
|
3178
|
+
```
|
|
3179
|
+
|
|
3180
|
+
#### Properties <a name="Properties" id="Properties"></a>
|
|
3181
|
+
|
|
3182
|
+
| **Name** | **Type** | **Description** |
|
|
3183
|
+
| --- | --- | --- |
|
|
3184
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionAttributes.property.endpointName">endpointName</a></code> | <code>string</code> | The endpoint `grantInvoke` allows calling. |
|
|
3185
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionAttributes.property.webFunctionArn">webFunctionArn</a></code> | <code>string</code> | The function's ARN, e.g. `arn:aws:lambda:us-east-1:111122223333:web-function/orders`. It may be in another region or account; across accounts, `grantInvoke` also needs the function's resource policy to allow the caller. |
|
|
3186
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionAttributes.property.webFunctionName">webFunctionName</a></code> | <code>string</code> | The function's name. |
|
|
3187
|
+
|
|
3188
|
+
---
|
|
3189
|
+
|
|
3190
|
+
##### `endpointName`<sup>Optional</sup> <a name="endpointName" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionAttributes.property.endpointName"></a>
|
|
3191
|
+
|
|
3192
|
+
```typescript
|
|
3193
|
+
public readonly endpointName: string;
|
|
3194
|
+
```
|
|
3195
|
+
|
|
3196
|
+
- *Type:* string
|
|
3197
|
+
- *Default:* every endpoint of the function
|
|
3198
|
+
|
|
3199
|
+
The endpoint `grantInvoke` allows calling.
|
|
3200
|
+
|
|
3201
|
+
---
|
|
3202
|
+
|
|
3203
|
+
##### `webFunctionArn`<sup>Optional</sup> <a name="webFunctionArn" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionAttributes.property.webFunctionArn"></a>
|
|
3204
|
+
|
|
3205
|
+
```typescript
|
|
3206
|
+
public readonly webFunctionArn: string;
|
|
3207
|
+
```
|
|
3208
|
+
|
|
3209
|
+
- *Type:* string
|
|
3210
|
+
- *Default:* built from `webFunctionName`, in this stack's account and region
|
|
3211
|
+
|
|
3212
|
+
The function's ARN, e.g. `arn:aws:lambda:us-east-1:111122223333:web-function/orders`. It may be in another region or account; across accounts, `grantInvoke` also needs the function's resource policy to allow the caller.
|
|
3213
|
+
|
|
3214
|
+
---
|
|
3215
|
+
|
|
3216
|
+
##### `webFunctionName`<sup>Optional</sup> <a name="webFunctionName" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionAttributes.property.webFunctionName"></a>
|
|
3217
|
+
|
|
3218
|
+
```typescript
|
|
3219
|
+
public readonly webFunctionName: string;
|
|
3220
|
+
```
|
|
3221
|
+
|
|
3222
|
+
- *Type:* string
|
|
3223
|
+
- *Default:* taken from `webFunctionArn`
|
|
3224
|
+
|
|
3225
|
+
The function's name.
|
|
3226
|
+
|
|
3227
|
+
---
|
|
3228
|
+
|
|
2479
3229
|
### WebFunctionCanaryDeploymentOptions <a name="WebFunctionCanaryDeploymentOptions" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionCanaryDeploymentOptions"></a>
|
|
2480
3230
|
|
|
2481
3231
|
Options for a canary deployment.
|
|
@@ -2988,6 +3738,84 @@ Renaming a function replaces it, and its endpoint gets a new URL.
|
|
|
2988
3738
|
|
|
2989
3739
|
---
|
|
2990
3740
|
|
|
3741
|
+
### WebFunctionPermission <a name="WebFunctionPermission" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionPermission"></a>
|
|
3742
|
+
|
|
3743
|
+
Permission for a principal outside this account, an AWS service or an organization to call a function's endpoints.
|
|
3744
|
+
|
|
3745
|
+
#### Initializer <a name="Initializer" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionPermission.Initializer"></a>
|
|
3746
|
+
|
|
3747
|
+
```typescript
|
|
3748
|
+
import { WebFunctionPermission } from '@ashishpandeyone/cdk-lambda-web-function'
|
|
3749
|
+
|
|
3750
|
+
const webFunctionPermission: WebFunctionPermission = { ... }
|
|
3751
|
+
```
|
|
3752
|
+
|
|
3753
|
+
#### Properties <a name="Properties" id="Properties"></a>
|
|
3754
|
+
|
|
3755
|
+
| **Name** | **Type** | **Description** |
|
|
3756
|
+
| --- | --- | --- |
|
|
3757
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionPermission.property.principal">principal</a></code> | <code>aws-cdk-lib.aws_iam.IPrincipal</code> | Who may call: an account (`iam.AccountPrincipal`), a role or user (`iam.ArnPrincipal`), an AWS service (`iam.ServicePrincipal`, with `sourceArn` or `sourceAccount`) or an organization (`iam.OrganizationPrincipal`). |
|
|
3758
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionPermission.property.endpoint">endpoint</a></code> | <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint">WebFunctionEndpoint</a></code> | The endpoint the principal may call. |
|
|
3759
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionPermission.property.sourceAccount">sourceAccount</a></code> | <code>string</code> | For an AWS service: the account that owns the resource calling on its behalf (condition `aws:SourceAccount`). |
|
|
3760
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionPermission.property.sourceArn">sourceArn</a></code> | <code>string</code> | For an AWS service: the ARN of the resource calling on its behalf (condition `aws:SourceArn`, `ArnLike`), e.g. a CloudFront distribution. Without it or `sourceAccount`, any account's use of the service could call the endpoint. |
|
|
3761
|
+
|
|
3762
|
+
---
|
|
3763
|
+
|
|
3764
|
+
##### `principal`<sup>Required</sup> <a name="principal" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionPermission.property.principal"></a>
|
|
3765
|
+
|
|
3766
|
+
```typescript
|
|
3767
|
+
public readonly principal: IPrincipal;
|
|
3768
|
+
```
|
|
3769
|
+
|
|
3770
|
+
- *Type:* aws-cdk-lib.aws_iam.IPrincipal
|
|
3771
|
+
|
|
3772
|
+
Who may call: an account (`iam.AccountPrincipal`), a role or user (`iam.ArnPrincipal`), an AWS service (`iam.ServicePrincipal`, with `sourceArn` or `sourceAccount`) or an organization (`iam.OrganizationPrincipal`).
|
|
3773
|
+
|
|
3774
|
+
A principal in another account also needs `lambda:InvokeWebFunctionEndpoint` in its own IAM policy.
|
|
3775
|
+
|
|
3776
|
+
---
|
|
3777
|
+
|
|
3778
|
+
##### `endpoint`<sup>Optional</sup> <a name="endpoint" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionPermission.property.endpoint"></a>
|
|
3779
|
+
|
|
3780
|
+
```typescript
|
|
3781
|
+
public readonly endpoint: WebFunctionEndpoint;
|
|
3782
|
+
```
|
|
3783
|
+
|
|
3784
|
+
- *Type:* <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint">WebFunctionEndpoint</a>
|
|
3785
|
+
- *Default:* every endpoint of the function, including ones added later
|
|
3786
|
+
|
|
3787
|
+
The endpoint the principal may call.
|
|
3788
|
+
|
|
3789
|
+
It must belong to this function.
|
|
3790
|
+
|
|
3791
|
+
---
|
|
3792
|
+
|
|
3793
|
+
##### `sourceAccount`<sup>Optional</sup> <a name="sourceAccount" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionPermission.property.sourceAccount"></a>
|
|
3794
|
+
|
|
3795
|
+
```typescript
|
|
3796
|
+
public readonly sourceAccount: string;
|
|
3797
|
+
```
|
|
3798
|
+
|
|
3799
|
+
- *Type:* string
|
|
3800
|
+
- *Default:* no condition
|
|
3801
|
+
|
|
3802
|
+
For an AWS service: the account that owns the resource calling on its behalf (condition `aws:SourceAccount`).
|
|
3803
|
+
|
|
3804
|
+
---
|
|
3805
|
+
|
|
3806
|
+
##### `sourceArn`<sup>Optional</sup> <a name="sourceArn" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionPermission.property.sourceArn"></a>
|
|
3807
|
+
|
|
3808
|
+
```typescript
|
|
3809
|
+
public readonly sourceArn: string;
|
|
3810
|
+
```
|
|
3811
|
+
|
|
3812
|
+
- *Type:* string
|
|
3813
|
+
- *Default:* no condition
|
|
3814
|
+
|
|
3815
|
+
For an AWS service: the ARN of the resource calling on its behalf (condition `aws:SourceArn`, `ArnLike`), e.g. a CloudFront distribution. Without it or `sourceAccount`, any account's use of the service could call the endpoint.
|
|
3816
|
+
|
|
3817
|
+
---
|
|
3818
|
+
|
|
2991
3819
|
### WebFunctionProps <a name="WebFunctionProps" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps"></a>
|
|
2992
3820
|
|
|
2993
3821
|
Properties for a `WebFunction`.
|
|
@@ -3522,6 +4350,9 @@ Allows `grantee` to call the endpoint (`lambda:InvokeWebFunctionEndpoint`).
|
|
|
3522
4350
|
The grant is on the endpoint's home-region ARN, which IAM evaluates for every region the
|
|
3523
4351
|
endpoint serves from, including a MULTI_REGION global URL.
|
|
3524
4352
|
|
|
4353
|
+
A grantee in the function's account gets an IAM policy statement. Another account or an AWS service also gets
|
|
4354
|
+
a statement in the function's resource policy (not for an imported function's endpoints).
|
|
4355
|
+
|
|
3525
4356
|
###### `grantee`<sup>Required</sup> <a name="grantee" id="@ashishpandeyone/cdk-lambda-web-function.WebFunctionGrants.invoke.parameter.grantee"></a>
|
|
3526
4357
|
|
|
3527
4358
|
- *Type:* aws-cdk-lib.aws_iam.IGrantable
|
|
@@ -3535,12 +4366,140 @@ endpoint serves from, including a MULTI_REGION global URL.
|
|
|
3535
4366
|
|
|
3536
4367
|
### IWebFunction <a name="IWebFunction" id="@ashishpandeyone/cdk-lambda-web-function.IWebFunction"></a>
|
|
3537
4368
|
|
|
3538
|
-
- *Extends:* aws-cdk-lib.IResource, aws-cdk-lib.interfaces.aws_lambda.IWebFunctionRef
|
|
4369
|
+
- *Extends:* aws-cdk-lib.IResource, aws-cdk-lib.interfaces.aws_lambda.IWebFunctionRef, aws-cdk-lib.aws_iam.IResourceWithPolicy
|
|
4370
|
+
|
|
4371
|
+
- *Implemented By:* <a href="#@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction">NodejsWebFunction</a>, <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunction">WebFunction</a>, <a href="#@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase">WebFunctionBase</a>, <a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunction">IWebFunction</a>
|
|
4372
|
+
|
|
4373
|
+
A Lambda Web Function, created in this app (`WebFunction`) or imported (`WebFunction.fromWebFunctionArn`).
|
|
4374
|
+
|
|
4375
|
+
`addToResourcePolicy` adds to the function's resource policy (who else may call or manage it). A `WebFunction` has
|
|
4376
|
+
one, created by its stack on the first statement. An imported function's policy belongs to the stack that created
|
|
4377
|
+
it, so the statement isn't added (`statementAdded: false`).
|
|
4378
|
+
|
|
4379
|
+
#### Methods <a name="Methods" id="Methods"></a>
|
|
4380
|
+
|
|
4381
|
+
| **Name** | **Description** |
|
|
4382
|
+
| --- | --- |
|
|
4383
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunction.grantInvoke">grantInvoke</a></code> | Allows `grantee` to call the function's endpoint (`lambda:InvokeWebFunctionEndpoint`): the default endpoint of a `WebFunction`; |
|
|
4384
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunction.metric">metric</a></code> | A metric of the function's execution environments in `AWS/Lambda/Web` (dimension `FunctionName`). |
|
|
4385
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunction.metricActiveTime">metricActiveTime</a></code> | Time the execution environments were active (`EnvironmentActiveTime`). |
|
|
4386
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunction.metricConcurrentRequests">metricConcurrentRequests</a></code> | Requests an execution environment handled at once (`EnvironmentConcurrentRequests`, maximum). |
|
|
4387
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunction.metricCpuTime">metricCpuTime</a></code> | CPU time the execution environments used (`EnvironmentCPUTime`). |
|
|
4388
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunction.metricMaxMemoryUsage">metricMaxMemoryUsage</a></code> | Peak memory an execution environment used (`EnvironmentMaxMemoryUsage`, maximum). |
|
|
4389
|
+
| <code><a href="#@ashishpandeyone/cdk-lambda-web-function.IWebFunction.metricResponseBytes">metricResponseBytes</a></code> | Bytes sent in responses (`ResponseBytes`). |
|
|
4390
|
+
|
|
4391
|
+
---
|
|
4392
|
+
|
|
4393
|
+
##### `grantInvoke` <a name="grantInvoke" id="@ashishpandeyone/cdk-lambda-web-function.IWebFunction.grantInvoke"></a>
|
|
4394
|
+
|
|
4395
|
+
```typescript
|
|
4396
|
+
public grantInvoke(grantee: IGrantable): Grant
|
|
4397
|
+
```
|
|
4398
|
+
|
|
4399
|
+
Allows `grantee` to call the function's endpoint (`lambda:InvokeWebFunctionEndpoint`): the default endpoint of a `WebFunction`;
|
|
4400
|
+
|
|
4401
|
+
for an imported function, the endpoint named in its attributes, or every endpoint.
|
|
4402
|
+
|
|
4403
|
+
For a `WebFunction`, a grantee in this account gets an IAM policy statement; another account or an AWS service
|
|
4404
|
+
also gets a statement in the function's resource policy. For an imported function, only the grantee's IAM policy
|
|
4405
|
+
changes: across accounts, the function's own resource policy must also allow the grantee.
|
|
4406
|
+
[disable-awslint:no-grants]
|
|
4407
|
+
|
|
4408
|
+
###### `grantee`<sup>Required</sup> <a name="grantee" id="@ashishpandeyone/cdk-lambda-web-function.IWebFunction.grantInvoke.parameter.grantee"></a>
|
|
4409
|
+
|
|
4410
|
+
- *Type:* aws-cdk-lib.aws_iam.IGrantable
|
|
4411
|
+
|
|
4412
|
+
---
|
|
4413
|
+
|
|
4414
|
+
##### `metric` <a name="metric" id="@ashishpandeyone/cdk-lambda-web-function.IWebFunction.metric"></a>
|
|
4415
|
+
|
|
4416
|
+
```typescript
|
|
4417
|
+
public metric(metricName: string, props?: MetricOptions): Metric
|
|
4418
|
+
```
|
|
4419
|
+
|
|
4420
|
+
A metric of the function's execution environments in `AWS/Lambda/Web` (dimension `FunctionName`).
|
|
4421
|
+
|
|
4422
|
+
###### `metricName`<sup>Required</sup> <a name="metricName" id="@ashishpandeyone/cdk-lambda-web-function.IWebFunction.metric.parameter.metricName"></a>
|
|
3539
4423
|
|
|
3540
|
-
- *
|
|
4424
|
+
- *Type:* string
|
|
4425
|
+
|
|
4426
|
+
---
|
|
4427
|
+
|
|
4428
|
+
###### `props`<sup>Optional</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.IWebFunction.metric.parameter.props"></a>
|
|
4429
|
+
|
|
4430
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
|
|
4431
|
+
|
|
4432
|
+
---
|
|
4433
|
+
|
|
4434
|
+
##### `metricActiveTime` <a name="metricActiveTime" id="@ashishpandeyone/cdk-lambda-web-function.IWebFunction.metricActiveTime"></a>
|
|
4435
|
+
|
|
4436
|
+
```typescript
|
|
4437
|
+
public metricActiveTime(props?: MetricOptions): Metric
|
|
4438
|
+
```
|
|
4439
|
+
|
|
4440
|
+
Time the execution environments were active (`EnvironmentActiveTime`).
|
|
4441
|
+
|
|
4442
|
+
###### `props`<sup>Optional</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.IWebFunction.metricActiveTime.parameter.props"></a>
|
|
4443
|
+
|
|
4444
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
|
|
4445
|
+
|
|
4446
|
+
---
|
|
4447
|
+
|
|
4448
|
+
##### `metricConcurrentRequests` <a name="metricConcurrentRequests" id="@ashishpandeyone/cdk-lambda-web-function.IWebFunction.metricConcurrentRequests"></a>
|
|
4449
|
+
|
|
4450
|
+
```typescript
|
|
4451
|
+
public metricConcurrentRequests(props?: MetricOptions): Metric
|
|
4452
|
+
```
|
|
4453
|
+
|
|
4454
|
+
Requests an execution environment handled at once (`EnvironmentConcurrentRequests`, maximum).
|
|
4455
|
+
|
|
4456
|
+
###### `props`<sup>Optional</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.IWebFunction.metricConcurrentRequests.parameter.props"></a>
|
|
4457
|
+
|
|
4458
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
|
|
4459
|
+
|
|
4460
|
+
---
|
|
4461
|
+
|
|
4462
|
+
##### `metricCpuTime` <a name="metricCpuTime" id="@ashishpandeyone/cdk-lambda-web-function.IWebFunction.metricCpuTime"></a>
|
|
3541
4463
|
|
|
3542
|
-
|
|
4464
|
+
```typescript
|
|
4465
|
+
public metricCpuTime(props?: MetricOptions): Metric
|
|
4466
|
+
```
|
|
4467
|
+
|
|
4468
|
+
CPU time the execution environments used (`EnvironmentCPUTime`).
|
|
4469
|
+
|
|
4470
|
+
###### `props`<sup>Optional</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.IWebFunction.metricCpuTime.parameter.props"></a>
|
|
4471
|
+
|
|
4472
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
|
|
4473
|
+
|
|
4474
|
+
---
|
|
4475
|
+
|
|
4476
|
+
##### `metricMaxMemoryUsage` <a name="metricMaxMemoryUsage" id="@ashishpandeyone/cdk-lambda-web-function.IWebFunction.metricMaxMemoryUsage"></a>
|
|
4477
|
+
|
|
4478
|
+
```typescript
|
|
4479
|
+
public metricMaxMemoryUsage(props?: MetricOptions): Metric
|
|
4480
|
+
```
|
|
4481
|
+
|
|
4482
|
+
Peak memory an execution environment used (`EnvironmentMaxMemoryUsage`, maximum).
|
|
3543
4483
|
|
|
4484
|
+
###### `props`<sup>Optional</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.IWebFunction.metricMaxMemoryUsage.parameter.props"></a>
|
|
4485
|
+
|
|
4486
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
|
|
4487
|
+
|
|
4488
|
+
---
|
|
4489
|
+
|
|
4490
|
+
##### `metricResponseBytes` <a name="metricResponseBytes" id="@ashishpandeyone/cdk-lambda-web-function.IWebFunction.metricResponseBytes"></a>
|
|
4491
|
+
|
|
4492
|
+
```typescript
|
|
4493
|
+
public metricResponseBytes(props?: MetricOptions): Metric
|
|
4494
|
+
```
|
|
4495
|
+
|
|
4496
|
+
Bytes sent in responses (`ResponseBytes`).
|
|
4497
|
+
|
|
4498
|
+
###### `props`<sup>Optional</sup> <a name="props" id="@ashishpandeyone/cdk-lambda-web-function.IWebFunction.metricResponseBytes.parameter.props"></a>
|
|
4499
|
+
|
|
4500
|
+
- *Type:* aws-cdk-lib.aws_cloudwatch.MetricOptions
|
|
4501
|
+
|
|
4502
|
+
---
|
|
3544
4503
|
|
|
3545
4504
|
#### Properties <a name="Properties" id="Properties"></a>
|
|
3546
4505
|
|