@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
90 lines (89 loc) • 4.05 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import * as stream from "./stream";
import * as lambda from "../lambda";
import * as types from "../types";
export interface StreamEventSubscriptionArgs {
/**
* The largest number of records that Lambda will retrieve from your event source at the time of
* invocation. Defaults to `100` for Kinesis.
*/
readonly batchSize?: number;
/**
* If the function returns an error, split the batch in two and retry. Defaults to `false`.
*/
readonly bisectBatchOnFunctionError?: boolean;
/**
* An Amazon SQS queue or Amazon SNS topic destination for failed records.
*/
readonly destinationConfig?: pulumi.Input<types.input.lambda.EventSourceMappingDestinationConfig>;
/**
* A list of current response type enums applied to the event source mapping. Where valid values are:
* * `ReportBatchItemFailures`
*/
readonly functionResponseTypes?: string[];
/**
* The maximum amount of time to gather records before invoking the function, in seconds. Records will continue to buffer
* until either maximum_batching_window_in_seconds expires or batch_size has been met. Defaults to as soon as records
* are available in the stream. If the batch it reads from the stream only has one record in it, Lambda only sends one record to the function.
*/
readonly maximumBatchingWindowInSeconds?: number;
/**
* The maximum age of a record that Lambda sends to a function for processing. Minimum of `60`, maximum and default of `604800`
*/
readonly maximumRecordAgeInSeconds?: number;
/**
* The maximum number of times to retry when the function returns an error. Minimum of `0`, maximum and default of `10000`.
*/
readonly maximumRetryAttempts?: number;
/**
* The number of batches to process from each shard concurrently. Minimum and default of `1`, maximum of `10`
*/
readonly parallelizationFactor?: number;
/**
* The position in the stream where AWS Lambda should start reading. Must be one of either
* `TRIM_HORIZON`, `LATEST` or `AT_TIMESTAMP`. If `AT_TIMESTAMP` is provided,
* [startingPositionTimestamp] must be provided as well.
*/
readonly startingPosition: "TRIM_HORIZON" | "LATEST" | "AT_TIMESTAMP";
/**
* A timestamp in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) of the
* data record which to start reading when using `starting_position` set to `AT_TIMESTAMP`.
* If a record with this exact timestamp does not exist, the next later record is chosen.
* If the timestamp is older than the current trim horizon, the oldest available record is
* chosen.
*/
readonly startingPositionTimestamp?: string;
}
export interface StreamEvent {
Records: StreamEventRecord[];
}
export interface StreamEventRecord {
kinesis: {
partitionKey: string;
kinesisSchemaVersion: string;
data: string;
sequenceNumber: string;
};
eventSource: "aws:kinesis";
eventID: string;
invokeIdentityArn: string;
eventVersion: string;
eventName: "aws:kinesis:record";
eventSourceARN: string;
awsRegion: string;
}
export type StreamEventHandler = lambda.EventHandler<StreamEvent, void>;
export declare class StreamEventSubscription extends lambda.EventSubscription {
readonly stream: stream.Stream;
readonly eventSourceMapping: lambda.EventSourceMapping;
constructor(name: string, stream: stream.Stream, handler: StreamEventHandler, args: StreamEventSubscriptionArgs, opts?: pulumi.ComponentResourceOptions);
}
declare module "./stream" {
interface Stream {
/**
* Creates a new subscription to events fired from this Stream to the handler provided, along
* with options to control the behavior of the subscription.
*/
onEvent(name: string, handler: StreamEventHandler, args: StreamEventSubscriptionArgs, opts?: pulumi.ComponentResourceOptions): StreamEventSubscription;
}
}