class Codepipe::Sns

Public Class Methods

new(options={}) click to toggle source
# File lib/codepipe/sns.rb, line 6
def initialize(options={})
  @options = options
  @sns_path = options[:sns_path] || get_sns_path
  @properties = default_properties
end

Public Instance Methods

default_properties() click to toggle source
# File lib/codepipe/sns.rb, line 24
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
run() click to toggle source
# File lib/codepipe/sns.rb, line 12
def run
  evaluate(@sns_path) if File.exist?(@sns_path)

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

Private Instance Methods

get_sns_path() click to toggle source
# File lib/codepipe/sns.rb, line 39
def get_sns_path
  lookup_codepipeline_file("sns.rb")
end