Sha256: dca331bb8df8d51a26d7b7597949ec3c289954476cc44a92f6a50726cee6b9f2

Contents?: true

Size: 1.03 KB

Versions: 136

Compression:

Stored size: 1.03 KB

Contents

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

    def definition
      {
        topic_logical_id => {
          type: "AWS::SNS::Topic",
          properties: merged_properties,
        }
      }
    end

    # Do not name this method properties, that is a computed method of `Jets::Resource::Base`
    def merged_properties
      display_name = "{namespace} Topic"[0..99] # limit is 100 chars
      {
        display_name: display_name,
        # Not setting subscription this way but instead with a SNS::Subscription resource so the interface
        # is consistent. Leaving comment in here to remind me and in case decide to change this.
        # subscription: [
        #   endpoint: "!GetAtt {namespace}LambdaFunction.Arn",
        #   protocol: "lambda"
        # ]
      }.deep_merge(@props)
    end

    def topic_logical_id
      "{namespace}_sns_topic"
    end
  end
end

Version data entries

136 entries across 136 versions & 3 rubygems

Version Path
jets-1.9.20 lib/jets/resource/sns/topic.rb
jets-1.9.19 lib/jets/resource/sns/topic.rb
jets-1.9.18 lib/jets/resource/sns/topic.rb
jets-1.9.17 lib/jets/resource/sns/topic.rb
jets-1.9.16 lib/jets/resource/sns/topic.rb
jets-1.9.15 lib/jets/resource/sns/topic.rb
jets-1.9.14 lib/jets/resource/sns/topic.rb
jets-1.9.13 lib/jets/resource/sns/topic.rb
jets-1.9.12 lib/jets/resource/sns/topic.rb
jets-1.9.11 lib/jets/resource/sns/topic.rb
jets-1.9.10 lib/jets/resource/sns/topic.rb
jets-1.9.9 lib/jets/resource/sns/topic.rb
jets-1.9.8 lib/jets/resource/sns/topic.rb
jets-1.9.7 lib/jets/resource/sns/topic.rb
jets-1.9.6 lib/jets/resource/sns/topic.rb
jets-1.9.5 lib/jets/resource/sns/topic.rb
jets-1.9.4 lib/jets/resource/sns/topic.rb
jets-1.9.3 lib/jets/resource/sns/topic.rb
jets-1.9.2 lib/jets/resource/sns/topic.rb
jets-1.9.1 lib/jets/resource/sns/topic.rb