Class: Jets::Resource::Iot::TopicRule

Inherits:
Base
  • Object
show all
Defined in:
lib/jets/resource/iot/topic_rule.rb

Instance Method Summary collapse

Methods inherited from Base

#replacements, #resource

Constructor Details

#initialize(props = {}) ⇒ TopicRule

Returns a new instance of TopicRule.



4
5
6
# File 'lib/jets/resource/iot/topic_rule.rb', line 4

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

Instance Method Details

#definitionObject



8
9
10
11
12
13
14
15
# File 'lib/jets/resource/iot/topic_rule.rb', line 8

def definition
  {
    topic_logical_id => {
      type: "AWS::IoT::TopicRule",
      properties: merged_properties,
    }
  }
end

#merged_propertiesObject

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



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/jets/resource/iot/topic_rule.rb', line 18

def merged_properties
  {
    # required properties
    topic_rule_payload: {
      actions: [{
        lambda: { function_arn: "!GetAtt {namespace}LambdaFunction.Arn" }
      }],
      rule_disabled: 'true',
    }
  }.deep_merge(@props)
end

#topic_logical_idObject



30
31
32
# File 'lib/jets/resource/iot/topic_rule.rb', line 30

def topic_logical_id
  "{namespace}_iot_topic_rule"
end