UNPKG

@scloud/cdk-patterns

Version:

Serverless CDK patterns for common infrastructure needs

54 lines (53 loc) 2.49 kB
import { Construct } from 'constructs'; import { DockerImageFunctionProps, Function, FunctionProps } from 'aws-cdk-lib/aws-lambda'; import { IRepository } from 'aws-cdk-lib/aws-ecr'; import * as cloudfront from 'aws-cdk-lib/aws-cloudfront'; /** * @deprecated Use ContainerFunction instead * * A Lambda function packaged as a container. * @param construct Parent CDK construct (typically 'this') * @param initialPass If the infrastructure is being built from scratch: true; * for incremental deployments: false. * @param name The name for this function * @param environment Environment variables for the Lambda function * @returns The lambda, if created, and associated ECR repository */ export declare function containerFunction(construct: Construct, initialPass: boolean, name: string, environment?: { [key: string]: string; }, lambdaProps?: Partial<DockerImageFunctionProps>, tagOrDigest?: string, ecr?: IRepository): { lambda: Function; repository: IRepository; }; /** * @deprecated Use ZipFunction.typescript() or ZipFunction.python() instead * * A Lambda function packaged as a zip file. * Key defaults are: * - runtime: Runtime.NODEJS_18_X * - handler: 'src/lambda.handler' * - logRetention: logs.RetentionDays.TWO_YEARS * @param construct Parent CDK construct (typically 'this') * @param name The name for this function * @param environment Environment variables for the Lambda function * @param lambdaProps Override properties for the Lambda function. you may want to pass e.g. { runtime: Runtime.PYTHON_3_10 } * @returns The lambda, if created, and associated ECR repository */ export declare function zipFunction(construct: Construct, name: string, environment?: { [key: string]: string; }, lambdaProps?: Partial<FunctionProps>): Function; /** * NB: This pattern is not well developed or maintained at the time of writing. * * A key reason for this is that I haven't worked out how to deal well with lambda function versions in CI/CD * which seemed to be needed when deploying an update to an edge function. * * A Lambda@edge function. * @param construct Parent CDK construct (typically 'this') * @param name The name for this function * @param environment Environment variables for the Lambda function * @returns The lambda, if created, and associated ECR repository */ export declare function edgeFunction(construct: Construct, name: string, environment?: { [key: string]: string; }): cloudfront.experimental.EdgeFunction;