UNPKG

1.84 kBTypeScriptView Raw
1import { Duration, Resource } from '@aws-cdk/core';
2import { Construct } from 'constructs';
3import { IDestination } from './destination';
4import { IFunction } from './function-base';
5/**
6 * Options to add an EventInvokeConfig to a function.
7 */
8export interface EventInvokeConfigOptions {
9 /**
10 * The destination for failed invocations.
11 *
12 * @default - no destination
13 */
14 readonly onFailure?: IDestination;
15 /**
16 * The destination for successful invocations.
17 *
18 * @default - no destination
19 */
20 readonly onSuccess?: IDestination;
21 /**
22 * The maximum age of a request that Lambda sends to a function for
23 * processing.
24 *
25 * Minimum: 60 seconds
26 * Maximum: 6 hours
27 *
28 * @default Duration.hours(6)
29 */
30 readonly maxEventAge?: Duration;
31 /**
32 * The maximum number of times to retry when the function returns an error.
33 *
34 * Minimum: 0
35 * Maximum: 2
36 *
37 * @default 2
38 */
39 readonly retryAttempts?: number;
40}
41/**
42 * Properties for an EventInvokeConfig
43 */
44export interface EventInvokeConfigProps extends EventInvokeConfigOptions {
45 /**
46 * The Lambda function
47 */
48 readonly function: IFunction;
49 /**
50 * The qualifier
51 *
52 * @default - latest version
53 */
54 readonly qualifier?: string;
55}
56/**
57 * Configure options for asynchronous invocation on a version or an alias
58 *
59 * By default, Lambda retries an asynchronous invocation twice if the function
60 * returns an error. It retains events in a queue for up to six hours. When an
61 * event fails all processing attempts or stays in the asynchronous invocation
62 * queue for too long, Lambda discards it.
63 */
64export declare class EventInvokeConfig extends Resource {
65 constructor(scope: Construct, id: string, props: EventInvokeConfigProps);
66}