Class: Jets::Resource::Sns::Subscription

Inherits:
Base
  • Object
show all
Defined in:
lib/jets/resource/sns/subscription.rb

Instance Method Summary collapse

Methods inherited from Base

#replacements, #resource

Constructor Details

#initialize(props = {}) ⇒ Subscription

Returns a new instance of Subscription.



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

def definition
  {
    subscription_logical_id => {
      type: "AWS::SNS::Subscription",
      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
# File 'lib/jets/resource/sns/subscription.rb', line 18

def merged_properties
  {
    endpoint: "!GetAtt {namespace}LambdaFunction.Arn",
    protocol: "lambda",
  }.deep_merge(@props)
end

#subscription_logical_idObject



25
26
27
# File 'lib/jets/resource/sns/subscription.rb', line 25

def subscription_logical_id
  "{namespace}_sns_subscription"
end