Class: AWS::EC2::RouteTable::Route

Inherits:
Object
  • Object
show all
Defined in:
lib/aws/ec2/route_table/route.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(route_table, details) ⇒ Route

Returns a new instance of Route.



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/aws/ec2/route_table/route.rb', line 29

def initialize route_table, details

  @route_table = route_table

  @destination_cidr_block = details.destination_cidr_block

  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

Instance Attribute Details

#destination_cidr_blockString (readonly) Also known as: cidr_block

Returns destination_cidr_block.

Returns:

  • (String)

    destination_cidr_block



67
68
69
# File 'lib/aws/ec2/route_table/route.rb', line 67

def destination_cidr_block
  @destination_cidr_block
end

#instanceInstance? (readonly)

Returns:



75
76
77
# File 'lib/aws/ec2/route_table/route.rb', line 75

def instance
  @instance
end

#internet_gatewayInternetGateway? (readonly)

Returns:



72
73
74
# File 'lib/aws/ec2/route_table/route.rb', line 72

def internet_gateway
  @internet_gateway
end

#network_interfaceNetworkInterface? (readonly)

Returns:



78
79
80
# File 'lib/aws/ec2/route_table/route.rb', line 78

def network_interface
  @network_interface
end

#originSymbol (readonly)

:create_route_table or :enable_vgw_route_propagation)

Returns:

  • (Symbol)

    Returns the origin (:create_route,



87
88
89
# File 'lib/aws/ec2/route_table/route.rb', line 87

def origin
  @origin
end

#route_tableRouteTable (readonly)

Returns:



64
65
66
# File 'lib/aws/ec2/route_table/route.rb', line 64

def route_table
  @route_table
end

#stateSymbol (readonly)

Returns the state (:active or :blackhole).

Returns:

  • (Symbol)

    Returns the state (:active or :blackhole).



90
91
92
# File 'lib/aws/ec2/route_table/route.rb', line 90

def state
  @state
end

#targetGateway, ... (readonly)

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

Returns:

  • (Gateway, Instance, NetworkInterface)

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



83
84
85
# File 'lib/aws/ec2/route_table/route.rb', line 83

def target
  @target
end

Instance Method Details

#deletenil

Deletes this route.

Returns:

  • (nil)


112
113
114
# File 'lib/aws/ec2/route_table/route.rb', line 112

def delete
  route_table.delete_route(destination_cidr_block)
end

#replace(options = {}) ⇒ nil

Parameters:

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :gateway (Gateway, String)

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

  • :instance (Instance, String)

    An instance (object or string id) to attach the route to.

  • :network_interface (NetworkInterface, String)

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

Returns:

  • (nil)


106
107
108
# File 'lib/aws/ec2/route_table/route.rb', line 106

def replace options = {}
  route_table.replace_route(destination_cidr_block, options)
end