@scloud/cdk-patterns
Version:
Serverless CDK patterns for common infrastructure needs
30 lines (29 loc) • 1.52 kB
TypeScript
import { Function } from 'aws-cdk-lib/aws-lambda';
import { Queue, QueueProps } from 'aws-cdk-lib/aws-sqs';
import { Construct } from 'constructs';
import { ZipFunctionProps } from './ZipFunction';
import { ContainerFunctionProps } from './ContainerFunction';
/**
* @param lambda The Lambda function to be triggered by the SQS queue. This will be generated for you if you use one of the static methods (node, python, container)
* @param queueProps Optional: If you need to specify any detailed properties for the SQS Queue, you can do so here and they will override any defaults
*/
export interface QueueFunctionProps {
lambda: Function;
queueProps?: Partial<QueueProps>;
}
/**
* A Lambda function triggered by SQS queue events.
*
* Defaults for the queue are:
* - visibilityTimeout: timeout from the lambdaProps or 60 seconds if not defined
* - encryption: QueueEncryption.KMS_MANAGED
* - removalPolicy: RemovalPolicy.DESTROY
*/
export declare class QueueFunction extends Construct {
queue: Queue;
lambda: Function;
constructor(scope: Construct, id: string, props: QueueFunctionProps);
static node(scope: Construct, id: string, functionProps?: ZipFunctionProps, queueProps?: Partial<QueueProps>): QueueFunction;
static python(scope: Construct, id: string, functionProps?: ZipFunctionProps, queueProps?: Partial<QueueProps>): QueueFunction;
static container(scope: Construct, id: string, functionProps?: ContainerFunctionProps, queueProps?: Partial<QueueProps>): QueueFunction;
}