Class: Jets::Resource::Lambda::EventSourceMapping

Inherits:
Base
  • Object
show all
Defined in:
lib/jets/resource/lambda/event_source_mapping.rb

Instance Method Summary collapse

Methods inherited from Base

#replacements, #resource

Constructor Details

#initialize(props = {}) ⇒ EventSourceMapping

Returns a new instance of EventSourceMapping.



4
5
6
# File 'lib/jets/resource/lambda/event_source_mapping.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
16
17
18
19
20
21
22
23
24
25
# File 'lib/jets/resource/lambda/event_source_mapping.rb', line 8

def definition
  # CloudFormation Docs: https://amzn.to/2WM6165
  properties = {
    # batch_size: 10, # Defaults: Kinesis 100, DynamoDB Streams: 100, SQS: 10
    # enabled: boolean,
    # event_source_arn: string, # required
    function_name: "!Ref {namespace}LambdaFunction",
    # starting_position: string # reqiured for Required for Amazon Kinesis and Amazon DynamoDB Streams sources
  }
  properties.merge!(@props)

  {
    event_source_mapping_logical_id => {
      type: "AWS::Lambda::EventSourceMapping",
      properties: properties
    }
  }
end

#event_source_mapping_logical_idObject



27
28
29
# File 'lib/jets/resource/lambda/event_source_mapping.rb', line 27

def event_source_mapping_logical_id
  "{namespace}EventSourceMapping"
end