UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

59 lines (58 loc) 2.13 kB
import * as pulumi from "@pulumi/pulumi"; import * as lambda from "../lambda"; import * as queue from "./queue"; export interface QueueEvent { Records: QueueRecord[]; } export interface QueueRecord { messageId: string; receiptHandle: string; body: string; attributes: { ApproximateReceiveCount: string; SentTimestamp: string; SenderId: string; ApproximateFirstReceiveTimestamp: string; }; messageAttributes: Record<string, any>; md5OfBody: string; eventSource: string; eventSourceARN: string; awsRegion: string; } export type QueueEventHandler = lambda.EventHandler<QueueEvent, void>; /** * Arguments to control the sqs subscription. */ export type QueueEventSubscriptionArgs = { /** * The largest number of records that AWS Lambda will retrieve. The maximum batch size supported * by Amazon Simple Queue Service is up to 10 queue messages per batch. The default setting is * 10. * * See https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html for more details. */ batchSize?: number; /** * The maximum amount of time, in seconds, that AWS Lambda spends gathering records before invoking the function. * The default setting is 0. */ maximumBatchingWindowInSeconds?: number; }; export declare class QueueEventSubscription extends lambda.EventSubscription { readonly queue: queue.Queue; /** * The underlying sns object created for the subscription. */ readonly eventSourceMapping: lambda.EventSourceMapping; constructor(name: string, queue: queue.Queue, handler: QueueEventHandler, args?: QueueEventSubscriptionArgs, opts?: pulumi.ComponentResourceOptions); } declare module "./queue" { interface Queue { /** * Creates a new subscription to events fired from this Queue to the handler provided, along * with options to control the behavior of the subscription. */ onEvent(name: string, handler: QueueEventHandler, args?: QueueEventSubscriptionArgs, opts?: pulumi.ComponentResourceOptions): QueueEventSubscription; } }