UNPKG

3.67 kBTypeScriptView Raw
1import * as iam from '@aws-cdk/aws-iam';
2import { IConstruct } from '@aws-cdk/core';
3import { CfnRule } from './events.generated';
4import { RuleTargetInput } from './input';
5import { IRule } from './rule-ref';
6/**
7 * An abstract target for EventRules.
8 */
9export interface IRuleTarget {
10 /**
11 * Returns the rule target specification.
12 * NOTE: Do not use the various `inputXxx` options. They can be set in a call to `addTarget`.
13 *
14 * @param rule The EventBridge Rule that would trigger this target.
15 * @param id The id of the target that will be attached to the rule.
16 */
17 bind(rule: IRule, id?: string): RuleTargetConfig;
18}
19/**
20 * Properties for an event rule target
21 */
22export interface RuleTargetConfig {
23 /**
24 * A unique, user-defined identifier for the target. Acceptable values
25 * include alphanumeric characters, periods (.), hyphens (-), and
26 * underscores (_).
27 *
28 * @default - an auto-generated id
29 * @deprecated no replacement. we will always use an autogenerated id.
30 */
31 readonly id?: string;
32 /**
33 * The Amazon Resource Name (ARN) of the target.
34 */
35 readonly arn: string;
36 /**
37 * Role to use to invoke this event target
38 */
39 readonly role?: iam.IRole;
40 /**
41 * Parameters used when the rule invokes Amazon AWS Batch Job/Queue
42 * @default no parameters set
43 */
44 readonly batchParameters?: CfnRule.BatchParametersProperty;
45 /**
46 * Contains information about a dead-letter queue configuration.
47 * @default no dead-letter queue set
48 */
49 readonly deadLetterConfig?: CfnRule.DeadLetterConfigProperty;
50 /**
51 * A RetryPolicy object that includes information about the retry policy settings.
52 * @default EventBridge default retry policy
53 */
54 readonly retryPolicy?: CfnRule.RetryPolicyProperty;
55 /**
56 * The Amazon ECS task definition and task count to use, if the event target
57 * is an Amazon ECS task.
58 */
59 readonly ecsParameters?: CfnRule.EcsParametersProperty;
60 /**
61 * Contains the HTTP parameters to use when the target is a API Gateway REST endpoint
62 * or EventBridge API destination.
63 * @default - None
64 */
65 readonly httpParameters?: CfnRule.HttpParametersProperty;
66 /**
67 * Settings that control shard assignment, when the target is a Kinesis
68 * stream. If you don't include this parameter, eventId is used as the
69 * partition key.
70 */
71 readonly kinesisParameters?: CfnRule.KinesisParametersProperty;
72 /**
73 * Parameters used when the rule invokes Amazon EC2 Systems Manager Run
74 * Command.
75 */
76 readonly runCommandParameters?: CfnRule.RunCommandParametersProperty;
77 /**
78 * Parameters used when the FIFO sqs queue is used an event target by the
79 * rule.
80 */
81 readonly sqsParameters?: CfnRule.SqsParametersProperty;
82 /**
83 * What input to send to the event target
84 *
85 * @default the entire event
86 */
87 readonly input?: RuleTargetInput;
88 /**
89 * The resource that is backing this target.
90 * This is the resource that will actually have some action performed on it when used as a target
91 * (for example, start a build for a CodeBuild project).
92 * We need it to determine whether the rule belongs to a different account than the target -
93 * if so, we generate a more complex setup,
94 * including an additional stack containing the EventBusPolicy.
95 *
96 * @see https://docs.aws.amazon.com/eventbridge/latest/userguide/eventbridge-cross-account-event-delivery.html
97 * @default the target is not backed by any resource
98 */
99 readonly targetResource?: IConstruct;
100}