class AWS::EC2::RouteTable::Route

Attributes

cidr_block[R]

@return [String] destination_cidr_block

destination_cidr_block[R]

@return [String] destination_cidr_block

instance[R]

@return [Instance,nil]

internet_gateway[R]

@return [InternetGateway,nil]

network_interface[R]

@return [NetworkInterface,nil]

origin[R]

@return [Symbol] Returns the origin (:create_route, :create_route_table or :enable_vgw_route_propagation)

route_table[R]

@return [RouteTable]

state[R]

@return [Symbol] Returns the state (:active or :blackhole).

target[R]

@return [Gateway,Instance,NetworkInterface] Returns the target

of this route table.  It will be a gateway id, instance or a
network interface.

Public Class Methods

new(route_table, details) click to toggle source
# File lib/aws/ec2/route_table/route.rb, line 29
def initialize route_table, details

  @route_table = route_table

  if details[:destination_cidr_block]
    @destination_cidr_block = details.destination_cidr_block
  end

  if details[:gateway_id]
    @internet_gateway = InternetGateway.new(
      details[:gateway_id],
      :config => route_table.config)
  end

  if details[:instance_id]
    @instance = Instance.new(details[:instance_id],
      :vpc_id => route_table.vpc_id,
      :owner_id => details[:instance_owner_id],
      :config => route_table.config)
  end

  if details[:network_interface_id]
    @network_interface = NetworkInterface.new(
      details[:network_interface_id],
      :vpc_id => route_table.vpc_id,
      :config => route_table.config)
  end

  @target = (internet_gateway || instance || network_interface)

  @origin = { 'CreateRoute' => :create_route, 'CreateRouteTable' => :create_route_table, 'EnableVgwRoutePropagation' => :enable_vgw_route_propagation }[details.origin]

  @state = details.state.to_sym

end

Public Instance Methods

delete() click to toggle source

Deletes this route. @return [nil]

# File lib/aws/ec2/route_table/route.rb, line 114
def delete
  route_table.delete_route(destination_cidr_block)
end
replace(options = {}) click to toggle source

@param [Hash] options

@option options [Gateway,String] :gateway A gateway (object or

string id) to attach the route to.

@option options [Instance,String] :instance An instance (object

or string id) to attach the route to.

@option options [NetworkInterface,String] :network_interface

A network interface (object or string id) to attach the route
to.

@return [nil]

# File lib/aws/ec2/route_table/route.rb, line 108
def replace options = {}
  route_table.replace_route(destination_cidr_block, options)
end