UNPKG

3.67 kBTypeScriptView Raw
1import { IResolvable, IResolveContext } from '@aws-cdk/core';
2import { IRule } from './rule-ref';
3/**
4 * The input to send to the event target
5 */
6export declare abstract class RuleTargetInput {
7 /**
8 * Pass text to the event target
9 *
10 * May contain strings returned by `EventField.from()` to substitute in parts of the
11 * matched event.
12 *
13 * The Rule Target input value will be a single string: the string you pass
14 * here. Do not use this method to pass a complex value like a JSON object to
15 * a Rule Target. Use `RuleTargetInput.fromObject()` instead.
16 */
17 static fromText(text: string): RuleTargetInput;
18 /**
19 * Pass text to the event target, splitting on newlines.
20 *
21 * This is only useful when passing to a target that does not
22 * take a single argument.
23 *
24 * May contain strings returned by `EventField.from()` to substitute in parts
25 * of the matched event.
26 */
27 static fromMultilineText(text: string): RuleTargetInput;
28 /**
29 * Pass a JSON object to the event target
30 *
31 * May contain strings returned by `EventField.from()` to substitute in parts of the
32 * matched event.
33 */
34 static fromObject(obj: any): RuleTargetInput;
35 /**
36 * Take the event target input from a path in the event JSON
37 */
38 static fromEventPath(path: string): RuleTargetInput;
39 protected constructor();
40 /**
41 * Return the input properties for this input object
42 */
43 abstract bind(rule: IRule): RuleTargetInputProperties;
44}
45/**
46 * The input properties for an event target
47 */
48export interface RuleTargetInputProperties {
49 /**
50 * Literal input to the target service (must be valid JSON)
51 *
52 * @default - input for the event target. If the input contains a paths map
53 * values wil be extracted from event and inserted into the `inputTemplate`.
54 */
55 readonly input?: string;
56 /**
57 * JsonPath to take input from the input event
58 *
59 * @default - None. The entire matched event is passed as input
60 */
61 readonly inputPath?: string;
62 /**
63 * Input template to insert paths map into
64 *
65 * @default - None.
66 */
67 readonly inputTemplate?: string;
68 /**
69 * Paths map to extract values from event and insert into `inputTemplate`
70 *
71 * @default - No values extracted from event.
72 */
73 readonly inputPathsMap?: {
74 [key: string]: string;
75 };
76}
77/**
78 * Represents a field in the event pattern
79 */
80export declare class EventField implements IResolvable {
81 readonly path: string;
82 /**
83 * Extract the event ID from the event
84 */
85 static get eventId(): string;
86 /**
87 * Extract the detail type from the event
88 */
89 static get detailType(): string;
90 /**
91 * Extract the source from the event
92 */
93 static get source(): string;
94 /**
95 * Extract the account from the event
96 */
97 static get account(): string;
98 /**
99 * Extract the time from the event
100 */
101 static get time(): string;
102 /**
103 * Extract the region from the event
104 */
105 static get region(): string;
106 /**
107 * Extract a custom JSON path from the event
108 */
109 static fromPath(path: string): string;
110 /**
111 * Human readable display hint about the event pattern
112 */
113 readonly displayHint: string;
114 readonly creationStack: string[];
115 /**
116 *
117 * @param path the path to a field in the event pattern
118 */
119 private constructor();
120 resolve(_ctx: IResolveContext): any;
121 toString(): string;
122 /**
123 * Convert the path to the field in the event pattern to JSON
124 */
125 toJSON(): string;
126}