@ashishpandeyone/cdk-lambda-web-function 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.jsii 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\n// errorRate: a cloudwatch.IAlarm, for example on the share of 5xx responses\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.\n deployment: WebFunctionDeployment.canary({ percent: 10, bake: Duration.minutes(10), alarms: [errorRate] }),\n },\n});\n\n// 25% more every 5 minutes. Each endpoint has its own deployment.\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\nLambda Web Function metrics have no revision dimension, so an alarm sees the whole endpoint: at 10%, a new revision's errors are a tenth of the endpoint's. Alarm on a rate, with a threshold low enough to notice that, or publish metrics from your application that carry its version. A bake should be longer than an alarm needs to fire (its period times its evaluation periods).\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## 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://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### 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\n`grantInvoke` adds to the caller's IAM policy, 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 this library doesn't manage yet.\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. The bucket is emptied and deleted with the stack.\n\nCode copies, log groups in other regions, revision cleanup and the bucket's emptying 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 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: VPC access (network connectors), resource-policy permissions, KMS encryption, 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\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",
@@ -9772,7 +9772,7 @@
9772
9772
  "kind": "interface",
9773
9773
  "locationInModule": {
9774
9774
  "filename": "src/web-function-endpoint.ts",
9775
- "line": 105
9775
+ "line": 112
9776
9776
  },
9777
9777
  "name": "AddWebFunctionEndpointOptions",
9778
9778
  "properties": [
@@ -9785,7 +9785,7 @@
9785
9785
  "immutable": true,
9786
9786
  "locationInModule": {
9787
9787
  "filename": "src/web-function-endpoint.ts",
9788
- "line": 109
9788
+ "line": 116
9789
9789
  },
9790
9790
  "name": "authType",
9791
9791
  "type": {
@@ -9803,7 +9803,7 @@
9803
9803
  "immutable": true,
9804
9804
  "locationInModule": {
9805
9805
  "filename": "src/web-function-endpoint.ts",
9806
- "line": 125
9806
+ "line": 132
9807
9807
  },
9808
9808
  "name": "additionalRevisions",
9809
9809
  "optional": true,
@@ -9826,7 +9826,7 @@
9826
9826
  "immutable": true,
9827
9827
  "locationInModule": {
9828
9828
  "filename": "src/web-function-endpoint.ts",
9829
- "line": 117
9829
+ "line": 124
9830
9830
  },
9831
9831
  "name": "revision",
9832
9832
  "optional": true,
@@ -9841,7 +9841,7 @@
9841
9841
  "assembly": "@ashishpandeyone/cdk-lambda-web-function",
9842
9842
  "docs": {
9843
9843
  "stability": "experimental",
9844
- "summary": "A Lambda Web Function."
9844
+ "summary": "A Lambda Web Function, created in this app (`WebFunction`) or imported (`WebFunction.fromWebFunctionArn`)."
9845
9845
  },
9846
9846
  "fqn": "@ashishpandeyone/cdk-lambda-web-function.IWebFunction",
9847
9847
  "interfaces": [
@@ -9851,8 +9851,198 @@
9851
9851
  "kind": "interface",
9852
9852
  "locationInModule": {
9853
9853
  "filename": "src/web-function.ts",
9854
- "line": 153
9854
+ "line": 155
9855
9855
  },
9856
+ "methods": [
9857
+ {
9858
+ "abstract": true,
9859
+ "docs": {
9860
+ "remarks": "for an imported function, the endpoint named in its attributes, or every endpoint.\n\nThis adds to the grantee's IAM policy. For a function in another account, its resource policy must also allow the grantee.\n[disable-awslint:no-grants]",
9861
+ "stability": "experimental",
9862
+ "summary": "Allows `grantee` to call the function's endpoint (`lambda:InvokeWebFunctionEndpoint`): the default endpoint of a `WebFunction`;"
9863
+ },
9864
+ "locationInModule": {
9865
+ "filename": "src/web-function.ts",
9866
+ "line": 177
9867
+ },
9868
+ "name": "grantInvoke",
9869
+ "parameters": [
9870
+ {
9871
+ "name": "grantee",
9872
+ "type": {
9873
+ "fqn": "aws-cdk-lib.aws_iam.IGrantable"
9874
+ }
9875
+ }
9876
+ ],
9877
+ "returns": {
9878
+ "type": {
9879
+ "fqn": "aws-cdk-lib.aws_iam.Grant"
9880
+ }
9881
+ }
9882
+ },
9883
+ {
9884
+ "abstract": true,
9885
+ "docs": {
9886
+ "stability": "experimental",
9887
+ "summary": "A metric of the function's execution environments in `AWS/Lambda/Web` (dimension `FunctionName`)."
9888
+ },
9889
+ "locationInModule": {
9890
+ "filename": "src/web-function.ts",
9891
+ "line": 182
9892
+ },
9893
+ "name": "metric",
9894
+ "parameters": [
9895
+ {
9896
+ "name": "metricName",
9897
+ "type": {
9898
+ "primitive": "string"
9899
+ }
9900
+ },
9901
+ {
9902
+ "name": "props",
9903
+ "optional": true,
9904
+ "type": {
9905
+ "fqn": "aws-cdk-lib.aws_cloudwatch.MetricOptions"
9906
+ }
9907
+ }
9908
+ ],
9909
+ "returns": {
9910
+ "type": {
9911
+ "fqn": "aws-cdk-lib.aws_cloudwatch.Metric"
9912
+ }
9913
+ }
9914
+ },
9915
+ {
9916
+ "abstract": true,
9917
+ "docs": {
9918
+ "stability": "experimental",
9919
+ "summary": "Time the execution environments were active (`EnvironmentActiveTime`)."
9920
+ },
9921
+ "locationInModule": {
9922
+ "filename": "src/web-function.ts",
9923
+ "line": 185
9924
+ },
9925
+ "name": "metricActiveTime",
9926
+ "parameters": [
9927
+ {
9928
+ "name": "props",
9929
+ "optional": true,
9930
+ "type": {
9931
+ "fqn": "aws-cdk-lib.aws_cloudwatch.MetricOptions"
9932
+ }
9933
+ }
9934
+ ],
9935
+ "returns": {
9936
+ "type": {
9937
+ "fqn": "aws-cdk-lib.aws_cloudwatch.Metric"
9938
+ }
9939
+ }
9940
+ },
9941
+ {
9942
+ "abstract": true,
9943
+ "docs": {
9944
+ "stability": "experimental",
9945
+ "summary": "Requests an execution environment handled at once (`EnvironmentConcurrentRequests`, maximum)."
9946
+ },
9947
+ "locationInModule": {
9948
+ "filename": "src/web-function.ts",
9949
+ "line": 191
9950
+ },
9951
+ "name": "metricConcurrentRequests",
9952
+ "parameters": [
9953
+ {
9954
+ "name": "props",
9955
+ "optional": true,
9956
+ "type": {
9957
+ "fqn": "aws-cdk-lib.aws_cloudwatch.MetricOptions"
9958
+ }
9959
+ }
9960
+ ],
9961
+ "returns": {
9962
+ "type": {
9963
+ "fqn": "aws-cdk-lib.aws_cloudwatch.Metric"
9964
+ }
9965
+ }
9966
+ },
9967
+ {
9968
+ "abstract": true,
9969
+ "docs": {
9970
+ "stability": "experimental",
9971
+ "summary": "CPU time the execution environments used (`EnvironmentCPUTime`)."
9972
+ },
9973
+ "locationInModule": {
9974
+ "filename": "src/web-function.ts",
9975
+ "line": 188
9976
+ },
9977
+ "name": "metricCpuTime",
9978
+ "parameters": [
9979
+ {
9980
+ "name": "props",
9981
+ "optional": true,
9982
+ "type": {
9983
+ "fqn": "aws-cdk-lib.aws_cloudwatch.MetricOptions"
9984
+ }
9985
+ }
9986
+ ],
9987
+ "returns": {
9988
+ "type": {
9989
+ "fqn": "aws-cdk-lib.aws_cloudwatch.Metric"
9990
+ }
9991
+ }
9992
+ },
9993
+ {
9994
+ "abstract": true,
9995
+ "docs": {
9996
+ "stability": "experimental",
9997
+ "summary": "Peak memory an execution environment used (`EnvironmentMaxMemoryUsage`, maximum)."
9998
+ },
9999
+ "locationInModule": {
10000
+ "filename": "src/web-function.ts",
10001
+ "line": 194
10002
+ },
10003
+ "name": "metricMaxMemoryUsage",
10004
+ "parameters": [
10005
+ {
10006
+ "name": "props",
10007
+ "optional": true,
10008
+ "type": {
10009
+ "fqn": "aws-cdk-lib.aws_cloudwatch.MetricOptions"
10010
+ }
10011
+ }
10012
+ ],
10013
+ "returns": {
10014
+ "type": {
10015
+ "fqn": "aws-cdk-lib.aws_cloudwatch.Metric"
10016
+ }
10017
+ }
10018
+ },
10019
+ {
10020
+ "abstract": true,
10021
+ "docs": {
10022
+ "stability": "experimental",
10023
+ "summary": "Bytes sent in responses (`ResponseBytes`)."
10024
+ },
10025
+ "locationInModule": {
10026
+ "filename": "src/web-function.ts",
10027
+ "line": 197
10028
+ },
10029
+ "name": "metricResponseBytes",
10030
+ "parameters": [
10031
+ {
10032
+ "name": "props",
10033
+ "optional": true,
10034
+ "type": {
10035
+ "fqn": "aws-cdk-lib.aws_cloudwatch.MetricOptions"
10036
+ }
10037
+ }
10038
+ ],
10039
+ "returns": {
10040
+ "type": {
10041
+ "fqn": "aws-cdk-lib.aws_cloudwatch.Metric"
10042
+ }
10043
+ }
10044
+ }
10045
+ ],
9856
10046
  "name": "IWebFunction",
9857
10047
  "properties": [
9858
10048
  {
@@ -9867,7 +10057,7 @@
9867
10057
  "immutable": true,
9868
10058
  "locationInModule": {
9869
10059
  "filename": "src/web-function.ts",
9870
- "line": 166
10060
+ "line": 168
9871
10061
  },
9872
10062
  "name": "webFunctionArn",
9873
10063
  "type": {
@@ -9886,7 +10076,7 @@
9886
10076
  "immutable": true,
9887
10077
  "locationInModule": {
9888
10078
  "filename": "src/web-function.ts",
9889
- "line": 159
10079
+ "line": 161
9890
10080
  },
9891
10081
  "name": "webFunctionName",
9892
10082
  "type": {
@@ -10447,12 +10637,12 @@
10447
10637
  },
10448
10638
  "@ashishpandeyone/cdk-lambda-web-function.WebFunction": {
10449
10639
  "assembly": "@ashishpandeyone/cdk-lambda-web-function",
10450
- "base": "aws-cdk-lib.Resource",
10640
+ "base": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase",
10451
10641
  "docs": {
10452
10642
  "custom": {
10453
10643
  "resource": "AWS::Lambda::WebFunction"
10454
10644
  },
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.",
10645
+ "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
10646
  "stability": "experimental",
10457
10647
  "summary": "A Node.js HTTP server running as an AWS Lambda Web Function, served from one or more regions."
10458
10648
  },
@@ -10463,7 +10653,7 @@
10463
10653
  },
10464
10654
  "locationInModule": {
10465
10655
  "filename": "src/web-function.ts",
10466
- "line": 221
10656
+ "line": 371
10467
10657
  },
10468
10658
  "parameters": [
10469
10659
  {
@@ -10487,15 +10677,125 @@
10487
10677
  ]
10488
10678
  },
10489
10679
  "interfaces": [
10490
- "@ashishpandeyone/cdk-lambda-web-function.IWebFunction",
10491
10680
  "aws-cdk-lib.aws_iam.IGrantable"
10492
10681
  ],
10493
10682
  "kind": "class",
10494
10683
  "locationInModule": {
10495
10684
  "filename": "src/web-function.ts",
10496
- "line": 180
10685
+ "line": 314
10497
10686
  },
10498
10687
  "methods": [
10688
+ {
10689
+ "docs": {
10690
+ "stability": "experimental",
10691
+ "summary": "Imports an existing Web Function by its ARN (in any region or account)."
10692
+ },
10693
+ "locationInModule": {
10694
+ "filename": "src/web-function.ts",
10695
+ "line": 318
10696
+ },
10697
+ "name": "fromWebFunctionArn",
10698
+ "parameters": [
10699
+ {
10700
+ "name": "scope",
10701
+ "type": {
10702
+ "fqn": "constructs.Construct"
10703
+ }
10704
+ },
10705
+ {
10706
+ "name": "id",
10707
+ "type": {
10708
+ "primitive": "string"
10709
+ }
10710
+ },
10711
+ {
10712
+ "name": "webFunctionArn",
10713
+ "type": {
10714
+ "primitive": "string"
10715
+ }
10716
+ }
10717
+ ],
10718
+ "returns": {
10719
+ "type": {
10720
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.IWebFunction"
10721
+ }
10722
+ },
10723
+ "static": true
10724
+ },
10725
+ {
10726
+ "docs": {
10727
+ "stability": "experimental",
10728
+ "summary": "Imports an existing Web Function: give its ARN or its name, and optionally the endpoint `grantInvoke` allows."
10729
+ },
10730
+ "locationInModule": {
10731
+ "filename": "src/web-function.ts",
10732
+ "line": 332
10733
+ },
10734
+ "name": "fromWebFunctionAttributes",
10735
+ "parameters": [
10736
+ {
10737
+ "name": "scope",
10738
+ "type": {
10739
+ "fqn": "constructs.Construct"
10740
+ }
10741
+ },
10742
+ {
10743
+ "name": "id",
10744
+ "type": {
10745
+ "primitive": "string"
10746
+ }
10747
+ },
10748
+ {
10749
+ "name": "attrs",
10750
+ "type": {
10751
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionAttributes"
10752
+ }
10753
+ }
10754
+ ],
10755
+ "returns": {
10756
+ "type": {
10757
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.IWebFunction"
10758
+ }
10759
+ },
10760
+ "static": true
10761
+ },
10762
+ {
10763
+ "docs": {
10764
+ "stability": "experimental",
10765
+ "summary": "Imports an existing Web Function in this stack's account and region by its name."
10766
+ },
10767
+ "locationInModule": {
10768
+ "filename": "src/web-function.ts",
10769
+ "line": 325
10770
+ },
10771
+ "name": "fromWebFunctionName",
10772
+ "parameters": [
10773
+ {
10774
+ "name": "scope",
10775
+ "type": {
10776
+ "fqn": "constructs.Construct"
10777
+ }
10778
+ },
10779
+ {
10780
+ "name": "id",
10781
+ "type": {
10782
+ "primitive": "string"
10783
+ }
10784
+ },
10785
+ {
10786
+ "name": "webFunctionName",
10787
+ "type": {
10788
+ "primitive": "string"
10789
+ }
10790
+ }
10791
+ ],
10792
+ "returns": {
10793
+ "type": {
10794
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.IWebFunction"
10795
+ }
10796
+ },
10797
+ "static": true
10798
+ },
10499
10799
  {
10500
10800
  "docs": {
10501
10801
  "stability": "experimental",
@@ -10503,7 +10803,7 @@
10503
10803
  },
10504
10804
  "locationInModule": {
10505
10805
  "filename": "src/web-function.ts",
10506
- "line": 323
10806
+ "line": 473
10507
10807
  },
10508
10808
  "name": "addEndpoint",
10509
10809
  "parameters": [
@@ -10537,7 +10837,7 @@
10537
10837
  },
10538
10838
  "locationInModule": {
10539
10839
  "filename": "src/web-function.ts",
10540
- "line": 331
10840
+ "line": 481
10541
10841
  },
10542
10842
  "name": "addEnvironment",
10543
10843
  "parameters": [
@@ -10567,7 +10867,7 @@
10567
10867
  },
10568
10868
  "locationInModule": {
10569
10869
  "filename": "src/web-function.ts",
10570
- "line": 342
10870
+ "line": 492
10571
10871
  },
10572
10872
  "name": "addToRolePolicy",
10573
10873
  "parameters": [
@@ -10587,9 +10887,10 @@
10587
10887
  },
10588
10888
  "locationInModule": {
10589
10889
  "filename": "src/web-function.ts",
10590
- "line": 350
10890
+ "line": 500
10591
10891
  },
10592
10892
  "name": "grantInvoke",
10893
+ "overrides": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase",
10593
10894
  "parameters": [
10594
10895
  {
10595
10896
  "name": "grantee",
@@ -10615,7 +10916,7 @@
10615
10916
  "immutable": true,
10616
10917
  "locationInModule": {
10617
10918
  "filename": "src/web-function.ts",
10618
- "line": 188
10919
+ "line": 343
10619
10920
  },
10620
10921
  "name": "currentRevision",
10621
10922
  "type": {
@@ -10631,7 +10932,7 @@
10631
10932
  "immutable": true,
10632
10933
  "locationInModule": {
10633
10934
  "filename": "src/web-function.ts",
10634
- "line": 191
10935
+ "line": 346
10635
10936
  },
10636
10937
  "name": "endpoint",
10637
10938
  "type": {
@@ -10646,7 +10947,7 @@
10646
10947
  "immutable": true,
10647
10948
  "locationInModule": {
10648
10949
  "filename": "src/web-function.ts",
10649
- "line": 200
10950
+ "line": 355
10650
10951
  },
10651
10952
  "name": "grantPrincipal",
10652
10953
  "overrides": "aws-cdk-lib.aws_iam.IGrantable",
@@ -10662,7 +10963,7 @@
10662
10963
  "immutable": true,
10663
10964
  "locationInModule": {
10664
10965
  "filename": "src/web-function.ts",
10665
- "line": 194
10966
+ "line": 349
10666
10967
  },
10667
10968
  "name": "grants",
10668
10969
  "type": {
@@ -10678,7 +10979,7 @@
10678
10979
  "immutable": true,
10679
10980
  "locationInModule": {
10680
10981
  "filename": "src/web-function.ts",
10681
- "line": 206
10982
+ "line": 361
10682
10983
  },
10683
10984
  "name": "logGroup",
10684
10985
  "type": {
@@ -10694,7 +10995,7 @@
10694
10995
  "immutable": true,
10695
10996
  "locationInModule": {
10696
10997
  "filename": "src/web-function.ts",
10697
- "line": 185
10998
+ "line": 340
10698
10999
  },
10699
11000
  "name": "revisionId",
10700
11001
  "type": {
@@ -10709,7 +11010,7 @@
10709
11010
  "immutable": true,
10710
11011
  "locationInModule": {
10711
11012
  "filename": "src/web-function.ts",
10712
- "line": 197
11013
+ "line": 352
10713
11014
  },
10714
11015
  "name": "role",
10715
11016
  "type": {
@@ -10724,10 +11025,10 @@
10724
11025
  "immutable": true,
10725
11026
  "locationInModule": {
10726
11027
  "filename": "src/web-function.ts",
10727
- "line": 182
11028
+ "line": 337
10728
11029
  },
10729
11030
  "name": "webFunctionArn",
10730
- "overrides": "@ashishpandeyone/cdk-lambda-web-function.IWebFunction",
11031
+ "overrides": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase",
10731
11032
  "type": {
10732
11033
  "primitive": "string"
10733
11034
  }
@@ -10740,32 +11041,89 @@
10740
11041
  "immutable": true,
10741
11042
  "locationInModule": {
10742
11043
  "filename": "src/web-function.ts",
10743
- "line": 181
11044
+ "line": 336
10744
11045
  },
10745
11046
  "name": "webFunctionName",
10746
- "overrides": "@ashishpandeyone/cdk-lambda-web-function.IWebFunction",
11047
+ "overrides": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase",
11048
+ "type": {
11049
+ "primitive": "string"
11050
+ }
11051
+ }
11052
+ ],
11053
+ "symbolId": "src/web-function:WebFunction"
11054
+ },
11055
+ "@ashishpandeyone/cdk-lambda-web-function.WebFunctionAttributes": {
11056
+ "assembly": "@ashishpandeyone/cdk-lambda-web-function",
11057
+ "datatype": true,
11058
+ "docs": {
11059
+ "remarks": "Give its ARN or its name.",
11060
+ "stability": "experimental",
11061
+ "summary": "Attributes of an existing Web Function."
11062
+ },
11063
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionAttributes",
11064
+ "kind": "interface",
11065
+ "locationInModule": {
11066
+ "filename": "src/web-function.ts",
11067
+ "line": 203
11068
+ },
11069
+ "name": "WebFunctionAttributes",
11070
+ "properties": [
11071
+ {
11072
+ "abstract": true,
11073
+ "docs": {
11074
+ "default": "- every endpoint of the function",
11075
+ "stability": "experimental",
11076
+ "summary": "The endpoint `grantInvoke` allows calling."
11077
+ },
11078
+ "immutable": true,
11079
+ "locationInModule": {
11080
+ "filename": "src/web-function.ts",
11081
+ "line": 224
11082
+ },
11083
+ "name": "endpointName",
11084
+ "optional": true,
10747
11085
  "type": {
10748
11086
  "primitive": "string"
10749
11087
  }
10750
11088
  },
10751
11089
  {
11090
+ "abstract": true,
10752
11091
  "docs": {
11092
+ "default": "- built from `webFunctionName`, in this stack's account and region",
10753
11093
  "stability": "experimental",
10754
- "summary": "A reference to this function, for APIs that accept `lambda.IWebFunctionRef`."
11094
+ "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."
11095
+ },
11096
+ "immutable": true,
11097
+ "locationInModule": {
11098
+ "filename": "src/web-function.ts",
11099
+ "line": 210
11100
+ },
11101
+ "name": "webFunctionArn",
11102
+ "optional": true,
11103
+ "type": {
11104
+ "primitive": "string"
11105
+ }
11106
+ },
11107
+ {
11108
+ "abstract": true,
11109
+ "docs": {
11110
+ "default": "- taken from `webFunctionArn`",
11111
+ "stability": "experimental",
11112
+ "summary": "The function's name."
10755
11113
  },
10756
11114
  "immutable": true,
10757
11115
  "locationInModule": {
10758
11116
  "filename": "src/web-function.ts",
10759
11117
  "line": 217
10760
11118
  },
10761
- "name": "webFunctionRef",
10762
- "overrides": "aws-cdk-lib.interfaces.aws_lambda.IWebFunctionRef",
11119
+ "name": "webFunctionName",
11120
+ "optional": true,
10763
11121
  "type": {
10764
- "fqn": "aws-cdk-lib.interfaces.aws_lambda.WebFunctionReference"
11122
+ "primitive": "string"
10765
11123
  }
10766
11124
  }
10767
11125
  ],
10768
- "symbolId": "src/web-function:WebFunction"
11126
+ "symbolId": "src/web-function:WebFunctionAttributes"
10769
11127
  },
10770
11128
  "@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType": {
10771
11129
  "assembly": "@ashishpandeyone/cdk-lambda-web-function",
@@ -10799,202 +11157,758 @@
10799
11157
  "name": "WebFunctionAuthType",
10800
11158
  "symbolId": "src/enums:WebFunctionAuthType"
10801
11159
  },
10802
- "@ashishpandeyone/cdk-lambda-web-function.WebFunctionCanaryDeploymentOptions": {
11160
+ "@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase": {
11161
+ "abstract": true,
10803
11162
  "assembly": "@ashishpandeyone/cdk-lambda-web-function",
10804
- "datatype": true,
11163
+ "base": "aws-cdk-lib.Resource",
10805
11164
  "docs": {
10806
11165
  "stability": "experimental",
10807
- "summary": "Options for a canary deployment."
11166
+ "summary": "What `WebFunction` and imported functions have in common."
10808
11167
  },
10809
- "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionCanaryDeploymentOptions",
10810
- "kind": "interface",
11168
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase",
11169
+ "initializer": {
11170
+ "docs": {
11171
+ "stability": "stable"
11172
+ },
11173
+ "locationInModule": {
11174
+ "filename": "core/lib/resource.ts",
11175
+ "line": 125
11176
+ },
11177
+ "parameters": [
11178
+ {
11179
+ "name": "scope",
11180
+ "type": {
11181
+ "fqn": "constructs.Construct"
11182
+ }
11183
+ },
11184
+ {
11185
+ "name": "id",
11186
+ "type": {
11187
+ "primitive": "string"
11188
+ }
11189
+ },
11190
+ {
11191
+ "name": "props",
11192
+ "optional": true,
11193
+ "type": {
11194
+ "fqn": "aws-cdk-lib.ResourceProps"
11195
+ }
11196
+ }
11197
+ ]
11198
+ },
11199
+ "interfaces": [
11200
+ "@ashishpandeyone/cdk-lambda-web-function.IWebFunction"
11201
+ ],
11202
+ "kind": "class",
10811
11203
  "locationInModule": {
10812
- "filename": "src/web-function-deployment.ts",
10813
- "line": 12
11204
+ "filename": "src/web-function.ts",
11205
+ "line": 230
10814
11206
  },
10815
- "name": "WebFunctionCanaryDeploymentOptions",
10816
- "properties": [
11207
+ "methods": [
10817
11208
  {
10818
11209
  "abstract": true,
10819
11210
  "docs": {
10820
- "remarks": "Make it longer than the time your alarms need to fire (period × evaluation periods).",
11211
+ "remarks": "[disable-awslint:no-grants]",
10821
11212
  "stability": "experimental",
10822
- "summary": "How long the new revision serves `percent` before it gets all traffic (1-45 minutes)."
11213
+ "summary": "Allows `grantee` to call the function's endpoint."
10823
11214
  },
10824
- "immutable": true,
10825
11215
  "locationInModule": {
10826
- "filename": "src/web-function-deployment.ts",
10827
- "line": 22
11216
+ "filename": "src/web-function.ts",
11217
+ "line": 243
10828
11218
  },
10829
- "name": "bake",
10830
- "type": {
10831
- "fqn": "aws-cdk-lib.Duration"
11219
+ "name": "grantInvoke",
11220
+ "overrides": "@ashishpandeyone/cdk-lambda-web-function.IWebFunction",
11221
+ "parameters": [
11222
+ {
11223
+ "name": "grantee",
11224
+ "type": {
11225
+ "fqn": "aws-cdk-lib.aws_iam.IGrantable"
11226
+ }
11227
+ }
11228
+ ],
11229
+ "returns": {
11230
+ "type": {
11231
+ "fqn": "aws-cdk-lib.aws_iam.Grant"
11232
+ }
11233
+ }
11234
+ },
11235
+ {
11236
+ "docs": {
11237
+ "default": "- sum over 1 minute, in the function's home region",
11238
+ "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.",
11239
+ "stability": "experimental",
11240
+ "summary": "A metric of this function's execution environments in `AWS/Lambda/Web` (dimension `FunctionName`), across all endpoints."
11241
+ },
11242
+ "locationInModule": {
11243
+ "filename": "src/web-function.ts",
11244
+ "line": 254
11245
+ },
11246
+ "name": "metric",
11247
+ "overrides": "@ashishpandeyone/cdk-lambda-web-function.IWebFunction",
11248
+ "parameters": [
11249
+ {
11250
+ "name": "metricName",
11251
+ "type": {
11252
+ "primitive": "string"
11253
+ }
11254
+ },
11255
+ {
11256
+ "name": "props",
11257
+ "optional": true,
11258
+ "type": {
11259
+ "fqn": "aws-cdk-lib.aws_cloudwatch.MetricOptions"
11260
+ }
11261
+ }
11262
+ ],
11263
+ "returns": {
11264
+ "type": {
11265
+ "fqn": "aws-cdk-lib.aws_cloudwatch.Metric"
11266
+ }
11267
+ }
11268
+ },
11269
+ {
11270
+ "docs": {
11271
+ "stability": "experimental",
11272
+ "summary": "Time the execution environments were active (`EnvironmentActiveTime`)."
11273
+ },
11274
+ "locationInModule": {
11275
+ "filename": "src/web-function.ts",
11276
+ "line": 269
11277
+ },
11278
+ "name": "metricActiveTime",
11279
+ "overrides": "@ashishpandeyone/cdk-lambda-web-function.IWebFunction",
11280
+ "parameters": [
11281
+ {
11282
+ "name": "props",
11283
+ "optional": true,
11284
+ "type": {
11285
+ "fqn": "aws-cdk-lib.aws_cloudwatch.MetricOptions"
11286
+ }
11287
+ }
11288
+ ],
11289
+ "returns": {
11290
+ "type": {
11291
+ "fqn": "aws-cdk-lib.aws_cloudwatch.Metric"
11292
+ }
11293
+ }
11294
+ },
11295
+ {
11296
+ "docs": {
11297
+ "default": "- maximum over 1 minute",
11298
+ "stability": "experimental",
11299
+ "summary": "Requests an execution environment handled at once (`EnvironmentConcurrentRequests`), to compare with `maxConcurrencyPerEnvironment`."
11300
+ },
11301
+ "locationInModule": {
11302
+ "filename": "src/web-function.ts",
11303
+ "line": 284
11304
+ },
11305
+ "name": "metricConcurrentRequests",
11306
+ "overrides": "@ashishpandeyone/cdk-lambda-web-function.IWebFunction",
11307
+ "parameters": [
11308
+ {
11309
+ "name": "props",
11310
+ "optional": true,
11311
+ "type": {
11312
+ "fqn": "aws-cdk-lib.aws_cloudwatch.MetricOptions"
11313
+ }
11314
+ }
11315
+ ],
11316
+ "returns": {
11317
+ "type": {
11318
+ "fqn": "aws-cdk-lib.aws_cloudwatch.Metric"
11319
+ }
11320
+ }
11321
+ },
11322
+ {
11323
+ "docs": {
11324
+ "stability": "experimental",
11325
+ "summary": "CPU time the execution environments used (`EnvironmentCPUTime`)."
11326
+ },
11327
+ "locationInModule": {
11328
+ "filename": "src/web-function.ts",
11329
+ "line": 274
11330
+ },
11331
+ "name": "metricCpuTime",
11332
+ "overrides": "@ashishpandeyone/cdk-lambda-web-function.IWebFunction",
11333
+ "parameters": [
11334
+ {
11335
+ "name": "props",
11336
+ "optional": true,
11337
+ "type": {
11338
+ "fqn": "aws-cdk-lib.aws_cloudwatch.MetricOptions"
11339
+ }
11340
+ }
11341
+ ],
11342
+ "returns": {
11343
+ "type": {
11344
+ "fqn": "aws-cdk-lib.aws_cloudwatch.Metric"
11345
+ }
11346
+ }
11347
+ },
11348
+ {
11349
+ "docs": {
11350
+ "default": "- maximum over 1 minute",
11351
+ "remarks": "each environment has 2 GB.",
11352
+ "stability": "experimental",
11353
+ "summary": "Peak memory an execution environment used (`EnvironmentMaxMemoryUsage`);"
11354
+ },
11355
+ "locationInModule": {
11356
+ "filename": "src/web-function.ts",
11357
+ "line": 293
11358
+ },
11359
+ "name": "metricMaxMemoryUsage",
11360
+ "overrides": "@ashishpandeyone/cdk-lambda-web-function.IWebFunction",
11361
+ "parameters": [
11362
+ {
11363
+ "name": "props",
11364
+ "optional": true,
11365
+ "type": {
11366
+ "fqn": "aws-cdk-lib.aws_cloudwatch.MetricOptions"
11367
+ }
11368
+ }
11369
+ ],
11370
+ "returns": {
11371
+ "type": {
11372
+ "fqn": "aws-cdk-lib.aws_cloudwatch.Metric"
11373
+ }
10832
11374
  }
10833
11375
  },
11376
+ {
11377
+ "docs": {
11378
+ "stability": "experimental",
11379
+ "summary": "Bytes sent in responses (`ResponseBytes`)."
11380
+ },
11381
+ "locationInModule": {
11382
+ "filename": "src/web-function.ts",
11383
+ "line": 298
11384
+ },
11385
+ "name": "metricResponseBytes",
11386
+ "overrides": "@ashishpandeyone/cdk-lambda-web-function.IWebFunction",
11387
+ "parameters": [
11388
+ {
11389
+ "name": "props",
11390
+ "optional": true,
11391
+ "type": {
11392
+ "fqn": "aws-cdk-lib.aws_cloudwatch.MetricOptions"
11393
+ }
11394
+ }
11395
+ ],
11396
+ "returns": {
11397
+ "type": {
11398
+ "fqn": "aws-cdk-lib.aws_cloudwatch.Metric"
11399
+ }
11400
+ }
11401
+ }
11402
+ ],
11403
+ "name": "WebFunctionBase",
11404
+ "properties": [
10834
11405
  {
10835
11406
  "abstract": true,
10836
11407
  "docs": {
10837
11408
  "stability": "experimental",
10838
- "summary": "The share of traffic, in whole percent (1-99), that the new revision gets first."
11409
+ "summary": "The function's ARN."
10839
11410
  },
10840
11411
  "immutable": true,
10841
11412
  "locationInModule": {
10842
- "filename": "src/web-function-deployment.ts",
10843
- "line": 16
11413
+ "filename": "src/web-function.ts",
11414
+ "line": 232
10844
11415
  },
10845
- "name": "percent",
11416
+ "name": "webFunctionArn",
11417
+ "overrides": "@ashishpandeyone/cdk-lambda-web-function.IWebFunction",
11418
+ "type": {
11419
+ "primitive": "string"
11420
+ }
11421
+ },
11422
+ {
11423
+ "abstract": true,
11424
+ "docs": {
11425
+ "stability": "experimental",
11426
+ "summary": "The function's name."
11427
+ },
11428
+ "immutable": true,
11429
+ "locationInModule": {
11430
+ "filename": "src/web-function.ts",
11431
+ "line": 231
11432
+ },
11433
+ "name": "webFunctionName",
11434
+ "overrides": "@ashishpandeyone/cdk-lambda-web-function.IWebFunction",
11435
+ "type": {
11436
+ "primitive": "string"
11437
+ }
11438
+ },
11439
+ {
11440
+ "docs": {
11441
+ "stability": "experimental",
11442
+ "summary": "A reference to this function, for APIs that accept `lambda.IWebFunctionRef`."
11443
+ },
11444
+ "immutable": true,
11445
+ "locationInModule": {
11446
+ "filename": "src/web-function.ts",
11447
+ "line": 235
11448
+ },
11449
+ "name": "webFunctionRef",
11450
+ "overrides": "aws-cdk-lib.interfaces.aws_lambda.IWebFunctionRef",
11451
+ "type": {
11452
+ "fqn": "aws-cdk-lib.interfaces.aws_lambda.WebFunctionReference"
11453
+ }
11454
+ }
11455
+ ],
11456
+ "symbolId": "src/web-function:WebFunctionBase"
11457
+ },
11458
+ "@ashishpandeyone/cdk-lambda-web-function.WebFunctionCanaryDeploymentOptions": {
11459
+ "assembly": "@ashishpandeyone/cdk-lambda-web-function",
11460
+ "datatype": true,
11461
+ "docs": {
11462
+ "stability": "experimental",
11463
+ "summary": "Options for a canary deployment."
11464
+ },
11465
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionCanaryDeploymentOptions",
11466
+ "kind": "interface",
11467
+ "locationInModule": {
11468
+ "filename": "src/web-function-deployment.ts",
11469
+ "line": 61
11470
+ },
11471
+ "name": "WebFunctionCanaryDeploymentOptions",
11472
+ "properties": [
11473
+ {
11474
+ "abstract": true,
11475
+ "docs": {
11476
+ "remarks": "Make it longer than the time your alarms need to fire (period × evaluation periods).",
11477
+ "stability": "experimental",
11478
+ "summary": "How long the new revision serves `percent` before it gets all traffic (1-45 minutes)."
11479
+ },
11480
+ "immutable": true,
11481
+ "locationInModule": {
11482
+ "filename": "src/web-function-deployment.ts",
11483
+ "line": 71
11484
+ },
11485
+ "name": "bake",
11486
+ "type": {
11487
+ "fqn": "aws-cdk-lib.Duration"
11488
+ }
11489
+ },
11490
+ {
11491
+ "abstract": true,
11492
+ "docs": {
11493
+ "stability": "experimental",
11494
+ "summary": "The share of traffic, in whole percent (1-99), that the new revision gets first."
11495
+ },
11496
+ "immutable": true,
11497
+ "locationInModule": {
11498
+ "filename": "src/web-function-deployment.ts",
11499
+ "line": 65
11500
+ },
11501
+ "name": "percent",
10846
11502
  "type": {
10847
11503
  "primitive": "number"
10848
11504
  }
10849
11505
  },
10850
11506
  {
10851
- "abstract": true,
11507
+ "abstract": true,
11508
+ "docs": {
11509
+ "default": "- no alarms: traffic moves on a timer",
11510
+ "remarks": "They're checked before traffic moves, during the bake, and once the new revision has all traffic.\nUse alarms in any region (by ARN), including composite alarms.",
11511
+ "stability": "experimental",
11512
+ "summary": "Alarms that stop the deployment: if one is in ALARM, the endpoint goes back to the previous revision and the deployment fails, so CloudFormation rolls the stack back."
11513
+ },
11514
+ "immutable": true,
11515
+ "locationInModule": {
11516
+ "filename": "src/web-function-deployment.ts",
11517
+ "line": 82
11518
+ },
11519
+ "name": "alarms",
11520
+ "optional": true,
11521
+ "type": {
11522
+ "collection": {
11523
+ "elementtype": {
11524
+ "fqn": "aws-cdk-lib.aws_cloudwatch.IAlarm"
11525
+ },
11526
+ "kind": "array"
11527
+ }
11528
+ }
11529
+ },
11530
+ {
11531
+ "abstract": true,
11532
+ "docs": {
11533
+ "default": "- no endpoint alarms",
11534
+ "remarks": "They stop the deployment like `alarms` (both can be used together).",
11535
+ "stability": "experimental",
11536
+ "summary": "Alarms on the endpoint's own error rates, created by the endpoint in every region it serves from."
11537
+ },
11538
+ "immutable": true,
11539
+ "locationInModule": {
11540
+ "filename": "src/web-function-deployment.ts",
11541
+ "line": 90
11542
+ },
11543
+ "name": "rollbackOn",
11544
+ "optional": true,
11545
+ "type": {
11546
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionRollbackOptions"
11547
+ }
11548
+ }
11549
+ ],
11550
+ "symbolId": "src/web-function-deployment:WebFunctionCanaryDeploymentOptions"
11551
+ },
11552
+ "@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment": {
11553
+ "assembly": "@ashishpandeyone/cdk-lambda-web-function",
11554
+ "docs": {
11555
+ "stability": "experimental",
11556
+ "summary": "How an endpoint moves its traffic to a new revision."
11557
+ },
11558
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment",
11559
+ "kind": "class",
11560
+ "locationInModule": {
11561
+ "filename": "src/web-function-deployment.ts",
11562
+ "line": 130
11563
+ },
11564
+ "methods": [
11565
+ {
11566
+ "docs": {
11567
+ "stability": "experimental",
11568
+ "summary": "All traffic moves to the new revision at once, as soon as it's ready (the default)."
11569
+ },
11570
+ "locationInModule": {
11571
+ "filename": "src/web-function-deployment.ts",
11572
+ "line": 134
11573
+ },
11574
+ "name": "allAtOnce",
11575
+ "returns": {
11576
+ "type": {
11577
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment"
11578
+ }
11579
+ },
11580
+ "static": true
11581
+ },
11582
+ {
11583
+ "docs": {
11584
+ "stability": "experimental",
11585
+ "summary": "The new revision first gets `percent` of the traffic for `bake`, then all of it."
11586
+ },
11587
+ "locationInModule": {
11588
+ "filename": "src/web-function-deployment.ts",
11589
+ "line": 141
11590
+ },
11591
+ "name": "canary",
11592
+ "parameters": [
11593
+ {
11594
+ "name": "options",
11595
+ "type": {
11596
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionCanaryDeploymentOptions"
11597
+ }
11598
+ }
11599
+ ],
11600
+ "returns": {
11601
+ "type": {
11602
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment"
11603
+ }
11604
+ },
11605
+ "static": true
11606
+ },
11607
+ {
11608
+ "docs": {
11609
+ "stability": "experimental",
11610
+ "summary": "The new revision gets `percent` more of the traffic every `interval` until it has all of it."
11611
+ },
11612
+ "locationInModule": {
11613
+ "filename": "src/web-function-deployment.ts",
11614
+ "line": 150
11615
+ },
11616
+ "name": "linear",
11617
+ "parameters": [
11618
+ {
11619
+ "name": "options",
11620
+ "type": {
11621
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionLinearDeploymentOptions"
11622
+ }
11623
+ }
11624
+ ],
11625
+ "returns": {
11626
+ "type": {
11627
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment"
11628
+ }
11629
+ },
11630
+ "static": true
11631
+ }
11632
+ ],
11633
+ "name": "WebFunctionDeployment",
11634
+ "symbolId": "src/web-function-deployment:WebFunctionDeployment"
11635
+ },
11636
+ "@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint": {
11637
+ "assembly": "@ashishpandeyone/cdk-lambda-web-function",
11638
+ "base": "constructs.Construct",
11639
+ "docs": {
11640
+ "remarks": "Endpoints are created only through `WebFunction`, which owns their log groups in every region, so the constructor is private.",
11641
+ "stability": "experimental",
11642
+ "summary": "An HTTPS endpoint of a Web Function: `fn.endpoint` (the default one) or the result of `fn.addEndpoint()`."
11643
+ },
11644
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint",
11645
+ "kind": "class",
11646
+ "locationInModule": {
11647
+ "filename": "src/web-function-endpoint.ts",
11648
+ "line": 157
11649
+ },
11650
+ "methods": [
11651
+ {
11652
+ "docs": {
11653
+ "remarks": "Shortcut for `grants.invoke(grantee)`.\n[disable-awslint:no-grants]",
11654
+ "stability": "experimental",
11655
+ "summary": "Allows `grantee` to call this endpoint."
11656
+ },
11657
+ "locationInModule": {
11658
+ "filename": "src/web-function-endpoint.ts",
11659
+ "line": 420
11660
+ },
11661
+ "name": "grantInvoke",
11662
+ "parameters": [
11663
+ {
11664
+ "name": "grantee",
11665
+ "type": {
11666
+ "fqn": "aws-cdk-lib.aws_iam.IGrantable"
11667
+ }
11668
+ }
11669
+ ],
11670
+ "returns": {
11671
+ "type": {
11672
+ "fqn": "aws-cdk-lib.aws_iam.Grant"
11673
+ }
11674
+ }
11675
+ },
11676
+ {
11677
+ "docs": {
11678
+ "default": "- sum over 1 minute, in the home region",
11679
+ "remarks": "Metrics are published in the region that served the request: pass `region` for one of the endpoint's\nother regions. An alarm can only use metrics from its own stack's region.",
11680
+ "stability": "experimental",
11681
+ "summary": "A metric of this endpoint in `AWS/Lambda/Web` (dimensions `FunctionName` and `EndpointName`)."
11682
+ },
11683
+ "locationInModule": {
11684
+ "filename": "src/web-function-endpoint.ts",
11685
+ "line": 355
11686
+ },
11687
+ "name": "metric",
11688
+ "parameters": [
11689
+ {
11690
+ "name": "metricName",
11691
+ "type": {
11692
+ "primitive": "string"
11693
+ }
11694
+ },
11695
+ {
11696
+ "name": "props",
11697
+ "optional": true,
11698
+ "type": {
11699
+ "fqn": "aws-cdk-lib.aws_cloudwatch.MetricOptions"
11700
+ }
11701
+ }
11702
+ ],
11703
+ "returns": {
11704
+ "type": {
11705
+ "fqn": "aws-cdk-lib.aws_cloudwatch.Metric"
11706
+ }
11707
+ }
11708
+ },
11709
+ {
11710
+ "docs": {
11711
+ "default": "- maximum over 1 minute, in the home region",
11712
+ "stability": "experimental",
11713
+ "summary": "Execution environments serving the endpoint (`EndpointActiveEnvironments`), to compare with `maxEnvironments`."
11714
+ },
11715
+ "locationInModule": {
11716
+ "filename": "src/web-function-endpoint.ts",
11717
+ "line": 402
11718
+ },
11719
+ "name": "metricActiveEnvironments",
11720
+ "parameters": [
11721
+ {
11722
+ "name": "props",
11723
+ "optional": true,
11724
+ "type": {
11725
+ "fqn": "aws-cdk-lib.aws_cloudwatch.MetricOptions"
11726
+ }
11727
+ }
11728
+ ],
11729
+ "returns": {
11730
+ "type": {
11731
+ "fqn": "aws-cdk-lib.aws_cloudwatch.Metric"
11732
+ }
11733
+ }
11734
+ },
11735
+ {
11736
+ "docs": {
11737
+ "remarks": "periods with no 4XX count as 0).",
11738
+ "stability": "experimental",
11739
+ "summary": "The percentage of requests answered with a 4XX status (math expression;"
11740
+ },
11741
+ "locationInModule": {
11742
+ "filename": "src/web-function-endpoint.ts",
11743
+ "line": 388
11744
+ },
11745
+ "name": "metricClientErrorRate",
11746
+ "parameters": [
11747
+ {
11748
+ "name": "props",
11749
+ "optional": true,
11750
+ "type": {
11751
+ "fqn": "aws-cdk-lib.aws_cloudwatch.MetricOptions"
11752
+ }
11753
+ }
11754
+ ],
11755
+ "returns": {
11756
+ "type": {
11757
+ "fqn": "aws-cdk-lib.aws_cloudwatch.MathExpression"
11758
+ }
11759
+ }
11760
+ },
11761
+ {
11762
+ "docs": {
11763
+ "remarks": "The metric only exists once it's non-zero, so alarms should treat missing data as not breaching.",
11764
+ "stability": "experimental",
11765
+ "summary": "Requests answered with a 4XX status (`HTTPResponseStatusClass4XX`), including 429s from `rateLimit` and `maxEnvironments`."
11766
+ },
11767
+ "locationInModule": {
11768
+ "filename": "src/web-function-endpoint.ts",
11769
+ "line": 375
11770
+ },
11771
+ "name": "metricClientErrors",
11772
+ "parameters": [
11773
+ {
11774
+ "name": "props",
11775
+ "optional": true,
11776
+ "type": {
11777
+ "fqn": "aws-cdk-lib.aws_cloudwatch.MetricOptions"
11778
+ }
11779
+ }
11780
+ ],
11781
+ "returns": {
11782
+ "type": {
11783
+ "fqn": "aws-cdk-lib.aws_cloudwatch.Metric"
11784
+ }
11785
+ }
11786
+ },
11787
+ {
10852
11788
  "docs": {
10853
- "default": "- no alarms: traffic moves on a timer",
10854
- "remarks": "They're checked before traffic moves, during the bake, and once the new revision has all traffic.\nUse alarms in any region (by ARN), including composite alarms.",
10855
11789
  "stability": "experimental",
10856
- "summary": "Alarms that stop the deployment: if one is in ALARM, the endpoint goes back to the previous revision and the deployment fails, so CloudFormation rolls the stack back."
11790
+ "summary": "Requests rejected with 429 because the endpoint reached `maxEnvironments` (`EndpointActiveEnvironmentThrottles`)."
10857
11791
  },
10858
- "immutable": true,
10859
11792
  "locationInModule": {
10860
- "filename": "src/web-function-deployment.ts",
10861
- "line": 33
11793
+ "filename": "src/web-function-endpoint.ts",
11794
+ "line": 412
10862
11795
  },
10863
- "name": "alarms",
10864
- "optional": true,
10865
- "type": {
10866
- "collection": {
10867
- "elementtype": {
10868
- "fqn": "aws-cdk-lib.aws_cloudwatch.IAlarm"
10869
- },
10870
- "kind": "array"
11796
+ "name": "metricEnvironmentThrottles",
11797
+ "parameters": [
11798
+ {
11799
+ "name": "props",
11800
+ "optional": true,
11801
+ "type": {
11802
+ "fqn": "aws-cdk-lib.aws_cloudwatch.MetricOptions"
11803
+ }
11804
+ }
11805
+ ],
11806
+ "returns": {
11807
+ "type": {
11808
+ "fqn": "aws-cdk-lib.aws_cloudwatch.Metric"
10871
11809
  }
10872
11810
  }
10873
- }
10874
- ],
10875
- "symbolId": "src/web-function-deployment:WebFunctionCanaryDeploymentOptions"
10876
- },
10877
- "@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment": {
10878
- "assembly": "@ashishpandeyone/cdk-lambda-web-function",
10879
- "docs": {
10880
- "stability": "experimental",
10881
- "summary": "How an endpoint moves its traffic to a new revision."
10882
- },
10883
- "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment",
10884
- "kind": "class",
10885
- "locationInModule": {
10886
- "filename": "src/web-function-deployment.ts",
10887
- "line": 65
10888
- },
10889
- "methods": [
11811
+ },
10890
11812
  {
10891
11813
  "docs": {
11814
+ "remarks": "There's no separate count of successful (2XX) responses.",
10892
11815
  "stability": "experimental",
10893
- "summary": "All traffic moves to the new revision at once, as soon as it's ready (the default)."
11816
+ "summary": "Requests the endpoint served (`ExecutedRequests`)."
10894
11817
  },
10895
11818
  "locationInModule": {
10896
- "filename": "src/web-function-deployment.ts",
10897
- "line": 69
11819
+ "filename": "src/web-function-endpoint.ts",
11820
+ "line": 367
10898
11821
  },
10899
- "name": "allAtOnce",
11822
+ "name": "metricRequests",
11823
+ "parameters": [
11824
+ {
11825
+ "name": "props",
11826
+ "optional": true,
11827
+ "type": {
11828
+ "fqn": "aws-cdk-lib.aws_cloudwatch.MetricOptions"
11829
+ }
11830
+ }
11831
+ ],
10900
11832
  "returns": {
10901
11833
  "type": {
10902
- "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment"
11834
+ "fqn": "aws-cdk-lib.aws_cloudwatch.Metric"
10903
11835
  }
10904
- },
10905
- "static": true
11836
+ }
10906
11837
  },
10907
11838
  {
10908
11839
  "docs": {
10909
11840
  "stability": "experimental",
10910
- "summary": "The new revision first gets `percent` of the traffic for `bake`, then all of it."
11841
+ "summary": "Requests rejected with 429 because the endpoint reached its `rateLimit` (`EndpointRequestThrottles`)."
10911
11842
  },
10912
11843
  "locationInModule": {
10913
- "filename": "src/web-function-deployment.ts",
10914
- "line": 76
11844
+ "filename": "src/web-function-endpoint.ts",
11845
+ "line": 407
10915
11846
  },
10916
- "name": "canary",
11847
+ "name": "metricRequestThrottles",
10917
11848
  "parameters": [
10918
11849
  {
10919
- "name": "options",
11850
+ "name": "props",
11851
+ "optional": true,
10920
11852
  "type": {
10921
- "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionCanaryDeploymentOptions"
11853
+ "fqn": "aws-cdk-lib.aws_cloudwatch.MetricOptions"
10922
11854
  }
10923
11855
  }
10924
11856
  ],
10925
11857
  "returns": {
10926
11858
  "type": {
10927
- "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment"
11859
+ "fqn": "aws-cdk-lib.aws_cloudwatch.Metric"
10928
11860
  }
10929
- },
10930
- "static": true
11861
+ }
10931
11862
  },
10932
11863
  {
10933
11864
  "docs": {
11865
+ "remarks": "periods with no 5XX count as 0).",
10934
11866
  "stability": "experimental",
10935
- "summary": "The new revision gets `percent` more of the traffic every `interval` until it has all of it."
11867
+ "summary": "The percentage of requests answered with a 5XX status (math expression;"
10936
11868
  },
10937
11869
  "locationInModule": {
10938
- "filename": "src/web-function-deployment.ts",
10939
- "line": 85
11870
+ "filename": "src/web-function-endpoint.ts",
11871
+ "line": 393
10940
11872
  },
10941
- "name": "linear",
11873
+ "name": "metricServerErrorRate",
10942
11874
  "parameters": [
10943
11875
  {
10944
- "name": "options",
11876
+ "name": "props",
11877
+ "optional": true,
10945
11878
  "type": {
10946
- "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionLinearDeploymentOptions"
11879
+ "fqn": "aws-cdk-lib.aws_cloudwatch.MetricOptions"
10947
11880
  }
10948
11881
  }
10949
11882
  ],
10950
11883
  "returns": {
10951
11884
  "type": {
10952
- "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment"
11885
+ "fqn": "aws-cdk-lib.aws_cloudwatch.MathExpression"
10953
11886
  }
10954
- },
10955
- "static": true
10956
- }
10957
- ],
10958
- "name": "WebFunctionDeployment",
10959
- "symbolId": "src/web-function-deployment:WebFunctionDeployment"
10960
- },
10961
- "@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint": {
10962
- "assembly": "@ashishpandeyone/cdk-lambda-web-function",
10963
- "base": "constructs.Construct",
10964
- "docs": {
10965
- "remarks": "Endpoints are created only through `WebFunction`, which owns their log groups in every region, so the constructor is private.",
10966
- "stability": "experimental",
10967
- "summary": "An HTTPS endpoint of a Web Function: `fn.endpoint` (the default one) or the result of `fn.addEndpoint()`."
10968
- },
10969
- "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint",
10970
- "kind": "class",
10971
- "locationInModule": {
10972
- "filename": "src/web-function-endpoint.ts",
10973
- "line": 150
10974
- },
10975
- "methods": [
11887
+ }
11888
+ },
10976
11889
  {
10977
11890
  "docs": {
10978
- "remarks": "Shortcut for `grants.invoke(grantee)`.\n[disable-awslint:no-grants]",
11891
+ "remarks": "Includes the platform's 503s while the endpoint\nscales up for a sudden burst, not only your application's errors. The metric only exists once it's non-zero.",
10979
11892
  "stability": "experimental",
10980
- "summary": "Allows `grantee` to call this endpoint."
11893
+ "summary": "Requests answered with a 5XX status (`HTTPResponseStatusClass5XX`)."
10981
11894
  },
10982
11895
  "locationInModule": {
10983
11896
  "filename": "src/web-function-endpoint.ts",
10984
- "line": 328
11897
+ "line": 383
10985
11898
  },
10986
- "name": "grantInvoke",
11899
+ "name": "metricServerErrors",
10987
11900
  "parameters": [
10988
11901
  {
10989
- "name": "grantee",
11902
+ "name": "props",
11903
+ "optional": true,
10990
11904
  "type": {
10991
- "fqn": "aws-cdk-lib.aws_iam.IGrantable"
11905
+ "fqn": "aws-cdk-lib.aws_cloudwatch.MetricOptions"
10992
11906
  }
10993
11907
  }
10994
11908
  ],
10995
11909
  "returns": {
10996
11910
  "type": {
10997
- "fqn": "aws-cdk-lib.aws_iam.Grant"
11911
+ "fqn": "aws-cdk-lib.aws_cloudwatch.Metric"
10998
11912
  }
10999
11913
  }
11000
11914
  },
@@ -11006,7 +11920,7 @@
11006
11920
  },
11007
11921
  "locationInModule": {
11008
11922
  "filename": "src/web-function-endpoint.ts",
11009
- "line": 275
11923
+ "line": 298
11010
11924
  },
11011
11925
  "name": "regionalUrl",
11012
11926
  "parameters": [
@@ -11034,7 +11948,7 @@
11034
11948
  },
11035
11949
  "locationInModule": {
11036
11950
  "filename": "src/web-function-endpoint.ts",
11037
- "line": 303
11951
+ "line": 326
11038
11952
  },
11039
11953
  "name": "routeTraffic",
11040
11954
  "parameters": [
@@ -11069,7 +11983,7 @@
11069
11983
  "immutable": true,
11070
11984
  "locationInModule": {
11071
11985
  "filename": "src/web-function-endpoint.ts",
11072
- "line": 170
11986
+ "line": 177
11073
11987
  },
11074
11988
  "name": "authType",
11075
11989
  "type": {
@@ -11084,7 +11998,7 @@
11084
11998
  "immutable": true,
11085
11999
  "locationInModule": {
11086
12000
  "filename": "src/web-function-endpoint.ts",
11087
- "line": 178
12001
+ "line": 185
11088
12002
  },
11089
12003
  "name": "domainName",
11090
12004
  "type": {
@@ -11099,7 +12013,7 @@
11099
12013
  "immutable": true,
11100
12014
  "locationInModule": {
11101
12015
  "filename": "src/web-function-endpoint.ts",
11102
- "line": 164
12016
+ "line": 171
11103
12017
  },
11104
12018
  "name": "endpointArn",
11105
12019
  "type": {
@@ -11114,7 +12028,7 @@
11114
12028
  "immutable": true,
11115
12029
  "locationInModule": {
11116
12030
  "filename": "src/web-function-endpoint.ts",
11117
- "line": 161
12031
+ "line": 168
11118
12032
  },
11119
12033
  "name": "endpointName",
11120
12034
  "type": {
@@ -11129,7 +12043,7 @@
11129
12043
  "immutable": true,
11130
12044
  "locationInModule": {
11131
12045
  "filename": "src/web-function-endpoint.ts",
11132
- "line": 167
12046
+ "line": 174
11133
12047
  },
11134
12048
  "name": "endpointType",
11135
12049
  "type": {
@@ -11144,7 +12058,7 @@
11144
12058
  "immutable": true,
11145
12059
  "locationInModule": {
11146
12060
  "filename": "src/web-function-endpoint.ts",
11147
- "line": 186
12061
+ "line": 193
11148
12062
  },
11149
12063
  "name": "grants",
11150
12064
  "type": {
@@ -11159,7 +12073,7 @@
11159
12073
  "immutable": true,
11160
12074
  "locationInModule": {
11161
12075
  "filename": "src/web-function-endpoint.ts",
11162
- "line": 173
12076
+ "line": 180
11163
12077
  },
11164
12078
  "name": "regions",
11165
12079
  "type": {
@@ -11171,6 +12085,27 @@
11171
12085
  }
11172
12086
  }
11173
12087
  },
12088
+ {
12089
+ "docs": {
12090
+ "remarks": "Empty without `rollbackOn`.",
12091
+ "stability": "experimental",
12092
+ "summary": "The alarms this endpoint created for its deployment's `rollbackOn`, one per threshold in every region it serves from (the home region's first)."
12093
+ },
12094
+ "immutable": true,
12095
+ "locationInModule": {
12096
+ "filename": "src/web-function-endpoint.ts",
12097
+ "line": 199
12098
+ },
12099
+ "name": "rollbackAlarms",
12100
+ "type": {
12101
+ "collection": {
12102
+ "elementtype": {
12103
+ "fqn": "aws-cdk-lib.aws_cloudwatch.IAlarm"
12104
+ },
12105
+ "kind": "array"
12106
+ }
12107
+ }
12108
+ },
11174
12109
  {
11175
12110
  "docs": {
11176
12111
  "stability": "experimental",
@@ -11179,7 +12114,7 @@
11179
12114
  "immutable": true,
11180
12115
  "locationInModule": {
11181
12116
  "filename": "src/web-function-endpoint.ts",
11182
- "line": 183
12117
+ "line": 190
11183
12118
  },
11184
12119
  "name": "url",
11185
12120
  "type": {
@@ -11200,7 +12135,7 @@
11200
12135
  "kind": "interface",
11201
12136
  "locationInModule": {
11202
12137
  "filename": "src/web-function-endpoint.ts",
11203
- "line": 32
12138
+ "line": 39
11204
12139
  },
11205
12140
  "name": "WebFunctionEndpointOptions",
11206
12141
  "properties": [
@@ -11215,7 +12150,7 @@
11215
12150
  "immutable": true,
11216
12151
  "locationInModule": {
11217
12152
  "filename": "src/web-function-endpoint.ts",
11218
- "line": 99
12153
+ "line": 106
11219
12154
  },
11220
12155
  "name": "deployment",
11221
12156
  "optional": true,
@@ -11233,7 +12168,7 @@
11233
12168
  "immutable": true,
11234
12169
  "locationInModule": {
11235
12170
  "filename": "src/web-function-endpoint.ts",
11236
- "line": 68
12171
+ "line": 75
11237
12172
  },
11238
12173
  "name": "description",
11239
12174
  "optional": true,
@@ -11252,7 +12187,7 @@
11252
12187
  "immutable": true,
11253
12188
  "locationInModule": {
11254
12189
  "filename": "src/web-function-endpoint.ts",
11255
- "line": 61
12190
+ "line": 68
11256
12191
  },
11257
12192
  "name": "endpointName",
11258
12193
  "optional": true,
@@ -11270,7 +12205,7 @@
11270
12205
  "immutable": true,
11271
12206
  "locationInModule": {
11272
12207
  "filename": "src/web-function-endpoint.ts",
11273
- "line": 38
12208
+ "line": 45
11274
12209
  },
11275
12210
  "name": "endpointType",
11276
12211
  "optional": true,
@@ -11289,7 +12224,7 @@
11289
12224
  "immutable": true,
11290
12225
  "locationInModule": {
11291
12226
  "filename": "src/web-function-endpoint.ts",
11292
- "line": 88
12227
+ "line": 95
11293
12228
  },
11294
12229
  "name": "maxEnvironments",
11295
12230
  "optional": true,
@@ -11308,7 +12243,7 @@
11308
12243
  "immutable": true,
11309
12244
  "locationInModule": {
11310
12245
  "filename": "src/web-function-endpoint.ts",
11311
- "line": 79
12246
+ "line": 86
11312
12247
  },
11313
12248
  "name": "rateLimit",
11314
12249
  "optional": true,
@@ -11327,7 +12262,7 @@
11327
12262
  "immutable": true,
11328
12263
  "locationInModule": {
11329
12264
  "filename": "src/web-function-endpoint.ts",
11330
- "line": 48
12265
+ "line": 55
11331
12266
  },
11332
12267
  "name": "regions",
11333
12268
  "optional": true,
@@ -11403,7 +12338,7 @@
11403
12338
  },
11404
12339
  "locationInModule": {
11405
12340
  "filename": "src/web-function-grants.ts",
11406
- "line": 23
12341
+ "line": 32
11407
12342
  },
11408
12343
  "name": "invoke",
11409
12344
  "parameters": [
@@ -11435,7 +12370,7 @@
11435
12370
  "kind": "interface",
11436
12371
  "locationInModule": {
11437
12372
  "filename": "src/web-function-deployment.ts",
11438
- "line": 39
12373
+ "line": 96
11439
12374
  },
11440
12375
  "name": "WebFunctionLinearDeploymentOptions",
11441
12376
  "properties": [
@@ -11448,7 +12383,7 @@
11448
12383
  "immutable": true,
11449
12384
  "locationInModule": {
11450
12385
  "filename": "src/web-function-deployment.ts",
11451
- "line": 48
12386
+ "line": 105
11452
12387
  },
11453
12388
  "name": "interval",
11454
12389
  "type": {
@@ -11464,7 +12399,7 @@
11464
12399
  "immutable": true,
11465
12400
  "locationInModule": {
11466
12401
  "filename": "src/web-function-deployment.ts",
11467
- "line": 43
12402
+ "line": 100
11468
12403
  },
11469
12404
  "name": "percent",
11470
12405
  "type": {
@@ -11482,7 +12417,7 @@
11482
12417
  "immutable": true,
11483
12418
  "locationInModule": {
11484
12419
  "filename": "src/web-function-deployment.ts",
11485
- "line": 59
12420
+ "line": 116
11486
12421
  },
11487
12422
  "name": "alarms",
11488
12423
  "optional": true,
@@ -11494,6 +12429,25 @@
11494
12429
  "kind": "array"
11495
12430
  }
11496
12431
  }
12432
+ },
12433
+ {
12434
+ "abstract": true,
12435
+ "docs": {
12436
+ "default": "- no endpoint alarms",
12437
+ "remarks": "They stop the deployment like `alarms` (both can be used together).",
12438
+ "stability": "experimental",
12439
+ "summary": "Alarms on the endpoint's own error rates, created by the endpoint in every region it serves from."
12440
+ },
12441
+ "immutable": true,
12442
+ "locationInModule": {
12443
+ "filename": "src/web-function-deployment.ts",
12444
+ "line": 124
12445
+ },
12446
+ "name": "rollbackOn",
12447
+ "optional": true,
12448
+ "type": {
12449
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionRollbackOptions"
12450
+ }
11497
12451
  }
11498
12452
  ],
11499
12453
  "symbolId": "src/web-function-deployment:WebFunctionLinearDeploymentOptions"
@@ -11509,7 +12463,7 @@
11509
12463
  "kind": "interface",
11510
12464
  "locationInModule": {
11511
12465
  "filename": "src/web-function.ts",
11512
- "line": 21
12466
+ "line": 23
11513
12467
  },
11514
12468
  "name": "WebFunctionOptions",
11515
12469
  "properties": [
@@ -11522,7 +12476,7 @@
11522
12476
  "immutable": true,
11523
12477
  "locationInModule": {
11524
12478
  "filename": "src/web-function.ts",
11525
- "line": 25
12479
+ "line": 27
11526
12480
  },
11527
12481
  "name": "authType",
11528
12482
  "type": {
@@ -11539,7 +12493,7 @@
11539
12493
  "immutable": true,
11540
12494
  "locationInModule": {
11541
12495
  "filename": "src/web-function.ts",
11542
- "line": 114
12496
+ "line": 116
11543
12497
  },
11544
12498
  "name": "applicationLogLevelV2",
11545
12499
  "optional": true,
@@ -11557,7 +12511,7 @@
11557
12511
  "immutable": true,
11558
12512
  "locationInModule": {
11559
12513
  "filename": "src/web-function.ts",
11560
- "line": 60
12514
+ "line": 62
11561
12515
  },
11562
12516
  "name": "description",
11563
12517
  "optional": true,
@@ -11575,7 +12529,7 @@
11575
12529
  "immutable": true,
11576
12530
  "locationInModule": {
11577
12531
  "filename": "src/web-function.ts",
11578
- "line": 34
12532
+ "line": 36
11579
12533
  },
11580
12534
  "name": "endpoint",
11581
12535
  "optional": true,
@@ -11594,7 +12548,7 @@
11594
12548
  "immutable": true,
11595
12549
  "locationInModule": {
11596
12550
  "filename": "src/web-function.ts",
11597
- "line": 77
12551
+ "line": 79
11598
12552
  },
11599
12553
  "name": "environment",
11600
12554
  "optional": true,
@@ -11618,7 +12572,7 @@
11618
12572
  "immutable": true,
11619
12573
  "locationInModule": {
11620
12574
  "filename": "src/web-function.ts",
11621
- "line": 107
12575
+ "line": 109
11622
12576
  },
11623
12577
  "name": "logRemovalPolicy",
11624
12578
  "optional": true,
@@ -11636,7 +12590,7 @@
11636
12590
  "immutable": true,
11637
12591
  "locationInModule": {
11638
12592
  "filename": "src/web-function.ts",
11639
- "line": 99
12593
+ "line": 101
11640
12594
  },
11641
12595
  "name": "logRetention",
11642
12596
  "optional": true,
@@ -11655,7 +12609,7 @@
11655
12609
  "immutable": true,
11656
12610
  "locationInModule": {
11657
12611
  "filename": "src/web-function.ts",
11658
- "line": 92
12612
+ "line": 94
11659
12613
  },
11660
12614
  "name": "maxConcurrencyPerEnvironment",
11661
12615
  "optional": true,
@@ -11674,7 +12628,7 @@
11674
12628
  "immutable": true,
11675
12629
  "locationInModule": {
11676
12630
  "filename": "src/web-function.ts",
11677
- "line": 46
12631
+ "line": 48
11678
12632
  },
11679
12633
  "name": "revisionRetention",
11680
12634
  "optional": true,
@@ -11693,7 +12647,7 @@
11693
12647
  "immutable": true,
11694
12648
  "locationInModule": {
11695
12649
  "filename": "src/web-function.ts",
11696
- "line": 70
12650
+ "line": 72
11697
12651
  },
11698
12652
  "name": "role",
11699
12653
  "optional": true,
@@ -11711,7 +12665,7 @@
11711
12665
  "immutable": true,
11712
12666
  "locationInModule": {
11713
12667
  "filename": "src/web-function.ts",
11714
- "line": 121
12668
+ "line": 123
11715
12669
  },
11716
12670
  "name": "systemLogLevelV2",
11717
12671
  "optional": true,
@@ -11729,7 +12683,7 @@
11729
12683
  "immutable": true,
11730
12684
  "locationInModule": {
11731
12685
  "filename": "src/web-function.ts",
11732
- "line": 84
12686
+ "line": 86
11733
12687
  },
11734
12688
  "name": "timeout",
11735
12689
  "optional": true,
@@ -11748,7 +12702,7 @@
11748
12702
  "immutable": true,
11749
12703
  "locationInModule": {
11750
12704
  "filename": "src/web-function.ts",
11751
- "line": 53
12705
+ "line": 55
11752
12706
  },
11753
12707
  "name": "webFunctionName",
11754
12708
  "optional": true,
@@ -11773,7 +12727,7 @@
11773
12727
  "kind": "interface",
11774
12728
  "locationInModule": {
11775
12729
  "filename": "src/web-function.ts",
11776
- "line": 127
12730
+ "line": 129
11777
12731
  },
11778
12732
  "name": "WebFunctionProps",
11779
12733
  "properties": [
@@ -11787,7 +12741,7 @@
11787
12741
  "immutable": true,
11788
12742
  "locationInModule": {
11789
12743
  "filename": "src/web-function.ts",
11790
- "line": 139
12744
+ "line": 141
11791
12745
  },
11792
12746
  "name": "code",
11793
12747
  "type": {
@@ -11803,7 +12757,7 @@
11803
12757
  "immutable": true,
11804
12758
  "locationInModule": {
11805
12759
  "filename": "src/web-function.ts",
11806
- "line": 131
12760
+ "line": 133
11807
12761
  },
11808
12762
  "name": "runtime",
11809
12763
  "type": {
@@ -11820,7 +12774,7 @@
11820
12774
  "immutable": true,
11821
12775
  "locationInModule": {
11822
12776
  "filename": "src/web-function.ts",
11823
- "line": 146
12777
+ "line": 148
11824
12778
  },
11825
12779
  "name": "entrypoint",
11826
12780
  "optional": true,
@@ -12001,7 +12955,7 @@
12001
12955
  "kind": "interface",
12002
12956
  "locationInModule": {
12003
12957
  "filename": "src/web-function-endpoint.ts",
12004
- "line": 18
12958
+ "line": 25
12005
12959
  },
12006
12960
  "name": "WebFunctionRevisionWeight",
12007
12961
  "properties": [
@@ -12014,7 +12968,7 @@
12014
12968
  "immutable": true,
12015
12969
  "locationInModule": {
12016
12970
  "filename": "src/web-function-endpoint.ts",
12017
- "line": 20
12971
+ "line": 27
12018
12972
  },
12019
12973
  "name": "revision",
12020
12974
  "type": {
@@ -12030,7 +12984,7 @@
12030
12984
  "immutable": true,
12031
12985
  "locationInModule": {
12032
12986
  "filename": "src/web-function-endpoint.ts",
12033
- "line": 26
12987
+ "line": 33
12034
12988
  },
12035
12989
  "name": "weight",
12036
12990
  "type": {
@@ -12039,8 +12993,119 @@
12039
12993
  }
12040
12994
  ],
12041
12995
  "symbolId": "src/web-function-endpoint:WebFunctionRevisionWeight"
12996
+ },
12997
+ "@ashishpandeyone/cdk-lambda-web-function.WebFunctionRollbackOptions": {
12998
+ "assembly": "@ashishpandeyone/cdk-lambda-web-function",
12999
+ "datatype": true,
13000
+ "docs": {
13001
+ "remarks": "The endpoint creates one alarm per threshold in every region it serves from (metrics are published\nin the region that served the request, and an alarm can only watch metrics in its own region).\nLambda Web Function metrics have no revision dimension, so the alarms watch the whole endpoint: while\nthe new revision gets 10% of the traffic, its errors are about a tenth of the endpoint's.",
13002
+ "stability": "experimental",
13003
+ "summary": "Alarms an endpoint creates on its own metrics to stop a canary or linear deployment."
13004
+ },
13005
+ "fqn": "@ashishpandeyone/cdk-lambda-web-function.WebFunctionRollbackOptions",
13006
+ "kind": "interface",
13007
+ "locationInModule": {
13008
+ "filename": "src/web-function-deployment.ts",
13009
+ "line": 18
13010
+ },
13011
+ "name": "WebFunctionRollbackOptions",
13012
+ "properties": [
13013
+ {
13014
+ "abstract": true,
13015
+ "docs": {
13016
+ "default": "- no client error alarm",
13017
+ "remarks": "Requests over `rateLimit` or `maxEnvironments` get 429, which counts here.",
13018
+ "stability": "experimental",
13019
+ "summary": "Roll back when more than this percent of the endpoint's requests get a 4XX response (0-100)."
13020
+ },
13021
+ "immutable": true,
13022
+ "locationInModule": {
13023
+ "filename": "src/web-function-deployment.ts",
13024
+ "line": 34
13025
+ },
13026
+ "name": "clientErrorRate",
13027
+ "optional": true,
13028
+ "type": {
13029
+ "primitive": "number"
13030
+ }
13031
+ },
13032
+ {
13033
+ "abstract": true,
13034
+ "docs": {
13035
+ "default": "2",
13036
+ "stability": "experimental",
13037
+ "summary": "How many consecutive periods must breach a threshold before the deployment rolls back."
13038
+ },
13039
+ "immutable": true,
13040
+ "locationInModule": {
13041
+ "filename": "src/web-function-deployment.ts",
13042
+ "line": 55
13043
+ },
13044
+ "name": "evaluationPeriods",
13045
+ "optional": true,
13046
+ "type": {
13047
+ "primitive": "number"
13048
+ }
13049
+ },
13050
+ {
13051
+ "abstract": true,
13052
+ "docs": {
13053
+ "default": "10",
13054
+ "stability": "experimental",
13055
+ "summary": "Periods with fewer requests than this don't count, so one failed request out of two doesn't roll back."
13056
+ },
13057
+ "immutable": true,
13058
+ "locationInModule": {
13059
+ "filename": "src/web-function-deployment.ts",
13060
+ "line": 41
13061
+ },
13062
+ "name": "minimumRequests",
13063
+ "optional": true,
13064
+ "type": {
13065
+ "primitive": "number"
13066
+ }
13067
+ },
13068
+ {
13069
+ "abstract": true,
13070
+ "docs": {
13071
+ "default": "Duration.minutes(1)",
13072
+ "stability": "experimental",
13073
+ "summary": "The period each rate is measured over (at least 1 minute, in whole minutes)."
13074
+ },
13075
+ "immutable": true,
13076
+ "locationInModule": {
13077
+ "filename": "src/web-function-deployment.ts",
13078
+ "line": 48
13079
+ },
13080
+ "name": "period",
13081
+ "optional": true,
13082
+ "type": {
13083
+ "fqn": "aws-cdk-lib.Duration"
13084
+ }
13085
+ },
13086
+ {
13087
+ "abstract": true,
13088
+ "docs": {
13089
+ "default": "- no server error alarm",
13090
+ "remarks": "5XX includes the platform's 503s while an endpoint scales up for a sudden burst, not only your application's errors.",
13091
+ "stability": "experimental",
13092
+ "summary": "Roll back when more than this percent of the endpoint's requests get a 5XX response (0-100)."
13093
+ },
13094
+ "immutable": true,
13095
+ "locationInModule": {
13096
+ "filename": "src/web-function-deployment.ts",
13097
+ "line": 26
13098
+ },
13099
+ "name": "serverErrorRate",
13100
+ "optional": true,
13101
+ "type": {
13102
+ "primitive": "number"
13103
+ }
13104
+ }
13105
+ ],
13106
+ "symbolId": "src/web-function-deployment:WebFunctionRollbackOptions"
12042
13107
  }
12043
13108
  },
12044
- "version": "0.1.2",
12045
- "fingerprint": "klXX+MmGau/7IlYuQHB50VIISLQsvsWWTDfCXLEc9FQ="
13109
+ "version": "0.1.4",
13110
+ "fingerprint": "jD4b9T+QRqWU7bgpwm773YKwDrQpiy3PKVU2Zby8LP8="
12046
13111
  }