Sha256: b3535694403eef1f13608d837200657d5823d6a7c2fd1b0f9f5cb41ae0517fc2

Contents?: true

Size: 1.05 KB

Versions: 6

Compression:

Stored size: 1.05 KB

Contents

module Pipedream
  class Sns
    include Pipedream::Dsl::Sns
    include Evaluate

    def initialize(options={})
      @options = options
      @sns_path = options[:sns_path] || get_sns_path
      @properties = default_properties
    end

    def run
      evaluate(@sns_path) if File.exist?(@sns_path)

      resource = {
        sns_topic: {
          type: "AWS::SNS::Topic",
          properties: @properties
        }
      }
      CfnCamelizer.transform(resource)
    end

    def default_properties
      display_name = "#{@options[:full_pipeline_name]} pipeline"
      {
        display_name: display_name,
        # kms_master_key_id: "string",
        # subscription: [{
        #   endpoint: '',
        #   protocol: ','
        # }],
        # topic_name: "string", # Not setting because update requires: Replacement. Dont want 2 pipelines to collide
      }
      # https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sns-subscription.html
    end

  private
    def get_sns_path
      lookup_pipedream_file("sns.rb")
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
pipedream-0.4.8 lib/pipedream/sns.rb
pipedream-0.4.7 lib/pipedream/sns.rb
pipedream-0.4.6 lib/pipedream/sns.rb
pipedream-0.4.5 lib/pipedream/sns.rb
pipedream-0.4.4 lib/pipedream/sns.rb
pipedream-0.4.3 lib/pipedream/sns.rb