Class: Awful::RouteTable
- Inherits:
-
Cli
show all
- Defined in:
- lib/awful/route_table.rb
Instance Method Summary
collapse
Methods inherited from Cli
#initialize, #ll, #version
Constructor Details
This class inherits a constructor from Awful::Cli
Instance Method Details
#dump(name) ⇒ Object
22
23
24
25
26
27
28
|
# File 'lib/awful/route_table.rb', line 22
def dump(name)
ec2.describe_route_tables.map(&:route_tables).flatten.find do |route|
route.route_table_id == name or route.tags.any? { |tag| tag.value == name }
end.tap do |route|
puts YAML.dump(stringify_keys(route.to_hash))
end
end
|
#ls(name = nil) ⇒ Object
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/awful/route_table.rb', line 7
def ls(name = nil)
fields = options[:long] ?
->(r) { [ tag_name(r), r.route_table_id, r.vpc_id ] } :
->(r) { [ tag_name(r) || r.route_table_id ] }
ec2.describe_route_tables.map(&:route_tables).flatten.select do |route|
name.nil? or route.tags.any? { |tag| tag.value.match(name) }
end.map do |route|
fields.call(route)
end.tap do |list|
print_table list
end
end
|