class Cumulus::S3::NotificationDiff

Public: Represents a single difference between local configuration and AWS S3 Notification configuration

Public Class Methods

new(type, aws = nil, local = nil) click to toggle source
Calls superclass method Cumulus::Common::Diff::new
# File lib/s3/models/NotificationDiff.rb, line 23
def initialize(type, aws = nil, local = nil)
  super(type, aws, local)

  if aws and local
    @triggers = Common::ListChange.new(
      local.triggers - aws.triggers,
      aws.triggers - local.triggers
    )
  end
end

Public Instance Methods

asset_type() click to toggle source
# File lib/s3/models/NotificationDiff.rb, line 34
def asset_type
  "Notification"
end
aws_name() click to toggle source
# File lib/s3/models/NotificationDiff.rb, line 38
def aws_name
  @aws.name
end
diff_string() click to toggle source
# File lib/s3/models/NotificationDiff.rb, line 42
def diff_string
  case @type
  when PREFIX
    "Prefix: AWS - #{Colors.aws_changes(@aws.prefix)}, Local - #{Colors.local_changes(@local.prefix)}"
  when SUFFIX
    "Suffix: AWS - #{Colors.aws_changes(@aws.suffix)}, Local - #{Colors.local_changes(@local.suffix)}"
  when TRIGGERS
    [
      "Triggers:",
      @triggers.removed.map { |t| Colors.removed("\t#{t}") },
      @triggers.added.map { |t| Colors.added("\t#{t}") },
    ].flatten.join("\n")
  when TYPE
    "Type: AWS - #{Colors.aws_changes(@aws.type)}, Local - #{Colors.local_changes(@local.type)}"
  when TARGET
    "Target: AWS - #{Colors.aws_changes(@aws.target)}, Local - #{Colors.local_changes(@local.target)}"
  end
end