import { aws_dynamodb as dynamodb, aws_s3 as s3, aws_cognito as cognito, aws_lambda as lambda, aws_lambda_nodejs as lambdaNodejs } from 'aws-cdk-lib'; import * as cdk from 'aws-cdk-lib'; import { Construct } from 'constructs'; import { IJwtAuthentication } from './authentication'; export type LambdaOptions = Omit; export interface LambdaTracingOptions { /** * Activate tracing with X-Ray * * @default lambda.Tracing.DISABLED */ xRayTracing?: lambda.Tracing; } export interface LambdaFunctionProps { /** * Deployment stage (e.g. dev) */ stageName?: string; /** * entry file name */ entry: string; /** * name of the exported handler function * * @default handler */ handler?: string; /** * description of the Lambda function */ description?: string; /** * DynamoDB that is used as datastore * The Lambda function will have read access to this table automatically * The name of the table is available as process.env.TABLE */ table?: dynamodb.ITable; /** * Activate write permissions to the DynamoDB table */ tableWrites?: boolean; /** * Cognito user pool * The name of the pool is available as process.env.USER_POOL_ID */ userPool?: cognito.IUserPool; /** * JwtAuthentication settings */ jwt?: IJwtAuthentication; /** * Bucket that is used for assets and published using the asset CDN * The name of the bucket is available as process.env.ASSET_BUCKET */ assetBucket?: s3.Bucket; /** * Fully qualified domain name of the asset CDN * It is available as process.env.ASSET_DOMAIN_NAME */ assetDomainName?: string; /** * Should the AWS-SDK be packaged with the Lambda code or excluded * * @default false (exclude SDK and use runtime provided one) */ includeSDK?: boolean; /** * additional environment variables of the Lambda function */ additionalEnv?: { [key: string]: string; }; /** * additional options for the underlying Lambda function construct */ lambdaOptions?: LambdaOptions; /** * Tracing config */ lambdaTracing?: LambdaTracingOptions; } export declare class LambdaFunction extends lambdaNodejs.NodejsFunction { private props; constructor(scope: Construct, id: string, props: LambdaFunctionProps); setTable(table: dynamodb.ITable, tableWrites?: boolean): LambdaFunction; setUserPool(userPool: cognito.IUserPool): LambdaFunction; grantTableWrite(): LambdaFunction; grantSendEmails(): LambdaFunction; grantUploadAssets(): LambdaFunction; grantDeleteAsset(): LambdaFunction; grantUserpoolRead(): LambdaFunction; grantUserpoolReadWrite(): LambdaFunction; setTimeout(timeout: cdk.Duration): LambdaFunction; }