@ashishpandeyone/cdk-lambda-web-function 0.1.11 → 0.1.13
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 +125 -62
- package/.jsii.tabl.json +1 -1
- package/API.md +129 -0
- package/README.md +29 -0
- package/assets/web-function-provider/index.js +19 -19
- package/lib/nodejs-web-function.js +1 -1
- package/lib/private/log-group.d.ts +2 -0
- package/lib/private/log-group.js +11 -2
- package/lib/private/provider-protocol.d.ts +2 -0
- package/lib/private/provider-protocol.js +1 -1
- package/lib/private/provider.js +2 -2
- package/lib/web-function-deployment.js +1 -1
- package/lib/web-function-endpoint.js +1 -1
- package/lib/web-function-grants.js +1 -1
- package/lib/web-function-origin.js +1 -1
- package/lib/web-function-revision.js +1 -1
- package/lib/web-function.d.ts +29 -0
- package/lib/web-function.js +55 -4
- package/package.json +1 -1
package/.jsii.tabl.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"2","toolVersion":"6.0.19","snippets":{"b722e8cfc284c4ad172d3c0845a1e12986655461f32df0e464aeccc8774b0a91":{"translations":{"python":{"source":"from ashishpandeyone.cdk_lambda_web_function import WebFunctionEndpointOptions\nimport aws_cdk.aws_lambda as lambda_\nfrom ashishpandeyone.cdk_lambda_web_function import WebFunction, WebFunctionAuthType, WebFunctionEndpointType\n\n\nfn = WebFunction(self, \"Api\",\n runtime=lambda_.Runtime.NODEJS_24_X,\n code=lambda_.Code.from_asset(\"dist\"),\n auth_type=WebFunctionAuthType.AWS_IAM,\n endpoint=WebFunctionEndpointOptions(\n endpoint_type=WebFunctionEndpointType.MULTI_REGION,\n regions=[\"us-east-1\", \"eu-west-1\"]\n )\n)\n\nCfnOutput(self, \"Url\", value=fn.endpoint.url)","version":"2"},"csharp":{"source":"using Amazon.CDK.AWS.Lambda;\nusing Ashishpandeyone.Cdk.Lambda.Web.Function;\n\n\nvar fn = new WebFunction(this, \"Api\", new WebFunctionProps {\n Runtime = Runtime.NODEJS_24_X,\n Code = Code.FromAsset(\"dist\"),\n AuthType = WebFunctionAuthType.AWS_IAM,\n Endpoint = new WebFunctionEndpointOptions {\n EndpointType = WebFunctionEndpointType.MULTI_REGION,\n Regions = new [] { \"us-east-1\", \"eu-west-1\" }\n }\n});\n\nnew CfnOutput(this, \"Url\", new CfnOutputProps { Value = fn.Endpoint.Url });","version":"2"},"java":{"source":"import software.amazon.awscdk.services.lambda.*;\nimport ashishpandeyone.cdk.lambda.web.function.WebFunction;\nimport ashishpandeyone.cdk.lambda.web.function.WebFunctionAuthType;\nimport ashishpandeyone.cdk.lambda.web.function.WebFunctionEndpointType;\n\n\nWebFunction fn = WebFunction.Builder.create(this, \"Api\")\n .runtime(Runtime.NODEJS_24_X)\n .code(Code.fromAsset(\"dist\"))\n .authType(WebFunctionAuthType.AWS_IAM)\n .endpoint(WebFunctionEndpointOptions.builder()\n .endpointType(WebFunctionEndpointType.MULTI_REGION)\n .regions(List.of(\"us-east-1\", \"eu-west-1\"))\n .build())\n .build();\n\nCfnOutput.Builder.create(this, \"Url\").value(fn.getEndpoint().getUrl()).build();","version":"1"},"go":{"source":"import \"github.com/aws/aws-cdk-go/awscdk\"\nimport \"github.com/aws-samples/dummy/ashishpandeyonecdklambdawebfunction\"\n\n\nfn := ashishpandeyonecdklambdawebfunction.NewWebFunction(this, jsii.String(\"Api\"), &WebFunctionProps{\n\tRuntime: lambda.Runtime_NODEJS_24_X(),\n\tCode: lambda.Code_FromAsset(jsii.String(\"dist\")),\n\tAuthType: *ashishpandeyonecdklambdawebfunction.WebFunctionAuthType_AWS_IAM,\n\tEndpoint: &WebFunctionEndpointOptions{\n\t\tEndpointType: *ashishpandeyonecdklambdawebfunction.WebFunctionEndpointType_MULTI_REGION,\n\t\tRegions: []*string{\n\t\t\tjsii.String(\"us-east-1\"),\n\t\t\tjsii.String(\"eu-west-1\"),\n\t\t},\n\t},\n})\n\nawscdk.NewCfnOutput(this, jsii.String(\"Url\"), &CfnOutputProps{\n\tValue: fn.Endpoint.Url,\n})","version":"2"},"$":{"source":"import * 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","version":"0"}},"location":{"api":{"api":"moduleReadme","moduleFqn":"@ashishpandeyone/cdk-lambda-web-function"},"field":{"field":"markdown","line":21}},"didCompile":true,"fqnsReferenced":["@ashishpandeyone/cdk-lambda-web-function.WebFunction","@ashishpandeyone/cdk-lambda-web-function.WebFunction#endpoint","@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType","@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType#AWS_IAM","@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint#url","@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions","@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointType","@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointType#MULTI_REGION","@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps","aws-cdk-lib.CfnOutput","aws-cdk-lib.CfnOutputProps","aws-cdk-lib.aws_lambda.Code","aws-cdk-lib.aws_lambda.Code#fromAsset","aws-cdk-lib.aws_lambda.Runtime","aws-cdk-lib.aws_lambda.Runtime#NODEJS_24_X","constructs.Construct"],"fullSource":"// Hoisted imports begin after !show marker below\n/// !show\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\nimport { WebFunction, WebFunctionAuthType, WebFunctionEndpointType } from '@ashishpandeyone/cdk-lambda-web-function';\n/// !hide\n// Hoisted imports ended before !hide marker above\n// Fixture for examples that show their own imports.\nimport { Construct } from 'constructs';\nimport { CfnOutput, Stack } from 'aws-cdk-lib';\n\nclass Fixture extends Stack {\n constructor(scope: Construct, id: string) {\n super(scope, id);\n\n // Code snippet begins after !show marker below\n/// !show\n\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 });\n/// !hide\n// Code snippet ended before !hide marker above\n }\n}\n","syntaxKindCounter":{"11":7,"80":27,"110":2,"210":1,"211":3,"212":8,"214":1,"215":2,"244":1,"245":1,"261":1,"262":1,"273":2,"274":2,"275":1,"276":1,"277":3,"304":7,"308":1},"fqnsFingerprint":"384a56f11539838f6a8ab522060646f388d7d70aa646236c624ffbc0d91ade7a"},"bb3f6414fcc3c98134fd029d5100626c240c5a2a293b9cac8457e3ad6fabedfe":{"translations":{"python":{"source":"from ashishpandeyone.cdk_lambda_web_function import WebFunctionEndpointOptions\nper_region = WebFunction(self, \"Api\",\n runtime=lambda_.Runtime.NODEJS_24_X,\n code=lambda_.Code.from_asset(\"dist\"),\n auth_type=WebFunctionAuthType.AWS_IAM,\n endpoint=WebFunctionEndpointOptions(\n endpoint_type=WebFunctionEndpointType.PER_REGION,\n regions=[\"us-east-1\", \"eu-west-1\"]\n )\n)\n\nCfnOutput(self, \"UsEast1Url\", value=per_region.endpoint.regional_url(\"us-east-1\"))","version":"2"},"csharp":{"source":"var perRegion = new WebFunction(this, \"Api\", new WebFunctionProps {\n Runtime = Runtime.NODEJS_24_X,\n Code = Code.FromAsset(\"dist\"),\n AuthType = WebFunctionAuthType.AWS_IAM,\n Endpoint = new WebFunctionEndpointOptions {\n EndpointType = WebFunctionEndpointType.PER_REGION,\n Regions = new [] { \"us-east-1\", \"eu-west-1\" }\n }\n});\n\nnew CfnOutput(this, \"UsEast1Url\", new CfnOutputProps { Value = perRegion.Endpoint.RegionalUrl(\"us-east-1\") });","version":"2"},"java":{"source":"WebFunction perRegion = WebFunction.Builder.create(this, \"Api\")\n .runtime(Runtime.NODEJS_24_X)\n .code(Code.fromAsset(\"dist\"))\n .authType(WebFunctionAuthType.AWS_IAM)\n .endpoint(WebFunctionEndpointOptions.builder()\n .endpointType(WebFunctionEndpointType.PER_REGION)\n .regions(List.of(\"us-east-1\", \"eu-west-1\"))\n .build())\n .build();\n\nCfnOutput.Builder.create(this, \"UsEast1Url\").value(perRegion.endpoint.regionalUrl(\"us-east-1\")).build();","version":"1"},"go":{"source":"perRegion := ashishpandeyonecdklambdawebfunction.NewWebFunction(this, jsii.String(\"Api\"), &WebFunctionProps{\n\tRuntime: lambda.Runtime_NODEJS_24_X(),\n\tCode: lambda.Code_FromAsset(jsii.String(\"dist\")),\n\tAuthType: *ashishpandeyonecdklambdawebfunction.WebFunctionAuthType_AWS_IAM,\n\tEndpoint: &WebFunctionEndpointOptions{\n\t\tEndpointType: *ashishpandeyonecdklambdawebfunction.WebFunctionEndpointType_PER_REGION,\n\t\tRegions: []*string{\n\t\t\tjsii.String(\"us-east-1\"),\n\t\t\tjsii.String(\"eu-west-1\"),\n\t\t},\n\t},\n})\n\nawscdk.NewCfnOutput(this, jsii.String(\"UsEast1Url\"), &CfnOutputProps{\n\tValue: perRegion.Endpoint.RegionalUrl(jsii.String(\"us-east-1\")),\n})","version":"2"},"$":{"source":"const 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']","version":"0"}},"location":{"api":{"api":"moduleReadme","moduleFqn":"@ashishpandeyone/cdk-lambda-web-function"},"field":{"field":"markdown","line":78}},"didCompile":true,"fqnsReferenced":["@ashishpandeyone/cdk-lambda-web-function.WebFunction","@ashishpandeyone/cdk-lambda-web-function.WebFunction#endpoint","@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType","@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType#AWS_IAM","@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint#regionalUrl","@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions","@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointType","@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointType#PER_REGION","@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps","aws-cdk-lib.CfnOutput","aws-cdk-lib.CfnOutputProps","aws-cdk-lib.aws_lambda.Code","aws-cdk-lib.aws_lambda.Code#fromAsset","aws-cdk-lib.aws_lambda.Runtime","aws-cdk-lib.aws_lambda.Runtime#NODEJS_24_X","constructs.Construct"],"fullSource":"// Fixture for README examples: imports and a few declared values; the example replaces \"/// here\".\nimport { CfnOutput, CfnResource, Duration, type IPropertyInjector, PropertyInjectors, RemovalPolicy, Stack } from 'aws-cdk-lib';\nimport * as cloudfront from 'aws-cdk-lib/aws-cloudfront';\nimport * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';\nimport * as dynamodb from 'aws-cdk-lib/aws-dynamodb';\nimport * as iam from 'aws-cdk-lib/aws-iam';\nimport * as kms from 'aws-cdk-lib/aws-kms';\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\nimport * as lambdaNodejs from 'aws-cdk-lib/aws-lambda-nodejs';\nimport * as logs from 'aws-cdk-lib/aws-logs';\nimport { Construct } from 'constructs';\nimport {\n NodejsWebFunction, WebFunction, WebFunctionAuthType, WebFunctionDeployment, WebFunctionEndpointType, WebFunctionOrigin, WebFunctionRevision,\n type WebFunctionProps,\n} from '@ashishpandeyone/cdk-lambda-web-function';\n\ndeclare const fn: WebFunction;\ndeclare const table: dynamodb.Table;\ndeclare const consumerRole: iam.IRole;\ndeclare const errorRate: cloudwatch.IAlarm;\n\nclass Fixture extends Stack {\n constructor(scope: Construct, id: string) {\n super(scope, id);\n\n // Code snippet begins after !show marker below\n/// !show\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/// !hide\n// Code snippet ended before !hide marker above\n }\n}\n","syntaxKindCounter":{"11":6,"80":23,"110":2,"210":1,"211":3,"212":8,"214":2,"215":2,"244":1,"245":1,"261":1,"262":1,"304":7},"fqnsFingerprint":"627fbf8a351baf6916db2a33dd31cc6a7651e9bd8e613e10420ae53ccd553b3a"},"076f6a80f55cad4801faa6bdc51de62d91e952006fd82731ca584333919e5c46":{"translations":{"python":{"source":"from ashishpandeyone.cdk_lambda_web_function import WebFunctionEndpointOptions\napi = WebFunction(self, \"Api\",\n runtime=lambda_.Runtime.NODEJS_24_X,\n code=lambda_.Code.from_asset(\"dist\"),\n auth_type=WebFunctionAuthType.NONE, # the default endpoint is public\n endpoint=WebFunctionEndpointOptions(rate_limit=1000)\n)\n\ninternal = api.add_endpoint(\"Internal\",\n auth_type=WebFunctionAuthType.AWS_IAM,\n endpoint_type=WebFunctionEndpointType.MULTI_REGION,\n regions=[\"us-east-1\", \"eu-west-1\"],\n description=\"Service-to-service traffic\",\n max_environments=50\n)\ninternal.grant_invoke(consumer_role)\nCfnOutput(self, \"InternalUrl\", value=internal.url)","version":"2"},"csharp":{"source":"var api = new WebFunction(this, \"Api\", new WebFunctionProps {\n Runtime = Runtime.NODEJS_24_X,\n Code = Code.FromAsset(\"dist\"),\n AuthType = WebFunctionAuthType.NONE, // the default endpoint is public\n Endpoint = new WebFunctionEndpointOptions { RateLimit = 1000 }\n});\n\nvar internal = api.AddEndpoint(\"Internal\", new AddWebFunctionEndpointOptions {\n AuthType = WebFunctionAuthType.AWS_IAM,\n EndpointType = WebFunctionEndpointType.MULTI_REGION,\n Regions = new [] { \"us-east-1\", \"eu-west-1\" },\n Description = \"Service-to-service traffic\",\n MaxEnvironments = 50\n});\ninternal.GrantInvoke(consumerRole);\nnew CfnOutput(this, \"InternalUrl\", new CfnOutputProps { Value = internal.Url });","version":"2"},"java":{"source":"WebFunction api = WebFunction.Builder.create(this, \"Api\")\n .runtime(Runtime.NODEJS_24_X)\n .code(Code.fromAsset(\"dist\"))\n .authType(WebFunctionAuthType.NONE) // the default endpoint is public\n .endpoint(WebFunctionEndpointOptions.builder().rateLimit(1000).build())\n .build();\n\nWebFunctionEndpoint internal = api.addEndpoint(\"Internal\", AddWebFunctionEndpointOptions.builder()\n .authType(WebFunctionAuthType.AWS_IAM)\n .endpointType(WebFunctionEndpointType.MULTI_REGION)\n .regions(List.of(\"us-east-1\", \"eu-west-1\"))\n .description(\"Service-to-service traffic\")\n .maxEnvironments(50)\n .build());\ninternal.grantInvoke(consumerRole);\nCfnOutput.Builder.create(this, \"InternalUrl\").value(internal.getUrl()).build();","version":"1"},"go":{"source":"api := ashishpandeyonecdklambdawebfunction.NewWebFunction(this, jsii.String(\"Api\"), &WebFunctionProps{\n\tRuntime: lambda.Runtime_NODEJS_24_X(),\n\tCode: lambda.Code_FromAsset(jsii.String(\"dist\")),\n\tAuthType: *ashishpandeyonecdklambdawebfunction.WebFunctionAuthType_NONE,\n\t // the default endpoint is public\n\tEndpoint: &WebFunctionEndpointOptions{\n\t\tRateLimit: jsii.Number(1000),\n\t},\n})\n\ninternal := api.AddEndpoint(jsii.String(\"Internal\"), &AddWebFunctionEndpointOptions{\n\tAuthType: *ashishpandeyonecdklambdawebfunction.WebFunctionAuthType_AWS_IAM,\n\tEndpointType: *ashishpandeyonecdklambdawebfunction.WebFunctionEndpointType_MULTI_REGION,\n\tRegions: []*string{\n\t\tjsii.String(\"us-east-1\"),\n\t\tjsii.String(\"eu-west-1\"),\n\t},\n\tDescription: jsii.String(\"Service-to-service traffic\"),\n\tMaxEnvironments: jsii.Number(50),\n})\ninternal.GrantInvoke(consumerRole)\nawscdk.NewCfnOutput(this, jsii.String(\"InternalUrl\"), &CfnOutputProps{\n\tValue: internal.Url,\n})","version":"2"},"$":{"source":"const 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 });","version":"0"}},"location":{"api":{"api":"moduleReadme","moduleFqn":"@ashishpandeyone/cdk-lambda-web-function"},"field":{"field":"markdown","line":101}},"didCompile":true,"fqnsReferenced":["@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions","@ashishpandeyone/cdk-lambda-web-function.WebFunction","@ashishpandeyone/cdk-lambda-web-function.WebFunction#addEndpoint","@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType","@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType#AWS_IAM","@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType#NONE","@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint","@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint#grantInvoke","@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint#url","@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions","@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointType","@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointType#MULTI_REGION","@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps","aws-cdk-lib.CfnOutput","aws-cdk-lib.CfnOutputProps","aws-cdk-lib.aws_iam.IGrantable","aws-cdk-lib.aws_lambda.Code","aws-cdk-lib.aws_lambda.Code#fromAsset","aws-cdk-lib.aws_lambda.Runtime","aws-cdk-lib.aws_lambda.Runtime#NODEJS_24_X","constructs.Construct"],"fullSource":"// Fixture for README examples: imports and a few declared values; the example replaces \"/// here\".\nimport { CfnOutput, CfnResource, Duration, type IPropertyInjector, PropertyInjectors, RemovalPolicy, Stack } from 'aws-cdk-lib';\nimport * as cloudfront from 'aws-cdk-lib/aws-cloudfront';\nimport * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';\nimport * as dynamodb from 'aws-cdk-lib/aws-dynamodb';\nimport * as iam from 'aws-cdk-lib/aws-iam';\nimport * as kms from 'aws-cdk-lib/aws-kms';\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\nimport * as lambdaNodejs from 'aws-cdk-lib/aws-lambda-nodejs';\nimport * as logs from 'aws-cdk-lib/aws-logs';\nimport { Construct } from 'constructs';\nimport {\n NodejsWebFunction, WebFunction, WebFunctionAuthType, WebFunctionDeployment, WebFunctionEndpointType, WebFunctionOrigin, WebFunctionRevision,\n type WebFunctionProps,\n} from '@ashishpandeyone/cdk-lambda-web-function';\n\ndeclare const fn: WebFunction;\ndeclare const table: dynamodb.Table;\ndeclare const consumerRole: iam.IRole;\ndeclare const errorRate: cloudwatch.IAlarm;\n\nclass Fixture extends Stack {\n constructor(scope: Construct, id: string) {\n super(scope, id);\n\n // Code snippet begins after !show marker below\n/// !show\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/// !hide\n// Code snippet ended before !hide marker above\n }\n}\n","syntaxKindCounter":{"9":2,"11":7,"80":34,"110":2,"210":1,"211":4,"212":10,"214":3,"215":2,"244":2,"245":2,"261":2,"262":2,"304":11},"fqnsFingerprint":"8882e78e6cab046624fb72bd3a9ff27d75230f3484f6b4d8653075399cac1544"},"cbc3e74e8a7a4d7155ceaf265ed8d4d4f9036659d4002a2038f397ca3695fd0b":{"translations":{"python":{"source":"fn.grants.invoke(consumer_role)","version":"2"},"csharp":{"source":"fn.Grants.Invoke(consumerRole);","version":"2"},"java":{"source":"fn.grants.invoke(consumerRole);","version":"1"},"go":{"source":"fn.Grants.Invoke(consumerRole)","version":"2"},"$":{"source":"fn.grants.invoke(consumerRole); // or fn.grantInvoke(consumerRole), as on lambda.Function","version":"0"}},"location":{"api":{"api":"moduleReadme","moduleFqn":"@ashishpandeyone/cdk-lambda-web-function"},"field":{"field":"markdown","line":142}},"didCompile":true,"fqnsReferenced":["@ashishpandeyone/cdk-lambda-web-function.WebFunction#grants","@ashishpandeyone/cdk-lambda-web-function.WebFunctionGrants#invoke","aws-cdk-lib.aws_iam.IGrantable"],"fullSource":"// Fixture for README examples: imports and a few declared values; the example replaces \"/// here\".\nimport { CfnOutput, CfnResource, Duration, type IPropertyInjector, PropertyInjectors, RemovalPolicy, Stack } from 'aws-cdk-lib';\nimport * as cloudfront from 'aws-cdk-lib/aws-cloudfront';\nimport * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';\nimport * as dynamodb from 'aws-cdk-lib/aws-dynamodb';\nimport * as iam from 'aws-cdk-lib/aws-iam';\nimport * as kms from 'aws-cdk-lib/aws-kms';\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\nimport * as lambdaNodejs from 'aws-cdk-lib/aws-lambda-nodejs';\nimport * as logs from 'aws-cdk-lib/aws-logs';\nimport { Construct } from 'constructs';\nimport {\n NodejsWebFunction, WebFunction, WebFunctionAuthType, WebFunctionDeployment, WebFunctionEndpointType, WebFunctionOrigin, WebFunctionRevision,\n type WebFunctionProps,\n} from '@ashishpandeyone/cdk-lambda-web-function';\n\ndeclare const fn: WebFunction;\ndeclare const table: dynamodb.Table;\ndeclare const consumerRole: iam.IRole;\ndeclare const errorRate: cloudwatch.IAlarm;\n\nclass Fixture extends Stack {\n constructor(scope: Construct, id: string) {\n super(scope, id);\n\n // Code snippet begins after !show marker below\n/// !show\nfn.grants.invoke(consumerRole);\n/// !hide\n// Code snippet ended before !hide marker above\n }\n}\n","syntaxKindCounter":{"80":4,"212":2,"214":1,"245":1},"fqnsFingerprint":"84e03ddd0e39964df63b14d33c75eade62af31971bb8967173dff80fa5c11da4"},"f57ea40c6f4331f384cf617f69e5459b68ad5bd935e7536332543e89e138e344":{"translations":{"python":{"source":"fn.grant_invoke(iam.Role.from_role_arn(self, \"Partner\", \"arn:aws:iam::444455556666:role/caller\"))","version":"2"},"csharp":{"source":"fn.GrantInvoke(Role.FromRoleArn(this, \"Partner\", \"arn:aws:iam::444455556666:role/caller\"));","version":"2"},"java":{"source":"fn.grantInvoke(Role.fromRoleArn(this, \"Partner\", \"arn:aws:iam::444455556666:role/caller\"));","version":"1"},"go":{"source":"fn.GrantInvoke(iam.Role_FromRoleArn(this, jsii.String(\"Partner\"), jsii.String(\"arn:aws:iam::444455556666:role/caller\")))","version":"2"},"$":{"source":"fn.grantInvoke(iam.Role.fromRoleArn(this, 'Partner', 'arn:aws:iam::444455556666:role/caller'));","version":"0"}},"location":{"api":{"api":"moduleReadme","moduleFqn":"@ashishpandeyone/cdk-lambda-web-function"},"field":{"field":"markdown","line":172}},"didCompile":true,"fqnsReferenced":["@ashishpandeyone/cdk-lambda-web-function.WebFunction#grantInvoke","aws-cdk-lib.aws_iam.IGrantable","aws-cdk-lib.aws_iam.Role","aws-cdk-lib.aws_iam.Role#fromRoleArn","constructs.Construct"],"fullSource":"// Fixture for README examples: imports and a few declared values; the example replaces \"/// here\".\nimport { CfnOutput, CfnResource, Duration, type IPropertyInjector, PropertyInjectors, RemovalPolicy, Stack } from 'aws-cdk-lib';\nimport * as cloudfront from 'aws-cdk-lib/aws-cloudfront';\nimport * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';\nimport * as dynamodb from 'aws-cdk-lib/aws-dynamodb';\nimport * as iam from 'aws-cdk-lib/aws-iam';\nimport * as kms from 'aws-cdk-lib/aws-kms';\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\nimport * as lambdaNodejs from 'aws-cdk-lib/aws-lambda-nodejs';\nimport * as logs from 'aws-cdk-lib/aws-logs';\nimport { Construct } from 'constructs';\nimport {\n NodejsWebFunction, WebFunction, WebFunctionAuthType, WebFunctionDeployment, WebFunctionEndpointType, WebFunctionOrigin, WebFunctionRevision,\n type WebFunctionProps,\n} from '@ashishpandeyone/cdk-lambda-web-function';\n\ndeclare const fn: WebFunction;\ndeclare const table: dynamodb.Table;\ndeclare const consumerRole: iam.IRole;\ndeclare const errorRate: cloudwatch.IAlarm;\n\nclass Fixture extends Stack {\n constructor(scope: Construct, id: string) {\n super(scope, id);\n\n // Code snippet begins after !show marker below\n/// !show\nfn.grantInvoke(iam.Role.fromRoleArn(this, 'Partner', 'arn:aws:iam::444455556666:role/caller'));\n/// !hide\n// Code snippet ended before !hide marker above\n }\n}\n","syntaxKindCounter":{"11":2,"80":5,"110":1,"212":3,"214":2,"245":1},"fqnsFingerprint":"edc73b1162858e87f57fd65666c3aada90c2672d1cb74a91cd24c00f10132c2c"},"d0dcbf0a0cad621704eb158fcd6e109cc1f2b655443d54604472b3202638dbe0":{"translations":{"python":{"source":"fn.add_permission(\"PartnerAccount\", principal=iam.AccountPrincipal(\"444455556666\"))\nfn.add_permission(\"MyOrg\", principal=iam.OrganizationPrincipal(\"o-a1b2c3d4e5\"), endpoint=fn.endpoint)\nfn.add_permission(\"Cdn\",\n principal=iam.ServicePrincipal(\"cloudfront.amazonaws.com\"),\n source_arn=f\"arn:aws:cloudfront::{this.account}:distribution/EDFDVBD6EXAMPLE\"\n)","version":"2"},"csharp":{"source":"fn.AddPermission(\"PartnerAccount\", new WebFunctionPermission { Principal = new AccountPrincipal(\"444455556666\") });\nfn.AddPermission(\"MyOrg\", new WebFunctionPermission { Principal = new OrganizationPrincipal(\"o-a1b2c3d4e5\"), Endpoint = fn.Endpoint });\nfn.AddPermission(\"Cdn\", new WebFunctionPermission {\n Principal = new ServicePrincipal(\"cloudfront.amazonaws.com\"),\n SourceArn = $\"arn:aws:cloudfront::{this.account}:distribution/EDFDVBD6EXAMPLE\"\n});","version":"2"},"java":{"source":"fn.addPermission(\"PartnerAccount\", WebFunctionPermission.builder().principal(new AccountPrincipal(\"444455556666\")).build());\nfn.addPermission(\"MyOrg\", WebFunctionPermission.builder().principal(new OrganizationPrincipal(\"o-a1b2c3d4e5\")).endpoint(fn.getEndpoint()).build());\nfn.addPermission(\"Cdn\", WebFunctionPermission.builder()\n .principal(new ServicePrincipal(\"cloudfront.amazonaws.com\"))\n .sourceArn(String.format(\"arn:aws:cloudfront::%s:distribution/EDFDVBD6EXAMPLE\", this.account))\n .build());","version":"1"},"go":{"source":"fn.AddPermission(jsii.String(\"PartnerAccount\"), &WebFunctionPermission{\n\tPrincipal: iam.NewAccountPrincipal(jsii.String(\"444455556666\")),\n})\nfn.AddPermission(jsii.String(\"MyOrg\"), &WebFunctionPermission{\n\tPrincipal: iam.NewOrganizationPrincipal(jsii.String(\"o-a1b2c3d4e5\")),\n\tEndpoint: fn.Endpoint,\n})\nfn.AddPermission(jsii.String(\"Cdn\"), &WebFunctionPermission{\n\tPrincipal: iam.NewServicePrincipal(jsii.String(\"cloudfront.amazonaws.com\")),\n\tSourceArn: fmt.Sprintf(\"arn:aws:cloudfront::%v:distribution/EDFDVBD6EXAMPLE\", this.Account),\n})","version":"2"},"$":{"source":"fn.addPermission('PartnerAccount', { principal: new iam.AccountPrincipal('444455556666') });\nfn.addPermission('MyOrg', { principal: new iam.OrganizationPrincipal('o-a1b2c3d4e5'), endpoint: fn.endpoint });\nfn.addPermission('Cdn', {\n principal: new iam.ServicePrincipal('cloudfront.amazonaws.com'),\n sourceArn: `arn:aws:cloudfront::${this.account}:distribution/EDFDVBD6EXAMPLE`,\n});","version":"0"}},"location":{"api":{"api":"moduleReadme","moduleFqn":"@ashishpandeyone/cdk-lambda-web-function"},"field":{"field":"markdown","line":178}},"didCompile":true,"fqnsReferenced":["@ashishpandeyone/cdk-lambda-web-function.WebFunction#addPermission","@ashishpandeyone/cdk-lambda-web-function.WebFunction#endpoint","@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint","@ashishpandeyone/cdk-lambda-web-function.WebFunctionPermission","aws-cdk-lib.aws_iam.AccountPrincipal","aws-cdk-lib.aws_iam.IPrincipal","aws-cdk-lib.aws_iam.OrganizationPrincipal","aws-cdk-lib.aws_iam.ServicePrincipal"],"fullSource":"// Fixture for README examples: imports and a few declared values; the example replaces \"/// here\".\nimport { CfnOutput, CfnResource, Duration, type IPropertyInjector, PropertyInjectors, RemovalPolicy, Stack } from 'aws-cdk-lib';\nimport * as cloudfront from 'aws-cdk-lib/aws-cloudfront';\nimport * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';\nimport * as dynamodb from 'aws-cdk-lib/aws-dynamodb';\nimport * as iam from 'aws-cdk-lib/aws-iam';\nimport * as kms from 'aws-cdk-lib/aws-kms';\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\nimport * as lambdaNodejs from 'aws-cdk-lib/aws-lambda-nodejs';\nimport * as logs from 'aws-cdk-lib/aws-logs';\nimport { Construct } from 'constructs';\nimport {\n NodejsWebFunction, WebFunction, WebFunctionAuthType, WebFunctionDeployment, WebFunctionEndpointType, WebFunctionOrigin, WebFunctionRevision,\n type WebFunctionProps,\n} from '@ashishpandeyone/cdk-lambda-web-function';\n\ndeclare const fn: WebFunction;\ndeclare const table: dynamodb.Table;\ndeclare const consumerRole: iam.IRole;\ndeclare const errorRate: cloudwatch.IAlarm;\n\nclass Fixture extends Stack {\n constructor(scope: Construct, id: string) {\n super(scope, id);\n\n // Code snippet begins after !show marker below\n/// !show\nfn.addPermission('PartnerAccount', { principal: new iam.AccountPrincipal('444455556666') });\nfn.addPermission('MyOrg', { principal: new iam.OrganizationPrincipal('o-a1b2c3d4e5'), endpoint: fn.endpoint });\nfn.addPermission('Cdn', {\n principal: new iam.ServicePrincipal('cloudfront.amazonaws.com'),\n sourceArn: `arn:aws:cloudfront::${this.account}:distribution/EDFDVBD6EXAMPLE`,\n});\n/// !hide\n// Code snippet ended before !hide marker above\n }\n}\n","syntaxKindCounter":{"11":6,"16":1,"18":1,"80":20,"110":1,"211":3,"212":8,"214":3,"215":3,"229":1,"240":1,"245":3,"304":5},"fqnsFingerprint":"d1ceda7c28639c0e720685694d613ad8abe8cb615ed7556528157ced57410dd4"},"222d21828ab9910a4bee85977f48a6244f37c674dbeac8852df48070f323bfdc":{"translations":{"python":{"source":"cloudfront.Distribution(self, \"Cdn\",\n default_behavior=cloudfront.BehaviorOptions(\n origin=WebFunctionOrigin.with_origin_access_control(fn.endpoint),\n viewer_protocol_policy=cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,\n allowed_methods=cloudfront.AllowedMethods.ALLOW_ALL,\n cache_policy=cloudfront.CachePolicy.CACHING_DISABLED,\n origin_request_policy=cloudfront.OriginRequestPolicy.ALL_VIEWER_EXCEPT_HOST_HEADER\n )\n)","version":"2"},"csharp":{"source":"new Distribution(this, \"Cdn\", new DistributionProps {\n DefaultBehavior = new BehaviorOptions {\n Origin = WebFunctionOrigin.WithOriginAccessControl(fn.Endpoint),\n ViewerProtocolPolicy = ViewerProtocolPolicy.REDIRECT_TO_HTTPS,\n AllowedMethods = AllowedMethods.ALLOW_ALL,\n CachePolicy = CachePolicy.CACHING_DISABLED,\n OriginRequestPolicy = OriginRequestPolicy.ALL_VIEWER_EXCEPT_HOST_HEADER\n }\n});","version":"2"},"java":{"source":"Distribution.Builder.create(this, \"Cdn\")\n .defaultBehavior(BehaviorOptions.builder()\n .origin(WebFunctionOrigin.withOriginAccessControl(fn.getEndpoint()))\n .viewerProtocolPolicy(ViewerProtocolPolicy.REDIRECT_TO_HTTPS)\n .allowedMethods(AllowedMethods.ALLOW_ALL)\n .cachePolicy(CachePolicy.CACHING_DISABLED)\n .originRequestPolicy(OriginRequestPolicy.ALL_VIEWER_EXCEPT_HOST_HEADER)\n .build())\n .build();","version":"1"},"go":{"source":"cloudfront.NewDistribution(this, jsii.String(\"Cdn\"), &DistributionProps{\n\tDefaultBehavior: &BehaviorOptions{\n\t\tOrigin: ashishpandeyonecdklambdawebfunction.WebFunctionOrigin_WithOriginAccessControl(fn.Endpoint),\n\t\tViewerProtocolPolicy: cloudfront.ViewerProtocolPolicy_REDIRECT_TO_HTTPS,\n\t\tAllowedMethods: cloudfront.AllowedMethods_ALLOW_ALL(),\n\t\tCachePolicy: cloudfront.CachePolicy_CACHING_DISABLED(),\n\t\tOriginRequestPolicy: cloudfront.OriginRequestPolicy_ALL_VIEWER_EXCEPT_HOST_HEADER(),\n\t},\n})","version":"2"},"$":{"source":"new cloudfront.Distribution(this, 'Cdn', {\n defaultBehavior: {\n origin: WebFunctionOrigin.withOriginAccessControl(fn.endpoint),\n viewerProtocolPolicy: cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,\n allowedMethods: cloudfront.AllowedMethods.ALLOW_ALL,\n cachePolicy: cloudfront.CachePolicy.CACHING_DISABLED,\n originRequestPolicy: cloudfront.OriginRequestPolicy.ALL_VIEWER_EXCEPT_HOST_HEADER,\n },\n});","version":"0"}},"location":{"api":{"api":"moduleReadme","moduleFqn":"@ashishpandeyone/cdk-lambda-web-function"},"field":{"field":"markdown","line":200}},"didCompile":true,"fqnsReferenced":["@ashishpandeyone/cdk-lambda-web-function.WebFunction#endpoint","@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint","@ashishpandeyone/cdk-lambda-web-function.WebFunctionOrigin#withOriginAccessControl","aws-cdk-lib.aws_cloudfront.AllowedMethods","aws-cdk-lib.aws_cloudfront.AllowedMethods#ALLOW_ALL","aws-cdk-lib.aws_cloudfront.BehaviorOptions","aws-cdk-lib.aws_cloudfront.CachePolicy","aws-cdk-lib.aws_cloudfront.CachePolicy#CACHING_DISABLED","aws-cdk-lib.aws_cloudfront.Distribution","aws-cdk-lib.aws_cloudfront.DistributionProps","aws-cdk-lib.aws_cloudfront.IOrigin","aws-cdk-lib.aws_cloudfront.OriginRequestPolicy","aws-cdk-lib.aws_cloudfront.OriginRequestPolicy#ALL_VIEWER_EXCEPT_HOST_HEADER","aws-cdk-lib.aws_cloudfront.ViewerProtocolPolicy","aws-cdk-lib.aws_cloudfront.ViewerProtocolPolicy#REDIRECT_TO_HTTPS","aws-cdk-lib.interfaces.aws_cloudfront.ICachePolicyRef","aws-cdk-lib.interfaces.aws_cloudfront.IOriginRequestPolicyRef","constructs.Construct"],"fullSource":"// Fixture for README examples: imports and a few declared values; the example replaces \"/// here\".\nimport { CfnOutput, CfnResource, Duration, type IPropertyInjector, PropertyInjectors, RemovalPolicy, Stack } from 'aws-cdk-lib';\nimport * as cloudfront from 'aws-cdk-lib/aws-cloudfront';\nimport * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';\nimport * as dynamodb from 'aws-cdk-lib/aws-dynamodb';\nimport * as iam from 'aws-cdk-lib/aws-iam';\nimport * as kms from 'aws-cdk-lib/aws-kms';\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\nimport * as lambdaNodejs from 'aws-cdk-lib/aws-lambda-nodejs';\nimport * as logs from 'aws-cdk-lib/aws-logs';\nimport { Construct } from 'constructs';\nimport {\n NodejsWebFunction, WebFunction, WebFunctionAuthType, WebFunctionDeployment, WebFunctionEndpointType, WebFunctionOrigin, WebFunctionRevision,\n type WebFunctionProps,\n} from '@ashishpandeyone/cdk-lambda-web-function';\n\ndeclare const fn: WebFunction;\ndeclare const table: dynamodb.Table;\ndeclare const consumerRole: iam.IRole;\ndeclare const errorRate: cloudwatch.IAlarm;\n\nclass Fixture extends Stack {\n constructor(scope: Construct, id: string) {\n super(scope, id);\n\n // Code snippet begins after !show marker below\n/// !show\nnew cloudfront.Distribution(this, 'Cdn', {\n defaultBehavior: {\n origin: WebFunctionOrigin.withOriginAccessControl(fn.endpoint),\n viewerProtocolPolicy: cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,\n allowedMethods: cloudfront.AllowedMethods.ALLOW_ALL,\n cachePolicy: cloudfront.CachePolicy.CACHING_DISABLED,\n originRequestPolicy: cloudfront.OriginRequestPolicy.ALL_VIEWER_EXCEPT_HOST_HEADER,\n },\n});\n/// !hide\n// Code snippet ended before !hide marker above\n }\n}\n","syntaxKindCounter":{"11":1,"80":24,"110":1,"211":2,"212":11,"214":1,"215":1,"245":1,"304":6},"fqnsFingerprint":"3df67a32c62c4183d88326e0b821e19a19d79680f364fff4fc96d8db49215315"},"66cd362055159c5ee35ed25e7d92b05896f4e8f48e90f22869e272a3b8aaf480":{"translations":{"python":{"source":"forward_authorization = cloudfront.CachePolicy(self, \"ForwardAuthorization\",\n header_behavior=cloudfront.CacheHeaderBehavior.allow_list(\"Authorization\"),\n min_ttl=Duration.seconds(0),\n default_ttl=Duration.seconds(0),\n max_ttl=Duration.seconds(1)\n)","version":"2"},"csharp":{"source":"var forwardAuthorization = new CachePolicy(this, \"ForwardAuthorization\", new CachePolicyProps {\n HeaderBehavior = CacheHeaderBehavior.AllowList(\"Authorization\"),\n MinTtl = Duration.Seconds(0),\n DefaultTtl = Duration.Seconds(0),\n MaxTtl = Duration.Seconds(1)\n});","version":"2"},"java":{"source":"CachePolicy forwardAuthorization = CachePolicy.Builder.create(this, \"ForwardAuthorization\")\n .headerBehavior(CacheHeaderBehavior.allowList(\"Authorization\"))\n .minTtl(Duration.seconds(0))\n .defaultTtl(Duration.seconds(0))\n .maxTtl(Duration.seconds(1))\n .build();","version":"1"},"go":{"source":"forwardAuthorization := cloudfront.NewCachePolicy(this, jsii.String(\"ForwardAuthorization\"), &CachePolicyProps{\n\tHeaderBehavior: cloudfront.CacheHeaderBehavior_AllowList(jsii.String(\"Authorization\")),\n\tMinTtl: awscdk.Duration_Seconds(jsii.Number(0)),\n\tDefaultTtl: awscdk.Duration_*Seconds(jsii.Number(0)),\n\tMaxTtl: awscdk.Duration_*Seconds(jsii.Number(1)),\n})","version":"2"},"$":{"source":"const forwardAuthorization = new cloudfront.CachePolicy(this, 'ForwardAuthorization', {\n headerBehavior: cloudfront.CacheHeaderBehavior.allowList('Authorization'),\n minTtl: Duration.seconds(0),\n defaultTtl: Duration.seconds(0),\n maxTtl: Duration.seconds(1), // a cache key with headers needs caching enabled; 0/0/1 keeps it off in practice\n});","version":"0"}},"location":{"api":{"api":"moduleReadme","moduleFqn":"@ashishpandeyone/cdk-lambda-web-function"},"field":{"field":"markdown","line":220}},"didCompile":true,"fqnsReferenced":["aws-cdk-lib.Duration","aws-cdk-lib.Duration#seconds","aws-cdk-lib.aws_cloudfront.CacheHeaderBehavior","aws-cdk-lib.aws_cloudfront.CacheHeaderBehavior#allowList","aws-cdk-lib.aws_cloudfront.CachePolicy","aws-cdk-lib.aws_cloudfront.CachePolicyProps","constructs.Construct"],"fullSource":"// Fixture for README examples: imports and a few declared values; the example replaces \"/// here\".\nimport { CfnOutput, CfnResource, Duration, type IPropertyInjector, PropertyInjectors, RemovalPolicy, Stack } from 'aws-cdk-lib';\nimport * as cloudfront from 'aws-cdk-lib/aws-cloudfront';\nimport * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';\nimport * as dynamodb from 'aws-cdk-lib/aws-dynamodb';\nimport * as iam from 'aws-cdk-lib/aws-iam';\nimport * as kms from 'aws-cdk-lib/aws-kms';\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\nimport * as lambdaNodejs from 'aws-cdk-lib/aws-lambda-nodejs';\nimport * as logs from 'aws-cdk-lib/aws-logs';\nimport { Construct } from 'constructs';\nimport {\n NodejsWebFunction, WebFunction, WebFunctionAuthType, WebFunctionDeployment, WebFunctionEndpointType, WebFunctionOrigin, WebFunctionRevision,\n type WebFunctionProps,\n} from '@ashishpandeyone/cdk-lambda-web-function';\n\ndeclare const fn: WebFunction;\ndeclare const table: dynamodb.Table;\ndeclare const consumerRole: iam.IRole;\ndeclare const errorRate: cloudwatch.IAlarm;\n\nclass Fixture extends Stack {\n constructor(scope: Construct, id: string) {\n super(scope, id);\n\n // Code snippet begins after !show marker below\n/// !show\nconst forwardAuthorization = new cloudfront.CachePolicy(this, 'ForwardAuthorization', {\n headerBehavior: cloudfront.CacheHeaderBehavior.allowList('Authorization'),\n minTtl: Duration.seconds(0),\n defaultTtl: Duration.seconds(0),\n maxTtl: Duration.seconds(1), // a cache key with headers needs caching enabled; 0/0/1 keeps it off in practice\n});\n/// !hide\n// Code snippet ended before !hide marker above\n }\n}\n","syntaxKindCounter":{"9":3,"11":2,"80":16,"110":1,"211":1,"212":6,"214":4,"215":1,"244":1,"261":1,"262":1,"304":4},"fqnsFingerprint":"8b3b0b479ae90a313f45521250f0179f9cfe33b779156bb741e004a4ca2c7bf3"},"441da626377c697dff8b4bd0246c0f1ac028b55f70b07e5996276ac73b7dc523":{"translations":{"python":{"source":"orders = WebFunction.from_web_function_arn(self, \"Orders\", \"arn:aws:lambda:us-east-1:111122223333:web-function/orders\")\norders.grant_invoke(consumer_role) # every endpoint of the function\n\nlive = WebFunction.from_web_function_attributes(self, \"Live\",\n web_function_name=\"orders\", # in this stack's account and region\n endpoint_name=\"live\"\n)\nlive.metric_concurrent_requests().create_alarm(self, \"Busy\", threshold=60, evaluation_periods=3)","version":"2"},"csharp":{"source":"var orders = WebFunction.FromWebFunctionArn(this, \"Orders\", \"arn:aws:lambda:us-east-1:111122223333:web-function/orders\");\norders.GrantInvoke(consumerRole); // every endpoint of the function\n\nvar live = WebFunction.FromWebFunctionAttributes(this, \"Live\", new WebFunctionAttributes {\n WebFunctionName = \"orders\", // in this stack's account and region\n EndpointName = \"live\"\n});\nlive.MetricConcurrentRequests().CreateAlarm(this, \"Busy\", new CreateAlarmOptions { Threshold = 60, EvaluationPeriods = 3 });","version":"2"},"java":{"source":"IWebFunction orders = WebFunction.fromWebFunctionArn(this, \"Orders\", \"arn:aws:lambda:us-east-1:111122223333:web-function/orders\");\norders.grantInvoke(consumerRole); // every endpoint of the function\n\nIWebFunction live = WebFunction.fromWebFunctionAttributes(this, \"Live\", WebFunctionAttributes.builder()\n .webFunctionName(\"orders\") // in this stack's account and region\n .endpointName(\"live\")\n .build());\nlive.metricConcurrentRequests().createAlarm(this, \"Busy\", CreateAlarmOptions.builder().threshold(60).evaluationPeriods(3).build());","version":"1"},"go":{"source":"orders := ashishpandeyonecdklambdawebfunction.WebFunction_FromWebFunctionArn(this, jsii.String(\"Orders\"), jsii.String(\"arn:aws:lambda:us-east-1:111122223333:web-function/orders\"))\norders.GrantInvoke(consumerRole) // every endpoint of the function\n\nlive := ashishpandeyonecdklambdawebfunction.WebFunction_FromWebFunctionAttributes(this, jsii.String(\"Live\"), &WebFunctionAttributes{\n\tWebFunctionName: jsii.String(\"orders\"),\n\t // in this stack's account and region\n\tEndpointName: jsii.String(\"live\"),\n})\nlive.MetricConcurrentRequests().CreateAlarm(this, jsii.String(\"Busy\"), &CreateAlarmOptions{\n\tThreshold: jsii.Number(60),\n\tEvaluationPeriods: jsii.Number(3),\n})","version":"2"},"$":{"source":"const 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 });","version":"0"}},"location":{"api":{"api":"moduleReadme","moduleFqn":"@ashishpandeyone/cdk-lambda-web-function"},"field":{"field":"markdown","line":242}},"didCompile":true,"fqnsReferenced":["@ashishpandeyone/cdk-lambda-web-function.IWebFunction","@ashishpandeyone/cdk-lambda-web-function.IWebFunction#grantInvoke","@ashishpandeyone/cdk-lambda-web-function.IWebFunction#metricConcurrentRequests","@ashishpandeyone/cdk-lambda-web-function.WebFunction#fromWebFunctionArn","@ashishpandeyone/cdk-lambda-web-function.WebFunction#fromWebFunctionAttributes","@ashishpandeyone/cdk-lambda-web-function.WebFunctionAttributes","aws-cdk-lib.aws_cloudwatch.CreateAlarmOptions","aws-cdk-lib.aws_cloudwatch.Metric#createAlarm","aws-cdk-lib.aws_iam.IGrantable","constructs.Construct"],"fullSource":"// Fixture for README examples: imports and a few declared values; the example replaces \"/// here\".\nimport { CfnOutput, CfnResource, Duration, type IPropertyInjector, PropertyInjectors, RemovalPolicy, Stack } from 'aws-cdk-lib';\nimport * as cloudfront from 'aws-cdk-lib/aws-cloudfront';\nimport * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';\nimport * as dynamodb from 'aws-cdk-lib/aws-dynamodb';\nimport * as iam from 'aws-cdk-lib/aws-iam';\nimport * as kms from 'aws-cdk-lib/aws-kms';\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\nimport * as lambdaNodejs from 'aws-cdk-lib/aws-lambda-nodejs';\nimport * as logs from 'aws-cdk-lib/aws-logs';\nimport { Construct } from 'constructs';\nimport {\n NodejsWebFunction, WebFunction, WebFunctionAuthType, WebFunctionDeployment, WebFunctionEndpointType, WebFunctionOrigin, WebFunctionRevision,\n type WebFunctionProps,\n} from '@ashishpandeyone/cdk-lambda-web-function';\n\ndeclare const fn: WebFunction;\ndeclare const table: dynamodb.Table;\ndeclare const consumerRole: iam.IRole;\ndeclare const errorRate: cloudwatch.IAlarm;\n\nclass Fixture extends Stack {\n constructor(scope: Construct, id: string) {\n super(scope, id);\n\n // Code snippet begins after !show marker below\n/// !show\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/// !hide\n// Code snippet ended before !hide marker above\n }\n}\n","syntaxKindCounter":{"9":2,"11":6,"80":16,"110":3,"211":2,"212":5,"214":5,"244":2,"245":2,"261":2,"262":2,"304":4},"fqnsFingerprint":"9daccbbaf7d98ac267c5776c98940c70b19f4ede7bcec1d3382255409321da6f"},"3947670aa73c5690ddddaa699ab18765d47eabfad1c70d883d0d54736c159495":{"translations":{"python":{"source":"api = WebFunction(self, \"Api\",\n runtime=lambda_.Runtime.NODEJS_24_X,\n code=lambda_.Code.from_asset(\"build\"),\n auth_type=WebFunctionAuthType.AWS_IAM,\n entrypoint=\"server.js\", # default index.js\n web_function_name=\"orders-api\", # default: generated from the construct path\n description=\"Orders HTTP API\",\n environment={\"TABLE_NAME\": table.table_name},\n timeout=Duration.seconds(60), # per request: 3 seconds to 15 minutes, default 30 seconds\n max_concurrency_per_environment=32\n)\n\napi.add_environment(\"FEATURE_FLAG\", \"on\")\ntable.grant_read_write_data(api)","version":"2"},"csharp":{"source":"var api = new WebFunction(this, \"Api\", new WebFunctionProps {\n Runtime = Runtime.NODEJS_24_X,\n Code = 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 = new Dictionary<string, string> { { \"TABLE_NAME\", table.TableName } },\n Timeout = Duration.Seconds(60), // per request: 3 seconds to 15 minutes, default 30 seconds\n MaxConcurrencyPerEnvironment = 32\n});\n\napi.AddEnvironment(\"FEATURE_FLAG\", \"on\");\ntable.GrantReadWriteData(api);","version":"2"},"java":{"source":"WebFunction api = WebFunction.Builder.create(this, \"Api\")\n .runtime(Runtime.NODEJS_24_X)\n .code(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(Map.of(\"TABLE_NAME\", table.getTableName()))\n .timeout(Duration.seconds(60)) // per request: 3 seconds to 15 minutes, default 30 seconds\n .maxConcurrencyPerEnvironment(32)\n .build();\n\napi.addEnvironment(\"FEATURE_FLAG\", \"on\");\ntable.grantReadWriteData(api);","version":"1"},"go":{"source":"api := ashishpandeyonecdklambdawebfunction.NewWebFunction(this, jsii.String(\"Api\"), &WebFunctionProps{\n\tRuntime: lambda.Runtime_NODEJS_24_X(),\n\tCode: lambda.Code_FromAsset(jsii.String(\"build\")),\n\tAuthType: *ashishpandeyonecdklambdawebfunction.WebFunctionAuthType_AWS_IAM,\n\tEntrypoint: jsii.String(\"server.js\"),\n\t // default index.js\n\tWebFunctionName: jsii.String(\"orders-api\"),\n\t // default: generated from the construct path\n\tDescription: jsii.String(\"Orders HTTP API\"),\n\tEnvironment: map[string]*string{\n\t\t\"TABLE_NAME\": table.tableName,\n\t},\n\tTimeout: awscdk.Duration_Seconds(jsii.Number(60)),\n\t // per request: 3 seconds to 15 minutes, default 30 seconds\n\tMaxConcurrencyPerEnvironment: jsii.Number(32),\n})\n\napi.AddEnvironment(jsii.String(\"FEATURE_FLAG\"), jsii.String(\"on\"))\ntable.GrantReadWriteData(api)","version":"2"},"$":{"source":"const 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","version":"0"}},"location":{"api":{"api":"moduleReadme","moduleFqn":"@ashishpandeyone/cdk-lambda-web-function"},"field":{"field":"markdown","line":259}},"didCompile":true,"fqnsReferenced":["@ashishpandeyone/cdk-lambda-web-function.WebFunction","@ashishpandeyone/cdk-lambda-web-function.WebFunction#addEnvironment","@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType","@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType#AWS_IAM","@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps","aws-cdk-lib.Duration","aws-cdk-lib.Duration#seconds","aws-cdk-lib.aws_dynamodb.TableBase#grantReadWriteData","aws-cdk-lib.aws_iam.IGrantable","aws-cdk-lib.aws_lambda.Code","aws-cdk-lib.aws_lambda.Code#fromAsset","aws-cdk-lib.aws_lambda.Runtime","aws-cdk-lib.aws_lambda.Runtime#NODEJS_24_X","constructs.Construct"],"fullSource":"// Fixture for README examples: imports and a few declared values; the example replaces \"/// here\".\nimport { CfnOutput, CfnResource, Duration, type IPropertyInjector, PropertyInjectors, RemovalPolicy, Stack } from 'aws-cdk-lib';\nimport * as cloudfront from 'aws-cdk-lib/aws-cloudfront';\nimport * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';\nimport * as dynamodb from 'aws-cdk-lib/aws-dynamodb';\nimport * as iam from 'aws-cdk-lib/aws-iam';\nimport * as kms from 'aws-cdk-lib/aws-kms';\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\nimport * as lambdaNodejs from 'aws-cdk-lib/aws-lambda-nodejs';\nimport * as logs from 'aws-cdk-lib/aws-logs';\nimport { Construct } from 'constructs';\nimport {\n NodejsWebFunction, WebFunction, WebFunctionAuthType, WebFunctionDeployment, WebFunctionEndpointType, WebFunctionOrigin, WebFunctionRevision,\n type WebFunctionProps,\n} from '@ashishpandeyone/cdk-lambda-web-function';\n\ndeclare const fn: WebFunction;\ndeclare const table: dynamodb.Table;\ndeclare const consumerRole: iam.IRole;\ndeclare const errorRate: cloudwatch.IAlarm;\n\nclass Fixture extends Stack {\n constructor(scope: Construct, id: string) {\n super(scope, id);\n\n // Code snippet begins after !show marker below\n/// !show\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);\n/// !hide\n// Code snippet ended before !hide marker above\n }\n}\n","syntaxKindCounter":{"9":2,"11":7,"80":29,"110":1,"211":2,"212":9,"214":4,"215":1,"244":1,"245":2,"261":1,"262":1,"304":10},"fqnsFingerprint":"25bbb073667dfb067009833d3892b315d358af4ee0728db4127fd3c46a3d9a4d"},"8e9ae71ca0694f8e91fbdc9d332009768c1cb4ffe102737a4345e5c3bb8428de":{"translations":{"python":{"source":"from ashishpandeyone.cdk_lambda_web_function import WebFunctionEndpointOptions\n# key_stack: Stack # deploys first\n# replica_stack: Stack\n# in us-east-1, deploys before this stack\n\nkey = kms.Key(key_stack, \"Key\", multi_region=True)\napi = WebFunction(self, \"Api\",\n runtime=lambda_.Runtime.NODEJS_24_X,\n code=lambda_.Code.from_asset(\"build\"),\n auth_type=WebFunctionAuthType.AWS_IAM,\n endpoint=WebFunctionEndpointOptions(endpoint_type=WebFunctionEndpointType.PER_REGION, regions=[\"us-east-1\"]),\n encryption_key=key\n)\n\n# One replica per region the endpoint serves from, with Lambda's statement in its own policy.\nkms.CfnReplicaKey(replica_stack, \"KeyReplica\",\n primary_key_arn=key.key_arn,\n key_policy=iam.PolicyDocument(\n statements=[\n iam.PolicyStatement(principals=[iam.AccountRootPrincipal()], actions=[\"kms:*\"], resources=[\"*\"]),\n api.encryption_key_policy_statement()\n ]\n )\n)","version":"2"},"csharp":{"source":"Stack keyStack; // deploys first\nStack replicaStack;\n// in us-east-1, deploys before this stack\n\nvar key = new Key(keyStack, \"Key\", new KeyProps { MultiRegion = true });\nvar api = new WebFunction(this, \"Api\", new WebFunctionProps {\n Runtime = Runtime.NODEJS_24_X,\n Code = Code.FromAsset(\"build\"),\n AuthType = WebFunctionAuthType.AWS_IAM,\n Endpoint = new WebFunctionEndpointOptions { EndpointType = WebFunctionEndpointType.PER_REGION, Regions = new [] { \"us-east-1\" } },\n EncryptionKey = key\n});\n\n// One replica per region the endpoint serves from, with Lambda's statement in its own policy.\n// One replica per region the endpoint serves from, with Lambda's statement in its own policy.\nnew CfnReplicaKey(replicaStack, \"KeyReplica\", new CfnReplicaKeyProps {\n PrimaryKeyArn = key.KeyArn,\n KeyPolicy = new PolicyDocument(new PolicyDocumentProps {\n Statements = new [] {\n new PolicyStatement(new PolicyStatementProps { Principals = new [] { new AccountRootPrincipal() }, Actions = new [] { \"kms:*\" }, Resources = new [] { \"*\" } }), api.EncryptionKeyPolicyStatement() }\n })\n});","version":"2"},"java":{"source":"Stack keyStack; // deploys first\nStack replicaStack;\n// in us-east-1, deploys before this stack\n\nKey key = Key.Builder.create(keyStack, \"Key\").multiRegion(true).build();\nWebFunction api = WebFunction.Builder.create(this, \"Api\")\n .runtime(Runtime.NODEJS_24_X)\n .code(Code.fromAsset(\"build\"))\n .authType(WebFunctionAuthType.AWS_IAM)\n .endpoint(WebFunctionEndpointOptions.builder().endpointType(WebFunctionEndpointType.PER_REGION).regions(List.of(\"us-east-1\")).build())\n .encryptionKey(key)\n .build();\n\n// One replica per region the endpoint serves from, with Lambda's statement in its own policy.\n// One replica per region the endpoint serves from, with Lambda's statement in its own policy.\nCfnReplicaKey.Builder.create(replicaStack, \"KeyReplica\")\n .primaryKeyArn(key.getKeyArn())\n .keyPolicy(PolicyDocument.Builder.create()\n .statements(List.of(\n PolicyStatement.Builder.create().principals(List.of(new AccountRootPrincipal())).actions(List.of(\"kms:*\")).resources(List.of(\"*\")).build(), api.encryptionKeyPolicyStatement()))\n .build())\n .build();","version":"1"},"go":{"source":"var keyStack Stack // deploys first\nvar replicaStack Stack\n// in us-east-1, deploys before this stack\n\nkey := kms.NewKey(keyStack, jsii.String(\"Key\"), &KeyProps{\n\tMultiRegion: jsii.Boolean(true),\n})\napi := ashishpandeyonecdklambdawebfunction.NewWebFunction(this, jsii.String(\"Api\"), &WebFunctionProps{\n\tRuntime: lambda.Runtime_NODEJS_24_X(),\n\tCode: lambda.Code_FromAsset(jsii.String(\"build\")),\n\tAuthType: *ashishpandeyonecdklambdawebfunction.WebFunctionAuthType_AWS_IAM,\n\tEndpoint: &WebFunctionEndpointOptions{\n\t\tEndpointType: *ashishpandeyonecdklambdawebfunction.WebFunctionEndpointType_PER_REGION,\n\t\tRegions: []*string{\n\t\t\tjsii.String(\"us-east-1\"),\n\t\t},\n\t},\n\tEncryptionKey: key,\n})\n\n// One replica per region the endpoint serves from, with Lambda's statement in its own policy.\n// One replica per region the endpoint serves from, with Lambda's statement in its own policy.\nkms.NewCfnReplicaKey(replicaStack, jsii.String(\"KeyReplica\"), &CfnReplicaKeyProps{\n\tPrimaryKeyArn: key.KeyArn,\n\tKeyPolicy: iam.NewPolicyDocument(&PolicyDocumentProps{\n\t\tStatements: []PolicyStatement{\n\t\t\tiam.NewPolicyStatement(&PolicyStatementProps{\n\t\t\t\tPrincipals: []IPrincipal{\n\t\t\t\t\tiam.NewAccountRootPrincipal(),\n\t\t\t\t},\n\t\t\t\tActions: []*string{\n\t\t\t\t\tjsii.String(\"kms:*\"),\n\t\t\t\t},\n\t\t\t\tResources: []*string{\n\t\t\t\t\tjsii.String(\"*\"),\n\t\t\t\t},\n\t\t\t}),\n\t\t\tapi.EncryptionKeyPolicyStatement(),\n\t\t},\n\t}),\n})","version":"2"},"$":{"source":"declare const keyStack: Stack; // deploys first\ndeclare const replicaStack: Stack; // in us-east-1, deploys before this stack\n\nconst key = new kms.Key(keyStack, 'Key', { multiRegion: true });\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 endpoint: { endpointType: WebFunctionEndpointType.PER_REGION, regions: ['us-east-1'] },\n encryptionKey: key,\n});\n\n// One replica per region the endpoint serves from, with Lambda's statement in its own policy.\nnew kms.CfnReplicaKey(replicaStack, 'KeyReplica', {\n primaryKeyArn: key.keyArn,\n keyPolicy: new iam.PolicyDocument({\n statements: [\n new iam.PolicyStatement({ principals: [new iam.AccountRootPrincipal()], actions: ['kms:*'], resources: ['*'] }),\n api.encryptionKeyPolicyStatement(),\n ],\n }),\n});","version":"0"}},"location":{"api":{"api":"moduleReadme","moduleFqn":"@ashishpandeyone/cdk-lambda-web-function"},"field":{"field":"markdown","line":286}},"didCompile":true,"fqnsReferenced":["@ashishpandeyone/cdk-lambda-web-function.WebFunction","@ashishpandeyone/cdk-lambda-web-function.WebFunction#encryptionKeyPolicyStatement","@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType","@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType#AWS_IAM","@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions","@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointType","@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointType#PER_REGION","@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps","aws-cdk-lib.aws_iam.AccountRootPrincipal","aws-cdk-lib.aws_iam.PolicyDocument","aws-cdk-lib.aws_iam.PolicyDocumentProps","aws-cdk-lib.aws_iam.PolicyStatement","aws-cdk-lib.aws_iam.PolicyStatementProps","aws-cdk-lib.aws_kms.CfnReplicaKey","aws-cdk-lib.aws_kms.CfnReplicaKeyProps","aws-cdk-lib.aws_kms.IKey","aws-cdk-lib.aws_kms.Key","aws-cdk-lib.aws_kms.Key#keyArn","aws-cdk-lib.aws_kms.KeyProps","aws-cdk-lib.aws_lambda.Code","aws-cdk-lib.aws_lambda.Code#fromAsset","aws-cdk-lib.aws_lambda.Runtime","aws-cdk-lib.aws_lambda.Runtime#NODEJS_24_X","constructs.Construct"],"fullSource":"// Hoisted imports begin after !show marker below\n/// !show\ndeclare const keyStack: Stack; // deploys first\ndeclare const replicaStack: Stack;\n/// !hide\n// Hoisted imports ended before !hide marker above\n// Fixture for README examples: imports and a few declared values; the example replaces \"/// here\".\nimport { CfnOutput, CfnResource, Duration, type IPropertyInjector, PropertyInjectors, RemovalPolicy, Stack } from 'aws-cdk-lib';\nimport * as cloudfront from 'aws-cdk-lib/aws-cloudfront';\nimport * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';\nimport * as dynamodb from 'aws-cdk-lib/aws-dynamodb';\nimport * as iam from 'aws-cdk-lib/aws-iam';\nimport * as kms from 'aws-cdk-lib/aws-kms';\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\nimport * as lambdaNodejs from 'aws-cdk-lib/aws-lambda-nodejs';\nimport * as logs from 'aws-cdk-lib/aws-logs';\nimport { Construct } from 'constructs';\nimport {\n NodejsWebFunction, WebFunction, WebFunctionAuthType, WebFunctionDeployment, WebFunctionEndpointType, WebFunctionOrigin, WebFunctionRevision,\n type WebFunctionProps,\n} from '@ashishpandeyone/cdk-lambda-web-function';\n\ndeclare const fn: WebFunction;\ndeclare const table: dynamodb.Table;\ndeclare const consumerRole: iam.IRole;\ndeclare const errorRate: cloudwatch.IAlarm;\n\nclass Fixture extends Stack {\n constructor(scope: Construct, id: string) {\n super(scope, id);\n\n // Code snippet begins after !show marker below\n/// !show\n // in us-east-1, deploys before this stack\n\nconst key = new kms.Key(keyStack, 'Key', { multiRegion: true });\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 endpoint: { endpointType: WebFunctionEndpointType.PER_REGION, regions: ['us-east-1'] },\n encryptionKey: key,\n});\n\n// One replica per region the endpoint serves from, with Lambda's statement in its own policy.\nnew kms.CfnReplicaKey(replicaStack, 'KeyReplica', {\n primaryKeyArn: key.keyArn,\n keyPolicy: new iam.PolicyDocument({\n statements: [\n new iam.PolicyStatement({ principals: [new iam.AccountRootPrincipal()], actions: ['kms:*'], resources: ['*'] }),\n api.encryptionKeyPolicyStatement(),\n ],\n }),\n});\n/// !hide\n// Code snippet ended before !hide marker above\n }\n}\n","syntaxKindCounter":{"11":7,"80":48,"110":1,"112":1,"138":2,"184":2,"210":5,"211":6,"212":13,"214":2,"215":6,"244":4,"245":1,"261":4,"262":4,"304":14,"308":1},"fqnsFingerprint":"0f56b192c0b4294ca42b8b0a0b49f109cf37d2132124a3e503baa9223d1f042e"},"dcd606a094b4c18aa17658e6e9d310514828753aaafa7cccc3e8306b3d456708":{"translations":{"python":{"source":"@jsii.implements(IPropertyInjector)\nclass TeamDefaults:\n def inject(self, *, runtime, code, entrypoint=None, authType, endpoint=None, revisionRetention=None, webFunctionName=None, description=None, role=None, encryptionKey=None, environment=None, timeout=None, maxConcurrencyPerEnvironment=None, logRetention=None, logRemovalPolicy=None, applicationLogLevelV2=None, systemLogLevelV2=None):\n # The team's defaults, with explicit props winning.\n return Object.assign({\"log_retention\": logs.RetentionDays.ONE_MONTH}, runtime=runtime, code=code, entrypoint=entrypoint, authType=authType, endpoint=endpoint, revisionRetention=revisionRetention, webFunctionName=webFunctionName, description=description, role=role, encryptionKey=encryptionKey, environment=environment, timeout=timeout, maxConcurrencyPerEnvironment=maxConcurrencyPerEnvironment, logRetention=logRetention, logRemovalPolicy=logRemovalPolicy, applicationLogLevelV2=applicationLogLevelV2, systemLogLevelV2=systemLogLevelV2)\nPropertyInjectors.of(self).add(TeamDefaults())","version":"2"},"csharp":{"source":"class TeamDefaults : IPropertyInjector\n{\n public readonly void ConstructUniqueId = WebFunction.PROPERTY_INJECTION_ID;\n public WebFunctionProps Inject(WebFunctionProps originalProps)\n {\n // The team's defaults, with explicit props winning.\n return Object.Assign(new Dictionary<string, RetentionDays> { { \"logRetention\", RetentionDays.ONE_MONTH } }, originalProps);\n }\n}\nPropertyInjectors.Of(this).Add(new TeamDefaults());","version":"2"},"java":{"source":"public class TeamDefaults implements IPropertyInjector {\n public final Object constructUniqueId;\n public WebFunctionProps inject(WebFunctionProps originalProps) {\n // The team's defaults, with explicit props winning.\n return Object.assign(Map.of(\"logRetention\", RetentionDays.ONE_MONTH), originalProps);\n }\n}\nPropertyInjectors.of(this).add(new TeamDefaults());","version":"1"},"go":{"source":"type teamDefaults struct {\n\tconstructUniqueId\n}\nfunc (this *teamDefaults) inject(originalProps WebFunctionProps) WebFunctionProps {\n\t// The team's defaults, with explicit props winning.\n\treturn object.assign(map[string]RetentionDays{\n\t\t\"logRetention\": logs.RetentionDays_ONE_MONTH,\n\t}, *originalProps)\n}\nawscdk.PropertyInjectors_Of(this).Add(newTeamDefaults())","version":"2"},"$":{"source":"class TeamDefaults implements IPropertyInjector {\n public readonly constructUniqueId = WebFunction.PROPERTY_INJECTION_ID;\n public inject(originalProps: WebFunctionProps): WebFunctionProps {\n // The team's defaults, with explicit props winning.\n return Object.assign({ logRetention: logs.RetentionDays.ONE_MONTH }, originalProps);\n }\n}\nPropertyInjectors.of(this).add(new TeamDefaults()); // or on the app, for every stack","version":"0"}},"location":{"api":{"api":"moduleReadme","moduleFqn":"@ashishpandeyone/cdk-lambda-web-function"},"field":{"field":"markdown","line":321}},"didCompile":true,"fqnsReferenced":["@ashishpandeyone/cdk-lambda-web-function.WebFunction#PROPERTY_INJECTION_ID","@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps","aws-cdk-lib.IPropertyInjector","aws-cdk-lib.PropertyInjectors#add","aws-cdk-lib.PropertyInjectors#of","aws-cdk-lib.aws_logs.RetentionDays","aws-cdk-lib.aws_logs.RetentionDays#ONE_MONTH","constructs.IConstruct"],"fullSource":"// Fixture for README examples: imports and a few declared values; the example replaces \"/// here\".\nimport { CfnOutput, CfnResource, Duration, type IPropertyInjector, PropertyInjectors, RemovalPolicy, Stack } from 'aws-cdk-lib';\nimport * as cloudfront from 'aws-cdk-lib/aws-cloudfront';\nimport * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';\nimport * as dynamodb from 'aws-cdk-lib/aws-dynamodb';\nimport * as iam from 'aws-cdk-lib/aws-iam';\nimport * as kms from 'aws-cdk-lib/aws-kms';\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\nimport * as lambdaNodejs from 'aws-cdk-lib/aws-lambda-nodejs';\nimport * as logs from 'aws-cdk-lib/aws-logs';\nimport { Construct } from 'constructs';\nimport {\n NodejsWebFunction, WebFunction, WebFunctionAuthType, WebFunctionDeployment, WebFunctionEndpointType, WebFunctionOrigin, WebFunctionRevision,\n type WebFunctionProps,\n} from '@ashishpandeyone/cdk-lambda-web-function';\n\ndeclare const fn: WebFunction;\ndeclare const table: dynamodb.Table;\ndeclare const consumerRole: iam.IRole;\ndeclare const errorRate: cloudwatch.IAlarm;\n\nclass Fixture extends Stack {\n constructor(scope: Construct, id: string) {\n super(scope, id);\n\n // Code snippet begins after !show marker below\n/// !show\nclass TeamDefaults implements IPropertyInjector {\n public readonly constructUniqueId = WebFunction.PROPERTY_INJECTION_ID;\n public inject(originalProps: WebFunctionProps): WebFunctionProps {\n // The team's defaults, with explicit props winning.\n return Object.assign({ logRetention: logs.RetentionDays.ONE_MONTH }, originalProps);\n }\n}\nPropertyInjectors.of(this).add(new TeamDefaults());\n/// !hide\n// Code snippet ended before !hide marker above\n }\n}\n","syntaxKindCounter":{"80":20,"110":1,"125":2,"148":1,"170":1,"173":1,"175":1,"184":2,"211":1,"212":6,"214":3,"215":1,"234":1,"242":1,"245":1,"254":1,"264":1,"299":1,"304":1},"fqnsFingerprint":"c9f624f29c01b3dc963cdc36aa03a32b540e9ef124166063570c6ce3e3546321"},"5154854c1105d400ac9c516e10f2e3f1fc48bc7fd009b0bd7c05d2d539dd6eae":{"translations":{"python":{"source":"from ashishpandeyone.cdk_lambda_web_function import NodejsWebFunctionBundlingOptions\nNodejsWebFunction(self, \"Api\",\n entry=\"src/server.ts\",\n auth_type=WebFunctionAuthType.AWS_IAM,\n bundling=NodejsWebFunctionBundlingOptions(\n minify=True, # default true\n source_map=True, # default true\n format=lambda_nodejs.OutputFormat.ESM, # default ESM (index.mjs); CJS gives index.js\n external_modules=[]\n )\n)","version":"2"},"csharp":{"source":"new NodejsWebFunction(this, \"Api\", new NodejsWebFunctionProps {\n Entry = \"src/server.ts\",\n AuthType = WebFunctionAuthType.AWS_IAM,\n Bundling = new NodejsWebFunctionBundlingOptions {\n Minify = true, // default true\n SourceMap = true, // default true\n Format = OutputFormat.ESM, // default ESM (index.mjs); CJS gives index.js\n ExternalModules = new [] { }\n }\n});","version":"2"},"java":{"source":"NodejsWebFunction.Builder.create(this, \"Api\")\n .entry(\"src/server.ts\")\n .authType(WebFunctionAuthType.AWS_IAM)\n .bundling(NodejsWebFunctionBundlingOptions.builder()\n .minify(true) // default true\n .sourceMap(true) // default true\n .format(OutputFormat.ESM) // default ESM (index.mjs); CJS gives index.js\n .externalModules(List.of())\n .build())\n .build();","version":"1"},"go":{"source":"ashishpandeyonecdklambdawebfunction.NewNodejsWebFunction(this, jsii.String(\"Api\"), &NodejsWebFunctionProps{\n\tEntry: jsii.String(\"src/server.ts\"),\n\tAuthType: *ashishpandeyonecdklambdawebfunction.WebFunctionAuthType_AWS_IAM,\n\tBundling: &NodejsWebFunctionBundlingOptions{\n\t\tMinify: jsii.Boolean(true),\n\t\t // default true\n\t\tSourceMap: jsii.Boolean(true),\n\t\t // default true\n\t\tFormat: lambdaNodejs.OutputFormat_ESM,\n\t\t // default ESM (index.mjs); CJS gives index.js\n\t\tExternalModules: []*string{\n\t\t},\n\t},\n})","version":"2"},"$":{"source":"new 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});","version":"0"}},"location":{"api":{"api":"moduleReadme","moduleFqn":"@ashishpandeyone/cdk-lambda-web-function"},"field":{"field":"markdown","line":339}},"didCompile":true,"fqnsReferenced":["@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction","@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions","@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps","@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType","@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType#AWS_IAM","aws-cdk-lib.aws_lambda_nodejs.OutputFormat","aws-cdk-lib.aws_lambda_nodejs.OutputFormat#ESM","constructs.Construct"],"fullSource":"// Fixture for README examples: imports and a few declared values; the example replaces \"/// here\".\nimport { CfnOutput, CfnResource, Duration, type IPropertyInjector, PropertyInjectors, RemovalPolicy, Stack } from 'aws-cdk-lib';\nimport * as cloudfront from 'aws-cdk-lib/aws-cloudfront';\nimport * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';\nimport * as dynamodb from 'aws-cdk-lib/aws-dynamodb';\nimport * as iam from 'aws-cdk-lib/aws-iam';\nimport * as kms from 'aws-cdk-lib/aws-kms';\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\nimport * as lambdaNodejs from 'aws-cdk-lib/aws-lambda-nodejs';\nimport * as logs from 'aws-cdk-lib/aws-logs';\nimport { Construct } from 'constructs';\nimport {\n NodejsWebFunction, WebFunction, WebFunctionAuthType, WebFunctionDeployment, WebFunctionEndpointType, WebFunctionOrigin, WebFunctionRevision,\n type WebFunctionProps,\n} from '@ashishpandeyone/cdk-lambda-web-function';\n\ndeclare const fn: WebFunction;\ndeclare const table: dynamodb.Table;\ndeclare const consumerRole: iam.IRole;\ndeclare const errorRate: cloudwatch.IAlarm;\n\nclass Fixture extends Stack {\n constructor(scope: Construct, id: string) {\n super(scope, id);\n\n // Code snippet begins after !show marker below\n/// !show\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/// !hide\n// Code snippet ended before !hide marker above\n }\n}\n","syntaxKindCounter":{"11":2,"80":13,"110":1,"112":2,"210":1,"211":2,"212":3,"215":1,"245":1,"304":7},"fqnsFingerprint":"e1f939b19a602a6479e6cde93eea00f1c992565702cd973ce86a6180c07a18e7"},"33c01292193a1b51c9292f851bf127a583f7c96ba4d6c82bec6b6e9c7b62dfc7":{"translations":{"python":{"source":"WebFunction(self, \"Api\",\n runtime=lambda_.Runtime.NODEJS_24_X,\n code=lambda_.Code.from_asset(\"dist\"),\n auth_type=WebFunctionAuthType.AWS_IAM,\n revision_retention=5\n)","version":"2"},"csharp":{"source":"new WebFunction(this, \"Api\", new WebFunctionProps {\n Runtime = Runtime.NODEJS_24_X,\n Code = Code.FromAsset(\"dist\"),\n AuthType = WebFunctionAuthType.AWS_IAM,\n RevisionRetention = 5\n});","version":"2"},"java":{"source":"WebFunction.Builder.create(this, \"Api\")\n .runtime(Runtime.NODEJS_24_X)\n .code(Code.fromAsset(\"dist\"))\n .authType(WebFunctionAuthType.AWS_IAM)\n .revisionRetention(5)\n .build();","version":"1"},"go":{"source":"ashishpandeyonecdklambdawebfunction.NewWebFunction(this, jsii.String(\"Api\"), &WebFunctionProps{\n\tRuntime: lambda.Runtime_NODEJS_24_X(),\n\tCode: lambda.Code_FromAsset(jsii.String(\"dist\")),\n\tAuthType: *ashishpandeyonecdklambdawebfunction.WebFunctionAuthType_AWS_IAM,\n\tRevisionRetention: jsii.Number(5),\n})","version":"2"},"$":{"source":"new 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});","version":"0"}},"location":{"api":{"api":"moduleReadme","moduleFqn":"@ashishpandeyone/cdk-lambda-web-function"},"field":{"field":"markdown","line":373}},"didCompile":true,"fqnsReferenced":["@ashishpandeyone/cdk-lambda-web-function.WebFunction","@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType","@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType#AWS_IAM","@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps","aws-cdk-lib.aws_lambda.Code","aws-cdk-lib.aws_lambda.Code#fromAsset","aws-cdk-lib.aws_lambda.Runtime","aws-cdk-lib.aws_lambda.Runtime#NODEJS_24_X","constructs.Construct"],"fullSource":"// Fixture for README examples: imports and a few declared values; the example replaces \"/// here\".\nimport { CfnOutput, CfnResource, Duration, type IPropertyInjector, PropertyInjectors, RemovalPolicy, Stack } from 'aws-cdk-lib';\nimport * as cloudfront from 'aws-cdk-lib/aws-cloudfront';\nimport * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';\nimport * as dynamodb from 'aws-cdk-lib/aws-dynamodb';\nimport * as iam from 'aws-cdk-lib/aws-iam';\nimport * as kms from 'aws-cdk-lib/aws-kms';\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\nimport * as lambdaNodejs from 'aws-cdk-lib/aws-lambda-nodejs';\nimport * as logs from 'aws-cdk-lib/aws-logs';\nimport { Construct } from 'constructs';\nimport {\n NodejsWebFunction, WebFunction, WebFunctionAuthType, WebFunctionDeployment, WebFunctionEndpointType, WebFunctionOrigin, WebFunctionRevision,\n type WebFunctionProps,\n} from '@ashishpandeyone/cdk-lambda-web-function';\n\ndeclare const fn: WebFunction;\ndeclare const table: dynamodb.Table;\ndeclare const consumerRole: iam.IRole;\ndeclare const errorRate: cloudwatch.IAlarm;\n\nclass Fixture extends Stack {\n constructor(scope: Construct, id: string) {\n super(scope, id);\n\n // Code snippet begins after !show marker below\n/// !show\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/// !hide\n// Code snippet ended before !hide marker above\n }\n}\n","syntaxKindCounter":{"9":1,"11":2,"80":13,"110":1,"211":1,"212":5,"214":1,"215":1,"245":1,"304":4},"fqnsFingerprint":"620202bfdc7c96cacbb02551211deda4bdf58c02d17a232b9bc113c46a98bc70"},"db82bfd0f2e297f423ad9dcbe1c89032c8ffe6e71cce1f8b4938af348f666617":{"translations":{"python":{"source":"previous = WebFunctionRevision.from_revision_attributes(self, \"Previous\",\n web_function=fn,\n revision_id=\"rev-a1b2c\"\n)\n\n# Keep the default endpoint on the previous revision, and send 10% to the new one:\nfn.endpoint.route_traffic(previous, [revision=fn.current_revision, weight=0.1])\n\n# Or a second endpoint that stays on the previous revision while fn.endpoint moves on:\nfn.add_endpoint(\"Stable\", auth_type=WebFunctionAuthType.AWS_IAM, revision=previous)","version":"2"},"csharp":{"source":"var previous = WebFunctionRevision.FromRevisionAttributes(this, \"Previous\", new WebFunctionRevisionAttributes {\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, new [] { new WebFunctionRevisionWeight { 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\", new AddWebFunctionEndpointOptions { AuthType = WebFunctionAuthType.AWS_IAM, Revision = previous });","version":"2"},"java":{"source":"IWebFunctionRevision previous = WebFunctionRevision.fromRevisionAttributes(this, \"Previous\", WebFunctionRevisionAttributes.builder()\n .webFunction(fn)\n .revisionId(\"rev-a1b2c\")\n .build());\n\n// Keep the default endpoint on the previous revision, and send 10% to the new one:\nfn.endpoint.routeTraffic(previous, List.of(WebFunctionRevisionWeight.builder().revision(fn.getCurrentRevision()).weight(0.1).build()));\n\n// Or a second endpoint that stays on the previous revision while fn.endpoint moves on:\nfn.addEndpoint(\"Stable\", AddWebFunctionEndpointOptions.builder().authType(WebFunctionAuthType.AWS_IAM).revision(previous).build());","version":"1"},"go":{"source":"previous := ashishpandeyonecdklambdawebfunction.WebFunctionRevision_FromRevisionAttributes(this, jsii.String(\"Previous\"), &WebFunctionRevisionAttributes{\n\tWebFunction: fn,\n\tRevisionId: jsii.String(\"rev-a1b2c\"),\n})\n\n// Keep the default endpoint on the previous revision, and send 10% to the new one:\nfn.Endpoint.RouteTraffic(previous, []WebFunctionRevisionWeight{\n\t&WebFunctionRevisionWeight{\n\t\tRevision: fn.CurrentRevision,\n\t\tWeight: jsii.Number(0.1),\n\t},\n})\n\n// Or a second endpoint that stays on the previous revision while fn.endpoint moves on:\nfn.AddEndpoint(jsii.String(\"Stable\"), &AddWebFunctionEndpointOptions{\n\tAuthType: *ashishpandeyonecdklambdawebfunction.WebFunctionAuthType_AWS_IAM,\n\tRevision: previous,\n})","version":"2"},"$":{"source":"const 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 });","version":"0"}},"location":{"api":{"api":"moduleReadme","moduleFqn":"@ashishpandeyone/cdk-lambda-web-function"},"field":{"field":"markdown","line":386}},"didCompile":true,"fqnsReferenced":["@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions","@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision","@ashishpandeyone/cdk-lambda-web-function.WebFunction#addEndpoint","@ashishpandeyone/cdk-lambda-web-function.WebFunction#currentRevision","@ashishpandeyone/cdk-lambda-web-function.WebFunction#endpoint","@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType","@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType#AWS_IAM","@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint#routeTraffic","@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevision#fromRevisionAttributes","@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevisionAttributes","aws-cdk-lib.interfaces.aws_lambda.IWebFunctionRef","constructs.Construct"],"fullSource":"// Fixture for README examples: imports and a few declared values; the example replaces \"/// here\".\nimport { CfnOutput, CfnResource, Duration, type IPropertyInjector, PropertyInjectors, RemovalPolicy, Stack } from 'aws-cdk-lib';\nimport * as cloudfront from 'aws-cdk-lib/aws-cloudfront';\nimport * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';\nimport * as dynamodb from 'aws-cdk-lib/aws-dynamodb';\nimport * as iam from 'aws-cdk-lib/aws-iam';\nimport * as kms from 'aws-cdk-lib/aws-kms';\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\nimport * as lambdaNodejs from 'aws-cdk-lib/aws-lambda-nodejs';\nimport * as logs from 'aws-cdk-lib/aws-logs';\nimport { Construct } from 'constructs';\nimport {\n NodejsWebFunction, WebFunction, WebFunctionAuthType, WebFunctionDeployment, WebFunctionEndpointType, WebFunctionOrigin, WebFunctionRevision,\n type WebFunctionProps,\n} from '@ashishpandeyone/cdk-lambda-web-function';\n\ndeclare const fn: WebFunction;\ndeclare const table: dynamodb.Table;\ndeclare const consumerRole: iam.IRole;\ndeclare const errorRate: cloudwatch.IAlarm;\n\nclass Fixture extends Stack {\n constructor(scope: Construct, id: string) {\n super(scope, id);\n\n // Code snippet begins after !show marker below\n/// !show\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/// !hide\n// Code snippet ended before !hide marker above\n }\n}\n","syntaxKindCounter":{"9":1,"11":3,"80":21,"110":1,"210":1,"211":3,"212":6,"214":3,"244":1,"245":2,"261":1,"262":1,"304":6},"fqnsFingerprint":"66c7d243eb7a2dec2a81b63baf7aac82a71bf50ca45f1795eb8fdb863fbec4ea"},"43367acfa330bb0800ebb668f1cdf635de6d7c0befe8c9ffeb6d6124e9b9cac6":{"translations":{"python":{"source":"from ashishpandeyone.cdk_lambda_web_function import WebFunctionEndpointOptions, WebFunctionRollbackOptions\napi = WebFunction(self, \"Api\",\n runtime=lambda_.Runtime.NODEJS_24_X,\n code=lambda_.Code.from_asset(\"dist\"),\n auth_type=WebFunctionAuthType.AWS_IAM,\n endpoint=WebFunctionEndpointOptions(\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), rollback_on=WebFunctionRollbackOptions(server_error_rate=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.add_endpoint(\"Public\",\n auth_type=WebFunctionAuthType.NONE,\n deployment=WebFunctionDeployment.linear(percent=25, interval=Duration.minutes(5), alarms=[error_rate])\n)","version":"2"},"csharp":{"source":"var api = new WebFunction(this, \"Api\", new WebFunctionProps {\n Runtime = Runtime.NODEJS_24_X,\n Code = Code.FromAsset(\"dist\"),\n AuthType = WebFunctionAuthType.AWS_IAM,\n Endpoint = new WebFunctionEndpointOptions {\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(new WebFunctionCanaryDeploymentOptions { Percent = 10, Bake = Duration.Minutes(10), RollbackOn = new WebFunctionRollbackOptions { 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\", new AddWebFunctionEndpointOptions {\n AuthType = WebFunctionAuthType.NONE,\n Deployment = WebFunctionDeployment.Linear(new WebFunctionLinearDeploymentOptions { Percent = 25, Interval = Duration.Minutes(5), Alarms = new [] { errorRate } })\n});","version":"2"},"java":{"source":"WebFunction api = WebFunction.Builder.create(this, \"Api\")\n .runtime(Runtime.NODEJS_24_X)\n .code(Code.fromAsset(\"dist\"))\n .authType(WebFunctionAuthType.AWS_IAM)\n .endpoint(WebFunctionEndpointOptions.builder()\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(WebFunctionCanaryDeploymentOptions.builder().percent(10).bake(Duration.minutes(10)).rollbackOn(WebFunctionRollbackOptions.builder().serverErrorRate(2).build()).build()))\n .build())\n .build();\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\", AddWebFunctionEndpointOptions.builder()\n .authType(WebFunctionAuthType.NONE)\n .deployment(WebFunctionDeployment.linear(WebFunctionLinearDeploymentOptions.builder().percent(25).interval(Duration.minutes(5)).alarms(List.of(errorRate)).build()))\n .build());","version":"1"},"go":{"source":"api := ashishpandeyonecdklambdawebfunction.NewWebFunction(this, jsii.String(\"Api\"), &WebFunctionProps{\n\tRuntime: lambda.Runtime_NODEJS_24_X(),\n\tCode: lambda.Code_FromAsset(jsii.String(\"dist\")),\n\tAuthType: *ashishpandeyonecdklambdawebfunction.WebFunctionAuthType_AWS_IAM,\n\tEndpoint: &WebFunctionEndpointOptions{\n\t\t// 10% of the traffic for 10 minutes, then all of it; back if more than 2% of requests get a 5XX.\n\t\tDeployment: *ashishpandeyonecdklambdawebfunction.WebFunctionDeployment_Canary(&WebFunctionCanaryDeploymentOptions{\n\t\t\tPercent: jsii.Number(10),\n\t\t\tBake: awscdk.Duration_Minutes(jsii.Number(10)),\n\t\t\tRollbackOn: &WebFunctionRollbackOptions{\n\t\t\t\tServerErrorRate: jsii.Number(2),\n\t\t\t},\n\t\t}),\n\t},\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(jsii.String(\"Public\"), &AddWebFunctionEndpointOptions{\n\tAuthType: *ashishpandeyonecdklambdawebfunction.WebFunctionAuthType_NONE,\n\tDeployment: *ashishpandeyonecdklambdawebfunction.WebFunctionDeployment_Linear(&WebFunctionLinearDeploymentOptions{\n\t\tPercent: jsii.Number(25),\n\t\tInterval: awscdk.Duration_*Minutes(jsii.Number(5)),\n\t\tAlarms: []IAlarm{\n\t\t\terrorRate,\n\t\t},\n\t}),\n})","version":"2"},"$":{"source":"const 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});","version":"0"}},"location":{"api":{"api":"moduleReadme","moduleFqn":"@ashishpandeyone/cdk-lambda-web-function"},"field":{"field":"markdown","line":407}},"didCompile":true,"fqnsReferenced":["@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions","@ashishpandeyone/cdk-lambda-web-function.WebFunction","@ashishpandeyone/cdk-lambda-web-function.WebFunction#addEndpoint","@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType","@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType#AWS_IAM","@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType#NONE","@ashishpandeyone/cdk-lambda-web-function.WebFunctionCanaryDeploymentOptions","@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment","@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment#canary","@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment#linear","@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions","@ashishpandeyone/cdk-lambda-web-function.WebFunctionLinearDeploymentOptions","@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps","@ashishpandeyone/cdk-lambda-web-function.WebFunctionRollbackOptions","aws-cdk-lib.Duration","aws-cdk-lib.Duration#minutes","aws-cdk-lib.aws_lambda.Code","aws-cdk-lib.aws_lambda.Code#fromAsset","aws-cdk-lib.aws_lambda.Runtime","aws-cdk-lib.aws_lambda.Runtime#NODEJS_24_X","constructs.Construct"],"fullSource":"// Fixture for README examples: imports and a few declared values; the example replaces \"/// here\".\nimport { CfnOutput, CfnResource, Duration, type IPropertyInjector, PropertyInjectors, RemovalPolicy, Stack } from 'aws-cdk-lib';\nimport * as cloudfront from 'aws-cdk-lib/aws-cloudfront';\nimport * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';\nimport * as dynamodb from 'aws-cdk-lib/aws-dynamodb';\nimport * as iam from 'aws-cdk-lib/aws-iam';\nimport * as kms from 'aws-cdk-lib/aws-kms';\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\nimport * as lambdaNodejs from 'aws-cdk-lib/aws-lambda-nodejs';\nimport * as logs from 'aws-cdk-lib/aws-logs';\nimport { Construct } from 'constructs';\nimport {\n NodejsWebFunction, WebFunction, WebFunctionAuthType, WebFunctionDeployment, WebFunctionEndpointType, WebFunctionOrigin, WebFunctionRevision,\n type WebFunctionProps,\n} from '@ashishpandeyone/cdk-lambda-web-function';\n\ndeclare const fn: WebFunction;\ndeclare const table: dynamodb.Table;\ndeclare const consumerRole: iam.IRole;\ndeclare const errorRate: cloudwatch.IAlarm;\n\nclass Fixture extends Stack {\n constructor(scope: Construct, id: string) {\n super(scope, id);\n\n // Code snippet begins after !show marker below\n/// !show\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/// !hide\n// Code snippet ended before !hide marker above\n }\n}\n","syntaxKindCounter":{"9":5,"11":3,"80":37,"110":1,"210":1,"211":6,"212":11,"214":6,"215":1,"244":1,"245":1,"261":1,"262":1,"304":14},"fqnsFingerprint":"d49a3f0a6fceb25cac1ab8b155ecf28fe13cb42c22b40dd29557804c355e8796"},"b74614e65d9f21334ceaf23e9a5511ff4d44b852c7911ae8511ede5c48f205b1":{"translations":{"python":{"source":"fn.endpoint.metric_server_error_rate().create_alarm(self, \"ErrorRate\", threshold=1, evaluation_periods=3)\nfn.endpoint.metric_request_throttles().create_alarm(self, \"Throttled\", threshold=10, evaluation_periods=3)\nfn.metric_concurrent_requests().create_alarm(self, \"Saturated\", threshold=60, evaluation_periods=3)","version":"2"},"csharp":{"source":"fn.Endpoint.MetricServerErrorRate().CreateAlarm(this, \"ErrorRate\", new CreateAlarmOptions { Threshold = 1, EvaluationPeriods = 3 });\nfn.Endpoint.MetricRequestThrottles().CreateAlarm(this, \"Throttled\", new CreateAlarmOptions { Threshold = 10, EvaluationPeriods = 3 });\nfn.MetricConcurrentRequests().CreateAlarm(this, \"Saturated\", new CreateAlarmOptions { Threshold = 60, EvaluationPeriods = 3 });","version":"2"},"java":{"source":"fn.endpoint.metricServerErrorRate().createAlarm(this, \"ErrorRate\", CreateAlarmOptions.builder().threshold(1).evaluationPeriods(3).build());\nfn.endpoint.metricRequestThrottles().createAlarm(this, \"Throttled\", CreateAlarmOptions.builder().threshold(10).evaluationPeriods(3).build());\nfn.metricConcurrentRequests().createAlarm(this, \"Saturated\", CreateAlarmOptions.builder().threshold(60).evaluationPeriods(3).build());","version":"1"},"go":{"source":"fn.Endpoint.MetricServerErrorRate().CreateAlarm(this, jsii.String(\"ErrorRate\"), &CreateAlarmOptions{\n\tThreshold: jsii.Number(1),\n\tEvaluationPeriods: jsii.Number(3),\n})\nfn.Endpoint.MetricRequestThrottles().CreateAlarm(this, jsii.String(\"Throttled\"), &CreateAlarmOptions{\n\tThreshold: jsii.Number(10),\n\tEvaluationPeriods: jsii.Number(3),\n})\nfn.MetricConcurrentRequests().CreateAlarm(this, jsii.String(\"Saturated\"), &CreateAlarmOptions{\n\tThreshold: jsii.Number(60),\n\tEvaluationPeriods: jsii.Number(3),\n})","version":"2"},"$":{"source":"fn.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 });","version":"0"}},"location":{"api":{"api":"moduleReadme","moduleFqn":"@ashishpandeyone/cdk-lambda-web-function"},"field":{"field":"markdown","line":464}},"didCompile":true,"fqnsReferenced":["@ashishpandeyone/cdk-lambda-web-function.WebFunction#endpoint","@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase#metricConcurrentRequests","@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint#metricRequestThrottles","@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint#metricServerErrorRate","aws-cdk-lib.aws_cloudwatch.CreateAlarmOptions","aws-cdk-lib.aws_cloudwatch.MathExpression#createAlarm","aws-cdk-lib.aws_cloudwatch.Metric#createAlarm","constructs.Construct"],"fullSource":"// Fixture for README examples: imports and a few declared values; the example replaces \"/// here\".\nimport { CfnOutput, CfnResource, Duration, type IPropertyInjector, PropertyInjectors, RemovalPolicy, Stack } from 'aws-cdk-lib';\nimport * as cloudfront from 'aws-cdk-lib/aws-cloudfront';\nimport * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';\nimport * as dynamodb from 'aws-cdk-lib/aws-dynamodb';\nimport * as iam from 'aws-cdk-lib/aws-iam';\nimport * as kms from 'aws-cdk-lib/aws-kms';\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\nimport * as lambdaNodejs from 'aws-cdk-lib/aws-lambda-nodejs';\nimport * as logs from 'aws-cdk-lib/aws-logs';\nimport { Construct } from 'constructs';\nimport {\n NodejsWebFunction, WebFunction, WebFunctionAuthType, WebFunctionDeployment, WebFunctionEndpointType, WebFunctionOrigin, WebFunctionRevision,\n type WebFunctionProps,\n} from '@ashishpandeyone/cdk-lambda-web-function';\n\ndeclare const fn: WebFunction;\ndeclare const table: dynamodb.Table;\ndeclare const consumerRole: iam.IRole;\ndeclare const errorRate: cloudwatch.IAlarm;\n\nclass Fixture extends Stack {\n constructor(scope: Construct, id: string) {\n super(scope, id);\n\n // Code snippet begins after !show marker below\n/// !show\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/// !hide\n// Code snippet ended before !hide marker above\n }\n}\n","syntaxKindCounter":{"9":6,"11":3,"80":17,"110":3,"211":3,"212":8,"214":6,"245":3,"304":6},"fqnsFingerprint":"17dafda2e00aa683b89ffed1a845e7dfeca595ea68afc75a8039ac1eb69b9c47"},"3c352cab55b922183fc2fdeed968c86af6f90a6e1f7aa5c2587f46a38e2b0968":{"translations":{"python":{"source":"WebFunction(self, \"Api\",\n runtime=lambda_.Runtime.NODEJS_24_X,\n code=lambda_.Code.from_asset(\"dist\"),\n auth_type=WebFunctionAuthType.AWS_IAM,\n log_retention=logs.RetentionDays.THREE_MONTHS, # default ONE_MONTH, every group in every region\n log_removal_policy=RemovalPolicy.DESTROY, # default RETAIN\n application_log_level_v2=lambda_.ApplicationLogLevel.WARN,\n system_log_level_v2=lambda_.SystemLogLevel.INFO\n)","version":"2"},"csharp":{"source":"new WebFunction(this, \"Api\", new WebFunctionProps {\n Runtime = Runtime.NODEJS_24_X,\n Code = Code.FromAsset(\"dist\"),\n AuthType = WebFunctionAuthType.AWS_IAM,\n LogRetention = RetentionDays.THREE_MONTHS, // default ONE_MONTH, every group in every region\n LogRemovalPolicy = RemovalPolicy.DESTROY, // default RETAIN\n ApplicationLogLevelV2 = ApplicationLogLevel.WARN,\n SystemLogLevelV2 = SystemLogLevel.INFO\n});","version":"2"},"java":{"source":"WebFunction.Builder.create(this, \"Api\")\n .runtime(Runtime.NODEJS_24_X)\n .code(Code.fromAsset(\"dist\"))\n .authType(WebFunctionAuthType.AWS_IAM)\n .logRetention(RetentionDays.THREE_MONTHS) // default ONE_MONTH, every group in every region\n .logRemovalPolicy(RemovalPolicy.DESTROY) // default RETAIN\n .applicationLogLevelV2(ApplicationLogLevel.WARN)\n .systemLogLevelV2(SystemLogLevel.INFO)\n .build();","version":"1"},"go":{"source":"ashishpandeyonecdklambdawebfunction.NewWebFunction(this, jsii.String(\"Api\"), &WebFunctionProps{\n\tRuntime: lambda.Runtime_NODEJS_24_X(),\n\tCode: lambda.Code_FromAsset(jsii.String(\"dist\")),\n\tAuthType: *ashishpandeyonecdklambdawebfunction.WebFunctionAuthType_AWS_IAM,\n\tLogRetention: logs.RetentionDays_THREE_MONTHS,\n\t // default ONE_MONTH, every group in every region\n\tLogRemovalPolicy: awscdk.RemovalPolicy_DESTROY,\n\t // default RETAIN\n\tApplicationLogLevelV2: lambda.ApplicationLogLevel_WARN,\n\tSystemLogLevelV2: lambda.SystemLogLevel_INFO,\n})","version":"2"},"$":{"source":"new 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});","version":"0"}},"location":{"api":{"api":"moduleReadme","moduleFqn":"@ashishpandeyone/cdk-lambda-web-function"},"field":{"field":"markdown","line":503}},"didCompile":true,"fqnsReferenced":["@ashishpandeyone/cdk-lambda-web-function.WebFunction","@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType","@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType#AWS_IAM","@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps","aws-cdk-lib.RemovalPolicy","aws-cdk-lib.RemovalPolicy#DESTROY","aws-cdk-lib.aws_lambda.ApplicationLogLevel","aws-cdk-lib.aws_lambda.ApplicationLogLevel#WARN","aws-cdk-lib.aws_lambda.Code","aws-cdk-lib.aws_lambda.Code#fromAsset","aws-cdk-lib.aws_lambda.Runtime","aws-cdk-lib.aws_lambda.Runtime#NODEJS_24_X","aws-cdk-lib.aws_lambda.SystemLogLevel","aws-cdk-lib.aws_lambda.SystemLogLevel#INFO","aws-cdk-lib.aws_logs.RetentionDays","aws-cdk-lib.aws_logs.RetentionDays#THREE_MONTHS","constructs.Construct"],"fullSource":"// Fixture for README examples: imports and a few declared values; the example replaces \"/// here\".\nimport { CfnOutput, CfnResource, Duration, type IPropertyInjector, PropertyInjectors, RemovalPolicy, Stack } from 'aws-cdk-lib';\nimport * as cloudfront from 'aws-cdk-lib/aws-cloudfront';\nimport * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';\nimport * as dynamodb from 'aws-cdk-lib/aws-dynamodb';\nimport * as iam from 'aws-cdk-lib/aws-iam';\nimport * as kms from 'aws-cdk-lib/aws-kms';\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\nimport * as lambdaNodejs from 'aws-cdk-lib/aws-lambda-nodejs';\nimport * as logs from 'aws-cdk-lib/aws-logs';\nimport { Construct } from 'constructs';\nimport {\n NodejsWebFunction, WebFunction, WebFunctionAuthType, WebFunctionDeployment, WebFunctionEndpointType, WebFunctionOrigin, WebFunctionRevision,\n type WebFunctionProps,\n} from '@ashishpandeyone/cdk-lambda-web-function';\n\ndeclare const fn: WebFunction;\ndeclare const table: dynamodb.Table;\ndeclare const consumerRole: iam.IRole;\ndeclare const errorRate: cloudwatch.IAlarm;\n\nclass Fixture extends Stack {\n constructor(scope: Construct, id: string) {\n super(scope, id);\n\n // Code snippet begins after !show marker below\n/// !show\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/// !hide\n// Code snippet ended before !hide marker above\n }\n}\n","syntaxKindCounter":{"11":2,"80":27,"110":1,"211":1,"212":12,"214":1,"215":1,"245":1,"304":7},"fqnsFingerprint":"31342459400f5f4d0dd4125e8ae3e88bc884b5e71ea559ad14a244f082e40b28"},"7678112ceb1faa7befc87dd9133f9321801d1545644522d64e6f6b4fd20bb987":{"translations":{"python":{"source":"(fn.node.find_child(\"ResourcePolicy\")).apply_removal_policy(RemovalPolicy.RETAIN)","version":"2"},"csharp":{"source":"((CfnResource)fn.Node.FindChild(\"ResourcePolicy\")).ApplyRemovalPolicy(RemovalPolicy.RETAIN);","version":"2"},"java":{"source":"((CfnResource)fn.node.findChild(\"ResourcePolicy\")).applyRemovalPolicy(RemovalPolicy.RETAIN);","version":"1"},"go":{"source":"(fn.Node.FindChild(jsii.String(\"ResourcePolicy\")).(CfnResource)).ApplyRemovalPolicy(awscdk.RemovalPolicy_RETAIN)","version":"2"},"$":{"source":"(fn.node.findChild('ResourcePolicy') as CfnResource).applyRemovalPolicy(RemovalPolicy.RETAIN);","version":"0"}},"location":{"api":{"api":"moduleReadme","moduleFqn":"@ashishpandeyone/cdk-lambda-web-function"},"field":{"field":"markdown","line":543}},"didCompile":true,"fqnsReferenced":["aws-cdk-lib.CfnResource#applyRemovalPolicy","aws-cdk-lib.RemovalPolicy","aws-cdk-lib.RemovalPolicy#RETAIN","constructs.Construct#node","constructs.Node#findChild"],"fullSource":"// Fixture for README examples: imports and a few declared values; the example replaces \"/// here\".\nimport { CfnOutput, CfnResource, Duration, type IPropertyInjector, PropertyInjectors, RemovalPolicy, Stack } from 'aws-cdk-lib';\nimport * as cloudfront from 'aws-cdk-lib/aws-cloudfront';\nimport * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';\nimport * as dynamodb from 'aws-cdk-lib/aws-dynamodb';\nimport * as iam from 'aws-cdk-lib/aws-iam';\nimport * as kms from 'aws-cdk-lib/aws-kms';\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\nimport * as lambdaNodejs from 'aws-cdk-lib/aws-lambda-nodejs';\nimport * as logs from 'aws-cdk-lib/aws-logs';\nimport { Construct } from 'constructs';\nimport {\n NodejsWebFunction, WebFunction, WebFunctionAuthType, WebFunctionDeployment, WebFunctionEndpointType, WebFunctionOrigin, WebFunctionRevision,\n type WebFunctionProps,\n} from '@ashishpandeyone/cdk-lambda-web-function';\n\ndeclare const fn: WebFunction;\ndeclare const table: dynamodb.Table;\ndeclare const consumerRole: iam.IRole;\ndeclare const errorRate: cloudwatch.IAlarm;\n\nclass Fixture extends Stack {\n constructor(scope: Construct, id: string) {\n super(scope, id);\n\n // Code snippet begins after !show marker below\n/// !show\n(fn.node.findChild('ResourcePolicy') as CfnResource).applyRemovalPolicy(RemovalPolicy.RETAIN);\n/// !hide\n// Code snippet ended before !hide marker above\n }\n}\n","syntaxKindCounter":{"11":1,"80":7,"184":1,"212":4,"214":2,"218":1,"235":1,"245":1},"fqnsFingerprint":"2ae251cb0bb88a2c1d253b3c0346beedabb4524f779a38a11e400eb553699881"}}}
|
|
1
|
+
{"version":"2","toolVersion":"6.0.19","snippets":{"b722e8cfc284c4ad172d3c0845a1e12986655461f32df0e464aeccc8774b0a91":{"translations":{"python":{"source":"from ashishpandeyone.cdk_lambda_web_function import WebFunctionEndpointOptions\nimport aws_cdk.aws_lambda as lambda_\nfrom ashishpandeyone.cdk_lambda_web_function import WebFunction, WebFunctionAuthType, WebFunctionEndpointType\n\n\nfn = WebFunction(self, \"Api\",\n runtime=lambda_.Runtime.NODEJS_24_X,\n code=lambda_.Code.from_asset(\"dist\"),\n auth_type=WebFunctionAuthType.AWS_IAM,\n endpoint=WebFunctionEndpointOptions(\n endpoint_type=WebFunctionEndpointType.MULTI_REGION,\n regions=[\"us-east-1\", \"eu-west-1\"]\n )\n)\n\nCfnOutput(self, \"Url\", value=fn.endpoint.url)","version":"2"},"csharp":{"source":"using Amazon.CDK.AWS.Lambda;\nusing Ashishpandeyone.Cdk.Lambda.Web.Function;\n\n\nvar fn = new WebFunction(this, \"Api\", new WebFunctionProps {\n Runtime = Runtime.NODEJS_24_X,\n Code = Code.FromAsset(\"dist\"),\n AuthType = WebFunctionAuthType.AWS_IAM,\n Endpoint = new WebFunctionEndpointOptions {\n EndpointType = WebFunctionEndpointType.MULTI_REGION,\n Regions = new [] { \"us-east-1\", \"eu-west-1\" }\n }\n});\n\nnew CfnOutput(this, \"Url\", new CfnOutputProps { Value = fn.Endpoint.Url });","version":"2"},"java":{"source":"import software.amazon.awscdk.services.lambda.*;\nimport ashishpandeyone.cdk.lambda.web.function.WebFunction;\nimport ashishpandeyone.cdk.lambda.web.function.WebFunctionAuthType;\nimport ashishpandeyone.cdk.lambda.web.function.WebFunctionEndpointType;\n\n\nWebFunction fn = WebFunction.Builder.create(this, \"Api\")\n .runtime(Runtime.NODEJS_24_X)\n .code(Code.fromAsset(\"dist\"))\n .authType(WebFunctionAuthType.AWS_IAM)\n .endpoint(WebFunctionEndpointOptions.builder()\n .endpointType(WebFunctionEndpointType.MULTI_REGION)\n .regions(List.of(\"us-east-1\", \"eu-west-1\"))\n .build())\n .build();\n\nCfnOutput.Builder.create(this, \"Url\").value(fn.getEndpoint().getUrl()).build();","version":"1"},"go":{"source":"import \"github.com/aws/aws-cdk-go/awscdk\"\nimport \"github.com/aws-samples/dummy/ashishpandeyonecdklambdawebfunction\"\n\n\nfn := ashishpandeyonecdklambdawebfunction.NewWebFunction(this, jsii.String(\"Api\"), &WebFunctionProps{\n\tRuntime: lambda.Runtime_NODEJS_24_X(),\n\tCode: lambda.Code_FromAsset(jsii.String(\"dist\")),\n\tAuthType: *ashishpandeyonecdklambdawebfunction.WebFunctionAuthType_AWS_IAM,\n\tEndpoint: &WebFunctionEndpointOptions{\n\t\tEndpointType: *ashishpandeyonecdklambdawebfunction.WebFunctionEndpointType_MULTI_REGION,\n\t\tRegions: []*string{\n\t\t\tjsii.String(\"us-east-1\"),\n\t\t\tjsii.String(\"eu-west-1\"),\n\t\t},\n\t},\n})\n\nawscdk.NewCfnOutput(this, jsii.String(\"Url\"), &CfnOutputProps{\n\tValue: fn.Endpoint.Url,\n})","version":"2"},"$":{"source":"import * 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","version":"0"}},"location":{"api":{"api":"moduleReadme","moduleFqn":"@ashishpandeyone/cdk-lambda-web-function"},"field":{"field":"markdown","line":21}},"didCompile":true,"fqnsReferenced":["@ashishpandeyone/cdk-lambda-web-function.WebFunction","@ashishpandeyone/cdk-lambda-web-function.WebFunction#endpoint","@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType","@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType#AWS_IAM","@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint#url","@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions","@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointType","@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointType#MULTI_REGION","@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps","aws-cdk-lib.CfnOutput","aws-cdk-lib.CfnOutputProps","aws-cdk-lib.aws_lambda.Code","aws-cdk-lib.aws_lambda.Code#fromAsset","aws-cdk-lib.aws_lambda.Runtime","aws-cdk-lib.aws_lambda.Runtime#NODEJS_24_X","constructs.Construct"],"fullSource":"// Hoisted imports begin after !show marker below\n/// !show\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\nimport { WebFunction, WebFunctionAuthType, WebFunctionEndpointType } from '@ashishpandeyone/cdk-lambda-web-function';\n/// !hide\n// Hoisted imports ended before !hide marker above\n// Fixture for examples that show their own imports.\nimport { Construct } from 'constructs';\nimport { CfnOutput, Stack } from 'aws-cdk-lib';\n\nclass Fixture extends Stack {\n constructor(scope: Construct, id: string) {\n super(scope, id);\n\n // Code snippet begins after !show marker below\n/// !show\n\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 });\n/// !hide\n// Code snippet ended before !hide marker above\n }\n}\n","syntaxKindCounter":{"11":7,"80":27,"110":2,"210":1,"211":3,"212":8,"214":1,"215":2,"244":1,"245":1,"261":1,"262":1,"273":2,"274":2,"275":1,"276":1,"277":3,"304":7,"308":1},"fqnsFingerprint":"f385c3e747cfeec07dede4e91ece148f0c7a2dbb163557cd1a088c4831598fcd"},"bb3f6414fcc3c98134fd029d5100626c240c5a2a293b9cac8457e3ad6fabedfe":{"translations":{"python":{"source":"from ashishpandeyone.cdk_lambda_web_function import WebFunctionEndpointOptions\nper_region = WebFunction(self, \"Api\",\n runtime=lambda_.Runtime.NODEJS_24_X,\n code=lambda_.Code.from_asset(\"dist\"),\n auth_type=WebFunctionAuthType.AWS_IAM,\n endpoint=WebFunctionEndpointOptions(\n endpoint_type=WebFunctionEndpointType.PER_REGION,\n regions=[\"us-east-1\", \"eu-west-1\"]\n )\n)\n\nCfnOutput(self, \"UsEast1Url\", value=per_region.endpoint.regional_url(\"us-east-1\"))","version":"2"},"csharp":{"source":"var perRegion = new WebFunction(this, \"Api\", new WebFunctionProps {\n Runtime = Runtime.NODEJS_24_X,\n Code = Code.FromAsset(\"dist\"),\n AuthType = WebFunctionAuthType.AWS_IAM,\n Endpoint = new WebFunctionEndpointOptions {\n EndpointType = WebFunctionEndpointType.PER_REGION,\n Regions = new [] { \"us-east-1\", \"eu-west-1\" }\n }\n});\n\nnew CfnOutput(this, \"UsEast1Url\", new CfnOutputProps { Value = perRegion.Endpoint.RegionalUrl(\"us-east-1\") });","version":"2"},"java":{"source":"WebFunction perRegion = WebFunction.Builder.create(this, \"Api\")\n .runtime(Runtime.NODEJS_24_X)\n .code(Code.fromAsset(\"dist\"))\n .authType(WebFunctionAuthType.AWS_IAM)\n .endpoint(WebFunctionEndpointOptions.builder()\n .endpointType(WebFunctionEndpointType.PER_REGION)\n .regions(List.of(\"us-east-1\", \"eu-west-1\"))\n .build())\n .build();\n\nCfnOutput.Builder.create(this, \"UsEast1Url\").value(perRegion.endpoint.regionalUrl(\"us-east-1\")).build();","version":"1"},"go":{"source":"perRegion := ashishpandeyonecdklambdawebfunction.NewWebFunction(this, jsii.String(\"Api\"), &WebFunctionProps{\n\tRuntime: lambda.Runtime_NODEJS_24_X(),\n\tCode: lambda.Code_FromAsset(jsii.String(\"dist\")),\n\tAuthType: *ashishpandeyonecdklambdawebfunction.WebFunctionAuthType_AWS_IAM,\n\tEndpoint: &WebFunctionEndpointOptions{\n\t\tEndpointType: *ashishpandeyonecdklambdawebfunction.WebFunctionEndpointType_PER_REGION,\n\t\tRegions: []*string{\n\t\t\tjsii.String(\"us-east-1\"),\n\t\t\tjsii.String(\"eu-west-1\"),\n\t\t},\n\t},\n})\n\nawscdk.NewCfnOutput(this, jsii.String(\"UsEast1Url\"), &CfnOutputProps{\n\tValue: perRegion.Endpoint.RegionalUrl(jsii.String(\"us-east-1\")),\n})","version":"2"},"$":{"source":"const 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']","version":"0"}},"location":{"api":{"api":"moduleReadme","moduleFqn":"@ashishpandeyone/cdk-lambda-web-function"},"field":{"field":"markdown","line":78}},"didCompile":true,"fqnsReferenced":["@ashishpandeyone/cdk-lambda-web-function.WebFunction","@ashishpandeyone/cdk-lambda-web-function.WebFunction#endpoint","@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType","@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType#AWS_IAM","@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint#regionalUrl","@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions","@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointType","@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointType#PER_REGION","@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps","aws-cdk-lib.CfnOutput","aws-cdk-lib.CfnOutputProps","aws-cdk-lib.aws_lambda.Code","aws-cdk-lib.aws_lambda.Code#fromAsset","aws-cdk-lib.aws_lambda.Runtime","aws-cdk-lib.aws_lambda.Runtime#NODEJS_24_X","constructs.Construct"],"fullSource":"// Fixture for README examples: imports and a few declared values; the example replaces \"/// here\".\nimport { CfnOutput, CfnResource, Duration, type IPropertyInjector, PropertyInjectors, RemovalPolicy, Stack } from 'aws-cdk-lib';\nimport * as cloudfront from 'aws-cdk-lib/aws-cloudfront';\nimport * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';\nimport * as dynamodb from 'aws-cdk-lib/aws-dynamodb';\nimport * as iam from 'aws-cdk-lib/aws-iam';\nimport * as kms from 'aws-cdk-lib/aws-kms';\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\nimport * as lambdaNodejs from 'aws-cdk-lib/aws-lambda-nodejs';\nimport * as logs from 'aws-cdk-lib/aws-logs';\nimport { Construct } from 'constructs';\nimport {\n NodejsWebFunction, WebFunction, WebFunctionAuthType, WebFunctionDeployment, WebFunctionEndpointType, WebFunctionOrigin, WebFunctionRevision,\n type WebFunctionProps,\n} from '@ashishpandeyone/cdk-lambda-web-function';\n\ndeclare const fn: WebFunction;\ndeclare const table: dynamodb.Table;\ndeclare const consumerRole: iam.IRole;\ndeclare const errorRate: cloudwatch.IAlarm;\n\nclass Fixture extends Stack {\n constructor(scope: Construct, id: string) {\n super(scope, id);\n\n // Code snippet begins after !show marker below\n/// !show\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/// !hide\n// Code snippet ended before !hide marker above\n }\n}\n","syntaxKindCounter":{"11":6,"80":23,"110":2,"210":1,"211":3,"212":8,"214":2,"215":2,"244":1,"245":1,"261":1,"262":1,"304":7},"fqnsFingerprint":"cbde633558e112c956a700280db4625aaa0f6bf1b482f767545ab7672eced604"},"076f6a80f55cad4801faa6bdc51de62d91e952006fd82731ca584333919e5c46":{"translations":{"python":{"source":"from ashishpandeyone.cdk_lambda_web_function import WebFunctionEndpointOptions\napi = WebFunction(self, \"Api\",\n runtime=lambda_.Runtime.NODEJS_24_X,\n code=lambda_.Code.from_asset(\"dist\"),\n auth_type=WebFunctionAuthType.NONE, # the default endpoint is public\n endpoint=WebFunctionEndpointOptions(rate_limit=1000)\n)\n\ninternal = api.add_endpoint(\"Internal\",\n auth_type=WebFunctionAuthType.AWS_IAM,\n endpoint_type=WebFunctionEndpointType.MULTI_REGION,\n regions=[\"us-east-1\", \"eu-west-1\"],\n description=\"Service-to-service traffic\",\n max_environments=50\n)\ninternal.grant_invoke(consumer_role)\nCfnOutput(self, \"InternalUrl\", value=internal.url)","version":"2"},"csharp":{"source":"var api = new WebFunction(this, \"Api\", new WebFunctionProps {\n Runtime = Runtime.NODEJS_24_X,\n Code = Code.FromAsset(\"dist\"),\n AuthType = WebFunctionAuthType.NONE, // the default endpoint is public\n Endpoint = new WebFunctionEndpointOptions { RateLimit = 1000 }\n});\n\nvar internal = api.AddEndpoint(\"Internal\", new AddWebFunctionEndpointOptions {\n AuthType = WebFunctionAuthType.AWS_IAM,\n EndpointType = WebFunctionEndpointType.MULTI_REGION,\n Regions = new [] { \"us-east-1\", \"eu-west-1\" },\n Description = \"Service-to-service traffic\",\n MaxEnvironments = 50\n});\ninternal.GrantInvoke(consumerRole);\nnew CfnOutput(this, \"InternalUrl\", new CfnOutputProps { Value = internal.Url });","version":"2"},"java":{"source":"WebFunction api = WebFunction.Builder.create(this, \"Api\")\n .runtime(Runtime.NODEJS_24_X)\n .code(Code.fromAsset(\"dist\"))\n .authType(WebFunctionAuthType.NONE) // the default endpoint is public\n .endpoint(WebFunctionEndpointOptions.builder().rateLimit(1000).build())\n .build();\n\nWebFunctionEndpoint internal = api.addEndpoint(\"Internal\", AddWebFunctionEndpointOptions.builder()\n .authType(WebFunctionAuthType.AWS_IAM)\n .endpointType(WebFunctionEndpointType.MULTI_REGION)\n .regions(List.of(\"us-east-1\", \"eu-west-1\"))\n .description(\"Service-to-service traffic\")\n .maxEnvironments(50)\n .build());\ninternal.grantInvoke(consumerRole);\nCfnOutput.Builder.create(this, \"InternalUrl\").value(internal.getUrl()).build();","version":"1"},"go":{"source":"api := ashishpandeyonecdklambdawebfunction.NewWebFunction(this, jsii.String(\"Api\"), &WebFunctionProps{\n\tRuntime: lambda.Runtime_NODEJS_24_X(),\n\tCode: lambda.Code_FromAsset(jsii.String(\"dist\")),\n\tAuthType: *ashishpandeyonecdklambdawebfunction.WebFunctionAuthType_NONE,\n\t // the default endpoint is public\n\tEndpoint: &WebFunctionEndpointOptions{\n\t\tRateLimit: jsii.Number(1000),\n\t},\n})\n\ninternal := api.AddEndpoint(jsii.String(\"Internal\"), &AddWebFunctionEndpointOptions{\n\tAuthType: *ashishpandeyonecdklambdawebfunction.WebFunctionAuthType_AWS_IAM,\n\tEndpointType: *ashishpandeyonecdklambdawebfunction.WebFunctionEndpointType_MULTI_REGION,\n\tRegions: []*string{\n\t\tjsii.String(\"us-east-1\"),\n\t\tjsii.String(\"eu-west-1\"),\n\t},\n\tDescription: jsii.String(\"Service-to-service traffic\"),\n\tMaxEnvironments: jsii.Number(50),\n})\ninternal.GrantInvoke(consumerRole)\nawscdk.NewCfnOutput(this, jsii.String(\"InternalUrl\"), &CfnOutputProps{\n\tValue: internal.Url,\n})","version":"2"},"$":{"source":"const 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 });","version":"0"}},"location":{"api":{"api":"moduleReadme","moduleFqn":"@ashishpandeyone/cdk-lambda-web-function"},"field":{"field":"markdown","line":101}},"didCompile":true,"fqnsReferenced":["@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions","@ashishpandeyone/cdk-lambda-web-function.WebFunction","@ashishpandeyone/cdk-lambda-web-function.WebFunction#addEndpoint","@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType","@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType#AWS_IAM","@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType#NONE","@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint","@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint#grantInvoke","@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint#url","@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions","@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointType","@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointType#MULTI_REGION","@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps","aws-cdk-lib.CfnOutput","aws-cdk-lib.CfnOutputProps","aws-cdk-lib.aws_iam.IGrantable","aws-cdk-lib.aws_lambda.Code","aws-cdk-lib.aws_lambda.Code#fromAsset","aws-cdk-lib.aws_lambda.Runtime","aws-cdk-lib.aws_lambda.Runtime#NODEJS_24_X","constructs.Construct"],"fullSource":"// Fixture for README examples: imports and a few declared values; the example replaces \"/// here\".\nimport { CfnOutput, CfnResource, Duration, type IPropertyInjector, PropertyInjectors, RemovalPolicy, Stack } from 'aws-cdk-lib';\nimport * as cloudfront from 'aws-cdk-lib/aws-cloudfront';\nimport * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';\nimport * as dynamodb from 'aws-cdk-lib/aws-dynamodb';\nimport * as iam from 'aws-cdk-lib/aws-iam';\nimport * as kms from 'aws-cdk-lib/aws-kms';\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\nimport * as lambdaNodejs from 'aws-cdk-lib/aws-lambda-nodejs';\nimport * as logs from 'aws-cdk-lib/aws-logs';\nimport { Construct } from 'constructs';\nimport {\n NodejsWebFunction, WebFunction, WebFunctionAuthType, WebFunctionDeployment, WebFunctionEndpointType, WebFunctionOrigin, WebFunctionRevision,\n type WebFunctionProps,\n} from '@ashishpandeyone/cdk-lambda-web-function';\n\ndeclare const fn: WebFunction;\ndeclare const table: dynamodb.Table;\ndeclare const consumerRole: iam.IRole;\ndeclare const errorRate: cloudwatch.IAlarm;\n\nclass Fixture extends Stack {\n constructor(scope: Construct, id: string) {\n super(scope, id);\n\n // Code snippet begins after !show marker below\n/// !show\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/// !hide\n// Code snippet ended before !hide marker above\n }\n}\n","syntaxKindCounter":{"9":2,"11":7,"80":34,"110":2,"210":1,"211":4,"212":10,"214":3,"215":2,"244":2,"245":2,"261":2,"262":2,"304":11},"fqnsFingerprint":"3c9d6468891ee6134508ad07e461a1e3cd56ed0c371d6674126f1585f29b286f"},"cbc3e74e8a7a4d7155ceaf265ed8d4d4f9036659d4002a2038f397ca3695fd0b":{"translations":{"python":{"source":"fn.grants.invoke(consumer_role)","version":"2"},"csharp":{"source":"fn.Grants.Invoke(consumerRole);","version":"2"},"java":{"source":"fn.grants.invoke(consumerRole);","version":"1"},"go":{"source":"fn.Grants.Invoke(consumerRole)","version":"2"},"$":{"source":"fn.grants.invoke(consumerRole); // or fn.grantInvoke(consumerRole), as on lambda.Function","version":"0"}},"location":{"api":{"api":"moduleReadme","moduleFqn":"@ashishpandeyone/cdk-lambda-web-function"},"field":{"field":"markdown","line":142}},"didCompile":true,"fqnsReferenced":["@ashishpandeyone/cdk-lambda-web-function.WebFunction#grants","@ashishpandeyone/cdk-lambda-web-function.WebFunctionGrants#invoke","aws-cdk-lib.aws_iam.IGrantable"],"fullSource":"// Fixture for README examples: imports and a few declared values; the example replaces \"/// here\".\nimport { CfnOutput, CfnResource, Duration, type IPropertyInjector, PropertyInjectors, RemovalPolicy, Stack } from 'aws-cdk-lib';\nimport * as cloudfront from 'aws-cdk-lib/aws-cloudfront';\nimport * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';\nimport * as dynamodb from 'aws-cdk-lib/aws-dynamodb';\nimport * as iam from 'aws-cdk-lib/aws-iam';\nimport * as kms from 'aws-cdk-lib/aws-kms';\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\nimport * as lambdaNodejs from 'aws-cdk-lib/aws-lambda-nodejs';\nimport * as logs from 'aws-cdk-lib/aws-logs';\nimport { Construct } from 'constructs';\nimport {\n NodejsWebFunction, WebFunction, WebFunctionAuthType, WebFunctionDeployment, WebFunctionEndpointType, WebFunctionOrigin, WebFunctionRevision,\n type WebFunctionProps,\n} from '@ashishpandeyone/cdk-lambda-web-function';\n\ndeclare const fn: WebFunction;\ndeclare const table: dynamodb.Table;\ndeclare const consumerRole: iam.IRole;\ndeclare const errorRate: cloudwatch.IAlarm;\n\nclass Fixture extends Stack {\n constructor(scope: Construct, id: string) {\n super(scope, id);\n\n // Code snippet begins after !show marker below\n/// !show\nfn.grants.invoke(consumerRole);\n/// !hide\n// Code snippet ended before !hide marker above\n }\n}\n","syntaxKindCounter":{"80":4,"212":2,"214":1,"245":1},"fqnsFingerprint":"84e03ddd0e39964df63b14d33c75eade62af31971bb8967173dff80fa5c11da4"},"f57ea40c6f4331f384cf617f69e5459b68ad5bd935e7536332543e89e138e344":{"translations":{"python":{"source":"fn.grant_invoke(iam.Role.from_role_arn(self, \"Partner\", \"arn:aws:iam::444455556666:role/caller\"))","version":"2"},"csharp":{"source":"fn.GrantInvoke(Role.FromRoleArn(this, \"Partner\", \"arn:aws:iam::444455556666:role/caller\"));","version":"2"},"java":{"source":"fn.grantInvoke(Role.fromRoleArn(this, \"Partner\", \"arn:aws:iam::444455556666:role/caller\"));","version":"1"},"go":{"source":"fn.GrantInvoke(iam.Role_FromRoleArn(this, jsii.String(\"Partner\"), jsii.String(\"arn:aws:iam::444455556666:role/caller\")))","version":"2"},"$":{"source":"fn.grantInvoke(iam.Role.fromRoleArn(this, 'Partner', 'arn:aws:iam::444455556666:role/caller'));","version":"0"}},"location":{"api":{"api":"moduleReadme","moduleFqn":"@ashishpandeyone/cdk-lambda-web-function"},"field":{"field":"markdown","line":172}},"didCompile":true,"fqnsReferenced":["@ashishpandeyone/cdk-lambda-web-function.WebFunction#grantInvoke","aws-cdk-lib.aws_iam.IGrantable","aws-cdk-lib.aws_iam.Role","aws-cdk-lib.aws_iam.Role#fromRoleArn","constructs.Construct"],"fullSource":"// Fixture for README examples: imports and a few declared values; the example replaces \"/// here\".\nimport { CfnOutput, CfnResource, Duration, type IPropertyInjector, PropertyInjectors, RemovalPolicy, Stack } from 'aws-cdk-lib';\nimport * as cloudfront from 'aws-cdk-lib/aws-cloudfront';\nimport * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';\nimport * as dynamodb from 'aws-cdk-lib/aws-dynamodb';\nimport * as iam from 'aws-cdk-lib/aws-iam';\nimport * as kms from 'aws-cdk-lib/aws-kms';\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\nimport * as lambdaNodejs from 'aws-cdk-lib/aws-lambda-nodejs';\nimport * as logs from 'aws-cdk-lib/aws-logs';\nimport { Construct } from 'constructs';\nimport {\n NodejsWebFunction, WebFunction, WebFunctionAuthType, WebFunctionDeployment, WebFunctionEndpointType, WebFunctionOrigin, WebFunctionRevision,\n type WebFunctionProps,\n} from '@ashishpandeyone/cdk-lambda-web-function';\n\ndeclare const fn: WebFunction;\ndeclare const table: dynamodb.Table;\ndeclare const consumerRole: iam.IRole;\ndeclare const errorRate: cloudwatch.IAlarm;\n\nclass Fixture extends Stack {\n constructor(scope: Construct, id: string) {\n super(scope, id);\n\n // Code snippet begins after !show marker below\n/// !show\nfn.grantInvoke(iam.Role.fromRoleArn(this, 'Partner', 'arn:aws:iam::444455556666:role/caller'));\n/// !hide\n// Code snippet ended before !hide marker above\n }\n}\n","syntaxKindCounter":{"11":2,"80":5,"110":1,"212":3,"214":2,"245":1},"fqnsFingerprint":"edc73b1162858e87f57fd65666c3aada90c2672d1cb74a91cd24c00f10132c2c"},"d0dcbf0a0cad621704eb158fcd6e109cc1f2b655443d54604472b3202638dbe0":{"translations":{"python":{"source":"fn.add_permission(\"PartnerAccount\", principal=iam.AccountPrincipal(\"444455556666\"))\nfn.add_permission(\"MyOrg\", principal=iam.OrganizationPrincipal(\"o-a1b2c3d4e5\"), endpoint=fn.endpoint)\nfn.add_permission(\"Cdn\",\n principal=iam.ServicePrincipal(\"cloudfront.amazonaws.com\"),\n source_arn=f\"arn:aws:cloudfront::{this.account}:distribution/EDFDVBD6EXAMPLE\"\n)","version":"2"},"csharp":{"source":"fn.AddPermission(\"PartnerAccount\", new WebFunctionPermission { Principal = new AccountPrincipal(\"444455556666\") });\nfn.AddPermission(\"MyOrg\", new WebFunctionPermission { Principal = new OrganizationPrincipal(\"o-a1b2c3d4e5\"), Endpoint = fn.Endpoint });\nfn.AddPermission(\"Cdn\", new WebFunctionPermission {\n Principal = new ServicePrincipal(\"cloudfront.amazonaws.com\"),\n SourceArn = $\"arn:aws:cloudfront::{this.account}:distribution/EDFDVBD6EXAMPLE\"\n});","version":"2"},"java":{"source":"fn.addPermission(\"PartnerAccount\", WebFunctionPermission.builder().principal(new AccountPrincipal(\"444455556666\")).build());\nfn.addPermission(\"MyOrg\", WebFunctionPermission.builder().principal(new OrganizationPrincipal(\"o-a1b2c3d4e5\")).endpoint(fn.getEndpoint()).build());\nfn.addPermission(\"Cdn\", WebFunctionPermission.builder()\n .principal(new ServicePrincipal(\"cloudfront.amazonaws.com\"))\n .sourceArn(String.format(\"arn:aws:cloudfront::%s:distribution/EDFDVBD6EXAMPLE\", this.account))\n .build());","version":"1"},"go":{"source":"fn.AddPermission(jsii.String(\"PartnerAccount\"), &WebFunctionPermission{\n\tPrincipal: iam.NewAccountPrincipal(jsii.String(\"444455556666\")),\n})\nfn.AddPermission(jsii.String(\"MyOrg\"), &WebFunctionPermission{\n\tPrincipal: iam.NewOrganizationPrincipal(jsii.String(\"o-a1b2c3d4e5\")),\n\tEndpoint: fn.Endpoint,\n})\nfn.AddPermission(jsii.String(\"Cdn\"), &WebFunctionPermission{\n\tPrincipal: iam.NewServicePrincipal(jsii.String(\"cloudfront.amazonaws.com\")),\n\tSourceArn: fmt.Sprintf(\"arn:aws:cloudfront::%v:distribution/EDFDVBD6EXAMPLE\", this.Account),\n})","version":"2"},"$":{"source":"fn.addPermission('PartnerAccount', { principal: new iam.AccountPrincipal('444455556666') });\nfn.addPermission('MyOrg', { principal: new iam.OrganizationPrincipal('o-a1b2c3d4e5'), endpoint: fn.endpoint });\nfn.addPermission('Cdn', {\n principal: new iam.ServicePrincipal('cloudfront.amazonaws.com'),\n sourceArn: `arn:aws:cloudfront::${this.account}:distribution/EDFDVBD6EXAMPLE`,\n});","version":"0"}},"location":{"api":{"api":"moduleReadme","moduleFqn":"@ashishpandeyone/cdk-lambda-web-function"},"field":{"field":"markdown","line":178}},"didCompile":true,"fqnsReferenced":["@ashishpandeyone/cdk-lambda-web-function.WebFunction#addPermission","@ashishpandeyone/cdk-lambda-web-function.WebFunction#endpoint","@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint","@ashishpandeyone/cdk-lambda-web-function.WebFunctionPermission","aws-cdk-lib.aws_iam.AccountPrincipal","aws-cdk-lib.aws_iam.IPrincipal","aws-cdk-lib.aws_iam.OrganizationPrincipal","aws-cdk-lib.aws_iam.ServicePrincipal"],"fullSource":"// Fixture for README examples: imports and a few declared values; the example replaces \"/// here\".\nimport { CfnOutput, CfnResource, Duration, type IPropertyInjector, PropertyInjectors, RemovalPolicy, Stack } from 'aws-cdk-lib';\nimport * as cloudfront from 'aws-cdk-lib/aws-cloudfront';\nimport * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';\nimport * as dynamodb from 'aws-cdk-lib/aws-dynamodb';\nimport * as iam from 'aws-cdk-lib/aws-iam';\nimport * as kms from 'aws-cdk-lib/aws-kms';\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\nimport * as lambdaNodejs from 'aws-cdk-lib/aws-lambda-nodejs';\nimport * as logs from 'aws-cdk-lib/aws-logs';\nimport { Construct } from 'constructs';\nimport {\n NodejsWebFunction, WebFunction, WebFunctionAuthType, WebFunctionDeployment, WebFunctionEndpointType, WebFunctionOrigin, WebFunctionRevision,\n type WebFunctionProps,\n} from '@ashishpandeyone/cdk-lambda-web-function';\n\ndeclare const fn: WebFunction;\ndeclare const table: dynamodb.Table;\ndeclare const consumerRole: iam.IRole;\ndeclare const errorRate: cloudwatch.IAlarm;\n\nclass Fixture extends Stack {\n constructor(scope: Construct, id: string) {\n super(scope, id);\n\n // Code snippet begins after !show marker below\n/// !show\nfn.addPermission('PartnerAccount', { principal: new iam.AccountPrincipal('444455556666') });\nfn.addPermission('MyOrg', { principal: new iam.OrganizationPrincipal('o-a1b2c3d4e5'), endpoint: fn.endpoint });\nfn.addPermission('Cdn', {\n principal: new iam.ServicePrincipal('cloudfront.amazonaws.com'),\n sourceArn: `arn:aws:cloudfront::${this.account}:distribution/EDFDVBD6EXAMPLE`,\n});\n/// !hide\n// Code snippet ended before !hide marker above\n }\n}\n","syntaxKindCounter":{"11":6,"16":1,"18":1,"80":20,"110":1,"211":3,"212":8,"214":3,"215":3,"229":1,"240":1,"245":3,"304":5},"fqnsFingerprint":"d1ceda7c28639c0e720685694d613ad8abe8cb615ed7556528157ced57410dd4"},"222d21828ab9910a4bee85977f48a6244f37c674dbeac8852df48070f323bfdc":{"translations":{"python":{"source":"cloudfront.Distribution(self, \"Cdn\",\n default_behavior=cloudfront.BehaviorOptions(\n origin=WebFunctionOrigin.with_origin_access_control(fn.endpoint),\n viewer_protocol_policy=cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,\n allowed_methods=cloudfront.AllowedMethods.ALLOW_ALL,\n cache_policy=cloudfront.CachePolicy.CACHING_DISABLED,\n origin_request_policy=cloudfront.OriginRequestPolicy.ALL_VIEWER_EXCEPT_HOST_HEADER\n )\n)","version":"2"},"csharp":{"source":"new Distribution(this, \"Cdn\", new DistributionProps {\n DefaultBehavior = new BehaviorOptions {\n Origin = WebFunctionOrigin.WithOriginAccessControl(fn.Endpoint),\n ViewerProtocolPolicy = ViewerProtocolPolicy.REDIRECT_TO_HTTPS,\n AllowedMethods = AllowedMethods.ALLOW_ALL,\n CachePolicy = CachePolicy.CACHING_DISABLED,\n OriginRequestPolicy = OriginRequestPolicy.ALL_VIEWER_EXCEPT_HOST_HEADER\n }\n});","version":"2"},"java":{"source":"Distribution.Builder.create(this, \"Cdn\")\n .defaultBehavior(BehaviorOptions.builder()\n .origin(WebFunctionOrigin.withOriginAccessControl(fn.getEndpoint()))\n .viewerProtocolPolicy(ViewerProtocolPolicy.REDIRECT_TO_HTTPS)\n .allowedMethods(AllowedMethods.ALLOW_ALL)\n .cachePolicy(CachePolicy.CACHING_DISABLED)\n .originRequestPolicy(OriginRequestPolicy.ALL_VIEWER_EXCEPT_HOST_HEADER)\n .build())\n .build();","version":"1"},"go":{"source":"cloudfront.NewDistribution(this, jsii.String(\"Cdn\"), &DistributionProps{\n\tDefaultBehavior: &BehaviorOptions{\n\t\tOrigin: ashishpandeyonecdklambdawebfunction.WebFunctionOrigin_WithOriginAccessControl(fn.Endpoint),\n\t\tViewerProtocolPolicy: cloudfront.ViewerProtocolPolicy_REDIRECT_TO_HTTPS,\n\t\tAllowedMethods: cloudfront.AllowedMethods_ALLOW_ALL(),\n\t\tCachePolicy: cloudfront.CachePolicy_CACHING_DISABLED(),\n\t\tOriginRequestPolicy: cloudfront.OriginRequestPolicy_ALL_VIEWER_EXCEPT_HOST_HEADER(),\n\t},\n})","version":"2"},"$":{"source":"new cloudfront.Distribution(this, 'Cdn', {\n defaultBehavior: {\n origin: WebFunctionOrigin.withOriginAccessControl(fn.endpoint),\n viewerProtocolPolicy: cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,\n allowedMethods: cloudfront.AllowedMethods.ALLOW_ALL,\n cachePolicy: cloudfront.CachePolicy.CACHING_DISABLED,\n originRequestPolicy: cloudfront.OriginRequestPolicy.ALL_VIEWER_EXCEPT_HOST_HEADER,\n },\n});","version":"0"}},"location":{"api":{"api":"moduleReadme","moduleFqn":"@ashishpandeyone/cdk-lambda-web-function"},"field":{"field":"markdown","line":200}},"didCompile":true,"fqnsReferenced":["@ashishpandeyone/cdk-lambda-web-function.WebFunction#endpoint","@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint","@ashishpandeyone/cdk-lambda-web-function.WebFunctionOrigin#withOriginAccessControl","aws-cdk-lib.aws_cloudfront.AllowedMethods","aws-cdk-lib.aws_cloudfront.AllowedMethods#ALLOW_ALL","aws-cdk-lib.aws_cloudfront.BehaviorOptions","aws-cdk-lib.aws_cloudfront.CachePolicy","aws-cdk-lib.aws_cloudfront.CachePolicy#CACHING_DISABLED","aws-cdk-lib.aws_cloudfront.Distribution","aws-cdk-lib.aws_cloudfront.DistributionProps","aws-cdk-lib.aws_cloudfront.IOrigin","aws-cdk-lib.aws_cloudfront.OriginRequestPolicy","aws-cdk-lib.aws_cloudfront.OriginRequestPolicy#ALL_VIEWER_EXCEPT_HOST_HEADER","aws-cdk-lib.aws_cloudfront.ViewerProtocolPolicy","aws-cdk-lib.aws_cloudfront.ViewerProtocolPolicy#REDIRECT_TO_HTTPS","aws-cdk-lib.interfaces.aws_cloudfront.ICachePolicyRef","aws-cdk-lib.interfaces.aws_cloudfront.IOriginRequestPolicyRef","constructs.Construct"],"fullSource":"// Fixture for README examples: imports and a few declared values; the example replaces \"/// here\".\nimport { CfnOutput, CfnResource, Duration, type IPropertyInjector, PropertyInjectors, RemovalPolicy, Stack } from 'aws-cdk-lib';\nimport * as cloudfront from 'aws-cdk-lib/aws-cloudfront';\nimport * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';\nimport * as dynamodb from 'aws-cdk-lib/aws-dynamodb';\nimport * as iam from 'aws-cdk-lib/aws-iam';\nimport * as kms from 'aws-cdk-lib/aws-kms';\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\nimport * as lambdaNodejs from 'aws-cdk-lib/aws-lambda-nodejs';\nimport * as logs from 'aws-cdk-lib/aws-logs';\nimport { Construct } from 'constructs';\nimport {\n NodejsWebFunction, WebFunction, WebFunctionAuthType, WebFunctionDeployment, WebFunctionEndpointType, WebFunctionOrigin, WebFunctionRevision,\n type WebFunctionProps,\n} from '@ashishpandeyone/cdk-lambda-web-function';\n\ndeclare const fn: WebFunction;\ndeclare const table: dynamodb.Table;\ndeclare const consumerRole: iam.IRole;\ndeclare const errorRate: cloudwatch.IAlarm;\n\nclass Fixture extends Stack {\n constructor(scope: Construct, id: string) {\n super(scope, id);\n\n // Code snippet begins after !show marker below\n/// !show\nnew cloudfront.Distribution(this, 'Cdn', {\n defaultBehavior: {\n origin: WebFunctionOrigin.withOriginAccessControl(fn.endpoint),\n viewerProtocolPolicy: cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,\n allowedMethods: cloudfront.AllowedMethods.ALLOW_ALL,\n cachePolicy: cloudfront.CachePolicy.CACHING_DISABLED,\n originRequestPolicy: cloudfront.OriginRequestPolicy.ALL_VIEWER_EXCEPT_HOST_HEADER,\n },\n});\n/// !hide\n// Code snippet ended before !hide marker above\n }\n}\n","syntaxKindCounter":{"11":1,"80":24,"110":1,"211":2,"212":11,"214":1,"215":1,"245":1,"304":6},"fqnsFingerprint":"3df67a32c62c4183d88326e0b821e19a19d79680f364fff4fc96d8db49215315"},"66cd362055159c5ee35ed25e7d92b05896f4e8f48e90f22869e272a3b8aaf480":{"translations":{"python":{"source":"forward_authorization = cloudfront.CachePolicy(self, \"ForwardAuthorization\",\n header_behavior=cloudfront.CacheHeaderBehavior.allow_list(\"Authorization\"),\n min_ttl=Duration.seconds(0),\n default_ttl=Duration.seconds(0),\n max_ttl=Duration.seconds(1)\n)","version":"2"},"csharp":{"source":"var forwardAuthorization = new CachePolicy(this, \"ForwardAuthorization\", new CachePolicyProps {\n HeaderBehavior = CacheHeaderBehavior.AllowList(\"Authorization\"),\n MinTtl = Duration.Seconds(0),\n DefaultTtl = Duration.Seconds(0),\n MaxTtl = Duration.Seconds(1)\n});","version":"2"},"java":{"source":"CachePolicy forwardAuthorization = CachePolicy.Builder.create(this, \"ForwardAuthorization\")\n .headerBehavior(CacheHeaderBehavior.allowList(\"Authorization\"))\n .minTtl(Duration.seconds(0))\n .defaultTtl(Duration.seconds(0))\n .maxTtl(Duration.seconds(1))\n .build();","version":"1"},"go":{"source":"forwardAuthorization := cloudfront.NewCachePolicy(this, jsii.String(\"ForwardAuthorization\"), &CachePolicyProps{\n\tHeaderBehavior: cloudfront.CacheHeaderBehavior_AllowList(jsii.String(\"Authorization\")),\n\tMinTtl: awscdk.Duration_Seconds(jsii.Number(0)),\n\tDefaultTtl: awscdk.Duration_*Seconds(jsii.Number(0)),\n\tMaxTtl: awscdk.Duration_*Seconds(jsii.Number(1)),\n})","version":"2"},"$":{"source":"const forwardAuthorization = new cloudfront.CachePolicy(this, 'ForwardAuthorization', {\n headerBehavior: cloudfront.CacheHeaderBehavior.allowList('Authorization'),\n minTtl: Duration.seconds(0),\n defaultTtl: Duration.seconds(0),\n maxTtl: Duration.seconds(1), // a cache key with headers needs caching enabled; 0/0/1 keeps it off in practice\n});","version":"0"}},"location":{"api":{"api":"moduleReadme","moduleFqn":"@ashishpandeyone/cdk-lambda-web-function"},"field":{"field":"markdown","line":220}},"didCompile":true,"fqnsReferenced":["aws-cdk-lib.Duration","aws-cdk-lib.Duration#seconds","aws-cdk-lib.aws_cloudfront.CacheHeaderBehavior","aws-cdk-lib.aws_cloudfront.CacheHeaderBehavior#allowList","aws-cdk-lib.aws_cloudfront.CachePolicy","aws-cdk-lib.aws_cloudfront.CachePolicyProps","constructs.Construct"],"fullSource":"// Fixture for README examples: imports and a few declared values; the example replaces \"/// here\".\nimport { CfnOutput, CfnResource, Duration, type IPropertyInjector, PropertyInjectors, RemovalPolicy, Stack } from 'aws-cdk-lib';\nimport * as cloudfront from 'aws-cdk-lib/aws-cloudfront';\nimport * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';\nimport * as dynamodb from 'aws-cdk-lib/aws-dynamodb';\nimport * as iam from 'aws-cdk-lib/aws-iam';\nimport * as kms from 'aws-cdk-lib/aws-kms';\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\nimport * as lambdaNodejs from 'aws-cdk-lib/aws-lambda-nodejs';\nimport * as logs from 'aws-cdk-lib/aws-logs';\nimport { Construct } from 'constructs';\nimport {\n NodejsWebFunction, WebFunction, WebFunctionAuthType, WebFunctionDeployment, WebFunctionEndpointType, WebFunctionOrigin, WebFunctionRevision,\n type WebFunctionProps,\n} from '@ashishpandeyone/cdk-lambda-web-function';\n\ndeclare const fn: WebFunction;\ndeclare const table: dynamodb.Table;\ndeclare const consumerRole: iam.IRole;\ndeclare const errorRate: cloudwatch.IAlarm;\n\nclass Fixture extends Stack {\n constructor(scope: Construct, id: string) {\n super(scope, id);\n\n // Code snippet begins after !show marker below\n/// !show\nconst forwardAuthorization = new cloudfront.CachePolicy(this, 'ForwardAuthorization', {\n headerBehavior: cloudfront.CacheHeaderBehavior.allowList('Authorization'),\n minTtl: Duration.seconds(0),\n defaultTtl: Duration.seconds(0),\n maxTtl: Duration.seconds(1), // a cache key with headers needs caching enabled; 0/0/1 keeps it off in practice\n});\n/// !hide\n// Code snippet ended before !hide marker above\n }\n}\n","syntaxKindCounter":{"9":3,"11":2,"80":16,"110":1,"211":1,"212":6,"214":4,"215":1,"244":1,"261":1,"262":1,"304":4},"fqnsFingerprint":"8b3b0b479ae90a313f45521250f0179f9cfe33b779156bb741e004a4ca2c7bf3"},"441da626377c697dff8b4bd0246c0f1ac028b55f70b07e5996276ac73b7dc523":{"translations":{"python":{"source":"orders = WebFunction.from_web_function_arn(self, \"Orders\", \"arn:aws:lambda:us-east-1:111122223333:web-function/orders\")\norders.grant_invoke(consumer_role) # every endpoint of the function\n\nlive = WebFunction.from_web_function_attributes(self, \"Live\",\n web_function_name=\"orders\", # in this stack's account and region\n endpoint_name=\"live\"\n)\nlive.metric_concurrent_requests().create_alarm(self, \"Busy\", threshold=60, evaluation_periods=3)","version":"2"},"csharp":{"source":"var orders = WebFunction.FromWebFunctionArn(this, \"Orders\", \"arn:aws:lambda:us-east-1:111122223333:web-function/orders\");\norders.GrantInvoke(consumerRole); // every endpoint of the function\n\nvar live = WebFunction.FromWebFunctionAttributes(this, \"Live\", new WebFunctionAttributes {\n WebFunctionName = \"orders\", // in this stack's account and region\n EndpointName = \"live\"\n});\nlive.MetricConcurrentRequests().CreateAlarm(this, \"Busy\", new CreateAlarmOptions { Threshold = 60, EvaluationPeriods = 3 });","version":"2"},"java":{"source":"IWebFunction orders = WebFunction.fromWebFunctionArn(this, \"Orders\", \"arn:aws:lambda:us-east-1:111122223333:web-function/orders\");\norders.grantInvoke(consumerRole); // every endpoint of the function\n\nIWebFunction live = WebFunction.fromWebFunctionAttributes(this, \"Live\", WebFunctionAttributes.builder()\n .webFunctionName(\"orders\") // in this stack's account and region\n .endpointName(\"live\")\n .build());\nlive.metricConcurrentRequests().createAlarm(this, \"Busy\", CreateAlarmOptions.builder().threshold(60).evaluationPeriods(3).build());","version":"1"},"go":{"source":"orders := ashishpandeyonecdklambdawebfunction.WebFunction_FromWebFunctionArn(this, jsii.String(\"Orders\"), jsii.String(\"arn:aws:lambda:us-east-1:111122223333:web-function/orders\"))\norders.GrantInvoke(consumerRole) // every endpoint of the function\n\nlive := ashishpandeyonecdklambdawebfunction.WebFunction_FromWebFunctionAttributes(this, jsii.String(\"Live\"), &WebFunctionAttributes{\n\tWebFunctionName: jsii.String(\"orders\"),\n\t // in this stack's account and region\n\tEndpointName: jsii.String(\"live\"),\n})\nlive.MetricConcurrentRequests().CreateAlarm(this, jsii.String(\"Busy\"), &CreateAlarmOptions{\n\tThreshold: jsii.Number(60),\n\tEvaluationPeriods: jsii.Number(3),\n})","version":"2"},"$":{"source":"const 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 });","version":"0"}},"location":{"api":{"api":"moduleReadme","moduleFqn":"@ashishpandeyone/cdk-lambda-web-function"},"field":{"field":"markdown","line":242}},"didCompile":true,"fqnsReferenced":["@ashishpandeyone/cdk-lambda-web-function.IWebFunction","@ashishpandeyone/cdk-lambda-web-function.IWebFunction#grantInvoke","@ashishpandeyone/cdk-lambda-web-function.IWebFunction#metricConcurrentRequests","@ashishpandeyone/cdk-lambda-web-function.WebFunction#fromWebFunctionArn","@ashishpandeyone/cdk-lambda-web-function.WebFunction#fromWebFunctionAttributes","@ashishpandeyone/cdk-lambda-web-function.WebFunctionAttributes","aws-cdk-lib.aws_cloudwatch.CreateAlarmOptions","aws-cdk-lib.aws_cloudwatch.Metric#createAlarm","aws-cdk-lib.aws_iam.IGrantable","constructs.Construct"],"fullSource":"// Fixture for README examples: imports and a few declared values; the example replaces \"/// here\".\nimport { CfnOutput, CfnResource, Duration, type IPropertyInjector, PropertyInjectors, RemovalPolicy, Stack } from 'aws-cdk-lib';\nimport * as cloudfront from 'aws-cdk-lib/aws-cloudfront';\nimport * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';\nimport * as dynamodb from 'aws-cdk-lib/aws-dynamodb';\nimport * as iam from 'aws-cdk-lib/aws-iam';\nimport * as kms from 'aws-cdk-lib/aws-kms';\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\nimport * as lambdaNodejs from 'aws-cdk-lib/aws-lambda-nodejs';\nimport * as logs from 'aws-cdk-lib/aws-logs';\nimport { Construct } from 'constructs';\nimport {\n NodejsWebFunction, WebFunction, WebFunctionAuthType, WebFunctionDeployment, WebFunctionEndpointType, WebFunctionOrigin, WebFunctionRevision,\n type WebFunctionProps,\n} from '@ashishpandeyone/cdk-lambda-web-function';\n\ndeclare const fn: WebFunction;\ndeclare const table: dynamodb.Table;\ndeclare const consumerRole: iam.IRole;\ndeclare const errorRate: cloudwatch.IAlarm;\n\nclass Fixture extends Stack {\n constructor(scope: Construct, id: string) {\n super(scope, id);\n\n // Code snippet begins after !show marker below\n/// !show\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/// !hide\n// Code snippet ended before !hide marker above\n }\n}\n","syntaxKindCounter":{"9":2,"11":6,"80":16,"110":3,"211":2,"212":5,"214":5,"244":2,"245":2,"261":2,"262":2,"304":4},"fqnsFingerprint":"9daccbbaf7d98ac267c5776c98940c70b19f4ede7bcec1d3382255409321da6f"},"3947670aa73c5690ddddaa699ab18765d47eabfad1c70d883d0d54736c159495":{"translations":{"python":{"source":"api = WebFunction(self, \"Api\",\n runtime=lambda_.Runtime.NODEJS_24_X,\n code=lambda_.Code.from_asset(\"build\"),\n auth_type=WebFunctionAuthType.AWS_IAM,\n entrypoint=\"server.js\", # default index.js\n web_function_name=\"orders-api\", # default: generated from the construct path\n description=\"Orders HTTP API\",\n environment={\"TABLE_NAME\": table.table_name},\n timeout=Duration.seconds(60), # per request: 3 seconds to 15 minutes, default 30 seconds\n max_concurrency_per_environment=32\n)\n\napi.add_environment(\"FEATURE_FLAG\", \"on\")\ntable.grant_read_write_data(api)","version":"2"},"csharp":{"source":"var api = new WebFunction(this, \"Api\", new WebFunctionProps {\n Runtime = Runtime.NODEJS_24_X,\n Code = 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 = new Dictionary<string, string> { { \"TABLE_NAME\", table.TableName } },\n Timeout = Duration.Seconds(60), // per request: 3 seconds to 15 minutes, default 30 seconds\n MaxConcurrencyPerEnvironment = 32\n});\n\napi.AddEnvironment(\"FEATURE_FLAG\", \"on\");\ntable.GrantReadWriteData(api);","version":"2"},"java":{"source":"WebFunction api = WebFunction.Builder.create(this, \"Api\")\n .runtime(Runtime.NODEJS_24_X)\n .code(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(Map.of(\"TABLE_NAME\", table.getTableName()))\n .timeout(Duration.seconds(60)) // per request: 3 seconds to 15 minutes, default 30 seconds\n .maxConcurrencyPerEnvironment(32)\n .build();\n\napi.addEnvironment(\"FEATURE_FLAG\", \"on\");\ntable.grantReadWriteData(api);","version":"1"},"go":{"source":"api := ashishpandeyonecdklambdawebfunction.NewWebFunction(this, jsii.String(\"Api\"), &WebFunctionProps{\n\tRuntime: lambda.Runtime_NODEJS_24_X(),\n\tCode: lambda.Code_FromAsset(jsii.String(\"build\")),\n\tAuthType: *ashishpandeyonecdklambdawebfunction.WebFunctionAuthType_AWS_IAM,\n\tEntrypoint: jsii.String(\"server.js\"),\n\t // default index.js\n\tWebFunctionName: jsii.String(\"orders-api\"),\n\t // default: generated from the construct path\n\tDescription: jsii.String(\"Orders HTTP API\"),\n\tEnvironment: map[string]*string{\n\t\t\"TABLE_NAME\": table.tableName,\n\t},\n\tTimeout: awscdk.Duration_Seconds(jsii.Number(60)),\n\t // per request: 3 seconds to 15 minutes, default 30 seconds\n\tMaxConcurrencyPerEnvironment: jsii.Number(32),\n})\n\napi.AddEnvironment(jsii.String(\"FEATURE_FLAG\"), jsii.String(\"on\"))\ntable.GrantReadWriteData(api)","version":"2"},"$":{"source":"const 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","version":"0"}},"location":{"api":{"api":"moduleReadme","moduleFqn":"@ashishpandeyone/cdk-lambda-web-function"},"field":{"field":"markdown","line":259}},"didCompile":true,"fqnsReferenced":["@ashishpandeyone/cdk-lambda-web-function.WebFunction","@ashishpandeyone/cdk-lambda-web-function.WebFunction#addEnvironment","@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType","@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType#AWS_IAM","@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps","aws-cdk-lib.Duration","aws-cdk-lib.Duration#seconds","aws-cdk-lib.aws_dynamodb.TableBase#grantReadWriteData","aws-cdk-lib.aws_iam.IGrantable","aws-cdk-lib.aws_lambda.Code","aws-cdk-lib.aws_lambda.Code#fromAsset","aws-cdk-lib.aws_lambda.Runtime","aws-cdk-lib.aws_lambda.Runtime#NODEJS_24_X","constructs.Construct"],"fullSource":"// Fixture for README examples: imports and a few declared values; the example replaces \"/// here\".\nimport { CfnOutput, CfnResource, Duration, type IPropertyInjector, PropertyInjectors, RemovalPolicy, Stack } from 'aws-cdk-lib';\nimport * as cloudfront from 'aws-cdk-lib/aws-cloudfront';\nimport * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';\nimport * as dynamodb from 'aws-cdk-lib/aws-dynamodb';\nimport * as iam from 'aws-cdk-lib/aws-iam';\nimport * as kms from 'aws-cdk-lib/aws-kms';\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\nimport * as lambdaNodejs from 'aws-cdk-lib/aws-lambda-nodejs';\nimport * as logs from 'aws-cdk-lib/aws-logs';\nimport { Construct } from 'constructs';\nimport {\n NodejsWebFunction, WebFunction, WebFunctionAuthType, WebFunctionDeployment, WebFunctionEndpointType, WebFunctionOrigin, WebFunctionRevision,\n type WebFunctionProps,\n} from '@ashishpandeyone/cdk-lambda-web-function';\n\ndeclare const fn: WebFunction;\ndeclare const table: dynamodb.Table;\ndeclare const consumerRole: iam.IRole;\ndeclare const errorRate: cloudwatch.IAlarm;\n\nclass Fixture extends Stack {\n constructor(scope: Construct, id: string) {\n super(scope, id);\n\n // Code snippet begins after !show marker below\n/// !show\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);\n/// !hide\n// Code snippet ended before !hide marker above\n }\n}\n","syntaxKindCounter":{"9":2,"11":7,"80":29,"110":1,"211":2,"212":9,"214":4,"215":1,"244":1,"245":2,"261":1,"262":1,"304":10},"fqnsFingerprint":"f5c15fb0bd94380032d9316b87816cc4ea93e6b12a2f5d56113d300728904443"},"8e9ae71ca0694f8e91fbdc9d332009768c1cb4ffe102737a4345e5c3bb8428de":{"translations":{"python":{"source":"from ashishpandeyone.cdk_lambda_web_function import WebFunctionEndpointOptions\n# key_stack: Stack # deploys first\n# replica_stack: Stack\n# in us-east-1, deploys before this stack\n\nkey = kms.Key(key_stack, \"Key\", multi_region=True)\napi = WebFunction(self, \"Api\",\n runtime=lambda_.Runtime.NODEJS_24_X,\n code=lambda_.Code.from_asset(\"build\"),\n auth_type=WebFunctionAuthType.AWS_IAM,\n endpoint=WebFunctionEndpointOptions(endpoint_type=WebFunctionEndpointType.PER_REGION, regions=[\"us-east-1\"]),\n encryption_key=key\n)\n\n# One replica per region the endpoint serves from, with Lambda's statement in its own policy.\nkms.CfnReplicaKey(replica_stack, \"KeyReplica\",\n primary_key_arn=key.key_arn,\n key_policy=iam.PolicyDocument(\n statements=[\n iam.PolicyStatement(principals=[iam.AccountRootPrincipal()], actions=[\"kms:*\"], resources=[\"*\"]),\n api.encryption_key_policy_statement()\n ]\n )\n)","version":"2"},"csharp":{"source":"Stack keyStack; // deploys first\nStack replicaStack;\n// in us-east-1, deploys before this stack\n\nvar key = new Key(keyStack, \"Key\", new KeyProps { MultiRegion = true });\nvar api = new WebFunction(this, \"Api\", new WebFunctionProps {\n Runtime = Runtime.NODEJS_24_X,\n Code = Code.FromAsset(\"build\"),\n AuthType = WebFunctionAuthType.AWS_IAM,\n Endpoint = new WebFunctionEndpointOptions { EndpointType = WebFunctionEndpointType.PER_REGION, Regions = new [] { \"us-east-1\" } },\n EncryptionKey = key\n});\n\n// One replica per region the endpoint serves from, with Lambda's statement in its own policy.\n// One replica per region the endpoint serves from, with Lambda's statement in its own policy.\nnew CfnReplicaKey(replicaStack, \"KeyReplica\", new CfnReplicaKeyProps {\n PrimaryKeyArn = key.KeyArn,\n KeyPolicy = new PolicyDocument(new PolicyDocumentProps {\n Statements = new [] {\n new PolicyStatement(new PolicyStatementProps { Principals = new [] { new AccountRootPrincipal() }, Actions = new [] { \"kms:*\" }, Resources = new [] { \"*\" } }), api.EncryptionKeyPolicyStatement() }\n })\n});","version":"2"},"java":{"source":"Stack keyStack; // deploys first\nStack replicaStack;\n// in us-east-1, deploys before this stack\n\nKey key = Key.Builder.create(keyStack, \"Key\").multiRegion(true).build();\nWebFunction api = WebFunction.Builder.create(this, \"Api\")\n .runtime(Runtime.NODEJS_24_X)\n .code(Code.fromAsset(\"build\"))\n .authType(WebFunctionAuthType.AWS_IAM)\n .endpoint(WebFunctionEndpointOptions.builder().endpointType(WebFunctionEndpointType.PER_REGION).regions(List.of(\"us-east-1\")).build())\n .encryptionKey(key)\n .build();\n\n// One replica per region the endpoint serves from, with Lambda's statement in its own policy.\n// One replica per region the endpoint serves from, with Lambda's statement in its own policy.\nCfnReplicaKey.Builder.create(replicaStack, \"KeyReplica\")\n .primaryKeyArn(key.getKeyArn())\n .keyPolicy(PolicyDocument.Builder.create()\n .statements(List.of(\n PolicyStatement.Builder.create().principals(List.of(new AccountRootPrincipal())).actions(List.of(\"kms:*\")).resources(List.of(\"*\")).build(), api.encryptionKeyPolicyStatement()))\n .build())\n .build();","version":"1"},"go":{"source":"var keyStack Stack // deploys first\nvar replicaStack Stack\n// in us-east-1, deploys before this stack\n\nkey := kms.NewKey(keyStack, jsii.String(\"Key\"), &KeyProps{\n\tMultiRegion: jsii.Boolean(true),\n})\napi := ashishpandeyonecdklambdawebfunction.NewWebFunction(this, jsii.String(\"Api\"), &WebFunctionProps{\n\tRuntime: lambda.Runtime_NODEJS_24_X(),\n\tCode: lambda.Code_FromAsset(jsii.String(\"build\")),\n\tAuthType: *ashishpandeyonecdklambdawebfunction.WebFunctionAuthType_AWS_IAM,\n\tEndpoint: &WebFunctionEndpointOptions{\n\t\tEndpointType: *ashishpandeyonecdklambdawebfunction.WebFunctionEndpointType_PER_REGION,\n\t\tRegions: []*string{\n\t\t\tjsii.String(\"us-east-1\"),\n\t\t},\n\t},\n\tEncryptionKey: key,\n})\n\n// One replica per region the endpoint serves from, with Lambda's statement in its own policy.\n// One replica per region the endpoint serves from, with Lambda's statement in its own policy.\nkms.NewCfnReplicaKey(replicaStack, jsii.String(\"KeyReplica\"), &CfnReplicaKeyProps{\n\tPrimaryKeyArn: key.KeyArn,\n\tKeyPolicy: iam.NewPolicyDocument(&PolicyDocumentProps{\n\t\tStatements: []PolicyStatement{\n\t\t\tiam.NewPolicyStatement(&PolicyStatementProps{\n\t\t\t\tPrincipals: []IPrincipal{\n\t\t\t\t\tiam.NewAccountRootPrincipal(),\n\t\t\t\t},\n\t\t\t\tActions: []*string{\n\t\t\t\t\tjsii.String(\"kms:*\"),\n\t\t\t\t},\n\t\t\t\tResources: []*string{\n\t\t\t\t\tjsii.String(\"*\"),\n\t\t\t\t},\n\t\t\t}),\n\t\t\tapi.EncryptionKeyPolicyStatement(),\n\t\t},\n\t}),\n})","version":"2"},"$":{"source":"declare const keyStack: Stack; // deploys first\ndeclare const replicaStack: Stack; // in us-east-1, deploys before this stack\n\nconst key = new kms.Key(keyStack, 'Key', { multiRegion: true });\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 endpoint: { endpointType: WebFunctionEndpointType.PER_REGION, regions: ['us-east-1'] },\n encryptionKey: key,\n});\n\n// One replica per region the endpoint serves from, with Lambda's statement in its own policy.\nnew kms.CfnReplicaKey(replicaStack, 'KeyReplica', {\n primaryKeyArn: key.keyArn,\n keyPolicy: new iam.PolicyDocument({\n statements: [\n new iam.PolicyStatement({ principals: [new iam.AccountRootPrincipal()], actions: ['kms:*'], resources: ['*'] }),\n api.encryptionKeyPolicyStatement(),\n ],\n }),\n});","version":"0"}},"location":{"api":{"api":"moduleReadme","moduleFqn":"@ashishpandeyone/cdk-lambda-web-function"},"field":{"field":"markdown","line":286}},"didCompile":true,"fqnsReferenced":["@ashishpandeyone/cdk-lambda-web-function.WebFunction","@ashishpandeyone/cdk-lambda-web-function.WebFunction#encryptionKeyPolicyStatement","@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType","@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType#AWS_IAM","@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions","@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointType","@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointType#PER_REGION","@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps","aws-cdk-lib.aws_iam.AccountRootPrincipal","aws-cdk-lib.aws_iam.PolicyDocument","aws-cdk-lib.aws_iam.PolicyDocumentProps","aws-cdk-lib.aws_iam.PolicyStatement","aws-cdk-lib.aws_iam.PolicyStatementProps","aws-cdk-lib.aws_kms.CfnReplicaKey","aws-cdk-lib.aws_kms.CfnReplicaKeyProps","aws-cdk-lib.aws_kms.IKey","aws-cdk-lib.aws_kms.Key","aws-cdk-lib.aws_kms.Key#keyArn","aws-cdk-lib.aws_kms.KeyProps","aws-cdk-lib.aws_lambda.Code","aws-cdk-lib.aws_lambda.Code#fromAsset","aws-cdk-lib.aws_lambda.Runtime","aws-cdk-lib.aws_lambda.Runtime#NODEJS_24_X","constructs.Construct"],"fullSource":"// Hoisted imports begin after !show marker below\n/// !show\ndeclare const keyStack: Stack; // deploys first\ndeclare const replicaStack: Stack;\n/// !hide\n// Hoisted imports ended before !hide marker above\n// Fixture for README examples: imports and a few declared values; the example replaces \"/// here\".\nimport { CfnOutput, CfnResource, Duration, type IPropertyInjector, PropertyInjectors, RemovalPolicy, Stack } from 'aws-cdk-lib';\nimport * as cloudfront from 'aws-cdk-lib/aws-cloudfront';\nimport * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';\nimport * as dynamodb from 'aws-cdk-lib/aws-dynamodb';\nimport * as iam from 'aws-cdk-lib/aws-iam';\nimport * as kms from 'aws-cdk-lib/aws-kms';\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\nimport * as lambdaNodejs from 'aws-cdk-lib/aws-lambda-nodejs';\nimport * as logs from 'aws-cdk-lib/aws-logs';\nimport { Construct } from 'constructs';\nimport {\n NodejsWebFunction, WebFunction, WebFunctionAuthType, WebFunctionDeployment, WebFunctionEndpointType, WebFunctionOrigin, WebFunctionRevision,\n type WebFunctionProps,\n} from '@ashishpandeyone/cdk-lambda-web-function';\n\ndeclare const fn: WebFunction;\ndeclare const table: dynamodb.Table;\ndeclare const consumerRole: iam.IRole;\ndeclare const errorRate: cloudwatch.IAlarm;\n\nclass Fixture extends Stack {\n constructor(scope: Construct, id: string) {\n super(scope, id);\n\n // Code snippet begins after !show marker below\n/// !show\n // in us-east-1, deploys before this stack\n\nconst key = new kms.Key(keyStack, 'Key', { multiRegion: true });\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 endpoint: { endpointType: WebFunctionEndpointType.PER_REGION, regions: ['us-east-1'] },\n encryptionKey: key,\n});\n\n// One replica per region the endpoint serves from, with Lambda's statement in its own policy.\nnew kms.CfnReplicaKey(replicaStack, 'KeyReplica', {\n primaryKeyArn: key.keyArn,\n keyPolicy: new iam.PolicyDocument({\n statements: [\n new iam.PolicyStatement({ principals: [new iam.AccountRootPrincipal()], actions: ['kms:*'], resources: ['*'] }),\n api.encryptionKeyPolicyStatement(),\n ],\n }),\n});\n/// !hide\n// Code snippet ended before !hide marker above\n }\n}\n","syntaxKindCounter":{"11":7,"80":48,"110":1,"112":1,"138":2,"184":2,"210":5,"211":6,"212":13,"214":2,"215":6,"244":4,"245":1,"261":4,"262":4,"304":14,"308":1},"fqnsFingerprint":"a72571b2a2cb711e248729291ab6330c0b4effd8e570034b8ad1943b39db398f"},"8a6373d4afda81d34da2d0ba3627b9c6ee1c965fc5a9ed895e553e8ff216c410":{"translations":{"python":{"source":"from ashishpandeyone.cdk_lambda_web_function import WebFunctionEndpointOptions\n# key: kms.Key # multiRegion: true, in the function's region\n# replica: kms.CfnReplicaKey\n# in us-east-1\n\napi = WebFunction(self, \"Api\",\n runtime=lambda_.Runtime.NODEJS_24_X,\n code=lambda_.Code.from_asset(\"build\"),\n auth_type=WebFunctionAuthType.AWS_IAM,\n endpoint=WebFunctionEndpointOptions(endpoint_type=WebFunctionEndpointType.PER_REGION, regions=[\"us-east-1\"]),\n log_encryption_key=key\n)\n\n# The replica's policy also allows CloudWatch Logs in its region, for this function's groups.\nreplica.key_policy = iam.PolicyDocument(\n statements=[\n iam.PolicyStatement(principals=[iam.AccountRootPrincipal()], actions=[\"kms:*\"], resources=[\"*\"]),\n api.log_encryption_key_policy_statement(\"us-east-1\")\n ]\n)","version":"2"},"csharp":{"source":"Key key; // multiRegion: true, in the function's region\nCfnReplicaKey replica;\n// in us-east-1\n\nvar api = new WebFunction(this, \"Api\", new WebFunctionProps {\n Runtime = Runtime.NODEJS_24_X,\n Code = Code.FromAsset(\"build\"),\n AuthType = WebFunctionAuthType.AWS_IAM,\n Endpoint = new WebFunctionEndpointOptions { EndpointType = WebFunctionEndpointType.PER_REGION, Regions = new [] { \"us-east-1\" } },\n LogEncryptionKey = key\n});\n\n// The replica's policy also allows CloudWatch Logs in its region, for this function's groups.\nreplica.KeyPolicy = new PolicyDocument(new PolicyDocumentProps {\n Statements = new [] {\n new PolicyStatement(new PolicyStatementProps { Principals = new [] { new AccountRootPrincipal() }, Actions = new [] { \"kms:*\" }, Resources = new [] { \"*\" } }), api.LogEncryptionKeyPolicyStatement(\"us-east-1\") }\n});","version":"2"},"java":{"source":"Key key; // multiRegion: true, in the function's region\nCfnReplicaKey replica;\n// in us-east-1\n\nWebFunction api = WebFunction.Builder.create(this, \"Api\")\n .runtime(Runtime.NODEJS_24_X)\n .code(Code.fromAsset(\"build\"))\n .authType(WebFunctionAuthType.AWS_IAM)\n .endpoint(WebFunctionEndpointOptions.builder().endpointType(WebFunctionEndpointType.PER_REGION).regions(List.of(\"us-east-1\")).build())\n .logEncryptionKey(key)\n .build();\n\n// The replica's policy also allows CloudWatch Logs in its region, for this function's groups.\nreplica.getKeyPolicy() = PolicyDocument.Builder.create()\n .statements(List.of(\n PolicyStatement.Builder.create().principals(List.of(new AccountRootPrincipal())).actions(List.of(\"kms:*\")).resources(List.of(\"*\")).build(), api.logEncryptionKeyPolicyStatement(\"us-east-1\")))\n .build();","version":"1"},"go":{"source":"var key Key // multiRegion: true, in the function's region\nvar replica CfnReplicaKey\n// in us-east-1\n\napi := ashishpandeyonecdklambdawebfunction.NewWebFunction(this, jsii.String(\"Api\"), &WebFunctionProps{\n\tRuntime: lambda.Runtime_NODEJS_24_X(),\n\tCode: lambda.Code_FromAsset(jsii.String(\"build\")),\n\tAuthType: *ashishpandeyonecdklambdawebfunction.WebFunctionAuthType_AWS_IAM,\n\tEndpoint: &WebFunctionEndpointOptions{\n\t\tEndpointType: *ashishpandeyonecdklambdawebfunction.WebFunctionEndpointType_PER_REGION,\n\t\tRegions: []*string{\n\t\t\tjsii.String(\"us-east-1\"),\n\t\t},\n\t},\n\tLogEncryptionKey: key,\n})\n\n// The replica's policy also allows CloudWatch Logs in its region, for this function's groups.\nreplica.keyPolicy = iam.NewPolicyDocument(&PolicyDocumentProps{\n\tStatements: []PolicyStatement{\n\t\tiam.NewPolicyStatement(&PolicyStatementProps{\n\t\t\tPrincipals: []IPrincipal{\n\t\t\t\tiam.NewAccountRootPrincipal(),\n\t\t\t},\n\t\t\tActions: []*string{\n\t\t\t\tjsii.String(\"kms:*\"),\n\t\t\t},\n\t\t\tResources: []*string{\n\t\t\t\tjsii.String(\"*\"),\n\t\t\t},\n\t\t}),\n\t\tapi.LogEncryptionKeyPolicyStatement(jsii.String(\"us-east-1\")),\n\t},\n})","version":"2"},"$":{"source":"declare const key: kms.Key; // multiRegion: true, in the function's region\ndeclare const replica: kms.CfnReplicaKey; // in us-east-1\n\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 endpoint: { endpointType: WebFunctionEndpointType.PER_REGION, regions: ['us-east-1'] },\n logEncryptionKey: key,\n});\n\n// The replica's policy also allows CloudWatch Logs in its region, for this function's groups.\nreplica.keyPolicy = new iam.PolicyDocument({\n statements: [\n new iam.PolicyStatement({ principals: [new iam.AccountRootPrincipal()], actions: ['kms:*'], resources: ['*'] }),\n api.logEncryptionKeyPolicyStatement('us-east-1'),\n ],\n});","version":"0"}},"location":{"api":{"api":"moduleReadme","moduleFqn":"@ashishpandeyone/cdk-lambda-web-function"},"field":{"field":"markdown","line":319}},"didCompile":true,"fqnsReferenced":["@ashishpandeyone/cdk-lambda-web-function.WebFunction","@ashishpandeyone/cdk-lambda-web-function.WebFunction#logEncryptionKeyPolicyStatement","@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType","@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType#AWS_IAM","@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions","@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointType","@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointType#PER_REGION","@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps","aws-cdk-lib.aws_iam.AccountRootPrincipal","aws-cdk-lib.aws_iam.PolicyDocument","aws-cdk-lib.aws_iam.PolicyDocumentProps","aws-cdk-lib.aws_iam.PolicyStatement","aws-cdk-lib.aws_iam.PolicyStatementProps","aws-cdk-lib.aws_kms.IKey","aws-cdk-lib.aws_lambda.Code","aws-cdk-lib.aws_lambda.Code#fromAsset","aws-cdk-lib.aws_lambda.Runtime","aws-cdk-lib.aws_lambda.Runtime#NODEJS_24_X","constructs.Construct"],"fullSource":"// Hoisted imports begin after !show marker below\n/// !show\ndeclare const key: kms.Key; // multiRegion: true, in the function's region\ndeclare const replica: kms.CfnReplicaKey;\n/// !hide\n// Hoisted imports ended before !hide marker above\n// Fixture for README examples: imports and a few declared values; the example replaces \"/// here\".\nimport { CfnOutput, CfnResource, Duration, type IPropertyInjector, PropertyInjectors, RemovalPolicy, Stack } from 'aws-cdk-lib';\nimport * as cloudfront from 'aws-cdk-lib/aws-cloudfront';\nimport * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';\nimport * as dynamodb from 'aws-cdk-lib/aws-dynamodb';\nimport * as iam from 'aws-cdk-lib/aws-iam';\nimport * as kms from 'aws-cdk-lib/aws-kms';\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\nimport * as lambdaNodejs from 'aws-cdk-lib/aws-lambda-nodejs';\nimport * as logs from 'aws-cdk-lib/aws-logs';\nimport { Construct } from 'constructs';\nimport {\n NodejsWebFunction, WebFunction, WebFunctionAuthType, WebFunctionDeployment, WebFunctionEndpointType, WebFunctionOrigin, WebFunctionRevision,\n type WebFunctionProps,\n} from '@ashishpandeyone/cdk-lambda-web-function';\n\ndeclare const fn: WebFunction;\ndeclare const table: dynamodb.Table;\ndeclare const consumerRole: iam.IRole;\ndeclare const errorRate: cloudwatch.IAlarm;\n\nclass Fixture extends Stack {\n constructor(scope: Construct, id: string) {\n super(scope, id);\n\n // Code snippet begins after !show marker below\n/// !show\n // in us-east-1\n\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 endpoint: { endpointType: WebFunctionEndpointType.PER_REGION, regions: ['us-east-1'] },\n logEncryptionKey: key,\n});\n\n// The replica's policy also allows CloudWatch Logs in its region, for this function's groups.\nreplica.keyPolicy = new iam.PolicyDocument({\n statements: [\n new iam.PolicyStatement({ principals: [new iam.AccountRootPrincipal()], actions: ['kms:*'], resources: ['*'] }),\n api.logEncryptionKeyPolicyStatement('us-east-1'),\n ],\n});\n/// !hide\n// Code snippet ended before !hide marker above\n }\n}\n","syntaxKindCounter":{"11":6,"64":1,"80":40,"110":1,"138":2,"167":2,"184":2,"210":5,"211":4,"212":11,"214":2,"215":4,"227":1,"244":3,"245":1,"261":3,"262":3,"304":11,"308":1},"fqnsFingerprint":"16a40444865e09a28b66ec8a761446e75ad17afc1447480dcad324f03cdddc5d"},"dcd606a094b4c18aa17658e6e9d310514828753aaafa7cccc3e8306b3d456708":{"translations":{"python":{"source":"@jsii.implements(IPropertyInjector)\nclass TeamDefaults:\n def inject(self, *, runtime, code, entrypoint=None, authType, endpoint=None, revisionRetention=None, webFunctionName=None, description=None, role=None, encryptionKey=None, environment=None, timeout=None, maxConcurrencyPerEnvironment=None, logRetention=None, logRemovalPolicy=None, logEncryptionKey=None, applicationLogLevelV2=None, systemLogLevelV2=None):\n # The team's defaults, with explicit props winning.\n return Object.assign({\"log_retention\": logs.RetentionDays.ONE_MONTH}, runtime=runtime, code=code, entrypoint=entrypoint, authType=authType, endpoint=endpoint, revisionRetention=revisionRetention, webFunctionName=webFunctionName, description=description, role=role, encryptionKey=encryptionKey, environment=environment, timeout=timeout, maxConcurrencyPerEnvironment=maxConcurrencyPerEnvironment, logRetention=logRetention, logRemovalPolicy=logRemovalPolicy, logEncryptionKey=logEncryptionKey, applicationLogLevelV2=applicationLogLevelV2, systemLogLevelV2=systemLogLevelV2)\nPropertyInjectors.of(self).add(TeamDefaults())","version":"2"},"csharp":{"source":"class TeamDefaults : IPropertyInjector\n{\n public readonly void ConstructUniqueId = WebFunction.PROPERTY_INJECTION_ID;\n public WebFunctionProps Inject(WebFunctionProps originalProps)\n {\n // The team's defaults, with explicit props winning.\n return Object.Assign(new Dictionary<string, RetentionDays> { { \"logRetention\", RetentionDays.ONE_MONTH } }, originalProps);\n }\n}\nPropertyInjectors.Of(this).Add(new TeamDefaults());","version":"2"},"java":{"source":"public class TeamDefaults implements IPropertyInjector {\n public final Object constructUniqueId;\n public WebFunctionProps inject(WebFunctionProps originalProps) {\n // The team's defaults, with explicit props winning.\n return Object.assign(Map.of(\"logRetention\", RetentionDays.ONE_MONTH), originalProps);\n }\n}\nPropertyInjectors.of(this).add(new TeamDefaults());","version":"1"},"go":{"source":"type teamDefaults struct {\n\tconstructUniqueId\n}\nfunc (this *teamDefaults) inject(originalProps WebFunctionProps) WebFunctionProps {\n\t// The team's defaults, with explicit props winning.\n\treturn object.assign(map[string]RetentionDays{\n\t\t\"logRetention\": logs.RetentionDays_ONE_MONTH,\n\t}, *originalProps)\n}\nawscdk.PropertyInjectors_Of(this).Add(newTeamDefaults())","version":"2"},"$":{"source":"class TeamDefaults implements IPropertyInjector {\n public readonly constructUniqueId = WebFunction.PROPERTY_INJECTION_ID;\n public inject(originalProps: WebFunctionProps): WebFunctionProps {\n // The team's defaults, with explicit props winning.\n return Object.assign({ logRetention: logs.RetentionDays.ONE_MONTH }, originalProps);\n }\n}\nPropertyInjectors.of(this).add(new TeamDefaults()); // or on the app, for every stack","version":"0"}},"location":{"api":{"api":"moduleReadme","moduleFqn":"@ashishpandeyone/cdk-lambda-web-function"},"field":{"field":"markdown","line":350}},"didCompile":true,"fqnsReferenced":["@ashishpandeyone/cdk-lambda-web-function.WebFunction#PROPERTY_INJECTION_ID","@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps","aws-cdk-lib.IPropertyInjector","aws-cdk-lib.PropertyInjectors#add","aws-cdk-lib.PropertyInjectors#of","aws-cdk-lib.aws_logs.RetentionDays","aws-cdk-lib.aws_logs.RetentionDays#ONE_MONTH","constructs.IConstruct"],"fullSource":"// Fixture for README examples: imports and a few declared values; the example replaces \"/// here\".\nimport { CfnOutput, CfnResource, Duration, type IPropertyInjector, PropertyInjectors, RemovalPolicy, Stack } from 'aws-cdk-lib';\nimport * as cloudfront from 'aws-cdk-lib/aws-cloudfront';\nimport * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';\nimport * as dynamodb from 'aws-cdk-lib/aws-dynamodb';\nimport * as iam from 'aws-cdk-lib/aws-iam';\nimport * as kms from 'aws-cdk-lib/aws-kms';\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\nimport * as lambdaNodejs from 'aws-cdk-lib/aws-lambda-nodejs';\nimport * as logs from 'aws-cdk-lib/aws-logs';\nimport { Construct } from 'constructs';\nimport {\n NodejsWebFunction, WebFunction, WebFunctionAuthType, WebFunctionDeployment, WebFunctionEndpointType, WebFunctionOrigin, WebFunctionRevision,\n type WebFunctionProps,\n} from '@ashishpandeyone/cdk-lambda-web-function';\n\ndeclare const fn: WebFunction;\ndeclare const table: dynamodb.Table;\ndeclare const consumerRole: iam.IRole;\ndeclare const errorRate: cloudwatch.IAlarm;\n\nclass Fixture extends Stack {\n constructor(scope: Construct, id: string) {\n super(scope, id);\n\n // Code snippet begins after !show marker below\n/// !show\nclass TeamDefaults implements IPropertyInjector {\n public readonly constructUniqueId = WebFunction.PROPERTY_INJECTION_ID;\n public inject(originalProps: WebFunctionProps): WebFunctionProps {\n // The team's defaults, with explicit props winning.\n return Object.assign({ logRetention: logs.RetentionDays.ONE_MONTH }, originalProps);\n }\n}\nPropertyInjectors.of(this).add(new TeamDefaults());\n/// !hide\n// Code snippet ended before !hide marker above\n }\n}\n","syntaxKindCounter":{"80":20,"110":1,"125":2,"148":1,"170":1,"173":1,"175":1,"184":2,"211":1,"212":6,"214":3,"215":1,"234":1,"242":1,"245":1,"254":1,"264":1,"299":1,"304":1},"fqnsFingerprint":"5ff88a1c844c9fb2324309eedfc4038508522b233d62e16d218bf48ea995267e"},"5154854c1105d400ac9c516e10f2e3f1fc48bc7fd009b0bd7c05d2d539dd6eae":{"translations":{"python":{"source":"from ashishpandeyone.cdk_lambda_web_function import NodejsWebFunctionBundlingOptions\nNodejsWebFunction(self, \"Api\",\n entry=\"src/server.ts\",\n auth_type=WebFunctionAuthType.AWS_IAM,\n bundling=NodejsWebFunctionBundlingOptions(\n minify=True, # default true\n source_map=True, # default true\n format=lambda_nodejs.OutputFormat.ESM, # default ESM (index.mjs); CJS gives index.js\n external_modules=[]\n )\n)","version":"2"},"csharp":{"source":"new NodejsWebFunction(this, \"Api\", new NodejsWebFunctionProps {\n Entry = \"src/server.ts\",\n AuthType = WebFunctionAuthType.AWS_IAM,\n Bundling = new NodejsWebFunctionBundlingOptions {\n Minify = true, // default true\n SourceMap = true, // default true\n Format = OutputFormat.ESM, // default ESM (index.mjs); CJS gives index.js\n ExternalModules = new [] { }\n }\n});","version":"2"},"java":{"source":"NodejsWebFunction.Builder.create(this, \"Api\")\n .entry(\"src/server.ts\")\n .authType(WebFunctionAuthType.AWS_IAM)\n .bundling(NodejsWebFunctionBundlingOptions.builder()\n .minify(true) // default true\n .sourceMap(true) // default true\n .format(OutputFormat.ESM) // default ESM (index.mjs); CJS gives index.js\n .externalModules(List.of())\n .build())\n .build();","version":"1"},"go":{"source":"ashishpandeyonecdklambdawebfunction.NewNodejsWebFunction(this, jsii.String(\"Api\"), &NodejsWebFunctionProps{\n\tEntry: jsii.String(\"src/server.ts\"),\n\tAuthType: *ashishpandeyonecdklambdawebfunction.WebFunctionAuthType_AWS_IAM,\n\tBundling: &NodejsWebFunctionBundlingOptions{\n\t\tMinify: jsii.Boolean(true),\n\t\t // default true\n\t\tSourceMap: jsii.Boolean(true),\n\t\t // default true\n\t\tFormat: lambdaNodejs.OutputFormat_ESM,\n\t\t // default ESM (index.mjs); CJS gives index.js\n\t\tExternalModules: []*string{\n\t\t},\n\t},\n})","version":"2"},"$":{"source":"new 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});","version":"0"}},"location":{"api":{"api":"moduleReadme","moduleFqn":"@ashishpandeyone/cdk-lambda-web-function"},"field":{"field":"markdown","line":368}},"didCompile":true,"fqnsReferenced":["@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunction","@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionBundlingOptions","@ashishpandeyone/cdk-lambda-web-function.NodejsWebFunctionProps","@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType","@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType#AWS_IAM","aws-cdk-lib.aws_lambda_nodejs.OutputFormat","aws-cdk-lib.aws_lambda_nodejs.OutputFormat#ESM","constructs.Construct"],"fullSource":"// Fixture for README examples: imports and a few declared values; the example replaces \"/// here\".\nimport { CfnOutput, CfnResource, Duration, type IPropertyInjector, PropertyInjectors, RemovalPolicy, Stack } from 'aws-cdk-lib';\nimport * as cloudfront from 'aws-cdk-lib/aws-cloudfront';\nimport * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';\nimport * as dynamodb from 'aws-cdk-lib/aws-dynamodb';\nimport * as iam from 'aws-cdk-lib/aws-iam';\nimport * as kms from 'aws-cdk-lib/aws-kms';\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\nimport * as lambdaNodejs from 'aws-cdk-lib/aws-lambda-nodejs';\nimport * as logs from 'aws-cdk-lib/aws-logs';\nimport { Construct } from 'constructs';\nimport {\n NodejsWebFunction, WebFunction, WebFunctionAuthType, WebFunctionDeployment, WebFunctionEndpointType, WebFunctionOrigin, WebFunctionRevision,\n type WebFunctionProps,\n} from '@ashishpandeyone/cdk-lambda-web-function';\n\ndeclare const fn: WebFunction;\ndeclare const table: dynamodb.Table;\ndeclare const consumerRole: iam.IRole;\ndeclare const errorRate: cloudwatch.IAlarm;\n\nclass Fixture extends Stack {\n constructor(scope: Construct, id: string) {\n super(scope, id);\n\n // Code snippet begins after !show marker below\n/// !show\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/// !hide\n// Code snippet ended before !hide marker above\n }\n}\n","syntaxKindCounter":{"11":2,"80":13,"110":1,"112":2,"210":1,"211":2,"212":3,"215":1,"245":1,"304":7},"fqnsFingerprint":"0a82458b9c2fc2b7dd61cd3d689ed60436c6f360cc27ea8828bf0eb94dbcb63c"},"33c01292193a1b51c9292f851bf127a583f7c96ba4d6c82bec6b6e9c7b62dfc7":{"translations":{"python":{"source":"WebFunction(self, \"Api\",\n runtime=lambda_.Runtime.NODEJS_24_X,\n code=lambda_.Code.from_asset(\"dist\"),\n auth_type=WebFunctionAuthType.AWS_IAM,\n revision_retention=5\n)","version":"2"},"csharp":{"source":"new WebFunction(this, \"Api\", new WebFunctionProps {\n Runtime = Runtime.NODEJS_24_X,\n Code = Code.FromAsset(\"dist\"),\n AuthType = WebFunctionAuthType.AWS_IAM,\n RevisionRetention = 5\n});","version":"2"},"java":{"source":"WebFunction.Builder.create(this, \"Api\")\n .runtime(Runtime.NODEJS_24_X)\n .code(Code.fromAsset(\"dist\"))\n .authType(WebFunctionAuthType.AWS_IAM)\n .revisionRetention(5)\n .build();","version":"1"},"go":{"source":"ashishpandeyonecdklambdawebfunction.NewWebFunction(this, jsii.String(\"Api\"), &WebFunctionProps{\n\tRuntime: lambda.Runtime_NODEJS_24_X(),\n\tCode: lambda.Code_FromAsset(jsii.String(\"dist\")),\n\tAuthType: *ashishpandeyonecdklambdawebfunction.WebFunctionAuthType_AWS_IAM,\n\tRevisionRetention: jsii.Number(5),\n})","version":"2"},"$":{"source":"new 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});","version":"0"}},"location":{"api":{"api":"moduleReadme","moduleFqn":"@ashishpandeyone/cdk-lambda-web-function"},"field":{"field":"markdown","line":402}},"didCompile":true,"fqnsReferenced":["@ashishpandeyone/cdk-lambda-web-function.WebFunction","@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType","@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType#AWS_IAM","@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps","aws-cdk-lib.aws_lambda.Code","aws-cdk-lib.aws_lambda.Code#fromAsset","aws-cdk-lib.aws_lambda.Runtime","aws-cdk-lib.aws_lambda.Runtime#NODEJS_24_X","constructs.Construct"],"fullSource":"// Fixture for README examples: imports and a few declared values; the example replaces \"/// here\".\nimport { CfnOutput, CfnResource, Duration, type IPropertyInjector, PropertyInjectors, RemovalPolicy, Stack } from 'aws-cdk-lib';\nimport * as cloudfront from 'aws-cdk-lib/aws-cloudfront';\nimport * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';\nimport * as dynamodb from 'aws-cdk-lib/aws-dynamodb';\nimport * as iam from 'aws-cdk-lib/aws-iam';\nimport * as kms from 'aws-cdk-lib/aws-kms';\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\nimport * as lambdaNodejs from 'aws-cdk-lib/aws-lambda-nodejs';\nimport * as logs from 'aws-cdk-lib/aws-logs';\nimport { Construct } from 'constructs';\nimport {\n NodejsWebFunction, WebFunction, WebFunctionAuthType, WebFunctionDeployment, WebFunctionEndpointType, WebFunctionOrigin, WebFunctionRevision,\n type WebFunctionProps,\n} from '@ashishpandeyone/cdk-lambda-web-function';\n\ndeclare const fn: WebFunction;\ndeclare const table: dynamodb.Table;\ndeclare const consumerRole: iam.IRole;\ndeclare const errorRate: cloudwatch.IAlarm;\n\nclass Fixture extends Stack {\n constructor(scope: Construct, id: string) {\n super(scope, id);\n\n // Code snippet begins after !show marker below\n/// !show\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/// !hide\n// Code snippet ended before !hide marker above\n }\n}\n","syntaxKindCounter":{"9":1,"11":2,"80":13,"110":1,"211":1,"212":5,"214":1,"215":1,"245":1,"304":4},"fqnsFingerprint":"6aba7fccd47c5ce2d69a07b2216af13bfb17afe0c1ab29b0fba4d1bddb004dc1"},"db82bfd0f2e297f423ad9dcbe1c89032c8ffe6e71cce1f8b4938af348f666617":{"translations":{"python":{"source":"previous = WebFunctionRevision.from_revision_attributes(self, \"Previous\",\n web_function=fn,\n revision_id=\"rev-a1b2c\"\n)\n\n# Keep the default endpoint on the previous revision, and send 10% to the new one:\nfn.endpoint.route_traffic(previous, [revision=fn.current_revision, weight=0.1])\n\n# Or a second endpoint that stays on the previous revision while fn.endpoint moves on:\nfn.add_endpoint(\"Stable\", auth_type=WebFunctionAuthType.AWS_IAM, revision=previous)","version":"2"},"csharp":{"source":"var previous = WebFunctionRevision.FromRevisionAttributes(this, \"Previous\", new WebFunctionRevisionAttributes {\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, new [] { new WebFunctionRevisionWeight { 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\", new AddWebFunctionEndpointOptions { AuthType = WebFunctionAuthType.AWS_IAM, Revision = previous });","version":"2"},"java":{"source":"IWebFunctionRevision previous = WebFunctionRevision.fromRevisionAttributes(this, \"Previous\", WebFunctionRevisionAttributes.builder()\n .webFunction(fn)\n .revisionId(\"rev-a1b2c\")\n .build());\n\n// Keep the default endpoint on the previous revision, and send 10% to the new one:\nfn.endpoint.routeTraffic(previous, List.of(WebFunctionRevisionWeight.builder().revision(fn.getCurrentRevision()).weight(0.1).build()));\n\n// Or a second endpoint that stays on the previous revision while fn.endpoint moves on:\nfn.addEndpoint(\"Stable\", AddWebFunctionEndpointOptions.builder().authType(WebFunctionAuthType.AWS_IAM).revision(previous).build());","version":"1"},"go":{"source":"previous := ashishpandeyonecdklambdawebfunction.WebFunctionRevision_FromRevisionAttributes(this, jsii.String(\"Previous\"), &WebFunctionRevisionAttributes{\n\tWebFunction: fn,\n\tRevisionId: jsii.String(\"rev-a1b2c\"),\n})\n\n// Keep the default endpoint on the previous revision, and send 10% to the new one:\nfn.Endpoint.RouteTraffic(previous, []WebFunctionRevisionWeight{\n\t&WebFunctionRevisionWeight{\n\t\tRevision: fn.CurrentRevision,\n\t\tWeight: jsii.Number(0.1),\n\t},\n})\n\n// Or a second endpoint that stays on the previous revision while fn.endpoint moves on:\nfn.AddEndpoint(jsii.String(\"Stable\"), &AddWebFunctionEndpointOptions{\n\tAuthType: *ashishpandeyonecdklambdawebfunction.WebFunctionAuthType_AWS_IAM,\n\tRevision: previous,\n})","version":"2"},"$":{"source":"const 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 });","version":"0"}},"location":{"api":{"api":"moduleReadme","moduleFqn":"@ashishpandeyone/cdk-lambda-web-function"},"field":{"field":"markdown","line":415}},"didCompile":true,"fqnsReferenced":["@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions","@ashishpandeyone/cdk-lambda-web-function.IWebFunctionRevision","@ashishpandeyone/cdk-lambda-web-function.WebFunction#addEndpoint","@ashishpandeyone/cdk-lambda-web-function.WebFunction#currentRevision","@ashishpandeyone/cdk-lambda-web-function.WebFunction#endpoint","@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType","@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType#AWS_IAM","@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint#routeTraffic","@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevision#fromRevisionAttributes","@ashishpandeyone/cdk-lambda-web-function.WebFunctionRevisionAttributes","aws-cdk-lib.interfaces.aws_lambda.IWebFunctionRef","constructs.Construct"],"fullSource":"// Fixture for README examples: imports and a few declared values; the example replaces \"/// here\".\nimport { CfnOutput, CfnResource, Duration, type IPropertyInjector, PropertyInjectors, RemovalPolicy, Stack } from 'aws-cdk-lib';\nimport * as cloudfront from 'aws-cdk-lib/aws-cloudfront';\nimport * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';\nimport * as dynamodb from 'aws-cdk-lib/aws-dynamodb';\nimport * as iam from 'aws-cdk-lib/aws-iam';\nimport * as kms from 'aws-cdk-lib/aws-kms';\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\nimport * as lambdaNodejs from 'aws-cdk-lib/aws-lambda-nodejs';\nimport * as logs from 'aws-cdk-lib/aws-logs';\nimport { Construct } from 'constructs';\nimport {\n NodejsWebFunction, WebFunction, WebFunctionAuthType, WebFunctionDeployment, WebFunctionEndpointType, WebFunctionOrigin, WebFunctionRevision,\n type WebFunctionProps,\n} from '@ashishpandeyone/cdk-lambda-web-function';\n\ndeclare const fn: WebFunction;\ndeclare const table: dynamodb.Table;\ndeclare const consumerRole: iam.IRole;\ndeclare const errorRate: cloudwatch.IAlarm;\n\nclass Fixture extends Stack {\n constructor(scope: Construct, id: string) {\n super(scope, id);\n\n // Code snippet begins after !show marker below\n/// !show\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/// !hide\n// Code snippet ended before !hide marker above\n }\n}\n","syntaxKindCounter":{"9":1,"11":3,"80":21,"110":1,"210":1,"211":3,"212":6,"214":3,"244":1,"245":2,"261":1,"262":1,"304":6},"fqnsFingerprint":"66c7d243eb7a2dec2a81b63baf7aac82a71bf50ca45f1795eb8fdb863fbec4ea"},"43367acfa330bb0800ebb668f1cdf635de6d7c0befe8c9ffeb6d6124e9b9cac6":{"translations":{"python":{"source":"from ashishpandeyone.cdk_lambda_web_function import WebFunctionEndpointOptions, WebFunctionRollbackOptions\napi = WebFunction(self, \"Api\",\n runtime=lambda_.Runtime.NODEJS_24_X,\n code=lambda_.Code.from_asset(\"dist\"),\n auth_type=WebFunctionAuthType.AWS_IAM,\n endpoint=WebFunctionEndpointOptions(\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), rollback_on=WebFunctionRollbackOptions(server_error_rate=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.add_endpoint(\"Public\",\n auth_type=WebFunctionAuthType.NONE,\n deployment=WebFunctionDeployment.linear(percent=25, interval=Duration.minutes(5), alarms=[error_rate])\n)","version":"2"},"csharp":{"source":"var api = new WebFunction(this, \"Api\", new WebFunctionProps {\n Runtime = Runtime.NODEJS_24_X,\n Code = Code.FromAsset(\"dist\"),\n AuthType = WebFunctionAuthType.AWS_IAM,\n Endpoint = new WebFunctionEndpointOptions {\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(new WebFunctionCanaryDeploymentOptions { Percent = 10, Bake = Duration.Minutes(10), RollbackOn = new WebFunctionRollbackOptions { 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\", new AddWebFunctionEndpointOptions {\n AuthType = WebFunctionAuthType.NONE,\n Deployment = WebFunctionDeployment.Linear(new WebFunctionLinearDeploymentOptions { Percent = 25, Interval = Duration.Minutes(5), Alarms = new [] { errorRate } })\n});","version":"2"},"java":{"source":"WebFunction api = WebFunction.Builder.create(this, \"Api\")\n .runtime(Runtime.NODEJS_24_X)\n .code(Code.fromAsset(\"dist\"))\n .authType(WebFunctionAuthType.AWS_IAM)\n .endpoint(WebFunctionEndpointOptions.builder()\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(WebFunctionCanaryDeploymentOptions.builder().percent(10).bake(Duration.minutes(10)).rollbackOn(WebFunctionRollbackOptions.builder().serverErrorRate(2).build()).build()))\n .build())\n .build();\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\", AddWebFunctionEndpointOptions.builder()\n .authType(WebFunctionAuthType.NONE)\n .deployment(WebFunctionDeployment.linear(WebFunctionLinearDeploymentOptions.builder().percent(25).interval(Duration.minutes(5)).alarms(List.of(errorRate)).build()))\n .build());","version":"1"},"go":{"source":"api := ashishpandeyonecdklambdawebfunction.NewWebFunction(this, jsii.String(\"Api\"), &WebFunctionProps{\n\tRuntime: lambda.Runtime_NODEJS_24_X(),\n\tCode: lambda.Code_FromAsset(jsii.String(\"dist\")),\n\tAuthType: *ashishpandeyonecdklambdawebfunction.WebFunctionAuthType_AWS_IAM,\n\tEndpoint: &WebFunctionEndpointOptions{\n\t\t// 10% of the traffic for 10 minutes, then all of it; back if more than 2% of requests get a 5XX.\n\t\tDeployment: *ashishpandeyonecdklambdawebfunction.WebFunctionDeployment_Canary(&WebFunctionCanaryDeploymentOptions{\n\t\t\tPercent: jsii.Number(10),\n\t\t\tBake: awscdk.Duration_Minutes(jsii.Number(10)),\n\t\t\tRollbackOn: &WebFunctionRollbackOptions{\n\t\t\t\tServerErrorRate: jsii.Number(2),\n\t\t\t},\n\t\t}),\n\t},\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(jsii.String(\"Public\"), &AddWebFunctionEndpointOptions{\n\tAuthType: *ashishpandeyonecdklambdawebfunction.WebFunctionAuthType_NONE,\n\tDeployment: *ashishpandeyonecdklambdawebfunction.WebFunctionDeployment_Linear(&WebFunctionLinearDeploymentOptions{\n\t\tPercent: jsii.Number(25),\n\t\tInterval: awscdk.Duration_*Minutes(jsii.Number(5)),\n\t\tAlarms: []IAlarm{\n\t\t\terrorRate,\n\t\t},\n\t}),\n})","version":"2"},"$":{"source":"const 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});","version":"0"}},"location":{"api":{"api":"moduleReadme","moduleFqn":"@ashishpandeyone/cdk-lambda-web-function"},"field":{"field":"markdown","line":436}},"didCompile":true,"fqnsReferenced":["@ashishpandeyone/cdk-lambda-web-function.AddWebFunctionEndpointOptions","@ashishpandeyone/cdk-lambda-web-function.WebFunction","@ashishpandeyone/cdk-lambda-web-function.WebFunction#addEndpoint","@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType","@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType#AWS_IAM","@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType#NONE","@ashishpandeyone/cdk-lambda-web-function.WebFunctionCanaryDeploymentOptions","@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment","@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment#canary","@ashishpandeyone/cdk-lambda-web-function.WebFunctionDeployment#linear","@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpointOptions","@ashishpandeyone/cdk-lambda-web-function.WebFunctionLinearDeploymentOptions","@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps","@ashishpandeyone/cdk-lambda-web-function.WebFunctionRollbackOptions","aws-cdk-lib.Duration","aws-cdk-lib.Duration#minutes","aws-cdk-lib.aws_lambda.Code","aws-cdk-lib.aws_lambda.Code#fromAsset","aws-cdk-lib.aws_lambda.Runtime","aws-cdk-lib.aws_lambda.Runtime#NODEJS_24_X","constructs.Construct"],"fullSource":"// Fixture for README examples: imports and a few declared values; the example replaces \"/// here\".\nimport { CfnOutput, CfnResource, Duration, type IPropertyInjector, PropertyInjectors, RemovalPolicy, Stack } from 'aws-cdk-lib';\nimport * as cloudfront from 'aws-cdk-lib/aws-cloudfront';\nimport * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';\nimport * as dynamodb from 'aws-cdk-lib/aws-dynamodb';\nimport * as iam from 'aws-cdk-lib/aws-iam';\nimport * as kms from 'aws-cdk-lib/aws-kms';\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\nimport * as lambdaNodejs from 'aws-cdk-lib/aws-lambda-nodejs';\nimport * as logs from 'aws-cdk-lib/aws-logs';\nimport { Construct } from 'constructs';\nimport {\n NodejsWebFunction, WebFunction, WebFunctionAuthType, WebFunctionDeployment, WebFunctionEndpointType, WebFunctionOrigin, WebFunctionRevision,\n type WebFunctionProps,\n} from '@ashishpandeyone/cdk-lambda-web-function';\n\ndeclare const fn: WebFunction;\ndeclare const table: dynamodb.Table;\ndeclare const consumerRole: iam.IRole;\ndeclare const errorRate: cloudwatch.IAlarm;\n\nclass Fixture extends Stack {\n constructor(scope: Construct, id: string) {\n super(scope, id);\n\n // Code snippet begins after !show marker below\n/// !show\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/// !hide\n// Code snippet ended before !hide marker above\n }\n}\n","syntaxKindCounter":{"9":5,"11":3,"80":37,"110":1,"210":1,"211":6,"212":11,"214":6,"215":1,"244":1,"245":1,"261":1,"262":1,"304":14},"fqnsFingerprint":"6596dc7d51b8c03f8420edc826671a77abedb6b0ff7f925b3ec4aca7d9e41ed4"},"b74614e65d9f21334ceaf23e9a5511ff4d44b852c7911ae8511ede5c48f205b1":{"translations":{"python":{"source":"fn.endpoint.metric_server_error_rate().create_alarm(self, \"ErrorRate\", threshold=1, evaluation_periods=3)\nfn.endpoint.metric_request_throttles().create_alarm(self, \"Throttled\", threshold=10, evaluation_periods=3)\nfn.metric_concurrent_requests().create_alarm(self, \"Saturated\", threshold=60, evaluation_periods=3)","version":"2"},"csharp":{"source":"fn.Endpoint.MetricServerErrorRate().CreateAlarm(this, \"ErrorRate\", new CreateAlarmOptions { Threshold = 1, EvaluationPeriods = 3 });\nfn.Endpoint.MetricRequestThrottles().CreateAlarm(this, \"Throttled\", new CreateAlarmOptions { Threshold = 10, EvaluationPeriods = 3 });\nfn.MetricConcurrentRequests().CreateAlarm(this, \"Saturated\", new CreateAlarmOptions { Threshold = 60, EvaluationPeriods = 3 });","version":"2"},"java":{"source":"fn.endpoint.metricServerErrorRate().createAlarm(this, \"ErrorRate\", CreateAlarmOptions.builder().threshold(1).evaluationPeriods(3).build());\nfn.endpoint.metricRequestThrottles().createAlarm(this, \"Throttled\", CreateAlarmOptions.builder().threshold(10).evaluationPeriods(3).build());\nfn.metricConcurrentRequests().createAlarm(this, \"Saturated\", CreateAlarmOptions.builder().threshold(60).evaluationPeriods(3).build());","version":"1"},"go":{"source":"fn.Endpoint.MetricServerErrorRate().CreateAlarm(this, jsii.String(\"ErrorRate\"), &CreateAlarmOptions{\n\tThreshold: jsii.Number(1),\n\tEvaluationPeriods: jsii.Number(3),\n})\nfn.Endpoint.MetricRequestThrottles().CreateAlarm(this, jsii.String(\"Throttled\"), &CreateAlarmOptions{\n\tThreshold: jsii.Number(10),\n\tEvaluationPeriods: jsii.Number(3),\n})\nfn.MetricConcurrentRequests().CreateAlarm(this, jsii.String(\"Saturated\"), &CreateAlarmOptions{\n\tThreshold: jsii.Number(60),\n\tEvaluationPeriods: jsii.Number(3),\n})","version":"2"},"$":{"source":"fn.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 });","version":"0"}},"location":{"api":{"api":"moduleReadme","moduleFqn":"@ashishpandeyone/cdk-lambda-web-function"},"field":{"field":"markdown","line":493}},"didCompile":true,"fqnsReferenced":["@ashishpandeyone/cdk-lambda-web-function.WebFunction#endpoint","@ashishpandeyone/cdk-lambda-web-function.WebFunctionBase#metricConcurrentRequests","@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint#metricRequestThrottles","@ashishpandeyone/cdk-lambda-web-function.WebFunctionEndpoint#metricServerErrorRate","aws-cdk-lib.aws_cloudwatch.CreateAlarmOptions","aws-cdk-lib.aws_cloudwatch.MathExpression#createAlarm","aws-cdk-lib.aws_cloudwatch.Metric#createAlarm","constructs.Construct"],"fullSource":"// Fixture for README examples: imports and a few declared values; the example replaces \"/// here\".\nimport { CfnOutput, CfnResource, Duration, type IPropertyInjector, PropertyInjectors, RemovalPolicy, Stack } from 'aws-cdk-lib';\nimport * as cloudfront from 'aws-cdk-lib/aws-cloudfront';\nimport * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';\nimport * as dynamodb from 'aws-cdk-lib/aws-dynamodb';\nimport * as iam from 'aws-cdk-lib/aws-iam';\nimport * as kms from 'aws-cdk-lib/aws-kms';\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\nimport * as lambdaNodejs from 'aws-cdk-lib/aws-lambda-nodejs';\nimport * as logs from 'aws-cdk-lib/aws-logs';\nimport { Construct } from 'constructs';\nimport {\n NodejsWebFunction, WebFunction, WebFunctionAuthType, WebFunctionDeployment, WebFunctionEndpointType, WebFunctionOrigin, WebFunctionRevision,\n type WebFunctionProps,\n} from '@ashishpandeyone/cdk-lambda-web-function';\n\ndeclare const fn: WebFunction;\ndeclare const table: dynamodb.Table;\ndeclare const consumerRole: iam.IRole;\ndeclare const errorRate: cloudwatch.IAlarm;\n\nclass Fixture extends Stack {\n constructor(scope: Construct, id: string) {\n super(scope, id);\n\n // Code snippet begins after !show marker below\n/// !show\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/// !hide\n// Code snippet ended before !hide marker above\n }\n}\n","syntaxKindCounter":{"9":6,"11":3,"80":17,"110":3,"211":3,"212":8,"214":6,"245":3,"304":6},"fqnsFingerprint":"17dafda2e00aa683b89ffed1a845e7dfeca595ea68afc75a8039ac1eb69b9c47"},"3c352cab55b922183fc2fdeed968c86af6f90a6e1f7aa5c2587f46a38e2b0968":{"translations":{"python":{"source":"WebFunction(self, \"Api\",\n runtime=lambda_.Runtime.NODEJS_24_X,\n code=lambda_.Code.from_asset(\"dist\"),\n auth_type=WebFunctionAuthType.AWS_IAM,\n log_retention=logs.RetentionDays.THREE_MONTHS, # default ONE_MONTH, every group in every region\n log_removal_policy=RemovalPolicy.DESTROY, # default RETAIN\n application_log_level_v2=lambda_.ApplicationLogLevel.WARN,\n system_log_level_v2=lambda_.SystemLogLevel.INFO\n)","version":"2"},"csharp":{"source":"new WebFunction(this, \"Api\", new WebFunctionProps {\n Runtime = Runtime.NODEJS_24_X,\n Code = Code.FromAsset(\"dist\"),\n AuthType = WebFunctionAuthType.AWS_IAM,\n LogRetention = RetentionDays.THREE_MONTHS, // default ONE_MONTH, every group in every region\n LogRemovalPolicy = RemovalPolicy.DESTROY, // default RETAIN\n ApplicationLogLevelV2 = ApplicationLogLevel.WARN,\n SystemLogLevelV2 = SystemLogLevel.INFO\n});","version":"2"},"java":{"source":"WebFunction.Builder.create(this, \"Api\")\n .runtime(Runtime.NODEJS_24_X)\n .code(Code.fromAsset(\"dist\"))\n .authType(WebFunctionAuthType.AWS_IAM)\n .logRetention(RetentionDays.THREE_MONTHS) // default ONE_MONTH, every group in every region\n .logRemovalPolicy(RemovalPolicy.DESTROY) // default RETAIN\n .applicationLogLevelV2(ApplicationLogLevel.WARN)\n .systemLogLevelV2(SystemLogLevel.INFO)\n .build();","version":"1"},"go":{"source":"ashishpandeyonecdklambdawebfunction.NewWebFunction(this, jsii.String(\"Api\"), &WebFunctionProps{\n\tRuntime: lambda.Runtime_NODEJS_24_X(),\n\tCode: lambda.Code_FromAsset(jsii.String(\"dist\")),\n\tAuthType: *ashishpandeyonecdklambdawebfunction.WebFunctionAuthType_AWS_IAM,\n\tLogRetention: logs.RetentionDays_THREE_MONTHS,\n\t // default ONE_MONTH, every group in every region\n\tLogRemovalPolicy: awscdk.RemovalPolicy_DESTROY,\n\t // default RETAIN\n\tApplicationLogLevelV2: lambda.ApplicationLogLevel_WARN,\n\tSystemLogLevelV2: lambda.SystemLogLevel_INFO,\n})","version":"2"},"$":{"source":"new 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});","version":"0"}},"location":{"api":{"api":"moduleReadme","moduleFqn":"@ashishpandeyone/cdk-lambda-web-function"},"field":{"field":"markdown","line":532}},"didCompile":true,"fqnsReferenced":["@ashishpandeyone/cdk-lambda-web-function.WebFunction","@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType","@ashishpandeyone/cdk-lambda-web-function.WebFunctionAuthType#AWS_IAM","@ashishpandeyone/cdk-lambda-web-function.WebFunctionProps","aws-cdk-lib.RemovalPolicy","aws-cdk-lib.RemovalPolicy#DESTROY","aws-cdk-lib.aws_lambda.ApplicationLogLevel","aws-cdk-lib.aws_lambda.ApplicationLogLevel#WARN","aws-cdk-lib.aws_lambda.Code","aws-cdk-lib.aws_lambda.Code#fromAsset","aws-cdk-lib.aws_lambda.Runtime","aws-cdk-lib.aws_lambda.Runtime#NODEJS_24_X","aws-cdk-lib.aws_lambda.SystemLogLevel","aws-cdk-lib.aws_lambda.SystemLogLevel#INFO","aws-cdk-lib.aws_logs.RetentionDays","aws-cdk-lib.aws_logs.RetentionDays#THREE_MONTHS","constructs.Construct"],"fullSource":"// Fixture for README examples: imports and a few declared values; the example replaces \"/// here\".\nimport { CfnOutput, CfnResource, Duration, type IPropertyInjector, PropertyInjectors, RemovalPolicy, Stack } from 'aws-cdk-lib';\nimport * as cloudfront from 'aws-cdk-lib/aws-cloudfront';\nimport * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';\nimport * as dynamodb from 'aws-cdk-lib/aws-dynamodb';\nimport * as iam from 'aws-cdk-lib/aws-iam';\nimport * as kms from 'aws-cdk-lib/aws-kms';\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\nimport * as lambdaNodejs from 'aws-cdk-lib/aws-lambda-nodejs';\nimport * as logs from 'aws-cdk-lib/aws-logs';\nimport { Construct } from 'constructs';\nimport {\n NodejsWebFunction, WebFunction, WebFunctionAuthType, WebFunctionDeployment, WebFunctionEndpointType, WebFunctionOrigin, WebFunctionRevision,\n type WebFunctionProps,\n} from '@ashishpandeyone/cdk-lambda-web-function';\n\ndeclare const fn: WebFunction;\ndeclare const table: dynamodb.Table;\ndeclare const consumerRole: iam.IRole;\ndeclare const errorRate: cloudwatch.IAlarm;\n\nclass Fixture extends Stack {\n constructor(scope: Construct, id: string) {\n super(scope, id);\n\n // Code snippet begins after !show marker below\n/// !show\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/// !hide\n// Code snippet ended before !hide marker above\n }\n}\n","syntaxKindCounter":{"11":2,"80":27,"110":1,"211":1,"212":12,"214":1,"215":1,"245":1,"304":7},"fqnsFingerprint":"90ff5351e9cd51273520849b840edb8fd9452bc5ec944896876560a8177bc200"},"7678112ceb1faa7befc87dd9133f9321801d1545644522d64e6f6b4fd20bb987":{"translations":{"python":{"source":"(fn.node.find_child(\"ResourcePolicy\")).apply_removal_policy(RemovalPolicy.RETAIN)","version":"2"},"csharp":{"source":"((CfnResource)fn.Node.FindChild(\"ResourcePolicy\")).ApplyRemovalPolicy(RemovalPolicy.RETAIN);","version":"2"},"java":{"source":"((CfnResource)fn.node.findChild(\"ResourcePolicy\")).applyRemovalPolicy(RemovalPolicy.RETAIN);","version":"1"},"go":{"source":"(fn.Node.FindChild(jsii.String(\"ResourcePolicy\")).(CfnResource)).ApplyRemovalPolicy(awscdk.RemovalPolicy_RETAIN)","version":"2"},"$":{"source":"(fn.node.findChild('ResourcePolicy') as CfnResource).applyRemovalPolicy(RemovalPolicy.RETAIN);","version":"0"}},"location":{"api":{"api":"moduleReadme","moduleFqn":"@ashishpandeyone/cdk-lambda-web-function"},"field":{"field":"markdown","line":572}},"didCompile":true,"fqnsReferenced":["aws-cdk-lib.CfnResource#applyRemovalPolicy","aws-cdk-lib.RemovalPolicy","aws-cdk-lib.RemovalPolicy#RETAIN","constructs.Construct#node","constructs.Node#findChild"],"fullSource":"// Fixture for README examples: imports and a few declared values; the example replaces \"/// here\".\nimport { CfnOutput, CfnResource, Duration, type IPropertyInjector, PropertyInjectors, RemovalPolicy, Stack } from 'aws-cdk-lib';\nimport * as cloudfront from 'aws-cdk-lib/aws-cloudfront';\nimport * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch';\nimport * as dynamodb from 'aws-cdk-lib/aws-dynamodb';\nimport * as iam from 'aws-cdk-lib/aws-iam';\nimport * as kms from 'aws-cdk-lib/aws-kms';\nimport * as lambda from 'aws-cdk-lib/aws-lambda';\nimport * as lambdaNodejs from 'aws-cdk-lib/aws-lambda-nodejs';\nimport * as logs from 'aws-cdk-lib/aws-logs';\nimport { Construct } from 'constructs';\nimport {\n NodejsWebFunction, WebFunction, WebFunctionAuthType, WebFunctionDeployment, WebFunctionEndpointType, WebFunctionOrigin, WebFunctionRevision,\n type WebFunctionProps,\n} from '@ashishpandeyone/cdk-lambda-web-function';\n\ndeclare const fn: WebFunction;\ndeclare const table: dynamodb.Table;\ndeclare const consumerRole: iam.IRole;\ndeclare const errorRate: cloudwatch.IAlarm;\n\nclass Fixture extends Stack {\n constructor(scope: Construct, id: string) {\n super(scope, id);\n\n // Code snippet begins after !show marker below\n/// !show\n(fn.node.findChild('ResourcePolicy') as CfnResource).applyRemovalPolicy(RemovalPolicy.RETAIN);\n/// !hide\n// Code snippet ended before !hide marker above\n }\n}\n","syntaxKindCounter":{"11":1,"80":7,"184":1,"212":4,"214":2,"218":1,"235":1,"245":1},"fqnsFingerprint":"2ae251cb0bb88a2c1d253b3c0346beedabb4524f779a38a11e400eb553699881"}}}
|