/ cloudformation-templates / node_modules / @aws-cdk / aws-lambda / lib / event-source-mapping.d.ts
event-source-mapping.d.ts
  1  import * as cdk from '@aws-cdk/core';
  2  import { Construct } from 'constructs';
  3  import { IEventSourceDlq } from './dlq';
  4  import { IFunction } from './function-base';
  5  /**
  6   * The type of authentication protocol or the VPC components for your event source's SourceAccessConfiguration.
  7   *
  8   * @see https://docs.aws.amazon.com/lambda/latest/dg/API_SourceAccessConfiguration.html#SSS-Type-SourceAccessConfiguration-Type
  9   * @stability stable
 10   */
 11  export declare class SourceAccessConfigurationType {
 12      /**
 13       * (MQ) The Secrets Manager secret that stores your broker credentials.
 14       *
 15       * @stability stable
 16       */
 17      static readonly BASIC_AUTH: SourceAccessConfigurationType;
 18      /**
 19       * The subnets associated with your VPC.
 20       *
 21       * Lambda connects to these subnets to fetch data from your Self-Managed Apache Kafka cluster.
 22       *
 23       * @stability stable
 24       */
 25      static readonly VPC_SUBNET: SourceAccessConfigurationType;
 26      /**
 27       * The VPC security group used to manage access to your Self-Managed Apache Kafka brokers.
 28       *
 29       * @stability stable
 30       */
 31      static readonly VPC_SECURITY_GROUP: SourceAccessConfigurationType;
 32      /**
 33       * The Secrets Manager ARN of your secret key used for SASL SCRAM-256 authentication of your Self-Managed Apache Kafka brokers.
 34       *
 35       * @stability stable
 36       */
 37      static readonly SASL_SCRAM_256_AUTH: SourceAccessConfigurationType;
 38      /**
 39       * The Secrets Manager ARN of your secret key used for SASL SCRAM-512 authentication of your Self-Managed Apache Kafka brokers.
 40       *
 41       * @stability stable
 42       */
 43      static readonly SASL_SCRAM_512_AUTH: SourceAccessConfigurationType;
 44      /**
 45       * A custom source access configuration property.
 46       *
 47       * @stability stable
 48       */
 49      static of(name: string): SourceAccessConfigurationType;
 50      /**
 51       * The key to use in `SourceAccessConfigurationProperty.Type` property in CloudFormation.
 52       *
 53       * @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-eventsourcemapping-sourceaccessconfiguration.html#cfn-lambda-eventsourcemapping-sourceaccessconfiguration-type
 54       * @stability stable
 55       */
 56      readonly type: string;
 57      private constructor();
 58  }
 59  /**
 60   * Specific settings like the authentication protocol or the VPC components to secure access to your event source.
 61   *
 62   * @stability stable
 63   */
 64  export interface SourceAccessConfiguration {
 65      /**
 66       * The type of authentication protocol or the VPC components for your event source.
 67       *
 68       * For example: "SASL_SCRAM_512_AUTH".
 69       *
 70       * @stability stable
 71       */
 72      readonly type: SourceAccessConfigurationType;
 73      /**
 74       * The value for your chosen configuration in type.
 75       *
 76       * For example: "URI": "arn:aws:secretsmanager:us-east-1:01234567890:secret:MyBrokerSecretName".
 77       * The exact string depends on the type.
 78       *
 79       * @see SourceAccessConfigurationType
 80       * @stability stable
 81       */
 82      readonly uri: string;
 83  }
 84  /**
 85   * @stability stable
 86   */
 87  export interface EventSourceMappingOptions {
 88      /**
 89       * The Amazon Resource Name (ARN) of the event source.
 90       *
 91       * Any record added to
 92       * this stream can invoke the Lambda function.
 93       *
 94       * @default - not set if using a self managed Kafka cluster, throws an error otherwise
 95       * @stability stable
 96       */
 97      readonly eventSourceArn?: string;
 98      /**
 99       * The largest number of records that AWS Lambda will retrieve from your event source at the time of invoking your function.
100       *
101       * Your function receives an
102       * event with all the retrieved records.
103       *
104       * Valid Range: Minimum value of 1. Maximum value of 10000.
105       *
106       * @default - Amazon Kinesis, Amazon DynamoDB, and Amazon MSK is 100 records.
107       * Both the default and maximum for Amazon SQS are 10 messages.
108       * @stability stable
109       */
110      readonly batchSize?: number;
111      /**
112       * If the function returns an error, split the batch in two and retry.
113       *
114       * @default false
115       * @stability stable
116       */
117      readonly bisectBatchOnError?: boolean;
118      /**
119       * An Amazon SQS queue or Amazon SNS topic destination for discarded records.
120       *
121       * @default discarded records are ignored
122       * @stability stable
123       */
124      readonly onFailure?: IEventSourceDlq;
125      /**
126       * Set to false to disable the event source upon creation.
127       *
128       * @default true
129       * @stability stable
130       */
131      readonly enabled?: boolean;
132      /**
133       * The position in the DynamoDB, Kinesis or MSK stream where AWS Lambda should start reading.
134       *
135       * @default - Required for Amazon Kinesis, Amazon DynamoDB, and Amazon MSK Streams sources.
136       * @see https://docs.aws.amazon.com/kinesis/latest/APIReference/API_GetShardIterator.html#Kinesis-GetShardIterator-request-ShardIteratorType
137       * @stability stable
138       */
139      readonly startingPosition?: StartingPosition;
140      /**
141       * Allow functions to return partially successful responses for a batch of records.
142       *
143       * @default false
144       * @see https://docs.aws.amazon.com/lambda/latest/dg/with-ddb.html#services-ddb-batchfailurereporting
145       * @stability stable
146       */
147      readonly reportBatchItemFailures?: boolean;
148      /**
149       * The maximum amount of time to gather records before invoking the function.
150       *
151       * Maximum of Duration.minutes(5)
152       *
153       * @default Duration.seconds(0)
154       * @stability stable
155       */
156      readonly maxBatchingWindow?: cdk.Duration;
157      /**
158       * The maximum age of a record that Lambda sends to a function for processing.
159       *
160       * Valid Range:
161       * * Minimum value of 60 seconds
162       * * Maximum value of 7 days
163       *
164       * @default - infinite or until the record expires.
165       * @stability stable
166       */
167      readonly maxRecordAge?: cdk.Duration;
168      /**
169       * The maximum number of times to retry when the function returns an error.
170       *
171       * Set to `undefined` if you want lambda to keep retrying infinitely or until
172       * the record expires.
173       *
174       * Valid Range:
175       * * Minimum value of 0
176       * * Maximum value of 10000
177       *
178       * @default - infinite or until the record expires.
179       * @stability stable
180       */
181      readonly retryAttempts?: number;
182      /**
183       * The number of batches to process from each shard concurrently.
184       *
185       * Valid Range:
186       * * Minimum value of 1
187       * * Maximum value of 10
188       *
189       * @default 1
190       * @stability stable
191       */
192      readonly parallelizationFactor?: number;
193      /**
194       * The name of the Kafka topic.
195       *
196       * @default - no topic
197       * @stability stable
198       */
199      readonly kafkaTopic?: string;
200      /**
201       * The size of the tumbling windows to group records sent to DynamoDB or Kinesis.
202       *
203       * @default - None
204       * @see https://docs.aws.amazon.com/lambda/latest/dg/with-ddb.html#services-ddb-windows
205       *
206       * Valid Range: 0 - 15 minutes
207       * @stability stable
208       */
209      readonly tumblingWindow?: cdk.Duration;
210      /**
211       * A list of host and port pairs that are the addresses of the Kafka brokers in a self managed "bootstrap" Kafka cluster that a Kafka client connects to initially to bootstrap itself.
212       *
213       * They are in the format `abc.example.com:9096`.
214       *
215       * @default - none
216       * @stability stable
217       */
218      readonly kafkaBootstrapServers?: string[];
219      /**
220       * Specific settings like the authentication protocol or the VPC components to secure access to your event source.
221       *
222       * @default - none
223       * @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-eventsourcemapping-sourceaccessconfiguration.html
224       * @stability stable
225       */
226      readonly sourceAccessConfigurations?: SourceAccessConfiguration[];
227  }
228  /**
229   * Properties for declaring a new event source mapping.
230   *
231   * @stability stable
232   */
233  export interface EventSourceMappingProps extends EventSourceMappingOptions {
234      /**
235       * The target AWS Lambda function.
236       *
237       * @stability stable
238       */
239      readonly target: IFunction;
240  }
241  /**
242   * Represents an event source mapping for a lambda function.
243   *
244   * @see https://docs.aws.amazon.com/lambda/latest/dg/invocation-eventsourcemapping.html
245   * @stability stable
246   */
247  export interface IEventSourceMapping extends cdk.IResource {
248      /**
249       * The identifier for this EventSourceMapping.
250       *
251       * @stability stable
252       * @attribute true
253       */
254      readonly eventSourceMappingId: string;
255  }
256  /**
257   * Defines a Lambda EventSourceMapping resource.
258   *
259   * Usually, you won't need to define the mapping yourself. This will usually be done by
260   * event sources. For example, to add an SQS event source to a function:
261   *
262   *     import { SqsEventSource } from '@aws-cdk/aws-lambda-event-sources';
263   *     lambda.addEventSource(new SqsEventSource(sqs));
264   *
265   * The `SqsEventSource` class will automatically create the mapping, and will also
266   * modify the Lambda's execution role so it can consume messages from the queue.
267   *
268   * @stability stable
269   */
270  export declare class EventSourceMapping extends cdk.Resource implements IEventSourceMapping {
271      /**
272       * Import an event source into this stack from its event source id.
273       *
274       * @stability stable
275       */
276      static fromEventSourceMappingId(scope: Construct, id: string, eventSourceMappingId: string): IEventSourceMapping;
277      /**
278       * The identifier for this EventSourceMapping.
279       *
280       * @stability stable
281       */
282      readonly eventSourceMappingId: string;
283      /**
284       * @stability stable
285       */
286      constructor(scope: Construct, id: string, props: EventSourceMappingProps);
287  }
288  /**
289   * The position in the DynamoDB, Kinesis or MSK stream where AWS Lambda should start reading.
290   *
291   * @stability stable
292   */
293  export declare enum StartingPosition {
294      /**
295       * Start reading at the last untrimmed record in the shard in the system, which is the oldest data record in the shard.
296       *
297       * @stability stable
298       */
299      TRIM_HORIZON = "TRIM_HORIZON",
300      /**
301       * Start reading just after the most recent record in the shard, so that you always read the most recent data in the shard.
302       *
303       * @stability stable
304       */
305      LATEST = "LATEST"
306  }