class Cumulus::VPC::EndpointDiff

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

Public Class Methods

policy(aws, local) click to toggle source
# File lib/vpc/models/EndpointDiff.rb, line 30
def self.policy(aws, local)
  if aws != local
    diff = EndpointDiff.new(POLICY, aws, local)
    diff
  end
end
route_tables(aws, local) click to toggle source
# File lib/vpc/models/EndpointDiff.rb, line 21
def self.route_tables(aws, local)
  changes = Common::ListChange.simple_list_diff(aws, local)
  if changes
    diff = EndpointDiff.new(ROUTE_TABLES, aws, local)
    diff.changes = changes
    diff
  end
end

Public Instance Methods

asset_type() click to toggle source
# File lib/vpc/models/EndpointDiff.rb, line 37
def asset_type
  "Endpoint"
end
aws_name() click to toggle source
# File lib/vpc/models/EndpointDiff.rb, line 41
def aws_name
  @aws.service_name
end
diff_string() click to toggle source
# File lib/vpc/models/EndpointDiff.rb, line 45
def diff_string
  case @type
  when POLICY
    [
      "Policy Statement:",
      Colors.unmanaged([
        "\tRemoving:",
        JSON.pretty_generate(aws).lines.map { |l| "\t\t#{l}".chomp("\n") }
      ].join("\n")),
      Colors.added([
        "\tAdding:",
        JSON.pretty_generate(local).lines.map { |l| "\t\t#{l}".chomp("\n") }
      ].join("\n"))
    ].join("\n")
  when ROUTE_TABLES
    [
      "Route Tables:",
      @changes.removed.map { |d| Colors.unmanaged("\t#{d}") },
      @changes.added.map { |d| Colors.added("\t#{d}") },
    ].flatten.join("\n")
  end
end