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

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

Instance Method Summary collapse

Methods inherited from Base

#attributes, #logical_id, #outputs, #parameters, #permission, #properties, #replacements, #replacer, #standarize, #template, truncate_id, #type

Methods included from Util::Camelize

#camelize

Constructor Details

#initialize(props = {}) ⇒ EventSourceMapping

Returns a new instance of EventSourceMapping.



4
5
6
# File 'lib/jets/cfn/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/cfn/resource/lambda/event_source_mapping.rb', line 8

def definition
  # CloudFormation Docs: https://amzn.to/2WM6165
  properties = {
    # BatchSize: 10, # Defaults: Kinesis 100, DynamoDB Streams: 100, SQS: 10
    # Enabled: boolean,
    # EventSourceArn: string, # required
    FunctionName: "!Ref {namespace}LambdaFunction",
    # StartingPosition: 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/cfn/resource/lambda/event_source_mapping.rb', line 27

def event_source_mapping_logical_id
  "{namespace}EventSourceMapping"
end