Sha256: f66ff05bb378f22d69b88c0bc8644abf4fecf3ee5c04fbff572d726827b99f75

Contents?: true

Size: 1.02 KB

Versions: 15

Compression:

Stored size: 1.02 KB

Contents

# CloudFormation SNS Topic docs: https://amzn.to/2MYbUZc
module Jets::Cfn::Resource::Sns
  class Topic < Jets::Cfn::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::Cfn::Resource`
    def merged_properties
      display_name = "{namespace} Topic"[0..99] # limit is 100 chars
      {
        DisplayName: 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}SnsTopic"
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
jets-5.0.13 lib/jets/cfn/resource/sns/topic.rb
jets-5.0.12 lib/jets/cfn/resource/sns/topic.rb
jets-5.0.11 lib/jets/cfn/resource/sns/topic.rb
jets-5.0.10 lib/jets/cfn/resource/sns/topic.rb
jets-5.0.9 lib/jets/cfn/resource/sns/topic.rb
jets-5.0.8 lib/jets/cfn/resource/sns/topic.rb
jets-5.0.7 lib/jets/cfn/resource/sns/topic.rb
jets-5.0.6 lib/jets/cfn/resource/sns/topic.rb
jets-5.0.5 lib/jets/cfn/resource/sns/topic.rb
jets-5.0.4 lib/jets/cfn/resource/sns/topic.rb
jets-5.0.3 lib/jets/cfn/resource/sns/topic.rb
jets-5.0.2 lib/jets/cfn/resource/sns/topic.rb
jets-5.0.1 lib/jets/cfn/resource/sns/topic.rb
jets-5.0.0 lib/jets/cfn/resource/sns/topic.rb
jets-5.0.0.beta1 lib/jets/cfn/resource/sns/topic.rb