How to use the @aws-cdk/aws-events.EventRule function in @aws-cdk/aws-events

To help you get started, we’ve selected a few @aws-cdk/aws-events examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github seagull-js / seagull / packages / deploy-aws / src / seagull_stack.ts View on Github external
addEventRule(rule: Rule, target: Events.IEventRuleTarget) {
    const name = rule.path.split('/').pop() || 'rootPath'
    const schedule = {
      scheduleExpression: rule.cron,
    }

    const eventRule = new Events.EventRule(this, name, schedule)
    eventRule.addTarget(target, { jsonTemplate: `{"path":"${rule.path}"}` })
    return eventRule
  }