UNPKG

2.39 kBTypeScriptView Raw
1import * as events from '@aws-cdk/aws-events';
2import * as iam from '@aws-cdk/aws-iam';
3import * as lambda from '@aws-cdk/aws-lambda';
4import * as sqs from '@aws-cdk/aws-sqs';
5import { IConstruct, Duration } from '@aws-cdk/core';
6/**
7 * The generic properties for an RuleTarget
8 */
9export interface TargetBaseProps {
10 /**
11 * The SQS queue to be used as deadLetterQueue.
12 * Check out the [considerations for using a dead-letter queue](https://docs.aws.amazon.com/eventbridge/latest/userguide/rule-dlq.html#dlq-considerations).
13 *
14 * The events not successfully delivered are automatically retried for a specified period of time,
15 * depending on the retry policy of the target.
16 * If an event is not delivered before all retry attempts are exhausted, it will be sent to the dead letter queue.
17 *
18 * @default - no dead-letter queue
19 */
20 readonly deadLetterQueue?: sqs.IQueue;
21 /**
22 * The maximum age of a request that Lambda sends to a function for
23 * processing.
24 *
25 * Minimum value of 60.
26 * Maximum value of 86400.
27 *
28 * @default Duration.hours(24)
29 */
30 readonly maxEventAge?: Duration;
31 /**
32 * The maximum number of times to retry when the function returns an error.
33 *
34 * Minimum value of 0.
35 * Maximum value of 185.
36 *
37 * @default 185
38 */
39 readonly retryAttempts?: number;
40}
41/**
42 * Bind props to base rule target config.
43 * @internal
44 */
45export declare function bindBaseTargetConfig(props: TargetBaseProps): {
46 deadLetterConfig: {
47 arn: string;
48 } | undefined;
49 retryPolicy: {
50 maximumRetryAttempts: number | undefined;
51 maximumEventAgeInSeconds: number | undefined;
52 } | undefined;
53};
54/**
55 * Obtain the Role for the EventBridge event
56 *
57 * If a role already exists, it will be returned. This ensures that if multiple
58 * events have the same target, they will share a role.
59 * @internal
60 */
61export declare function singletonEventRole(scope: IConstruct): iam.IRole;
62/**
63 * Allows a Lambda function to be called from a rule
64 * @internal
65 */
66export declare function addLambdaPermission(rule: events.IRule, handler: lambda.IFunction): void;
67/**
68 * Allow a rule to send events with failed invocation to an Amazon SQS queue.
69 * @internal
70 */
71export declare function addToDeadLetterQueueResourcePolicy(rule: events.IRule, queue: sqs.IQueue): void;