UNPKG

@pulumi/aws-serverless

Version:

Pulumi Amazon Web Services (AWS) Serverless Components.

17 lines (16 loc) 1.17 kB
import * as aws from "@pulumi/aws"; import { ResourceOptions } from "@pulumi/pulumi"; /** * A synchronous or asynchronous function that can be converted into an AWS lambda. Async callbacks * are only supported with an AWS lambda runtime of 8.10 or higher. On those runtimes a Promise can * be returned, 'callback' parameter can be ignored, and AWS will appropriately handle things. For * AWS lambda pre-8.10, a synchronous function must be provided. The synchronous function should * return nothing, and should instead invoke 'callback' when complete. */ export declare type Callback<E, R> = (event: E, context: aws.serverless.Context, callback: (error: any, result: R) => void) => Promise<R> | void; /** * Handler represents the appropriate type for functions that can take either an AWS lambda function * instance, or a JS function object that will then be used to create the AWS lambda function. */ export declare type Handler<E, R> = Callback<E, R> | aws.lambda.Function; export declare function createLambdaFunction<E, R>(name: string, handler: Handler<E, R>, opts?: ResourceOptions, functionOptions?: aws.serverless.FunctionOptions): aws.lambda.Function;