Sha256: 3f938d7a4c42d457c07ce87047ac05afdb23921b2dcca99493e2835ad17de392

Contents?: true

Size: 738 Bytes

Versions: 1

Compression:

Stored size: 738 Bytes

Contents

# CloudFormation SNS Subscription docs: https://amzn.to/2SJtN3C
module Jets::Resource::Sns
  class Subscription < Jets::Resource::Base
    def initialize(props)
      @props = props # associated_properties from dsl.rb
    end

    def definition
      {
        subscription_logical_id => {
          type: "AWS::SNS::Subscription",
          properties: merged_properties,
        }
      }
    end

    # Do not name this method properties, that is a computed method of `Jets::Resource::Base`
    def merged_properties
      {
        endpoint: "!GetAtt {namespace}LambdaFunction.Arn",
        protocol: "lambda",
      }.deep_merge(@props)
    end

    def subscription_logical_id
      "{namespace}_sns_subscription"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jets-1.7.2 lib/jets/resource/sns/subscription.rb