Class: Jets::Resource::Events::Rule

Inherits:
Base
  • Object
show all
Defined in:
lib/jets/resource/events/rule.rb

Instance Method Summary collapse

Methods inherited from Base

#replacements, #resource

Constructor Details

#initialize(props = {}) ⇒ Rule

Returns a new instance of Rule.



3
4
5
# File 'lib/jets/resource/events/rule.rb', line 3

def initialize(props={})
  @props = props # associated_properties from dsl.rb
end

Instance Method Details

#definitionObject



7
8
9
10
11
12
13
14
# File 'lib/jets/resource/events/rule.rb', line 7

def definition
  {
    rule_logical_id => {
      type: "AWS::Events::Rule",
      properties: merged_properties
    }
  }
end

#merged_propertiesObject

Do not name this method properties, that is a computed method of ‘Jets::Resource::Base`



17
18
19
20
21
22
23
24
25
# File 'lib/jets/resource/events/rule.rb', line 17

def merged_properties
  {
    state: "ENABLED",
    targets: [{
      arn: "!GetAtt {namespace}LambdaFunction.Arn",
      id: "{namespace}RuleTarget"
    }]
  }.deep_merge(@props)
end

#rule_logical_idObject



27
28
29
# File 'lib/jets/resource/events/rule.rb', line 27

def rule_logical_id
  "{namespace}_events_rule"
end