class Awscli::EC2::RouteTable

Public Class Methods

new(connection) click to toggle source
# File lib/awscli/ec2.rb, line 788
def initialize(connection)
  @conn = connection
end

Public Instance Methods

associate_route_table(options) click to toggle source
# File lib/awscli/ec2.rb, line 826
def associate_route_table(options)
  @conn.associate_route_table(options[:route_table_id], options[:subnet_id])
  puts "Associated route table: #{options[:route_table_id]} with subnet: #{options[:subnet_id]}"
end
create(options) click to toggle source
# File lib/awscli/ec2.rb, line 801
def create(options)
  @conn.create_route_table(options[:vpc_id])
  puts "Created route table"
end
create_route(options) click to toggle source
# File lib/awscli/ec2.rb, line 806
def create_route(options)
  @conn.create_route(
    options[:route_table_id], 
    options[:dest_cidr],
    options[:gateway_id] || nil, 
    options[:instance_id] || nil, 
    options[:net_interface_id] || nil)
  puts "Created specified route"
end
delete(options) click to toggle source
# File lib/awscli/ec2.rb, line 816
def delete(options)
  @conn.delete_route_table(options[:route_table_id])
  puts "Deleted route table with id #{options[:route_table_id]}"
end
delete_route(options) click to toggle source
# File lib/awscli/ec2.rb, line 821
def delete_route(options)
  @conn.delete_route(options[:route_table_id], options[:dest_cidr])
  puts "Deleted route from routetable: #{options[:route_table_id]} with destination cidr: #{options[:dest_cidr]}"
end
disassociate_route_table(options) click to toggle source
# File lib/awscli/ec2.rb, line 831
def disassociate_route_table(options)
  @conn.disassociate_route_table(options[:association_id])
  puts "Disassociated route talbe with association_id: #{options[:association_id]}"
end
list(options) click to toggle source
# File lib/awscli/ec2.rb, line 792
def list(options)
  if options[:route_table_id]
    puts @conn.describe_route_tables('route-table-id' => options[:route_table_id].split(',')).body['routeTableSet'].to_yaml
  else
    Formatador.display_line("[green]#{@conn.describe_route_tables.body['routeTableSet'].map {|k| k['associationSet'].first}.map{|k| k['routeTableId']}}[/]")
    puts "For more info on a specific route table pass route-table-id to '--route-table-id' or '-r' of `list` subcommand"
  end
end