import { Construct } from '@aws-cdk/cdk'; import { EventPattern } from './event-pattern'; import { RuleArn } from './events.generated'; import { TargetInputTemplate } from './input-options'; import { EventRuleRef } from './rule-ref'; import { IEventRuleTarget } from './target'; export interface EventRuleProps { /** * A description of the rule's purpose. */ description?: string; /** * A name for the rule. If you don't specify a name, AWS CloudFormation * generates a unique physical ID and uses that ID for the rule name. For * more information, see Name Type. */ ruleName?: string; /** * Indicates whether the rule is enabled. * @default Rule is enabled */ enabled?: boolean; /** * The schedule or rate (frequency) that determines when CloudWatch Events * runs the rule. For more information, see Schedule Expression Syntax for * Rules in the Amazon CloudWatch User Guide. * * @see http://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html * * You must specify this property, the `eventPattern` property, or both. */ scheduleExpression?: string; /** * Describes which events CloudWatch Events routes to the specified target. * These routed events are matched events. For more information, see Events * and Event Patterns in the Amazon CloudWatch User Guide. * * @see * http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/CloudWatchEventsandEventPatterns.html * * You must specify this property (either via props or via * `addEventPattern`), the `scheduleExpression` property, or both. The * method `addEventPattern` can be used to add filter values to the event * pattern. */ eventPattern?: EventPattern; /** * Targets to invoke when this rule matches an event. * * Input will be the full matched event. If you wish to specify custom * target input, use `addTarget(target[, inputOptions])`. */ targets?: IEventRuleTarget[]; } /** * Defines a CloudWatch Event Rule in this stack. */ export declare class EventRule extends EventRuleRef { readonly ruleArn: RuleArn; private readonly targets; private readonly eventPattern; private scheduleExpression?; constructor(parent: Construct, name: string, props?: EventRuleProps); /** * Adds a target to the rule. The abstract class RuleTarget can be extended to define new * targets. * * No-op if target is undefined. */ addTarget(target?: IEventRuleTarget, inputOptions?: TargetInputTemplate): void; /** * Adds an event pattern filter to this rule. If a pattern was already specified, * these values are merged into the existing pattern. * * For example, if the rule already contains the pattern: * * { * "resources": [ "r1" ], * "detail": { * "hello": [ 1 ] * } * } * * And `addEventPattern` is called with the pattern: * * { * "resources": [ "r2" ], * "detail": { * "foo": [ "bar" ] * } * } * * The resulting event pattern will be: * * { * "resources": [ "r1", "r2" ], * "detail": { * "hello": [ 1 ], * "foo": [ "bar" ] * } * } * */ addEventPattern(eventPattern?: EventPattern): void; validate(): string[]; private renderTargets; private renderEventPattern; }