class Cumulus::VPC::RouteConfig

Public: An object representing configuration for a VPC route table route

Attributes

dest_cidr[R]
gateway_id[R]
instance_id[R]
nat_gateway_id[R]
network_interface_id[R]
vpc_peering_connection_id[R]

Public Class Methods

new(json = nil) click to toggle source

Public: Constructor

json - a hash containing the JSON configuration for the route table route

# File lib/vpc/models/RouteConfig.rb, line 22
def initialize(json = nil)
  if !json.nil?
    @dest_cidr = json["dest-cidr"]
    @gateway_id = json["gateway-id"]
    @network_interface_id = json["network-interface-id"]
    @vpc_peering_connection_id = json["vpc-peering-connection-id"]
    @nat_gateway_id = json["nat-gateway-id"]
  end
end

Public Instance Methods

diff(aws) click to toggle source

Public: Produce an array of differences between this local configuration and the configuration in AWS

aws - the AWS resource

Returns an array of the RouteDiffs that were found

# File lib/vpc/models/RouteConfig.rb, line 58
def diff(aws)
  diffs = []

  if @gateway_id != aws.gateway_id
    diffs << RouteDiff.new(RouteChange::GATEWAY, aws.gateway_id, @gateway_id)
  end

  if @network_interface_id != aws.network_interface_id
    diffs << RouteDiff.new(RouteChange::NETWORK, aws.network_interface_id, @network_interface_id)
  end

  if @vpc_peering_connection_id != aws.vpc_peering_connection_id
    diffs << RouteDiff.new(RouteChange::VPC_PEERING, aws.vpc_peering_connection_id, @vpc_peering_connection_id)
  end

  if @nat_gateway_id != aws.nat_gateway_id
    diffs << RouteDiff.new(RouteChange::NAT_GATEWAY, aws.nat_gateway_id, @nat_gateway_id)
  end

  diffs
end
populate!(aws) click to toggle source
# File lib/vpc/models/RouteConfig.rb, line 42
def populate!(aws)
  @dest_cidr = aws.destination_cidr_block
  @gateway_id = aws.gateway_id
  @network_interface_id = aws.network_interface_id
  @vpc_peering_connection_id = aws.vpc_peering_connection_id
  @nat_gateway_id = aws.nat_gateway_id

  self
end
to_hash() click to toggle source
# File lib/vpc/models/RouteConfig.rb, line 32
def to_hash
  {
    "dest-cidr" => @dest_cidr,
    "gateway-id" => @gateway_id,
    "network-interface-id" => @network_interface_id,
    "vpc-peering-connection-id" => @vpc_peering_connection_id,
    "nat-gateway-id" => @nat_gateway_id,
  }.reject { |k, v| v.nil? }
end