Class: AWS::EC2::RouteTableCollection

Inherits:
Collection
  • Object
show all
Includes:
Core::Collection::Simple, TaggedCollection
Defined in:
lib/aws/ec2/route_table_collection.rb

Instance Method Summary collapse

Methods included from Core::Collection

#each, #each_batch, #enum, #first, #in_groups_of, #page

Methods included from TaggedCollection

#tagged, #tagged_values

Methods included from FilteredCollection

#filter, #initialize

Instance Method Details

#[](route_table_id) ⇒ RouteTable

Parameters:

  • route_table_id (String)

Returns:



45
46
47
# File 'lib/aws/ec2/route_table_collection.rb', line 45

def [] route_table_id
  RouteTable.new(route_table_id, :config => config)
end

#create(options = {}) ⇒ RouteTable

Creates a route table.

Parameters:

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

Options Hash (options):

  • :vpc (VPC, String)

    The vpc or vpc id of where you want to create the route table.

Returns:



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/aws/ec2/route_table_collection.rb', line 31

def create options = {}

  client_opts = {}
  client_opts[:vpc_id] = vpc_id_option(options)

  resp = client.create_route_table(client_opts)

  RouteTable.new_from(:create_route_table, resp.route_table,
    resp.route_table.route_table_id, :config => config)

end

#main_route_tableRouteTable

Returns the main (default) route table. This route table is automatically assigned to new subnets and can not be deleted.

Returns:

  • (RouteTable)

    Returns the main (default) route table. This route table is automatically assigned to new subnets and can not be deleted.



52
53
54
55
# File 'lib/aws/ec2/route_table_collection.rb', line 52

def main_route_table
  @main = AWS.memoize { self.find {|rt| rt.main? } } if @main.nil?
  @main
end