import * as esbuild from "esbuild"; import * as cdk from "@aws-cdk/core"; import * as lambda from "@aws-cdk/aws-lambda"; import * as lambdaNode from "@aws-cdk/aws-lambda-nodejs"; import { Permissions } from "./util/permission"; export declare type HandlerProps = FunctionHandlerProps; export declare type FunctionDefinition = string | Function | FunctionProps; export interface FunctionProps extends Omit { /** * Path to the entry point and handler function. Of the format: * `/path/to/file.function`. */ readonly handler?: string; /** * The source directory where the entry point is located. The node_modules in this * directory is used to generate the bundle. * * @default - Defaults to the app directory. */ readonly srcPath?: string; /** * The runtime environment. * * @default - Defaults to NODEJS_12_X */ readonly runtime?: string | lambda.Runtime; /** * The amount of memory in MB allocated. * * @default - Defaults to 1024 */ readonly memorySize?: number; /** * The execution timeout in seconds. * * @default - number */ readonly timeout?: number | cdk.Duration; /** * Enable AWS X-Ray Tracing. * * @default - Defaults to ACTIVE */ readonly tracing?: lambda.Tracing; /** * Disable bundling with esbuild. * * @default - Defaults to true */ readonly bundle?: boolean | FunctionBundleNodejsProps | FunctionBundlePythonProps; readonly permissions?: Permissions; } export interface FunctionHandlerProps { readonly srcPath: string; readonly handler: string; readonly bundle: boolean | FunctionBundleNodejsProps | FunctionBundlePythonProps; readonly runtime: string; } export interface FunctionBundleNodejsProps { readonly loader?: { [ext: string]: esbuild.Loader; }; readonly externalModules?: string[]; readonly nodeModules?: string[]; readonly copyFiles?: FunctionBundleCopyFilesProps[]; readonly commandHooks?: lambdaNode.ICommandHooks; readonly esbuildConfig?: string; } export interface FunctionBundlePythonProps { readonly installCommands?: string[]; } export interface FunctionBundleCopyFilesProps { readonly from: string; readonly to: string; } export declare class Function extends lambda.Function { constructor(scope: cdk.Construct, id: string, props: FunctionProps); attachPermissions(permissions: Permissions): void; static fromDefinition(scope: cdk.Construct, id: string, definition: FunctionDefinition, inheritedProps?: FunctionProps, inheritErrorMessage?: string): Function; static mergeProps(baseProps?: FunctionProps, props?: FunctionProps): FunctionProps; }