UNPKG

@cdklabs/cdk-amazonmq

Version:
76 lines (75 loc) 2.87 kB
import { Duration } from "aws-cdk-lib"; import { IEventSource, IFunction, SourceAccessConfiguration } from "aws-cdk-lib/aws-lambda"; import { ISecret } from "aws-cdk-lib/aws-secretsmanager"; import { IBrokerDeployment } from "../broker-deployment"; export interface EventSourceProps { /** * source at the time of invoking your function. Your function receives an * The largest number of records that AWS Lambda will retrieve from your event * event with all the retrieved records. * * Valid Range: * * Minimum value of 1 * * Maximum value of: 10000 * * @default 100 */ readonly batchSize?: number; /** * The maximum amount of time to gather records before invoking the function. * Maximum of Duration.minutes(5). * * @see https://docs.aws.amazon.com/lambda/latest/dg/invocation-eventsourcemapping.html#invocation-eventsourcemapping-batching * * @default - Duration.millis(500) for Amazon MQ. */ readonly maxBatchingWindow?: Duration; /** * If the stream event source mapping should be enabled. * * @default true */ readonly enabled?: boolean; /** * A secret with credentials of the user to use when receiving messages. * * The credentials in the secret have fields required: * * username * * password */ readonly credentials: ISecret; /** * The name of the queue that the function will receive messages from. */ readonly queueName: string; /** * If the default permissions should be added to the Lambda function's execution role. * * @default true */ readonly addPermissions?: boolean; } export interface EventSourceBaseProps extends EventSourceProps { /** * The Amazon MQ broker deployment to receive messages from. */ readonly broker: IBrokerDeployment; } /** * Represents an AWS Lambda Event Source Mapping for RabbitMQ. This event source will add additional permissions to * the AWS Lambda function's IAM Role following https://docs.aws.amazon.com/lambda/latest/dg/with-mq.html#events-mq-permissions */ export declare abstract class EventSourceBase implements IEventSource { protected readonly props: EventSourceBaseProps; protected readonly mqType: string; private sourceAccessConfigurations; /** * Instantiates an AWS Lambda Event Source Mapping for RabbitMQ. This event source will add additional permissions to * the AWS Lambda function's IAM Role following https://docs.aws.amazon.com/lambda/latest/dg/with-mq.html#events-mq-permissions * * @param props properties of the RabbitMQ event source */ constructor(props: EventSourceBaseProps, mqType: string); bind(target: IFunction): void; protected addToSourceAccessConfigurations(config: SourceAccessConfiguration): void; }