import assets = require('@aws-cdk/assets'); import s3 = require('@aws-cdk/aws-s3'); import { Function as Func } from './lambda'; import { cloudformation } from './lambda.generated'; export declare abstract class Code { /** * @returns `LambdaS3Code` associated with the specified S3 object. * @param bucket The S3 bucket * @param key The object key * @param objectVersion Optional S3 object version */ static bucket(bucket: s3.BucketRef, key: string, objectVersion?: string): S3Code; /** * @returns `LambdaInlineCode` with inline code. * @param code The actual handler code (limited to 4KiB) */ static inline(code: string): InlineCode; /** * @returns Zip archives the contents of a directory on disk and uses this * as the lambda handler's code. * @param directoryToZip The directory to zip */ static directory(directoryToZip: string): AssetCode; /** * @returns Uses a file on disk as a lambda handler's code. * @param filePath The file path */ static file(filePath: string): AssetCode; /** * Called during stack synthesis to render the CodePropery for the * Lambda function. */ abstract toJSON(): cloudformation.FunctionResource.CodeProperty; /** * Called when the lambda is initialized to allow this object to * bind to the stack, add resources and have fun. */ bind(_lambda: Func): void; } /** * Lambda code from an S3 archive. */ export declare class S3Code extends Code { private key; private objectVersion?; private bucketName; constructor(bucket: s3.BucketRef, key: string, objectVersion?: string | undefined); toJSON(): cloudformation.FunctionResource.CodeProperty; } /** * Lambda code from an inline string (limited to 4KiB). */ export declare class InlineCode extends Code { private code; constructor(code: string); bind(lambda: Func): void; toJSON(): cloudformation.FunctionResource.CodeProperty; } /** * Lambda code from a local directory. */ export declare class AssetCode extends Code { private readonly path; private readonly packaging; private asset?; /** * @param path The path to the asset file or directory. * @param packaging The asset packaging format */ constructor(path: string, packaging: assets.AssetPackaging); bind(lambda: Func): void; toJSON(): cloudformation.FunctionResource.CodeProperty; }