@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 CHANGED
@@ -9745,7 +9745,7 @@
9745
9745
  },
9746
9746
  "name": "@ashishpandeyone/cdk-lambda-web-function",
9747
9747
  "readme": {
9748
- "markdown": "# CDK constructs for AWS Lambda Web Functions\n\n<!--BEGIN STABILITY BANNER-->\n\n---\n\n![cdk-constructs: Experimental](https://img.shields.io/badge/cdk--constructs-experimental-important.svg?style=for-the-badge)\n\n> The APIs of higher level constructs in this module are experimental and under active development.\n> They are subject to non-backward compatible changes or removal in any future version. These are\n> not subject to the [Semantic Versioning](https://semver.org/) model and breaking changes will be\n> announced in the release notes. This means that while you may use them, you may need to update\n> your source code when upgrading to a newer version of this package.\n\n---\n\n<!--END STABILITY BANNER-->\n\n[AWS Lambda Web Functions](https://aws.amazon.com/lambda/) run an ordinary Node.js HTTP server (Express, Fastify, Hono, `node:http`) on Lambda and give it an HTTPS endpoint, optionally served from several regions. `WebFunction` deploys one, following the conventions of `aws-cdk-lib/aws-lambda` where the two services overlap.\n\n```ts fixture=bare\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\nimport { WebFunction, WebFunctionAuthType, WebFunctionEndpointType } from '@ashishpandeyone/cdk-lambda-web-function';\n\nconst fn = new WebFunction(this, 'Api', {\n runtime: lambda.Runtime.NODEJS_24_X,\n code: lambda.Code.fromAsset('dist'),\n authType: WebFunctionAuthType.AWS_IAM,\n endpoint: {\n endpointType: WebFunctionEndpointType.MULTI_REGION,\n regions: ['us-east-1', 'eu-west-1'],\n },\n});\n\nnew CfnOutput(this, 'Url', { value: fn.endpoint.url }); // https://<id>.lambda-web.global.on.aws\n```\n\nThe stack's region is the function's **home region**. Multi-region endpoints need a stack with an explicit `env.region`.\n\n## Writing the server\n\n1. Listen on the host and port in **`AWS_LAMBDA_HTTP_ENDPOINT`** (`0.0.0.0:3000` today). `PORT` is not set.\n2. Start listening within **about 9 seconds**, or initialisation fails with `Application.TimeoutListenError`.\n3. Put the entry file at the root of your bundle as **`index.js`**, or set `entrypoint`.\n4. The runtime has **no AWS SDK**: bundle the clients you import.\n5. Code runs on **arm64**.\n\n```js\nconst express = require('express');\n\nconst app = express();\napp.get('/', (req, res) => res.json({ hello: 'world', region: process.env.AWS_REGION }));\n\nconst [host, port] = process.env.AWS_LAMBDA_HTTP_ENDPOINT.split(':');\napp.listen(Number(port), host);\n```\n\nRequests carry `lambda-web-request-id` and `lambda-web-endpoint-name` headers.\n\n## Regions and endpoints\n\nEach `WebFunction` has a default endpoint, `fn.endpoint`, configured with the `endpoint` property. [Add more](#more-endpoints) with `fn.addEndpoint()`.\n\n| `endpointType` | URL | Routing |\n|---|---|---|\n| `HOME_REGION` (default) | `https://<id>.<cell>.lambda-web.<home>.on.aws` | home region only |\n| `MULTI_REGION` | one global `https://<id>.lambda-web.global.on.aws` | nearest region |\n| `PER_REGION` | one URL per region, from `fn.endpoint.regionalUrl(region)` | the region in the hostname |\n\n```ts\nconst perRegion = new WebFunction(this, 'Api', {\n runtime: lambda.Runtime.NODEJS_24_X,\n code: lambda.Code.fromAsset('dist'),\n authType: WebFunctionAuthType.AWS_IAM,\n endpoint: {\n endpointType: WebFunctionEndpointType.PER_REGION,\n regions: ['us-east-1', 'eu-west-1'],\n },\n});\n\nnew CfnOutput(this, 'UsEast1Url', { value: perRegion.endpoint.regionalUrl('us-east-1') });\n// perRegion.endpoint.regions is ['<home region>', 'eu-west-1', 'us-east-1']\n```\n\n- `MULTI_REGION` and `PER_REGION` need at least one region besides the home region; `HOME_REGION` takes none.\n- A MultiRegion endpoint takes about a minute to create.\n- Lambda routes a `MULTI_REGION` endpoint by latency, not by health: it doesn't fail over when a region has problems.\n\n### More endpoints\n\nA function can have up to 10 endpoints, each with its own URL, authentication, regions and limits. For example, a public endpoint next to an IAM-only global one:\n\n```ts\nconst api = new WebFunction(this, 'Api', {\n runtime: lambda.Runtime.NODEJS_24_X,\n code: lambda.Code.fromAsset('dist'),\n authType: WebFunctionAuthType.NONE, // the default endpoint is public\n endpoint: { rateLimit: 1000 }, // requests per second\n});\n\nconst internal = api.addEndpoint('Internal', {\n authType: WebFunctionAuthType.AWS_IAM,\n endpointType: WebFunctionEndpointType.MULTI_REGION,\n regions: ['us-east-1', 'eu-west-1'],\n description: 'Service-to-service traffic',\n maxEnvironments: 50,\n});\ninternal.grantInvoke(consumerRole);\nnew CfnOutput(this, 'InternalUrl', { value: internal.url });\n```\n\n- `rateLimit` takes 0 (blocks all traffic), 100–1,000 in steps of 100, or 2,000–10,000 in steps of 1,000; excess requests get HTTP 429. `maxEnvironments` takes 2–10,000.\n- **Both limits apply separately in each region** an endpoint serves from: a 3-region endpoint with `rateLimit: 1000` accepts up to 1,000 requests per second in each region.\n- Endpoints can serve the same regions. The construct owns one `.local` log group per region, whichever endpoints serve it.\n\n### Changing regions or the endpoint type\n\nAn endpoint's type and regions can't change in place: a change creates a **new endpoint with a new URL**, and the old one is deleted once the new one is live. Two endpoints of one function can't share a name, so:\n\n| `endpointName` | Physical name | Changing `regions` or `endpointType` |\n|---|---|---|\n| omitted (recommended) | `default-<hash>` for `fn.endpoint`, `<id>-<hash>` for added endpoints; the hash covers the type and regions | works: new endpoint, new URL |\n| set, e.g. `'live'` | `live` | also change the name in the same deployment, or it fails with *The endpoint live already exists* (the stack rolls back and the old endpoint keeps serving) |\n\nThe construct warns at synth time when `endpointName` is set.\n\n## Authentication and invoking\n\n| `authType` | Meaning |\n|---|---|\n| `AWS_IAM` | Callers sign requests (SigV4 or SigV4a, signing name `lambda`) and need `lambda:InvokeWebFunctionEndpoint` |\n| `NONE` | **Public**: Lambda does no authentication; your application does (JWT, sessions). The `Authorization` header reaches your application untouched. The construct warns at synth time |\n\n```ts\nfn.grants.invoke(consumerRole); // or fn.grantInvoke(consumerRole), as on lambda.Function\n```\n\nThe grant is on the endpoint's home-region ARN, which IAM evaluates in every region the endpoint serves from, including the global URL. `fn.grants` covers the default endpoint only; grant other endpoints with their own `grantInvoke()` or `grants.invoke()`.\n\n| Endpoint | How to sign |\n|---|---|\n| `HOME_REGION` | SigV4 for the home region |\n| `PER_REGION` | SigV4 for the hostname's region, or SigV4a |\n| `MULTI_REGION` | **SigV4a with region set `*`**: you can't know which region will serve the request |\n\n```js\nimport { SignatureV4a } from '@smithy/signature-v4a';\nimport { Sha256 } from '@aws-crypto/sha256-js';\nimport { fromNodeProviderChain } from '@aws-sdk/credential-providers';\n\nconst signer = new SignatureV4a({ service: 'lambda', region: '*', sha256: Sha256, credentials: fromNodeProviderChain() });\nconst signed = await signer.sign(\n { method: 'GET', protocol: 'https:', hostname: host, path: '/', headers: { host } },\n { signingRegion: '*' },\n);\nconst response = await fetch(`https://${host}/`, { headers: signed.headers });\n```\n\n## Configuration\n\n```ts\nconst api = new WebFunction(this, 'Api', {\n runtime: lambda.Runtime.NODEJS_24_X,\n code: lambda.Code.fromAsset('build'),\n authType: WebFunctionAuthType.AWS_IAM,\n entrypoint: 'server.js', // default index.js\n webFunctionName: 'orders-api', // default: generated from the construct path\n description: 'Orders HTTP API',\n environment: { TABLE_NAME: table.tableName },\n timeout: Duration.seconds(60), // per request: 3 seconds to 15 minutes, default 30 seconds\n maxConcurrencyPerEnvironment: 32, // requests per environment at once: 1-128, default 64\n});\n\napi.addEnvironment('FEATURE_FLAG', 'on');\ntable.grantReadWriteData(api); // the default role trusts lambda.amazonaws.com\n```\n\n- Requests handled by one environment share module-level state, so keep handlers concurrency-safe.\n- Environment variable names starting with `AWS_` are reserved.\n- **Renaming the function replaces it and changes its URL.** A generated name depends on the construct path, so moving the construct renames it too.\n\n### Bundling TypeScript with `NodejsWebFunction`\n\n`NodejsWebFunction` is a `WebFunction` that bundles your server from a TypeScript or JavaScript entry file with esbuild, like `NodejsFunction` does for Lambda functions:\n\n```ts\nnew NodejsWebFunction(this, 'Api', {\n entry: 'src/server.ts',\n authType: WebFunctionAuthType.AWS_IAM,\n bundling: {\n minify: true, // default true\n sourceMap: true, // default true\n format: lambdaNodejs.OutputFormat.ESM, // default ESM (index.mjs); CJS gives index.js\n externalModules: [], // default: bundle everything you import\n },\n});\n```\n\n- **Defaults:** `runtime` is `NODEJS_24_X`, and the esbuild target follows the runtime (`node24`). The project root is the directory of the nearest lock file above `entry` (override it with `depsLockFilePath` or `projectRoot`).\n- **It also sets what a `lambda.Code` can't:** the entry point that matches the bundle, and `NODE_OPTIONS=--enable-source-maps` when source maps are on, appended to any `NODE_OPTIONS` you set, so stack traces point at your `.ts` files (e.g. `/var/task/src/server.ts:22:12`). Source map paths are relative to the project root, so no build-machine paths are deployed.\n- **ESM bundles include a `require` shim**, so CommonJS dependencies that load Node.js built-ins (Express, for example) work.\n- **The AWS SDK is bundled like any other dependency**, since the runtime has none. Only the clients you import are included.\n- **Bundling runs locally** when esbuild is installed in your project, and otherwise in Docker (an arm64 AWS SAM build image; set `forceDockerBundling` to always use Docker).\n- **Not yet supported:** installing native modules next to the bundle (`nodeModules`) and command hooks. For native dependencies, use `WebFunction` with `Code.fromAsset(..., { bundling: { image, command } })`.\n\n### Code\n\n`code` takes any `lambda.Code` that produces a zip in S3: `fromAsset`, `fromBucket`/`fromBucketV2`, `fromCustomCommand`, `fromDockerBuild`. Inline code and container images fail at synth time.\n\nLambda Web Functions download code as the `lambda.amazonaws.com` service principal, from a **versioned** bucket, and the CDK bootstrap bucket allows neither. So each stack gets a small code bucket, and the code is copied into it on deploy.\n\n## Revisions\n\nAny change to code or configuration creates a new **revision** (`fn.currentRevision`), and endpoints switch to it once it's ready. A failed deployment rolls back to the previous revision. If nothing changed, nothing is deployed.\n\nEarlier revisions are kept, so you can roll back or route traffic to them. After each deployment, the construct deletes the oldest beyond `revisionRetention` (default 20, up to 50). It never deletes a revision an endpoint routes to, or one the previous deployment used, which a rollback returns to.\n\n```ts\nnew WebFunction(this, 'Api', {\n runtime: lambda.Runtime.NODEJS_24_X,\n code: lambda.Code.fromAsset('dist'),\n authType: WebFunctionAuthType.AWS_IAM,\n revisionRetention: 5,\n});\n```\n\n### Routing to earlier revisions\n\nReference an earlier revision by its ID (for example from a `CfnOutput` of `fn.currentRevision.revisionId`, or `aws lambda-web list-web-function-revisions`). Then pin an endpoint to it, or split traffic between two revisions:\n\n```ts\nconst previous = WebFunctionRevision.fromRevisionAttributes(this, 'Previous', {\n webFunction: fn,\n revisionId: 'rev-a1b2c',\n});\n\n// Keep the default endpoint on the previous revision, and send 10% to the new one:\nfn.endpoint.routeTraffic(previous, [{ revision: fn.currentRevision, weight: 0.1 }]);\n\n// Or a second endpoint that stays on the previous revision while fn.endpoint moves on:\nfn.addEndpoint('Stable', { authType: WebFunctionAuthType.AWS_IAM, revision: previous });\n```\n\n- An endpoint routes to at most two revisions. The additional revision's `weight` is a whole percentage, from 0.01 to 0.99.\n- To promote, remove `routeTraffic` (or `revision`) and deploy: the endpoint serves the current revision again.\n- Lambda Web Function metrics have no revision dimension. To compare a split's revisions, log a version you control (for example an environment variable) from your application.\n\n### Canary and linear deployments\n\nBy default an endpoint moves all its traffic to a new revision at once. With `deployment`, it moves in steps instead, watching CloudWatch alarms: if one goes into ALARM, the endpoint goes back to the revision it served before and the deployment fails, so CloudFormation rolls the stack back.\n\n```ts\nconst api = new WebFunction(this, 'Api', {\n runtime: lambda.Runtime.NODEJS_24_X,\n code: lambda.Code.fromAsset('dist'),\n authType: WebFunctionAuthType.AWS_IAM,\n endpoint: {\n // 10% of the traffic for 10 minutes, then all of it; back if more than 2% of requests get a 5XX.\n deployment: WebFunctionDeployment.canary({ percent: 10, bake: Duration.minutes(10), rollbackOn: { serverErrorRate: 2 } }),\n },\n});\n\n// 25% more every 5 minutes, watching an alarm of your own. Each endpoint has its own deployment.\n// errorRate: any cloudwatch.IAlarm, e.g. on a metric your application publishes.\napi.addEndpoint('Public', {\n authType: WebFunctionAuthType.NONE,\n deployment: WebFunctionDeployment.linear({ percent: 25, interval: Duration.minutes(5), alarms: [errorRate] }),\n});\n```\n\n| | Steps | Limits |\n|---|---|---|\n| `allAtOnce()` (default) | 100% | |\n| `canary({ percent, bake })` | `percent`, then 100% after `bake` | `percent` 1–99, `bake` 1–45 minutes |\n| `linear({ percent, interval })` | `percent` more every `interval` | `percent` 5–50, `interval` from 1 minute, at most 45 minutes in all |\n\nHow it works:\n\n- Each deployment that creates a revision (code or configuration) moves the traffic from the revision the endpoint serves at that moment, which is also what it goes back to. If someone switched the endpoint outside CloudFormation, the deployment starts from there.\n- Each step waits until every region of a `MULTI_REGION` or `PER_REGION` endpoint has applied it (usually about 15 seconds), and if a region fails to update, the endpoint goes back as for an alarm. The bake or interval counts from the start of the step.\n- Alarms are checked before the first step (an alarm already in ALARM stops the deployment before any traffic moves), throughout every step, and once the new revision has all the traffic. They can be in any region, and composite alarms work. `INSUFFICIENT_DATA` doesn't stop a deployment.\n- A rollback of the stack, for any reason, moves the traffic back at once, without waiting or checking alarms.\n- A stack's first deployment, and a new endpoint (including one renamed by a region change), serve the revision at once: there's nothing to move from.\n- A deployment can take up to an hour: CloudFormation waits for it before it updates the endpoint. Deployments of different endpoints run in parallel.\n- A canary or linear endpoint always moves to the current revision, so it can't also use `revision`, `additionalRevisions` or `routeTraffic()`. Use `allAtOnce()` to deploy a fix immediately, for example while an alarm is in ALARM.\n\n#### Rollback alarms\n\n`rollbackOn` makes the endpoint create alarms on its own error rates, and the deployment watches them alongside any `alarms` you pass:\n\n| `rollbackOn` | Default | |\n|---|---|---|\n| `serverErrorRate` | none | roll back when more than this % of requests get a 5XX |\n| `clientErrorRate` | none | the same for 4XX (including 429s from `rateLimit` and `maxEnvironments`) |\n| `minimumRequests` | 10 | periods with fewer requests don't count, so one failed request out of two doesn't roll back |\n| `period`, `evaluationPeriods` | 1 minute, 2 | consecutive periods over the threshold before rolling back |\n\n- **One alarm per threshold in every region the endpoint serves from.** Metrics are published in the region that served the request, and an alarm can only watch metrics in its own region. The home region's alarm is a normal CloudFormation alarm; the others are created and deleted with the endpoint by a custom resource, and named `LambdaWeb-<function>-<endpoint>-5xx-rate` (or `-4xx-rate`). `endpoint.rollbackAlarms` lists them all, e.g. to add notifications to the home region's.\n- **The alarms see the whole endpoint.** Lambda Web Function metrics have no revision dimension, so at 10% a new revision's errors are about a tenth of the endpoint's: set the threshold low enough to notice that, or alarm on metrics your application publishes with its version.\n- **5XX includes the platform's 503s** while the endpoint scales up for a sudden burst, not only your application's errors.\n- **A step should outlast the alarm.** CloudWatch needs `period` × `evaluationPeriods`, plus a couple of minutes of delay, to fire; the construct warns when a canary's bake or a linear interval is shorter.\n\nThe deployment runs in a few resources per stack, created on first use: two Lambda functions, a Step Functions state machine that calls them every 15 seconds, and a log group.\n\n## Metrics\n\nEndpoints and functions have helpers for their CloudWatch metrics (namespace `AWS/Lambda/Web`), like `lambda.Function`'s:\n\n```ts\nfn.endpoint.metricServerErrorRate().createAlarm(this, 'ErrorRate', { threshold: 1, evaluationPeriods: 3 });\nfn.endpoint.metricRequestThrottles().createAlarm(this, 'Throttled', { threshold: 10, evaluationPeriods: 3 });\nfn.metricConcurrentRequests().createAlarm(this, 'Saturated', { threshold: 60, evaluationPeriods: 3 });\n```\n\n| Endpoint | Metric |\n|---|---|\n| `metricRequests()` | `ExecutedRequests` (there's no separate 2XX count) |\n| `metricClientErrors()`, `metricServerErrors()` | `HTTPResponseStatusClass4XX`, `HTTPResponseStatusClass5XX` |\n| `metricClientErrorRate()`, `metricServerErrorRate()` | 4XX or 5XX as a % of requests (math expression) |\n| `metricActiveEnvironments()` | `EndpointActiveEnvironments`, to compare with `maxEnvironments` |\n| `metricRequestThrottles()`, `metricEnvironmentThrottles()` | 429s from `rateLimit` and from `maxEnvironments` |\n\n| Function | Metric |\n|---|---|\n| `metricConcurrentRequests()` | `EnvironmentConcurrentRequests` (maximum), to compare with `maxConcurrencyPerEnvironment` |\n| `metricMaxMemoryUsage()` | `EnvironmentMaxMemoryUsage` (maximum) |\n| `metricActiveTime()`, `metricCpuTime()`, `metricResponseBytes()` | `EnvironmentActiveTime`, `EnvironmentCPUTime`, `ResponseBytes` |\n\n- **Metrics stay in the region that served the request**; unlike logs, they aren't copied to the home region. Every helper takes `region`. Dashboards can show any region, but an alarm can only use metrics from its own stack's region.\n- 4XX, 5XX and the throttle metrics only exist once they're non-zero: alarm on them with `treatMissingData: NOT_BREACHING`. The rate helpers count missing errors as 0.\n- There's no latency metric. Publish one from your application (e.g. with the CloudWatch embedded metric format).\n\n## Logs in every region\n\nWeb Functions log in two tiers:\n\n```text\n every serving region home region\n ┌──────────────────┐ ┌──────────────────────────────────────────┐\n │ <group>.local │── copied ───►│ <group> every region's logs │\n │ (that region's │ (seconds) │ streams …[rev]<instance>-<acct>-<region> │\n │ environments) │ │ <group>.local (home-region traffic) │\n └──────────────────┘ └──────────────────────────────────────────┘\n```\n\n**Query `fn.logGroup`**, the home-region group that receives every region's logs. The service would create missing groups without retention and never delete them, so the construct creates and owns all of them: both home-region groups, and `<group>.local` in every other region of the endpoint.\n\n```ts\nnew WebFunction(this, 'Api', {\n runtime: lambda.Runtime.NODEJS_24_X,\n code: lambda.Code.fromAsset('dist'),\n authType: WebFunctionAuthType.AWS_IAM,\n logRetention: logs.RetentionDays.THREE_MONTHS, // default ONE_MONTH, every group in every region\n logRemovalPolicy: RemovalPolicy.DESTROY, // default RETAIN\n applicationLogLevelV2: lambda.ApplicationLogLevel.WARN,\n systemLogLevelV2: lambda.SystemLogLevel.INFO, // DEBUG, INFO or WARN\n});\n```\n\n- The default group is `/aws/lambda/web/<function name>`. Log lines are JSON; application lines carry `requestId`, `endpointName` and `region`.\n- Every event is stored twice (`.local` plus the home-region copy), so expect about double log ingestion, plus cross-region transfer.\n- With `DESTROY`, deletion waits about a minute after the function is gone, because environments flush their last lines late.\n- Subscribe only to `fn.logGroup`: subscribing to the `.local` groups as well delivers every event twice.\n\n## Limitations\n\n- Not yet supported: importing existing functions, VPC access (network connectors), resource-policy permissions, KMS encryption, metrics helpers, tracing, and a CloudFront origin.\n- `cdk deploy --hotswap` and `cdk watch` don't support Web Functions.\n- Quotas: 10 endpoints and about 50 revisions per function (Lambda cleans up older revisions automatically), and 10,000 requests per second per endpoint. Per account and region: 100,000 requests per second and 2,000 Arm64 vCPUs (each execution environment uses 2). The account quotas are adjustable, and new accounts start lower. See [Lambda quotas](https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-limits.html).\n- The stack's custom resource provider Lambda keeps its own log group after the stack is deleted, as with other CDK custom resources.\n\n## Development\n\nTooling is pinned in `mise.toml` (Node 24, AWS CDK CLI). Personal settings, such as the AWS profile for the live end-to-end tests, go in a git-ignored `mise.local.toml`.\n\n```bash\nmise install\nnpx projen build # compile, unit tests, lint, API docs\nnpx projen e2e # deploy, verify and destroy real stacks in three regions (needs AWS credentials)\n```\n"
9748
+ "markdown": "# CDK constructs for AWS Lambda Web Functions\n\n<!--BEGIN STABILITY BANNER-->\n\n---\n\n![cdk-constructs: Experimental](https://img.shields.io/badge/cdk--constructs-experimental-important.svg?style=for-the-badge)\n\n> The APIs of higher level constructs in this module are experimental and under active development.\n> They are subject to non-backward compatible changes or removal in any future version. These are\n> not subject to the [Semantic Versioning](https://semver.org/) model and breaking changes will be\n> announced in the release notes. This means that while you may use them, you may need to update\n> your source code when upgrading to a newer version of this package.\n\n---\n\n<!--END STABILITY BANNER-->\n\n[AWS Lambda Web Functions](https://docs.aws.amazon.com/lambda/latest/dg/web-functions.html) run an ordinary Node.js HTTP server (Express, Fastify, Hono, `node:http`) on Lambda and give it an HTTPS endpoint, optionally served from several regions. `WebFunction` deploys one, following the conventions of `aws-cdk-lib/aws-lambda` where the two services overlap.\n\n```ts fixture=bare\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\nimport { WebFunction, WebFunctionAuthType, WebFunctionEndpointType } from '@ashishpandeyone/cdk-lambda-web-function';\n\nconst fn = new WebFunction(this, 'Api', {\n runtime: lambda.Runtime.NODEJS_24_X,\n code: lambda.Code.fromAsset('dist'),\n authType: WebFunctionAuthType.AWS_IAM,\n endpoint: {\n endpointType: WebFunctionEndpointType.MULTI_REGION,\n regions: ['us-east-1', 'eu-west-1'],\n },\n});\n\nnew CfnOutput(this, 'Url', { value: fn.endpoint.url }); // https://<id>.lambda-web.global.on.aws\n```\n\nThe stack's region is the function's **home region**. Multi-region endpoints need a stack with an explicit `env.region`.\n\n## Installation\n\n```bash\nnpm install @ashishpandeyone/cdk-lambda-web-function\n```\n\nIt needs `aws-cdk-lib` 2.273.0 or later and `constructs` 10.5.1 or later (peer dependencies), and Node.js 22 or later. The package is published for TypeScript and JavaScript only.\n\n## Writing the server\n\n1. Listen on the host and port in **`AWS_LAMBDA_HTTP_ENDPOINT`** (`0.0.0.0:3000` today). `PORT` is not set.\n2. Start listening within **10 seconds**, or initialisation fails with `Application.TimeoutListenError`.\n3. Put the entry file at the root of your bundle as **`index.js`**, or set `entrypoint`.\n4. The runtime has **no AWS SDK**: bundle the clients you import.\n5. Code runs on **arm64**.\n\n```js\nconst express = require('express');\n\nconst app = express();\napp.get('/', (req, res) => res.json({ hello: 'world', region: process.env.AWS_REGION }));\n\nconst [host, port] = process.env.AWS_LAMBDA_HTTP_ENDPOINT.split(':');\napp.listen(Number(port), host);\n```\n\nRequests carry `lambda-web-request-id` and `lambda-web-endpoint-name` headers.\n\n## Regions and endpoints\n\nEach `WebFunction` has a default endpoint, `fn.endpoint`, configured with the `endpoint` property. [Add more](#more-endpoints) with `fn.addEndpoint()`.\n\n| `endpointType` | URL | Routing |\n|---|---|---|\n| `HOME_REGION` (default) | `https://<id>.<cell>.lambda-web.<home>.on.aws` | home region only |\n| `MULTI_REGION` | one global `https://<id>.lambda-web.global.on.aws` | nearest region |\n| `PER_REGION` | one URL per region, from `fn.endpoint.regionalUrl(region)` | the region in the hostname |\n\n```ts\nconst perRegion = new WebFunction(this, 'Api', {\n runtime: lambda.Runtime.NODEJS_24_X,\n code: lambda.Code.fromAsset('dist'),\n authType: WebFunctionAuthType.AWS_IAM,\n endpoint: {\n endpointType: WebFunctionEndpointType.PER_REGION,\n regions: ['us-east-1', 'eu-west-1'],\n },\n});\n\nnew CfnOutput(this, 'UsEast1Url', { value: perRegion.endpoint.regionalUrl('us-east-1') });\n// perRegion.endpoint.regions is ['<home region>', 'eu-west-1', 'us-east-1']\n```\n\n- `MULTI_REGION` and `PER_REGION` need at least one region besides the home region; `HOME_REGION` takes none.\n- A MultiRegion endpoint takes about a minute to create.\n- Lambda routes a `MULTI_REGION` endpoint by latency, not by health: it doesn't fail over when a region has problems.\n\n### More endpoints\n\nA function can have up to 10 endpoints, each with its own URL, authentication, regions and limits. For example, a public endpoint next to an IAM-only global one:\n\n```ts\nconst api = new WebFunction(this, 'Api', {\n runtime: lambda.Runtime.NODEJS_24_X,\n code: lambda.Code.fromAsset('dist'),\n authType: WebFunctionAuthType.NONE, // the default endpoint is public\n endpoint: { rateLimit: 1000 }, // requests per second\n});\n\nconst internal = api.addEndpoint('Internal', {\n authType: WebFunctionAuthType.AWS_IAM,\n endpointType: WebFunctionEndpointType.MULTI_REGION,\n regions: ['us-east-1', 'eu-west-1'],\n description: 'Service-to-service traffic',\n maxEnvironments: 50,\n});\ninternal.grantInvoke(consumerRole);\nnew CfnOutput(this, 'InternalUrl', { value: internal.url });\n```\n\n- `rateLimit` takes 0 (blocks all traffic), 100–1,000 in steps of 100, or 2,000–10,000 in steps of 1,000; excess requests get HTTP 429. `maxEnvironments` takes 2–10,000.\n- **Both limits apply separately in each region** an endpoint serves from: a 3-region endpoint with `rateLimit: 1000` accepts up to 1,000 requests per second in each region.\n- Endpoints can serve the same regions. The construct owns one `.local` log group per region, whichever endpoints serve it.\n\n### Changing regions or the endpoint type\n\nAn endpoint's type and regions can't change in place: a change creates a **new endpoint with a new URL**, and the old one is deleted once the new one is live. Two endpoints of one function can't share a name, so:\n\n| `endpointName` | Physical name | Changing `regions` or `endpointType` |\n|---|---|---|\n| omitted (recommended) | `default-<hash>` for `fn.endpoint`, `<id>-<hash>` for added endpoints; the hash covers the type and regions | works: new endpoint, new URL |\n| set, e.g. `'live'` | `live` | also change the name in the same deployment, or it fails with *The endpoint live already exists* (the stack rolls back and the old endpoint keeps serving) |\n\nThe construct warns at synth time when `endpointName` is set.\n\n## Authentication and invoking\n\n| `authType` | Meaning |\n|---|---|\n| `AWS_IAM` | Callers sign requests (SigV4 or SigV4a, signing name `lambda`) and need `lambda:InvokeWebFunctionEndpoint` |\n| `NONE` | **Public**: Lambda does no authentication; your application does (JWT, sessions). The `Authorization` header reaches your application untouched. The construct warns at synth time |\n\n```ts\nfn.grants.invoke(consumerRole); // or fn.grantInvoke(consumerRole), as on lambda.Function\n```\n\nThe grant is on the endpoint's home-region ARN, which IAM evaluates in every region the endpoint serves from, including the global URL. `fn.grants` covers the default endpoint only; grant other endpoints with their own `grantInvoke()` or `grants.invoke()`.\n\n| Endpoint | How to sign |\n|---|---|\n| `HOME_REGION` | SigV4 for the home region |\n| `PER_REGION` | SigV4 for the hostname's region, or SigV4a |\n| `MULTI_REGION` | **SigV4a with region set `*`**: you can't know which region will serve the request |\n\n```js\nimport { SignatureV4a } from '@smithy/signature-v4a';\nimport { Sha256 } from '@aws-crypto/sha256-js';\nimport { fromNodeProviderChain } from '@aws-sdk/credential-providers';\n\nconst host = new URL(url).hostname; // url: the endpoint's URL\nconst signer = new SignatureV4a({ service: 'lambda', region: '*', sha256: Sha256, credentials: fromNodeProviderChain() });\nconst signed = await signer.sign(\n { method: 'GET', protocol: 'https:', hostname: host, path: '/', headers: { host } },\n { signingRegion: '*' },\n);\nconst response = await fetch(`https://${host}/`, { headers: signed.headers });\n```\n\n### Other accounts and AWS services\n\nA caller in another account needs permission twice: in its own IAM policy, and in the function's **resource policy**. `grantInvoke` handles the function's side: a role in the function's account only gets an IAM policy statement, while a principal in another account or an AWS service also gets a statement in the resource policy.\n\n```ts\nfn.grantInvoke(iam.Role.fromRoleArn(this, 'Partner', 'arn:aws:iam::444455556666:role/caller'));\n```\n\nFor principals you can't grant to (a whole account, an organization, an AWS service with conditions), use `addPermission`. The `id` becomes the statement's `Sid`:\n\n```ts\nfn.addPermission('PartnerAccount', { principal: new iam.AccountPrincipal('444455556666') });\nfn.addPermission('MyOrg', { principal: new iam.OrganizationPrincipal('o-a1b2c3d4e5'), endpoint: fn.endpoint });\nfn.addPermission('Cdn', {\n principal: new iam.ServicePrincipal('cloudfront.amazonaws.com'),\n sourceArn: `arn:aws:cloudfront::${this.account}:distribution/EDFDVBD6EXAMPLE`,\n});\n```\n\n`addPermission` allows calling every endpoint unless you pass `endpoint`. For other actions, such as letting another account create revisions, use `fn.addToResourcePolicy(statement)`. Statements use the endpoint ARN for invoking and the function ARN for actions on the function.\n\n- **One resource policy per function, written by the function's stack.** The construct creates it (`AWS::Lambda::ResourcePolicy`) with the first statement. CloudFormation can't attach a second one: another stack, or a `CfnResourcePolicy` of your own on the function, fails at change-set validation with \"already exists\". If you attached one yourself, move its statements into `addPermission` or `addToResourcePolicy`. Each update of the policy replaces any statements added outside CloudFormation.\n- **Public policies are rejected.** Lambda refuses a policy that lets anyone call the function, and the construct fails synthesis first. A `*` principal is only accepted with a condition that pins the caller, such as `aws:PrincipalOrgID` (`iam.OrganizationPrincipal`) or `aws:SourceAccount`. For a public endpoint, use `authType: NONE`.\n- **Scope AWS services to your resource.** Lambda accepts a service principal with no condition, which would let that service call the endpoint on behalf of any account. The construct warns unless you give `sourceArn` or `sourceAccount` (or an `aws:SourceArn`, `aws:SourceAccount`, `aws:SourceOrgID` or `aws:SourceOrgPaths` condition).\n- Lambda copies the policy to every region the function's endpoints serve from. The copy is eventually consistent, and in tests changes applied in every region within seconds.\n\n### Functions defined elsewhere\n\nImport a Web Function defined in another stack or app to grant access to it, read its metrics, or reference its revisions:\n\n```ts\nconst orders = WebFunction.fromWebFunctionArn(this, 'Orders', 'arn:aws:lambda:us-east-1:111122223333:web-function/orders');\norders.grantInvoke(consumerRole); // every endpoint of the function\n\nconst live = WebFunction.fromWebFunctionAttributes(this, 'Live', {\n webFunctionName: 'orders', // in this stack's account and region\n endpointName: 'live', // grantInvoke allows this endpoint only\n});\nlive.metricConcurrentRequests().createAlarm(this, 'Busy', { threshold: 60, evaluationPeriods: 3 });\n```\n\nAn imported function's metrics default to its own region. Its endpoints, revisions and log groups stay with the stack that defines it.\n\nAn imported function's `grantInvoke` adds to the caller's IAM policy only, which is all a caller in the function's account needs. A caller in another account also needs the function's resource policy to allow it, which only the function's own stack can change: `addToResourcePolicy` on an imported function adds nothing and warns.\n\n## Configuration\n\n```ts\nconst api = new WebFunction(this, 'Api', {\n runtime: lambda.Runtime.NODEJS_24_X,\n code: lambda.Code.fromAsset('build'),\n authType: WebFunctionAuthType.AWS_IAM,\n entrypoint: 'server.js', // default index.js\n webFunctionName: 'orders-api', // default: generated from the construct path\n description: 'Orders HTTP API',\n environment: { TABLE_NAME: table.tableName },\n timeout: Duration.seconds(60), // per request: 3 seconds to 15 minutes, default 30 seconds\n maxConcurrencyPerEnvironment: 32, // requests per environment at once: 1-128, default 64\n});\n\napi.addEnvironment('FEATURE_FLAG', 'on');\ntable.grantReadWriteData(api); // the default role trusts lambda.amazonaws.com\n```\n\n- **Each execution environment has 2 vCPUs and 2 GB of memory.** There's no memory setting as on Lambda functions; scale with `maxConcurrencyPerEnvironment` and more environments instead.\n- Requests handled by one environment share module-level state, so keep handlers concurrency-safe.\n- Environment variable names starting with `AWS_` are reserved.\n- **Renaming the function replaces it and changes its URL.** A generated name depends on the construct path, so moving the construct renames it too.\n\n### Bundling TypeScript with `NodejsWebFunction`\n\n`NodejsWebFunction` is a `WebFunction` that bundles your server from a TypeScript or JavaScript entry file with esbuild, like `NodejsFunction` does for Lambda functions:\n\n```ts\nnew NodejsWebFunction(this, 'Api', {\n entry: 'src/server.ts',\n authType: WebFunctionAuthType.AWS_IAM,\n bundling: {\n minify: true, // default true\n sourceMap: true, // default true\n format: lambdaNodejs.OutputFormat.ESM, // default ESM (index.mjs); CJS gives index.js\n externalModules: [], // default: bundle everything you import\n },\n});\n```\n\n- **Defaults:** `runtime` is `NODEJS_24_X`, and the esbuild target follows the runtime (`node24`). The project root is the directory of the nearest lock file above `entry` (override it with `depsLockFilePath` or `projectRoot`).\n- **It also sets what a `lambda.Code` can't:** the entry point that matches the bundle, and `NODE_OPTIONS=--enable-source-maps` when source maps are on, appended to any `NODE_OPTIONS` you set, so stack traces point at your `.ts` files (e.g. `/var/task/src/server.ts:22:12`). Source map paths are relative to the project root, so no build-machine paths are deployed.\n- **ESM bundles include a `require` shim**, so CommonJS dependencies that load Node.js built-ins (Express, for example) work.\n- **The AWS SDK is bundled like any other dependency**, since the runtime has none. Only the clients you import are included.\n- **Bundling runs locally** when esbuild is installed in your project, and otherwise in Docker (an arm64 AWS SAM build image; set `forceDockerBundling` to always use Docker).\n- **Not yet supported:** installing native modules next to the bundle (`nodeModules`) and command hooks. For native dependencies, use `WebFunction` with `Code.fromAsset(..., { bundling: { image, command } })`.\n\n### Code\n\n`code` takes any `lambda.Code` that produces a zip in S3: `fromAsset`, `fromBucket`/`fromBucketV2`, `fromCustomCommand`, `fromDockerBuild`. Inline code and container images fail at synth time.\n\nLambda Web Functions download code as the `lambda.amazonaws.com` service principal, from a **versioned** bucket, and the CDK bootstrap bucket allows neither. So each stack gets a small code bucket, and the code is copied into it on deploy. The bucket is emptied and deleted with the stack.\n\nCopying code, managing the function's log groups in every region, looking up regional URLs, cleaning up old revisions, creating rollback alarms in other regions and emptying the code bucket all run in one custom resource Lambda per stack. Its logs go to a log group the stack owns, kept for a month and deleted with the stack.\n\n## Revisions\n\nAny change to code or configuration creates a new **revision** (`fn.currentRevision`), and endpoints switch to it once it's ready. A failed deployment rolls back to the previous revision. If nothing changed, nothing is deployed.\n\nEarlier revisions are kept, so you can roll back or route traffic to them. After each deployment, the construct deletes the oldest beyond `revisionRetention` (default 20, up to 50). It never deletes a revision an endpoint routes to, or one the previous deployment used, which a rollback returns to.\n\n```ts\nnew WebFunction(this, 'Api', {\n runtime: lambda.Runtime.NODEJS_24_X,\n code: lambda.Code.fromAsset('dist'),\n authType: WebFunctionAuthType.AWS_IAM,\n revisionRetention: 5,\n});\n```\n\n### Routing to earlier revisions\n\nReference an earlier revision by its ID (for example from a `CfnOutput` of `fn.currentRevision.revisionId`, or `aws lambda-web list-web-function-revisions`). Then pin an endpoint to it, or split traffic between two revisions:\n\n```ts\nconst previous = WebFunctionRevision.fromRevisionAttributes(this, 'Previous', {\n webFunction: fn,\n revisionId: 'rev-a1b2c',\n});\n\n// Keep the default endpoint on the previous revision, and send 10% to the new one:\nfn.endpoint.routeTraffic(previous, [{ revision: fn.currentRevision, weight: 0.1 }]);\n\n// Or a second endpoint that stays on the previous revision while fn.endpoint moves on:\nfn.addEndpoint('Stable', { authType: WebFunctionAuthType.AWS_IAM, revision: previous });\n```\n\n- An endpoint routes to at most two revisions. The additional revision's `weight` is a whole percentage, from 0.01 to 0.99.\n- To promote, remove `routeTraffic` (or `revision`) and deploy: the endpoint serves the current revision again.\n- Lambda Web Function metrics have no revision dimension. To compare a split's revisions, log a version you control (for example an environment variable) from your application.\n\n### Canary and linear deployments\n\nBy default an endpoint moves all its traffic to a new revision at once. With `deployment`, it moves in steps instead, watching CloudWatch alarms: if one goes into ALARM, the endpoint goes back to the revision it served before and the deployment fails, so CloudFormation rolls the stack back.\n\n```ts\nconst api = new WebFunction(this, 'Api', {\n runtime: lambda.Runtime.NODEJS_24_X,\n code: lambda.Code.fromAsset('dist'),\n authType: WebFunctionAuthType.AWS_IAM,\n endpoint: {\n // 10% of the traffic for 10 minutes, then all of it; back if more than 2% of requests get a 5XX.\n deployment: WebFunctionDeployment.canary({ percent: 10, bake: Duration.minutes(10), rollbackOn: { serverErrorRate: 2 } }),\n },\n});\n\n// 25% more every 5 minutes, watching an alarm of your own. Each endpoint has its own deployment.\n// errorRate: any cloudwatch.IAlarm, e.g. on a metric your application publishes.\napi.addEndpoint('Public', {\n authType: WebFunctionAuthType.NONE,\n deployment: WebFunctionDeployment.linear({ percent: 25, interval: Duration.minutes(5), alarms: [errorRate] }),\n});\n```\n\n| | Steps | Limits |\n|---|---|---|\n| `allAtOnce()` (default) | 100% | |\n| `canary({ percent, bake })` | `percent`, then 100% after `bake` | `percent` 1–99, `bake` 1–45 minutes |\n| `linear({ percent, interval })` | `percent` more every `interval` | `percent` 5–50, `interval` from 1 minute, at most 45 minutes in all |\n\nHow it works:\n\n- Each deployment that creates a revision (code or configuration) moves the traffic from the revision the endpoint serves at that moment, which is also what it goes back to. If someone switched the endpoint outside CloudFormation, the deployment starts from there.\n- Each step waits until every region of a `MULTI_REGION` or `PER_REGION` endpoint has applied it (usually about 15 seconds), and if a region fails to update, the endpoint goes back as for an alarm. The bake or interval counts from the start of the step.\n- Alarms are checked before the first step (an alarm already in ALARM stops the deployment before any traffic moves), throughout every step, and once the new revision has all the traffic. They can be in any region, and composite alarms work. `INSUFFICIENT_DATA` doesn't stop a deployment.\n- A rollback of the stack, for any reason, moves the traffic back at once, without waiting or checking alarms.\n- A stack's first deployment, and a new endpoint (including one renamed by a region change), serve the revision at once: there's nothing to move from.\n- A deployment can take up to an hour: CloudFormation waits for it before it updates the endpoint. Deployments of different endpoints run in parallel.\n- A canary or linear endpoint always moves to the current revision, so it can't also use `revision`, `additionalRevisions` or `routeTraffic()`. Use `allAtOnce()` to deploy a fix immediately, for example while an alarm is in ALARM.\n\n#### Rollback alarms\n\n`rollbackOn` makes the endpoint create alarms on its own error rates, and the deployment watches them alongside any `alarms` you pass:\n\n| `rollbackOn` | Default | |\n|---|---|---|\n| `serverErrorRate` | none | roll back when more than this % of requests get a 5XX |\n| `clientErrorRate` | none | the same for 4XX (including 429s from `rateLimit` and `maxEnvironments`) |\n| `minimumRequests` | 10 | periods with fewer requests don't count, so one failed request out of two doesn't roll back |\n| `period`, `evaluationPeriods` | 1 minute, 2 | consecutive periods over the threshold before rolling back |\n\n- **One alarm per threshold in every region the endpoint serves from.** Metrics are published in the region that served the request, and an alarm can only watch metrics in its own region. The home region's alarm is a normal CloudFormation alarm; the others are created and deleted with the endpoint by a custom resource, and named `LambdaWeb-<function>-<endpoint>-5xx-rate` (or `-4xx-rate`). `endpoint.rollbackAlarms` lists them all, e.g. to add notifications to the home region's.\n- **The alarms see the whole endpoint.** Lambda Web Function metrics have no revision dimension, so at 10% a new revision's errors are about a tenth of the endpoint's: set the threshold low enough to notice that, or alarm on metrics your application publishes with its version.\n- **5XX includes the platform's 503s** while the endpoint scales up for a sudden burst, not only your application's errors.\n- **A step should outlast the alarm.** CloudWatch needs `period` × `evaluationPeriods`, plus a couple of minutes of delay, to fire; the construct warns when a canary's bake or a linear interval is shorter.\n\nThe deployment runs in a few resources per stack, created on first use: two Lambda functions, a Step Functions state machine that calls them every 15 seconds, and a log group.\n\n## Metrics\n\nEndpoints and functions have helpers for their CloudWatch metrics (namespace `AWS/Lambda/Web`), like `lambda.Function`'s:\n\n```ts\nfn.endpoint.metricServerErrorRate().createAlarm(this, 'ErrorRate', { threshold: 1, evaluationPeriods: 3 });\nfn.endpoint.metricRequestThrottles().createAlarm(this, 'Throttled', { threshold: 10, evaluationPeriods: 3 });\nfn.metricConcurrentRequests().createAlarm(this, 'Saturated', { threshold: 60, evaluationPeriods: 3 });\n```\n\n| Endpoint | Metric |\n|---|---|\n| `metricRequests()` | `ExecutedRequests` (there's no separate 2XX count) |\n| `metricClientErrors()`, `metricServerErrors()` | `HTTPResponseStatusClass4XX`, `HTTPResponseStatusClass5XX` |\n| `metricClientErrorRate()`, `metricServerErrorRate()` | 4XX or 5XX as a % of requests (math expression) |\n| `metricActiveEnvironments()` | `EndpointActiveEnvironments`, to compare with `maxEnvironments` |\n| `metricRequestThrottles()`, `metricEnvironmentThrottles()` | 429s from `rateLimit` and from `maxEnvironments` |\n\n| Function | Metric |\n|---|---|\n| `metricConcurrentRequests()` | `EnvironmentConcurrentRequests` (maximum), to compare with `maxConcurrencyPerEnvironment` |\n| `metricMaxMemoryUsage()` | `EnvironmentMaxMemoryUsage` (maximum) |\n| `metricActiveTime()`, `metricCpuTime()`, `metricResponseBytes()` | `EnvironmentActiveTime`, `EnvironmentCPUTime`, `ResponseBytes` |\n\n- **Metrics stay in the region that served the request**; unlike logs, they aren't copied to the home region. Every helper takes `region`. Dashboards can show any region, but an alarm can only use metrics from its own stack's region.\n- 4XX, 5XX and the throttle metrics only exist once they're non-zero: alarm on them with `treatMissingData: NOT_BREACHING`. The rate helpers count missing errors as 0.\n- There's no latency metric. Publish one from your application (e.g. with the CloudWatch embedded metric format).\n\n## Logs in every region\n\nWeb Functions log in two tiers:\n\n```text\n every serving region home region\n ┌──────────────────┐ ┌──────────────────────────────────────────┐\n │ <group>.local │── copied ───►│ <group> every region's logs │\n │ (that region's │ (seconds) │ streams …[rev]<instance>-<acct>-<region> │\n │ environments) │ │ <group>.local (home-region traffic) │\n └──────────────────┘ └──────────────────────────────────────────┘\n```\n\n**Query `fn.logGroup`**, the home-region group that receives every region's logs. The service would create missing groups without retention and never delete them, so the construct creates and owns all of them: both home-region groups, and `<group>.local` in every other region any of its endpoints serves from.\n\n```ts\nnew WebFunction(this, 'Api', {\n runtime: lambda.Runtime.NODEJS_24_X,\n code: lambda.Code.fromAsset('dist'),\n authType: WebFunctionAuthType.AWS_IAM,\n logRetention: logs.RetentionDays.THREE_MONTHS, // default ONE_MONTH, every group in every region\n logRemovalPolicy: RemovalPolicy.DESTROY, // default RETAIN\n applicationLogLevelV2: lambda.ApplicationLogLevel.WARN,\n systemLogLevelV2: lambda.SystemLogLevel.INFO, // DEBUG, INFO or WARN\n});\n```\n\n- The default group is `/aws/lambda/web/<function name>`. Log lines are JSON; application lines carry `requestId`, `endpointName` and `region`.\n- Every event is stored twice (`.local` plus the home-region copy), so expect about double log ingestion, plus cross-region transfer.\n- With `DESTROY`, deletion waits about a minute after the function is gone, because environments flush their last lines late.\n- Subscribe only to `fn.logGroup`: subscribing to the `.local` groups as well delivers every event twice.\n\n## Limitations\n\n- Not yet supported: VPC access (network connectors), KMS encryption, tracing, and a CloudFront origin.\n- **Hotswap skips Web Functions without a warning.** `cdk deploy --hotswap` and `cdk watch`, which hotswaps by default, report `(no changes)` for a code or configuration change and the endpoint keeps serving the old revision. Use `cdk watch --hotswap-fallback` (or `cdk deploy --hotswap-fallback`): it deploys Web Function changes through CloudFormation, in about 40 seconds for a home-region endpoint.\n- Fixed limits: 512 MB of code (unzipped) and 32 KB of environment variables per revision, 512 MB of `/tmp` per execution environment, and 128 KiB of headers per request.\n- Quotas: 10 endpoints and about 50 revisions per function (Lambda cleans up older revisions automatically), and 10,000 requests per second per endpoint. Per account and region: 100,000 requests per second and 2,000 Arm64 vCPUs (each execution environment uses 2). The account quotas are adjustable, and new accounts start lower. See [Lambda quotas](https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-limits.html).\n\n## Development\n\nTooling is pinned in `mise.toml` (Node 24, AWS CDK CLI). Personal settings, such as the AWS profile for the live end-to-end tests, go in a git-ignored `mise.local.toml`.\n\n```bash\nmise install\nnpx projen build # compile, unit tests, lint, API docs\nnpx projen e2e # deploy, verify and destroy real stacks in three regions (needs AWS credentials)\n```\n"
9749
9749
  },
9750
9750
  "repository": {
9751
9751
  "type": "git",
@@ -9840,19 +9840,211 @@
9840
9840
  "@ashishpandeyone/cdk-lambda-web-function.IWebFunction": {
9841
9841
  "assembly": "@ashishpandeyone/cdk-lambda-web-function",
9842
9842
  "docs": {
9843
+ "remarks": "`addToResourcePolicy` adds to the function's resource policy (who else may call or manage it). A `WebFunction` has\none, created by its stack on the first statement. An imported function's policy belongs to the stack that created\nit, so the statement isn't added (`statementAdded: false`).",
9843
9844
  "stability": "experimental",
9844
- "summary": "A Lambda Web Function."
9845
+ "summary": "A Lambda Web Function, created in this app (`WebFunction`) or imported (`WebFunction.fromWebFunctionArn`)."
9845
9846
  },
9846
9847
  "fqn": "@ashishpandeyone/cdk-lambda-web-function.IWebFunction",
9847
9848
  "interfaces": [
9848
9849
  "aws-cdk-lib.IResource",
9849
- "aws-cdk-lib.interfaces.aws_lambda.IWebFunctionRef"
9850
+ "aws-cdk-lib.interfaces.aws_lambda.IWebFunctionRef",
9851
+ "aws-cdk-lib.aws_iam.IResourceWithPolicy"
9850
9852
  ],
9851
9853
  "kind": "interface",
9852
9854
  "locationInModule": {
9853
9855
  "filename": "src/web-function.ts",
9854
- "line": 155
9856
+ "line": 160
9855
9857
  },
9858
+ "methods": [
9859
+ {
9860
+ "abstract": true,
9861
+ "docs": {
9862
+ "remarks": "for an imported function, the endpoint named in its attributes, or every endpoint.\n\nFor a `WebFunction`, a grantee in this account gets an IAM policy statement; another account or an AWS service\nalso gets a statement in the function's resource policy. For an imported function, only the grantee's IAM policy\nchanges: across accounts, the function's own resource policy must also allow the grantee.\n[disable-awslint:no-grants]",
9863
+ "stability": "experimental",
9864
+ "summary": "Allows `grantee` to call the function's endpoint (`lambda:InvokeWebFunctionEndpoint`): the default endpoint of a `WebFunction`;"
9865
+ },
9866
+ "locationInModule": {
9867
+ "filename": "src/web-function.ts",
9868
+ "line": 184
9869
+ },
9870
+ "name": "grantInvoke",
9871
+ "parameters": [
9872
+ {
9873
+ "name": "grantee",
9874
+ "type": {
9875
+ "fqn": "aws-cdk-lib.aws_iam.IGrantable"
9876
+ }
9877
+ }
9878
+ ],
9879
+ "returns": {
9880
+ "type": {
9881
+ "fqn": "aws-cdk-lib.aws_iam.Grant"
9882
+ }
9883
+ }
9884
+ },
9885
+ {
9886
+ "abstract": true,
9887
+ "docs": {
9888
+ "stability": "experimental",
9889
+ "summary": "A metric of the function's execution environments in `AWS/Lambda/Web` (dimension `FunctionName`)."
9890
+ },
9891
+ "locationInModule": {
9892
+ "filename": "src/web-function.ts",
9893
+ "line": 189
9894
+ },
9895
+ "name": "metric",
9896
+ "parameters": [
9897
+ {
9898
+ "name": "metricName",
9899
+ "type": {
9900
+ "primitive": "string"
9901
+ }
9902
+ },
9903
+ {
9904
+ "name": "props",
9905
+ "optional": true,
9906
+ "type": {
9907
+ "fqn": "aws-cdk-lib.aws_cloudwatch.MetricOptions"
9908
+ }
9909
+ }
9910
+ ],
9911
+ "returns": {
9912
+ "type": {
9913
+ "fqn": "aws-cdk-lib.aws_cloudwatch.Metric"
9914
+ }
9915
+ }
9916
+ },
9917
+ {
9918
+ "abstract": true,
9919
+ "docs": {
9920
+ "stability": "experimental",
9921
+ "summary": "Time the execution environments were active (`EnvironmentActiveTime`)."
9922
+ },
9923
+ "locationInModule": {
9924
+ "filename": "src/web-function.ts",
9925
+ "line": 192
9926
+ },
9927
+ "name": "metricActiveTime",
9928
+ "parameters": [
9929
+ {
9930
+ "name": "props",
9931
+ "optional": true,
9932
+ "type": {
9933
+ "fqn": "aws-cdk-lib.aws_cloudwatch.MetricOptions"
9934
+ }
9935
+ }
9936
+ ],
9937
+ "returns": {
9938
+ "type": {
9939
+ "fqn": "aws-cdk-lib.aws_cloudwatch.Metric"
9940
+ }
9941
+ }
9942
+ },
9943
+ {
9944
+ "abstract": true,
9945
+ "docs": {
9946
+ "stability": "experimental",
9947
+ "summary": "Requests an execution environment handled at once (`EnvironmentConcurrentRequests`, maximum)."
9948
+ },
9949
+ "locationInModule": {
9950
+ "filename": "src/web-function.ts",
9951
+ "line": 198
9952
+ },
9953
+ "name": "metricConcurrentRequests",
9954
+ "parameters": [
9955
+ {
9956
+ "name": "props",
9957
+ "optional": true,
9958
+ "type": {
9959
+ "fqn": "aws-cdk-lib.aws_cloudwatch.MetricOptions"
9960
+ }
9961
+ }
9962
+ ],
9963
+ "returns": {
9964
+ "type": {
9965
+ "fqn": "aws-cdk-lib.aws_cloudwatch.Metric"
9966
+ }
9967
+ }
9968
+ },
9969
+ {
9970
+ "abstract": true,
9971
+ "docs": {
9972
+ "stability": "experimental",
9973
+ "summary": "CPU time the execution environments used (`EnvironmentCPUTime`)."
9974
+ },
9975
+ "locationInModule": {
9976
+ "filename": "src/web-function.ts",
9977
+ "line": 195
9978
+ },
9979
+ "name": "metricCpuTime",
9980
+ "parameters": [
9981
+ {
9982
+ "name": "props",
9983
+ "optional": true,
9984
+ "type": {
9985
+ "fqn": "aws-cdk-lib.aws_cloudwatch.MetricOptions"
9986
+ }
9987
+ }
9988
+ ],
9989
+ "returns": {
9990
+ "type": {
9991
+ "fqn": "aws-cdk-lib.aws_cloudwatch.Metric"
9992
+ }
9993
+ }
9994
+ },
9995
+ {
9996
+ "abstract": true,
9997
+ "docs": {
9998
+ "stability": "experimental",
9999
+ "summary": "Peak memory an execution environment used (`EnvironmentMaxMemoryUsage`, maximum)."
10000
+ },
10001
+ "locationInModule": {
10002
+ "filename": "src/web-function.ts",
10003
+ "line": 201
10004
+ },
10005
+ "name": "metricMaxMemoryUsage",
10006
+ "parameters": [
10007
+ {
10008
+ "name": "props",
10009
+ "optional": true,
10010
+ "type": {
10011
+ "fqn": "aws-cdk-lib.aws_cloudwatch.MetricOptions"
10012
+ }
10013
+ }
10014
+ ],
10015
+ "returns": {
10016
+ "type": {
10017
+ "fqn": "aws-cdk-lib.aws_cloudwatch.Metric"
10018
+ }
10019
+ }
10020
+ },
10021
+ {
10022
+ "abstract": true,
10023
+ "docs": {
10024
+ "stability": "experimental",
10025
+ "summary": "Bytes sent in responses (`ResponseBytes`)."
10026
+ },
10027
+ "locationInModule": {
10028
+ "filename": "src/web-function.ts",
10029
+ "line": 204
10030
+ },
10031
+ "name": "metricResponseBytes",
10032
+ "parameters": [
10033
+ {
10034
+ "name": "props",
10035
+ "optional": true,
10036
+ "type": {
10037
+ "fqn": "aws-cdk-lib.aws_cloudwatch.MetricOptions"
10038
+ }
10039
+ }
10040
+ ],
10041
+ "returns": {
10042
+ "type": {
10043
+ "fqn": "aws-cdk-lib.aws_cloudwatch.Metric"
10044
+ }
10045
+ }
10046
+ }
10047
+ ],
9856
10048
  "name": "IWebFunction",
9857
10049
  "properties": [
9858
10050
  {
@@ -9867,7 +10059,7 @@
9867
10059
  "immutable": true,
9868
10060
  "locationInModule": {
9869
10061
  "filename": "src/web-function.ts",
9870
- "line": 168
10062
+ "line": 173
9871
10063
  },
9872
10064
  "name": "webFunctionArn",
9873
10065
  "type": {
@@ -9886,7 +10078,7 @@
9886
10078
  "immutable": true,
9887
10079
  "locationInModule": {
9888
10080
  "filename": "src/web-function.ts",
9889
- "line": 161
10081
+ "line": 166
9890
10082
  },
9891
10083
  "name": "webFunctionName",
9892
10084
  "type": {
@@ -10447,12 +10639,12 @@
10447
10639
  },
10448
10640
  "@ashishpandeyone/cdk-lambda-web-function.WebFunction": {
10449
10641
  "assembly": "@ashishpandeyone/cdk-lambda-web-function",
10450
- "base": "aws-cdk-lib.Resource",
10642
+ "base": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase",
10451
10643
  "docs": {
10452
10644
  "custom": {
10453
10645
  "resource": "AWS::Lambda::WebFunction"
10454
10646
  },
10455
- "remarks": "Creates the function, its current revision (code and configuration; any change creates a new one,\nand the newest `revisionRetention` are kept), a default HTTPS endpoint, an execution role, and owns\nthe function's log groups in every region its endpoints serve from.\n\nImporting existing functions (`fromXxx` methods) is planned after 0.1.",
10647
+ "remarks": "Creates the function, its current revision (code and configuration; any change creates a new one,\nand the newest `revisionRetention` are kept), a default HTTPS endpoint, an execution role, and owns\nthe function's log groups in every region its endpoints serve from.\n\nUse `fromWebFunctionArn`, `fromWebFunctionName` or `fromWebFunctionAttributes` for a function defined elsewhere.",
10456
10648
  "stability": "experimental",
10457
10649
  "summary": "A Node.js HTTP server running as an AWS Lambda Web Function, served from one or more regions."
10458
10650
  },
@@ -10463,7 +10655,7 @@
10463
10655
  },
10464
10656
  "locationInModule": {
10465
10657
  "filename": "src/web-function.ts",
10466
- "line": 223
10658
+ "line": 420
10467
10659
  },
10468
10660
  "parameters": [
10469
10661
  {
@@ -10487,68 +10679,113 @@
10487
10679
  ]
10488
10680
  },
10489
10681
  "interfaces": [
10490
- "@ashishpandeyone/cdk-lambda-web-function.IWebFunction",
10491
10682
  "aws-cdk-lib.aws_iam.IGrantable"
10492
10683
  ],
10493
10684
  "kind": "class",
10494
10685
  "locationInModule": {
10495
10686
  "filename": "src/web-function.ts",
10496
- "line": 182
10687
+ "line": 361
10497
10688
  },
10498
10689
  "methods": [
10499
10690
  {
10500
10691
  "docs": {
10501
10692
  "stability": "experimental",
10502
- "summary": "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."
10693
+ "summary": "Imports an existing Web Function by its ARN (in any region or account)."
10503
10694
  },
10504
10695
  "locationInModule": {
10505
10696
  "filename": "src/web-function.ts",
10506
- "line": 325
10697
+ "line": 365
10507
10698
  },
10508
- "name": "addEndpoint",
10699
+ "name": "fromWebFunctionArn",
10509
10700
  "parameters": [
10510
10701
  {
10511
- "docs": {
10512
- "summary": "the endpoint's construct ID, also used in its generated name (`<id>-<hash>`)."
10513
- },
10702
+ "name": "scope",
10703
+ "type": {
10704
+ "fqn": "constructs.Construct"
10705
+ }
10706
+ },
10707
+ {
10514
10708
  "name": "id",
10515
10709
  "type": {
10516
10710
  "primitive": "string"
10517
10711
  }
10518
10712
  },
10519
10713
  {
10520
- "name": "options",
10714
+ "name": "webFunctionArn",
10521
10715
  "type": {
10522
- "fqn": "@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions"
10716
+ "primitive": "string"
10523
10717
  }
10524
10718
  }
10525
10719
  ],
10526
10720
  "returns": {
10527
10721
  "type": {
10528
- "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint"
10722
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.IWebFunction"
10529
10723
  }
10530
- }
10724
+ },
10725
+ "static": true
10531
10726
  },
10532
10727
  {
10533
10728
  "docs": {
10534
- "remarks": "Names starting with `AWS_` are reserved.",
10535
10729
  "stability": "experimental",
10536
- "summary": "Adds an environment variable."
10730
+ "summary": "Imports an existing Web Function: give its ARN or its name, and optionally the endpoint `grantInvoke` allows."
10537
10731
  },
10538
10732
  "locationInModule": {
10539
10733
  "filename": "src/web-function.ts",
10540
- "line": 333
10734
+ "line": 379
10541
10735
  },
10542
- "name": "addEnvironment",
10736
+ "name": "fromWebFunctionAttributes",
10543
10737
  "parameters": [
10544
10738
  {
10545
- "name": "key",
10739
+ "name": "scope",
10740
+ "type": {
10741
+ "fqn": "constructs.Construct"
10742
+ }
10743
+ },
10744
+ {
10745
+ "name": "id",
10546
10746
  "type": {
10547
10747
  "primitive": "string"
10548
10748
  }
10549
10749
  },
10550
10750
  {
10551
- "name": "value",
10751
+ "name": "attrs",
10752
+ "type": {
10753
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionAttributes"
10754
+ }
10755
+ }
10756
+ ],
10757
+ "returns": {
10758
+ "type": {
10759
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.IWebFunction"
10760
+ }
10761
+ },
10762
+ "static": true
10763
+ },
10764
+ {
10765
+ "docs": {
10766
+ "stability": "experimental",
10767
+ "summary": "Imports an existing Web Function in this stack's account and region by its name."
10768
+ },
10769
+ "locationInModule": {
10770
+ "filename": "src/web-function.ts",
10771
+ "line": 372
10772
+ },
10773
+ "name": "fromWebFunctionName",
10774
+ "parameters": [
10775
+ {
10776
+ "name": "scope",
10777
+ "type": {
10778
+ "fqn": "constructs.Construct"
10779
+ }
10780
+ },
10781
+ {
10782
+ "name": "id",
10783
+ "type": {
10784
+ "primitive": "string"
10785
+ }
10786
+ },
10787
+ {
10788
+ "name": "webFunctionName",
10552
10789
  "type": {
10553
10790
  "primitive": "string"
10554
10791
  }
@@ -10556,20 +10793,487 @@
10556
10793
  ],
10557
10794
  "returns": {
10558
10795
  "type": {
10559
- "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunction"
10796
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.IWebFunction"
10560
10797
  }
10561
- }
10798
+ },
10799
+ "static": true
10562
10800
  },
10563
10801
  {
10564
10802
  "docs": {
10565
10803
  "stability": "experimental",
10566
- "summary": "Adds a statement to the execution role's policy."
10804
+ "summary": "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."
10805
+ },
10806
+ "locationInModule": {
10807
+ "filename": "src/web-function.ts",
10808
+ "line": 522
10809
+ },
10810
+ "name": "addEndpoint",
10811
+ "parameters": [
10812
+ {
10813
+ "docs": {
10814
+ "summary": "the endpoint's construct ID, also used in its generated name (`<id>-<hash>`)."
10815
+ },
10816
+ "name": "id",
10817
+ "type": {
10818
+ "primitive": "string"
10819
+ }
10820
+ },
10821
+ {
10822
+ "name": "options",
10823
+ "type": {
10824
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions"
10825
+ }
10826
+ }
10827
+ ],
10828
+ "returns": {
10829
+ "type": {
10830
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint"
10831
+ }
10832
+ }
10833
+ },
10834
+ {
10835
+ "docs": {
10836
+ "remarks": "Names starting with `AWS_` are reserved.",
10837
+ "stability": "experimental",
10838
+ "summary": "Adds an environment variable."
10839
+ },
10840
+ "locationInModule": {
10841
+ "filename": "src/web-function.ts",
10842
+ "line": 530
10843
+ },
10844
+ "name": "addEnvironment",
10845
+ "parameters": [
10846
+ {
10847
+ "name": "key",
10848
+ "type": {
10849
+ "primitive": "string"
10850
+ }
10851
+ },
10852
+ {
10853
+ "name": "value",
10854
+ "type": {
10855
+ "primitive": "string"
10856
+ }
10857
+ }
10858
+ ],
10859
+ "returns": {
10860
+ "type": {
10861
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunction"
10862
+ }
10863
+ }
10864
+ },
10865
+ {
10866
+ "docs": {
10867
+ "remarks": "For a role in this account, use `grantInvoke`.",
10868
+ "stability": "experimental",
10869
+ "summary": "Allows a principal in another account, an AWS service or an organization to call the function's endpoints, through the function's resource policy."
10870
+ },
10871
+ "locationInModule": {
10872
+ "filename": "src/web-function.ts",
10873
+ "line": 559
10874
+ },
10875
+ "name": "addPermission",
10876
+ "parameters": [
10877
+ {
10878
+ "docs": {
10879
+ "summary": "the statement ID (`Sid`): letters and digits, unique within the function."
10880
+ },
10881
+ "name": "id",
10882
+ "type": {
10883
+ "primitive": "string"
10884
+ }
10885
+ },
10886
+ {
10887
+ "name": "permission",
10888
+ "type": {
10889
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionPermission"
10890
+ }
10891
+ }
10892
+ ]
10893
+ },
10894
+ {
10895
+ "docs": {
10896
+ "remarks": "The function has one resource policy (`AWS::Lambda::ResourcePolicy`), created on the first statement. This stack\nis its only writer: another stack or template can't also attach one, and changes made outside CloudFormation\nare overwritten by the next update of the policy.",
10897
+ "stability": "experimental",
10898
+ "summary": "Adds a statement to the function's resource policy, e.g. to let another account manage the function. For invoking, prefer `addPermission` or `grantInvoke`."
10899
+ },
10900
+ "locationInModule": {
10901
+ "filename": "src/web-function.ts",
10902
+ "line": 590
10903
+ },
10904
+ "name": "addToResourcePolicy",
10905
+ "overrides": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase",
10906
+ "parameters": [
10907
+ {
10908
+ "name": "statement",
10909
+ "type": {
10910
+ "fqn": "aws-cdk-lib.aws_iam.PolicyStatement"
10911
+ }
10912
+ }
10913
+ ],
10914
+ "returns": {
10915
+ "type": {
10916
+ "fqn": "aws-cdk-lib.aws_iam.AddToResourcePolicyResult"
10917
+ }
10918
+ }
10919
+ },
10920
+ {
10921
+ "docs": {
10922
+ "stability": "experimental",
10923
+ "summary": "Adds a statement to the execution role's policy."
10924
+ },
10925
+ "locationInModule": {
10926
+ "filename": "src/web-function.ts",
10927
+ "line": 541
10928
+ },
10929
+ "name": "addToRolePolicy",
10930
+ "parameters": [
10931
+ {
10932
+ "name": "statement",
10933
+ "type": {
10934
+ "fqn": "aws-cdk-lib.aws_iam.PolicyStatement"
10935
+ }
10936
+ }
10937
+ ]
10938
+ },
10939
+ {
10940
+ "docs": {
10941
+ "remarks": "Shortcut for `grants.invoke(grantee)`, as on `lambda.Function`.\n[disable-awslint:no-grants]",
10942
+ "stability": "experimental",
10943
+ "summary": "Allows `grantee` to call the endpoint."
10944
+ },
10945
+ "locationInModule": {
10946
+ "filename": "src/web-function.ts",
10947
+ "line": 549
10948
+ },
10949
+ "name": "grantInvoke",
10950
+ "overrides": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase",
10951
+ "parameters": [
10952
+ {
10953
+ "name": "grantee",
10954
+ "type": {
10955
+ "fqn": "aws-cdk-lib.aws_iam.IGrantable"
10956
+ }
10957
+ }
10958
+ ],
10959
+ "returns": {
10960
+ "type": {
10961
+ "fqn": "aws-cdk-lib.aws_iam.Grant"
10962
+ }
10963
+ }
10964
+ }
10965
+ ],
10966
+ "name": "WebFunction",
10967
+ "properties": [
10968
+ {
10969
+ "docs": {
10970
+ "stability": "experimental",
10971
+ "summary": "The revision built from the current code and configuration."
10972
+ },
10973
+ "immutable": true,
10974
+ "locationInModule": {
10975
+ "filename": "src/web-function.ts",
10976
+ "line": 390
10977
+ },
10978
+ "name": "currentRevision",
10979
+ "type": {
10980
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision"
10981
+ }
10982
+ },
10983
+ {
10984
+ "docs": {
10985
+ "remarks": "Add more with `addEndpoint`.",
10986
+ "stability": "experimental",
10987
+ "summary": "The default endpoint."
10988
+ },
10989
+ "immutable": true,
10990
+ "locationInModule": {
10991
+ "filename": "src/web-function.ts",
10992
+ "line": 393
10993
+ },
10994
+ "name": "endpoint",
10995
+ "type": {
10996
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint"
10997
+ }
10998
+ },
10999
+ {
11000
+ "docs": {
11001
+ "stability": "experimental",
11002
+ "summary": "The principal to grant permissions to (the execution role)."
11003
+ },
11004
+ "immutable": true,
11005
+ "locationInModule": {
11006
+ "filename": "src/web-function.ts",
11007
+ "line": 402
11008
+ },
11009
+ "name": "grantPrincipal",
11010
+ "overrides": "aws-cdk-lib.aws_iam.IGrantable",
11011
+ "type": {
11012
+ "fqn": "aws-cdk-lib.aws_iam.IPrincipal"
11013
+ }
11014
+ },
11015
+ {
11016
+ "docs": {
11017
+ "stability": "experimental",
11018
+ "summary": "Grants on the default endpoint (e.g. `grants.invoke(principal)`). Other endpoints have their own `grants`."
11019
+ },
11020
+ "immutable": true,
11021
+ "locationInModule": {
11022
+ "filename": "src/web-function.ts",
11023
+ "line": 396
11024
+ },
11025
+ "name": "grants",
11026
+ "type": {
11027
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionGrants"
11028
+ }
11029
+ },
11030
+ {
11031
+ "docs": {
11032
+ "remarks": "Subscribe to this one only: each region's `.local` group holds a copy of the same events.",
11033
+ "stability": "experimental",
11034
+ "summary": "The home-region log group that receives the logs of every region the function serves from."
11035
+ },
11036
+ "immutable": true,
11037
+ "locationInModule": {
11038
+ "filename": "src/web-function.ts",
11039
+ "line": 408
11040
+ },
11041
+ "name": "logGroup",
11042
+ "type": {
11043
+ "fqn": "aws-cdk-lib.aws_logs.ILogGroup"
11044
+ }
11045
+ },
11046
+ {
11047
+ "docs": {
11048
+ "remarks": "Same as `currentRevision.revisionId`.",
11049
+ "stability": "experimental",
11050
+ "summary": "The ID of the current revision."
11051
+ },
11052
+ "immutable": true,
11053
+ "locationInModule": {
11054
+ "filename": "src/web-function.ts",
11055
+ "line": 387
11056
+ },
11057
+ "name": "revisionId",
11058
+ "type": {
11059
+ "primitive": "string"
11060
+ }
11061
+ },
11062
+ {
11063
+ "docs": {
11064
+ "stability": "experimental",
11065
+ "summary": "The execution role."
11066
+ },
11067
+ "immutable": true,
11068
+ "locationInModule": {
11069
+ "filename": "src/web-function.ts",
11070
+ "line": 399
11071
+ },
11072
+ "name": "role",
11073
+ "type": {
11074
+ "fqn": "aws-cdk-lib.aws_iam.IRole"
11075
+ }
11076
+ },
11077
+ {
11078
+ "docs": {
11079
+ "stability": "experimental",
11080
+ "summary": "The function's ARN."
11081
+ },
11082
+ "immutable": true,
11083
+ "locationInModule": {
11084
+ "filename": "src/web-function.ts",
11085
+ "line": 384
11086
+ },
11087
+ "name": "webFunctionArn",
11088
+ "overrides": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase",
11089
+ "type": {
11090
+ "primitive": "string"
11091
+ }
11092
+ },
11093
+ {
11094
+ "docs": {
11095
+ "stability": "experimental",
11096
+ "summary": "The function's name."
11097
+ },
11098
+ "immutable": true,
11099
+ "locationInModule": {
11100
+ "filename": "src/web-function.ts",
11101
+ "line": 383
11102
+ },
11103
+ "name": "webFunctionName",
11104
+ "overrides": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase",
11105
+ "type": {
11106
+ "primitive": "string"
11107
+ }
11108
+ }
11109
+ ],
11110
+ "symbolId": "src/web-function:WebFunction"
11111
+ },
11112
+ "@ashishpandeyone/cdk-lambda-web-function.WebFunctionAttributes": {
11113
+ "assembly": "@ashishpandeyone/cdk-lambda-web-function",
11114
+ "datatype": true,
11115
+ "docs": {
11116
+ "remarks": "Give its ARN or its name.",
11117
+ "stability": "experimental",
11118
+ "summary": "Attributes of an existing Web Function."
11119
+ },
11120
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionAttributes",
11121
+ "kind": "interface",
11122
+ "locationInModule": {
11123
+ "filename": "src/web-function.ts",
11124
+ "line": 210
11125
+ },
11126
+ "name": "WebFunctionAttributes",
11127
+ "properties": [
11128
+ {
11129
+ "abstract": true,
11130
+ "docs": {
11131
+ "default": "- every endpoint of the function",
11132
+ "stability": "experimental",
11133
+ "summary": "The endpoint `grantInvoke` allows calling."
11134
+ },
11135
+ "immutable": true,
11136
+ "locationInModule": {
11137
+ "filename": "src/web-function.ts",
11138
+ "line": 231
11139
+ },
11140
+ "name": "endpointName",
11141
+ "optional": true,
11142
+ "type": {
11143
+ "primitive": "string"
11144
+ }
11145
+ },
11146
+ {
11147
+ "abstract": true,
11148
+ "docs": {
11149
+ "default": "- built from `webFunctionName`, in this stack's account and region",
11150
+ "stability": "experimental",
11151
+ "summary": "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."
11152
+ },
11153
+ "immutable": true,
11154
+ "locationInModule": {
11155
+ "filename": "src/web-function.ts",
11156
+ "line": 217
11157
+ },
11158
+ "name": "webFunctionArn",
11159
+ "optional": true,
11160
+ "type": {
11161
+ "primitive": "string"
11162
+ }
11163
+ },
11164
+ {
11165
+ "abstract": true,
11166
+ "docs": {
11167
+ "default": "- taken from `webFunctionArn`",
11168
+ "stability": "experimental",
11169
+ "summary": "The function's name."
11170
+ },
11171
+ "immutable": true,
11172
+ "locationInModule": {
11173
+ "filename": "src/web-function.ts",
11174
+ "line": 224
11175
+ },
11176
+ "name": "webFunctionName",
11177
+ "optional": true,
11178
+ "type": {
11179
+ "primitive": "string"
11180
+ }
11181
+ }
11182
+ ],
11183
+ "symbolId": "src/web-function:WebFunctionAttributes"
11184
+ },
11185
+ "@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType": {
11186
+ "assembly": "@ashishpandeyone/cdk-lambda-web-function",
11187
+ "docs": {
11188
+ "stability": "experimental",
11189
+ "summary": "How callers of a Web Function endpoint are authenticated."
11190
+ },
11191
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType",
11192
+ "kind": "enum",
11193
+ "locationInModule": {
11194
+ "filename": "src/enums.ts",
11195
+ "line": 4
11196
+ },
11197
+ "members": [
11198
+ {
11199
+ "docs": {
11200
+ "stability": "experimental",
11201
+ "summary": "Requests must be signed with SigV4 or SigV4a (signing name `lambda`) by a principal allowed `lambda:InvokeWebFunctionEndpoint` on the endpoint."
11202
+ },
11203
+ "name": "AWS_IAM"
11204
+ },
11205
+ {
11206
+ "docs": {
11207
+ "remarks": "The `Authorization` header reaches your application untouched.",
11208
+ "stability": "experimental",
11209
+ "summary": "No authentication by Lambda: the endpoint is public and your application authenticates requests itself."
11210
+ },
11211
+ "name": "NONE"
11212
+ }
11213
+ ],
11214
+ "name": "WebFunctionAuthType",
11215
+ "symbolId": "src/enums:WebFunctionAuthType"
11216
+ },
11217
+ "@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase": {
11218
+ "abstract": true,
11219
+ "assembly": "@ashishpandeyone/cdk-lambda-web-function",
11220
+ "base": "aws-cdk-lib.Resource",
11221
+ "docs": {
11222
+ "stability": "experimental",
11223
+ "summary": "What `WebFunction` and imported functions have in common."
11224
+ },
11225
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase",
11226
+ "initializer": {
11227
+ "docs": {
11228
+ "stability": "stable"
11229
+ },
11230
+ "locationInModule": {
11231
+ "filename": "core/lib/resource.ts",
11232
+ "line": 125
11233
+ },
11234
+ "parameters": [
11235
+ {
11236
+ "name": "scope",
11237
+ "type": {
11238
+ "fqn": "constructs.Construct"
11239
+ }
11240
+ },
11241
+ {
11242
+ "name": "id",
11243
+ "type": {
11244
+ "primitive": "string"
11245
+ }
11246
+ },
11247
+ {
11248
+ "name": "props",
11249
+ "optional": true,
11250
+ "type": {
11251
+ "fqn": "aws-cdk-lib.ResourceProps"
11252
+ }
11253
+ }
11254
+ ]
11255
+ },
11256
+ "interfaces": [
11257
+ "@ashishpandeyone/cdk-lambda-web-function.IWebFunction"
11258
+ ],
11259
+ "kind": "class",
11260
+ "locationInModule": {
11261
+ "filename": "src/web-function.ts",
11262
+ "line": 272
11263
+ },
11264
+ "methods": [
11265
+ {
11266
+ "abstract": true,
11267
+ "docs": {
11268
+ "stability": "experimental",
11269
+ "summary": "Adds a statement to the function's resource policy (not added for an imported function)."
10567
11270
  },
10568
11271
  "locationInModule": {
10569
11272
  "filename": "src/web-function.ts",
10570
- "line": 344
11273
+ "line": 290
10571
11274
  },
10572
- "name": "addToRolePolicy",
11275
+ "name": "addToResourcePolicy",
11276
+ "overrides": "aws-cdk-lib.aws_iam.IResourceWithPolicyV2",
10573
11277
  "parameters": [
10574
11278
  {
10575
11279
  "name": "statement",
@@ -10577,19 +11281,26 @@
10577
11281
  "fqn": "aws-cdk-lib.aws_iam.PolicyStatement"
10578
11282
  }
10579
11283
  }
10580
- ]
11284
+ ],
11285
+ "returns": {
11286
+ "type": {
11287
+ "fqn": "aws-cdk-lib.aws_iam.AddToResourcePolicyResult"
11288
+ }
11289
+ }
10581
11290
  },
10582
11291
  {
11292
+ "abstract": true,
10583
11293
  "docs": {
10584
- "remarks": "Shortcut for `grants.invoke(grantee)`, as on `lambda.Function`.\n[disable-awslint:no-grants]",
11294
+ "remarks": "[disable-awslint:no-grants]",
10585
11295
  "stability": "experimental",
10586
- "summary": "Allows `grantee` to call the endpoint."
11296
+ "summary": "Allows `grantee` to call the function's endpoint."
10587
11297
  },
10588
11298
  "locationInModule": {
10589
11299
  "filename": "src/web-function.ts",
10590
- "line": 352
11300
+ "line": 285
10591
11301
  },
10592
11302
  "name": "grantInvoke",
11303
+ "overrides": "@ashishpandeyone/cdk-lambda-web-function.IWebFunction",
10593
11304
  "parameters": [
10594
11305
  {
10595
11306
  "name": "grantee",
@@ -10606,16 +11317,17 @@
10606
11317
  },
10607
11318
  {
10608
11319
  "docs": {
10609
- "default": "- sum over 1 minute, in the home region",
11320
+ "default": "- sum over 1 minute, in the function's home region",
10610
11321
  "remarks": "For request and error counts, use the endpoint's metrics (`fn.endpoint.metricRequests()`).\n\nMetrics are published in the region that served the request: pass `region` for another serving region.\nAn alarm can only use metrics from its own stack's region.",
10611
11322
  "stability": "experimental",
10612
11323
  "summary": "A metric of this function's execution environments in `AWS/Lambda/Web` (dimension `FunctionName`), across all endpoints."
10613
11324
  },
10614
11325
  "locationInModule": {
10615
11326
  "filename": "src/web-function.ts",
10616
- "line": 365
11327
+ "line": 301
10617
11328
  },
10618
11329
  "name": "metric",
11330
+ "overrides": "@ashishpandeyone/cdk-lambda-web-function.IWebFunction",
10619
11331
  "parameters": [
10620
11332
  {
10621
11333
  "name": "metricName",
@@ -10644,9 +11356,10 @@
10644
11356
  },
10645
11357
  "locationInModule": {
10646
11358
  "filename": "src/web-function.ts",
10647
- "line": 377
11359
+ "line": 316
10648
11360
  },
10649
11361
  "name": "metricActiveTime",
11362
+ "overrides": "@ashishpandeyone/cdk-lambda-web-function.IWebFunction",
10650
11363
  "parameters": [
10651
11364
  {
10652
11365
  "name": "props",
@@ -10670,9 +11383,10 @@
10670
11383
  },
10671
11384
  "locationInModule": {
10672
11385
  "filename": "src/web-function.ts",
10673
- "line": 392
11386
+ "line": 331
10674
11387
  },
10675
11388
  "name": "metricConcurrentRequests",
11389
+ "overrides": "@ashishpandeyone/cdk-lambda-web-function.IWebFunction",
10676
11390
  "parameters": [
10677
11391
  {
10678
11392
  "name": "props",
@@ -10695,9 +11409,10 @@
10695
11409
  },
10696
11410
  "locationInModule": {
10697
11411
  "filename": "src/web-function.ts",
10698
- "line": 382
11412
+ "line": 321
10699
11413
  },
10700
11414
  "name": "metricCpuTime",
11415
+ "overrides": "@ashishpandeyone/cdk-lambda-web-function.IWebFunction",
10701
11416
  "parameters": [
10702
11417
  {
10703
11418
  "name": "props",
@@ -10722,9 +11437,10 @@
10722
11437
  },
10723
11438
  "locationInModule": {
10724
11439
  "filename": "src/web-function.ts",
10725
- "line": 401
11440
+ "line": 340
10726
11441
  },
10727
11442
  "name": "metricMaxMemoryUsage",
11443
+ "overrides": "@ashishpandeyone/cdk-lambda-web-function.IWebFunction",
10728
11444
  "parameters": [
10729
11445
  {
10730
11446
  "name": "props",
@@ -10747,9 +11463,10 @@
10747
11463
  },
10748
11464
  "locationInModule": {
10749
11465
  "filename": "src/web-function.ts",
10750
- "line": 406
11466
+ "line": 345
10751
11467
  },
10752
11468
  "name": "metricResponseBytes",
11469
+ "overrides": "@ashishpandeyone/cdk-lambda-web-function.IWebFunction",
10753
11470
  "parameters": [
10754
11471
  {
10755
11472
  "name": "props",
@@ -10766,118 +11483,10 @@
10766
11483
  }
10767
11484
  }
10768
11485
  ],
10769
- "name": "WebFunction",
11486
+ "name": "WebFunctionBase",
10770
11487
  "properties": [
10771
11488
  {
10772
- "docs": {
10773
- "stability": "experimental",
10774
- "summary": "The revision built from the current code and configuration."
10775
- },
10776
- "immutable": true,
10777
- "locationInModule": {
10778
- "filename": "src/web-function.ts",
10779
- "line": 190
10780
- },
10781
- "name": "currentRevision",
10782
- "type": {
10783
- "fqn": "@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision"
10784
- }
10785
- },
10786
- {
10787
- "docs": {
10788
- "remarks": "Add more with `addEndpoint`.",
10789
- "stability": "experimental",
10790
- "summary": "The default endpoint."
10791
- },
10792
- "immutable": true,
10793
- "locationInModule": {
10794
- "filename": "src/web-function.ts",
10795
- "line": 193
10796
- },
10797
- "name": "endpoint",
10798
- "type": {
10799
- "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint"
10800
- }
10801
- },
10802
- {
10803
- "docs": {
10804
- "stability": "experimental",
10805
- "summary": "The principal to grant permissions to (the execution role)."
10806
- },
10807
- "immutable": true,
10808
- "locationInModule": {
10809
- "filename": "src/web-function.ts",
10810
- "line": 202
10811
- },
10812
- "name": "grantPrincipal",
10813
- "overrides": "aws-cdk-lib.aws_iam.IGrantable",
10814
- "type": {
10815
- "fqn": "aws-cdk-lib.aws_iam.IPrincipal"
10816
- }
10817
- },
10818
- {
10819
- "docs": {
10820
- "stability": "experimental",
10821
- "summary": "Grants on the default endpoint (e.g. `grants.invoke(principal)`). Other endpoints have their own `grants`."
10822
- },
10823
- "immutable": true,
10824
- "locationInModule": {
10825
- "filename": "src/web-function.ts",
10826
- "line": 196
10827
- },
10828
- "name": "grants",
10829
- "type": {
10830
- "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionGrants"
10831
- }
10832
- },
10833
- {
10834
- "docs": {
10835
- "remarks": "Subscribe to this one only: each region's `.local` group holds a copy of the same events.",
10836
- "stability": "experimental",
10837
- "summary": "The home-region log group that receives the logs of every region the function serves from."
10838
- },
10839
- "immutable": true,
10840
- "locationInModule": {
10841
- "filename": "src/web-function.ts",
10842
- "line": 208
10843
- },
10844
- "name": "logGroup",
10845
- "type": {
10846
- "fqn": "aws-cdk-lib.aws_logs.ILogGroup"
10847
- }
10848
- },
10849
- {
10850
- "docs": {
10851
- "remarks": "Same as `currentRevision.revisionId`.",
10852
- "stability": "experimental",
10853
- "summary": "The ID of the current revision."
10854
- },
10855
- "immutable": true,
10856
- "locationInModule": {
10857
- "filename": "src/web-function.ts",
10858
- "line": 187
10859
- },
10860
- "name": "revisionId",
10861
- "type": {
10862
- "primitive": "string"
10863
- }
10864
- },
10865
- {
10866
- "docs": {
10867
- "stability": "experimental",
10868
- "summary": "The execution role."
10869
- },
10870
- "immutable": true,
10871
- "locationInModule": {
10872
- "filename": "src/web-function.ts",
10873
- "line": 199
10874
- },
10875
- "name": "role",
10876
- "type": {
10877
- "fqn": "aws-cdk-lib.aws_iam.IRole"
10878
- }
10879
- },
10880
- {
11489
+ "abstract": true,
10881
11490
  "docs": {
10882
11491
  "stability": "experimental",
10883
11492
  "summary": "The function's ARN."
@@ -10885,7 +11494,7 @@
10885
11494
  "immutable": true,
10886
11495
  "locationInModule": {
10887
11496
  "filename": "src/web-function.ts",
10888
- "line": 184
11497
+ "line": 274
10889
11498
  },
10890
11499
  "name": "webFunctionArn",
10891
11500
  "overrides": "@ashishpandeyone/cdk-lambda-web-function.IWebFunction",
@@ -10894,6 +11503,7 @@
10894
11503
  }
10895
11504
  },
10896
11505
  {
11506
+ "abstract": true,
10897
11507
  "docs": {
10898
11508
  "stability": "experimental",
10899
11509
  "summary": "The function's name."
@@ -10901,7 +11511,7 @@
10901
11511
  "immutable": true,
10902
11512
  "locationInModule": {
10903
11513
  "filename": "src/web-function.ts",
10904
- "line": 183
11514
+ "line": 273
10905
11515
  },
10906
11516
  "name": "webFunctionName",
10907
11517
  "overrides": "@ashishpandeyone/cdk-lambda-web-function.IWebFunction",
@@ -10917,7 +11527,7 @@
10917
11527
  "immutable": true,
10918
11528
  "locationInModule": {
10919
11529
  "filename": "src/web-function.ts",
10920
- "line": 219
11530
+ "line": 277
10921
11531
  },
10922
11532
  "name": "webFunctionRef",
10923
11533
  "overrides": "aws-cdk-lib.interfaces.aws_lambda.IWebFunctionRef",
@@ -10926,39 +11536,7 @@
10926
11536
  }
10927
11537
  }
10928
11538
  ],
10929
- "symbolId": "src/web-function:WebFunction"
10930
- },
10931
- "@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType": {
10932
- "assembly": "@ashishpandeyone/cdk-lambda-web-function",
10933
- "docs": {
10934
- "stability": "experimental",
10935
- "summary": "How callers of a Web Function endpoint are authenticated."
10936
- },
10937
- "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType",
10938
- "kind": "enum",
10939
- "locationInModule": {
10940
- "filename": "src/enums.ts",
10941
- "line": 4
10942
- },
10943
- "members": [
10944
- {
10945
- "docs": {
10946
- "stability": "experimental",
10947
- "summary": "Requests must be signed with SigV4 or SigV4a (signing name `lambda`) by a principal allowed `lambda:InvokeWebFunctionEndpoint` on the endpoint."
10948
- },
10949
- "name": "AWS_IAM"
10950
- },
10951
- {
10952
- "docs": {
10953
- "remarks": "The `Authorization` header reaches your application untouched.",
10954
- "stability": "experimental",
10955
- "summary": "No authentication by Lambda: the endpoint is public and your application authenticates requests itself."
10956
- },
10957
- "name": "NONE"
10958
- }
10959
- ],
10960
- "name": "WebFunctionAuthType",
10961
- "symbolId": "src/enums:WebFunctionAuthType"
11539
+ "symbolId": "src/web-function:WebFunctionBase"
10962
11540
  },
10963
11541
  "@ashishpandeyone/cdk-lambda-web-function.WebFunctionCanaryDeploymentOptions": {
10964
11542
  "assembly": "@ashishpandeyone/cdk-lambda-web-function",
@@ -11832,18 +12410,18 @@
11832
12410
  "kind": "class",
11833
12411
  "locationInModule": {
11834
12412
  "filename": "src/web-function-grants.ts",
11835
- "line": 7
12413
+ "line": 8
11836
12414
  },
11837
12415
  "methods": [
11838
12416
  {
11839
12417
  "docs": {
11840
- "remarks": "The grant is on the endpoint's home-region ARN, which IAM evaluates for every region the\nendpoint serves from, including a MULTI_REGION global URL.",
12418
+ "remarks": "The grant is on the endpoint's home-region ARN, which IAM evaluates for every region the\nendpoint serves from, including a MULTI_REGION global URL.\n\nA grantee in the function's account gets an IAM policy statement. Another account or an AWS service also gets\na statement in the function's resource policy (not for an imported function's endpoints).",
11841
12419
  "stability": "experimental",
11842
12420
  "summary": "Allows `grantee` to call the endpoint (`lambda:InvokeWebFunctionEndpoint`)."
11843
12421
  },
11844
12422
  "locationInModule": {
11845
12423
  "filename": "src/web-function-grants.ts",
11846
- "line": 23
12424
+ "line": 36
11847
12425
  },
11848
12426
  "name": "invoke",
11849
12427
  "parameters": [
@@ -11968,7 +12546,7 @@
11968
12546
  "kind": "interface",
11969
12547
  "locationInModule": {
11970
12548
  "filename": "src/web-function.ts",
11971
- "line": 23
12549
+ "line": 24
11972
12550
  },
11973
12551
  "name": "WebFunctionOptions",
11974
12552
  "properties": [
@@ -11981,7 +12559,7 @@
11981
12559
  "immutable": true,
11982
12560
  "locationInModule": {
11983
12561
  "filename": "src/web-function.ts",
11984
- "line": 27
12562
+ "line": 28
11985
12563
  },
11986
12564
  "name": "authType",
11987
12565
  "type": {
@@ -11998,7 +12576,7 @@
11998
12576
  "immutable": true,
11999
12577
  "locationInModule": {
12000
12578
  "filename": "src/web-function.ts",
12001
- "line": 116
12579
+ "line": 117
12002
12580
  },
12003
12581
  "name": "applicationLogLevelV2",
12004
12582
  "optional": true,
@@ -12016,7 +12594,7 @@
12016
12594
  "immutable": true,
12017
12595
  "locationInModule": {
12018
12596
  "filename": "src/web-function.ts",
12019
- "line": 62
12597
+ "line": 63
12020
12598
  },
12021
12599
  "name": "description",
12022
12600
  "optional": true,
@@ -12034,7 +12612,7 @@
12034
12612
  "immutable": true,
12035
12613
  "locationInModule": {
12036
12614
  "filename": "src/web-function.ts",
12037
- "line": 36
12615
+ "line": 37
12038
12616
  },
12039
12617
  "name": "endpoint",
12040
12618
  "optional": true,
@@ -12053,7 +12631,7 @@
12053
12631
  "immutable": true,
12054
12632
  "locationInModule": {
12055
12633
  "filename": "src/web-function.ts",
12056
- "line": 79
12634
+ "line": 80
12057
12635
  },
12058
12636
  "name": "environment",
12059
12637
  "optional": true,
@@ -12077,7 +12655,7 @@
12077
12655
  "immutable": true,
12078
12656
  "locationInModule": {
12079
12657
  "filename": "src/web-function.ts",
12080
- "line": 109
12658
+ "line": 110
12081
12659
  },
12082
12660
  "name": "logRemovalPolicy",
12083
12661
  "optional": true,
@@ -12095,7 +12673,7 @@
12095
12673
  "immutable": true,
12096
12674
  "locationInModule": {
12097
12675
  "filename": "src/web-function.ts",
12098
- "line": 101
12676
+ "line": 102
12099
12677
  },
12100
12678
  "name": "logRetention",
12101
12679
  "optional": true,
@@ -12114,7 +12692,7 @@
12114
12692
  "immutable": true,
12115
12693
  "locationInModule": {
12116
12694
  "filename": "src/web-function.ts",
12117
- "line": 94
12695
+ "line": 95
12118
12696
  },
12119
12697
  "name": "maxConcurrencyPerEnvironment",
12120
12698
  "optional": true,
@@ -12133,7 +12711,7 @@
12133
12711
  "immutable": true,
12134
12712
  "locationInModule": {
12135
12713
  "filename": "src/web-function.ts",
12136
- "line": 48
12714
+ "line": 49
12137
12715
  },
12138
12716
  "name": "revisionRetention",
12139
12717
  "optional": true,
@@ -12152,7 +12730,7 @@
12152
12730
  "immutable": true,
12153
12731
  "locationInModule": {
12154
12732
  "filename": "src/web-function.ts",
12155
- "line": 72
12733
+ "line": 73
12156
12734
  },
12157
12735
  "name": "role",
12158
12736
  "optional": true,
@@ -12170,7 +12748,7 @@
12170
12748
  "immutable": true,
12171
12749
  "locationInModule": {
12172
12750
  "filename": "src/web-function.ts",
12173
- "line": 123
12751
+ "line": 124
12174
12752
  },
12175
12753
  "name": "systemLogLevelV2",
12176
12754
  "optional": true,
@@ -12188,7 +12766,7 @@
12188
12766
  "immutable": true,
12189
12767
  "locationInModule": {
12190
12768
  "filename": "src/web-function.ts",
12191
- "line": 86
12769
+ "line": 87
12192
12770
  },
12193
12771
  "name": "timeout",
12194
12772
  "optional": true,
@@ -12207,7 +12785,7 @@
12207
12785
  "immutable": true,
12208
12786
  "locationInModule": {
12209
12787
  "filename": "src/web-function.ts",
12210
- "line": 55
12788
+ "line": 56
12211
12789
  },
12212
12790
  "name": "webFunctionName",
12213
12791
  "optional": true,
@@ -12218,6 +12796,96 @@
12218
12796
  ],
12219
12797
  "symbolId": "src/web-function:WebFunctionOptions"
12220
12798
  },
12799
+ "@ashishpandeyone/cdk-lambda-web-function.WebFunctionPermission": {
12800
+ "assembly": "@ashishpandeyone/cdk-lambda-web-function",
12801
+ "datatype": true,
12802
+ "docs": {
12803
+ "stability": "experimental",
12804
+ "summary": "Permission for a principal outside this account, an AWS service or an organization to call a function's endpoints."
12805
+ },
12806
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionPermission",
12807
+ "kind": "interface",
12808
+ "locationInModule": {
12809
+ "filename": "src/web-function.ts",
12810
+ "line": 237
12811
+ },
12812
+ "name": "WebFunctionPermission",
12813
+ "properties": [
12814
+ {
12815
+ "abstract": true,
12816
+ "docs": {
12817
+ "remarks": "A principal in another account also needs `lambda:InvokeWebFunctionEndpoint` in its own IAM policy.",
12818
+ "stability": "experimental",
12819
+ "summary": "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`)."
12820
+ },
12821
+ "immutable": true,
12822
+ "locationInModule": {
12823
+ "filename": "src/web-function.ts",
12824
+ "line": 244
12825
+ },
12826
+ "name": "principal",
12827
+ "type": {
12828
+ "fqn": "aws-cdk-lib.aws_iam.IPrincipal"
12829
+ }
12830
+ },
12831
+ {
12832
+ "abstract": true,
12833
+ "docs": {
12834
+ "default": "- every endpoint of the function, including ones added later",
12835
+ "remarks": "It must belong to this function.",
12836
+ "stability": "experimental",
12837
+ "summary": "The endpoint the principal may call."
12838
+ },
12839
+ "immutable": true,
12840
+ "locationInModule": {
12841
+ "filename": "src/web-function.ts",
12842
+ "line": 251
12843
+ },
12844
+ "name": "endpoint",
12845
+ "optional": true,
12846
+ "type": {
12847
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint"
12848
+ }
12849
+ },
12850
+ {
12851
+ "abstract": true,
12852
+ "docs": {
12853
+ "default": "- no condition",
12854
+ "stability": "experimental",
12855
+ "summary": "For an AWS service: the account that owns the resource calling on its behalf (condition `aws:SourceAccount`)."
12856
+ },
12857
+ "immutable": true,
12858
+ "locationInModule": {
12859
+ "filename": "src/web-function.ts",
12860
+ "line": 266
12861
+ },
12862
+ "name": "sourceAccount",
12863
+ "optional": true,
12864
+ "type": {
12865
+ "primitive": "string"
12866
+ }
12867
+ },
12868
+ {
12869
+ "abstract": true,
12870
+ "docs": {
12871
+ "default": "- no condition",
12872
+ "stability": "experimental",
12873
+ "summary": "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."
12874
+ },
12875
+ "immutable": true,
12876
+ "locationInModule": {
12877
+ "filename": "src/web-function.ts",
12878
+ "line": 259
12879
+ },
12880
+ "name": "sourceArn",
12881
+ "optional": true,
12882
+ "type": {
12883
+ "primitive": "string"
12884
+ }
12885
+ }
12886
+ ],
12887
+ "symbolId": "src/web-function:WebFunctionPermission"
12888
+ },
12221
12889
  "@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps": {
12222
12890
  "assembly": "@ashishpandeyone/cdk-lambda-web-function",
12223
12891
  "datatype": true,
@@ -12232,7 +12900,7 @@
12232
12900
  "kind": "interface",
12233
12901
  "locationInModule": {
12234
12902
  "filename": "src/web-function.ts",
12235
- "line": 129
12903
+ "line": 130
12236
12904
  },
12237
12905
  "name": "WebFunctionProps",
12238
12906
  "properties": [
@@ -12246,7 +12914,7 @@
12246
12914
  "immutable": true,
12247
12915
  "locationInModule": {
12248
12916
  "filename": "src/web-function.ts",
12249
- "line": 141
12917
+ "line": 142
12250
12918
  },
12251
12919
  "name": "code",
12252
12920
  "type": {
@@ -12262,7 +12930,7 @@
12262
12930
  "immutable": true,
12263
12931
  "locationInModule": {
12264
12932
  "filename": "src/web-function.ts",
12265
- "line": 133
12933
+ "line": 134
12266
12934
  },
12267
12935
  "name": "runtime",
12268
12936
  "type": {
@@ -12279,7 +12947,7 @@
12279
12947
  "immutable": true,
12280
12948
  "locationInModule": {
12281
12949
  "filename": "src/web-function.ts",
12282
- "line": 148
12950
+ "line": 149
12283
12951
  },
12284
12952
  "name": "entrypoint",
12285
12953
  "optional": true,
@@ -12611,6 +13279,6 @@
12611
13279
  "symbolId": "src/web-function-deployment:WebFunctionRollbackOptions"
12612
13280
  }
12613
13281
  },
12614
- "version": "0.1.3",
12615
- "fingerprint": "F4xpSs8RKEtfPPB2ssJBW33WiisXtZt7E1UR0EZcJQs="
13282
+ "version": "0.1.5",
13283
+ "fingerprint": "Tr7QOU1oeRBvqTeXCFZ6IGobUlmK9K3kgz1HNsWILN4="
12616
13284
  }