Sha256: e153b2a635768d889bd44972ed49fef8dad0e7f76835e57ec508a8bfe0d9c87b

Contents?: true

Size: 1.05 KB

Versions: 7

Compression:

Stored size: 1.05 KB

Contents

module Codepipe
  class Sns
    include Codepipe::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_codepipeline_file("sns.rb")
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
codepipeline-0.3.4 lib/codepipe/sns.rb
codepipeline-0.3.3 lib/codepipe/sns.rb
codepipeline-0.3.2 lib/codepipe/sns.rb
codepipeline-0.3.1 lib/codepipe/sns.rb
codepipeline-0.3.0 lib/codepipe/sns.rb
codepipeline-0.2.1 lib/codepipe/sns.rb
codepipeline-0.2.0 lib/codepipe/sns.rb