UNPKG

4.41 kBTypeScriptView Raw
1/**
2 * Events in Amazon CloudWatch Events are represented as JSON objects. For more
3 * information about JSON objects, see RFC 7159.
4 *
5 * **Important**: this class can only be used with a `Rule` class. In particular,
6 * do not use it with `CfnRule` class: your pattern will not be rendered
7 * correctly. In a `CfnRule` class, write the pattern as you normally would when
8 * directly writing CloudFormation.
9 *
10 * Rules use event patterns to select events and route them to targets. A
11 * pattern either matches an event or it doesn't. Event patterns are represented
12 * as JSON objects with a structure that is similar to that of events.
13 *
14 * It is important to remember the following about event pattern matching:
15 *
16 * - For a pattern to match an event, the event must contain all the field names
17 * listed in the pattern. The field names must appear in the event with the
18 * same nesting structure.
19 *
20 * - Other fields of the event not mentioned in the pattern are ignored;
21 * effectively, there is a ``"*": "*"`` wildcard for fields not mentioned.
22 *
23 * - The matching is exact (character-by-character), without case-folding or any
24 * other string normalization.
25 *
26 * - The values being matched follow JSON rules: Strings enclosed in quotes,
27 * numbers, and the unquoted keywords true, false, and null.
28 *
29 * - Number matching is at the string representation level. For example, 300,
30 * 300.0, and 3.0e2 are not considered equal.
31 *
32 * @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/CloudWatchEventsandEventPatterns.html
33 */
34export interface EventPattern {
35 /**
36 * By default, this is set to 0 (zero) in all events.
37 *
38 * @default - No filtering on version
39 */
40 readonly version?: string[];
41 /**
42 * A unique value is generated for every event. This can be helpful in
43 * tracing events as they move through rules to targets, and are processed.
44 *
45 * @default - No filtering on id
46 */
47 readonly id?: string[];
48 /**
49 * Identifies, in combination with the source field, the fields and values
50 * that appear in the detail field.
51 *
52 * Represents the "detail-type" event field.
53 *
54 * @default - No filtering on detail type
55 */
56 readonly detailType?: string[];
57 /**
58 * Identifies the service that sourced the event. All events sourced from
59 * within AWS begin with "aws." Customer-generated events can have any value
60 * here, as long as it doesn't begin with "aws." We recommend the use of
61 * Java package-name style reverse domain-name strings.
62 *
63 * To find the correct value for source for an AWS service, see the table in
64 * AWS Service Namespaces. For example, the source value for Amazon
65 * CloudFront is aws.cloudfront.
66 *
67 * @see http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#genref-aws-service-namespaces
68 * @default - No filtering on source
69 */
70 readonly source?: string[];
71 /**
72 * The 12-digit number identifying an AWS account.
73 *
74 * @default - No filtering on account
75 */
76 readonly account?: string[];
77 /**
78 * The event timestamp, which can be specified by the service originating
79 * the event. If the event spans a time interval, the service might choose
80 * to report the start time, so this value can be noticeably before the time
81 * the event is actually received.
82 *
83 * @default - No filtering on time
84 */
85 readonly time?: string[];
86 /**
87 * Identifies the AWS region where the event originated.
88 *
89 * @default - No filtering on region
90 */
91 readonly region?: string[];
92 /**
93 * This JSON array contains ARNs that identify resources that are involved
94 * in the event. Inclusion of these ARNs is at the discretion of the
95 * service.
96 *
97 * For example, Amazon EC2 instance state-changes include Amazon EC2
98 * instance ARNs, Auto Scaling events include ARNs for both instances and
99 * Auto Scaling groups, but API calls with AWS CloudTrail do not include
100 * resource ARNs.
101 *
102 * @default - No filtering on resource
103 */
104 readonly resources?: string[];
105 /**
106 * A JSON object, whose content is at the discretion of the service
107 * originating the event.
108 *
109 * @default - No filtering on detail
110 */
111 readonly detail?: {
112 [key: string]: any;
113 };
114}