awful 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f2edeb3d038db1c9063d5808e2475b027a057dce
4
- data.tar.gz: 6d04587e11d128aa9363ef8cf332886a26e80b3e
3
+ metadata.gz: 26f73b86154c9ea1c9f9a1118555121ec2ec4d6e
4
+ data.tar.gz: 129ef7375025775df791dc538a098a419c62c4a2
5
5
  SHA512:
6
- metadata.gz: dc25885681695b9eb9e15a55847ac46e978c7ba91457bc4bce2562b847d736ba9eaa4bf1d58fbc371032c0bea5f971d1c1009f2193c234a5b4f65d97989cef0b
7
- data.tar.gz: af16e76f55bc4895fba349b7c551a1cd35157b1aa5b420087dfbb59734d27544b59c1392c334672aa5289b59f43938b1556c6990dae86a2b7ebd6a575cd95cdf
6
+ metadata.gz: 0e5f284806a404647de961a2fd325edca785c099376f1c56664e31268bfb1516cc6604ac6769631084d3cb9445009f65390e6b14dc4affb8962d115d309ea48f
7
+ data.tar.gz: 06052a701f4a304e7b6438bba4f9eb837fb329e559ff50dd3cc8f61aae7bf6f9c4015f7109ad4454b972e19bf05779e0161a6717b7ab7d8f0b88fcd20e467951
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/ruby
2
+ #-*- mode: ruby; -*-
3
+
4
+ require 'awful'
5
+ require 'awful/route_table'
6
+
7
+ Awful::RouteTable.start(ARGV)
@@ -0,0 +1,33 @@
1
+ module Awful
2
+
3
+ class RouteTable < Thor
4
+ include Awful
5
+
6
+ desc 'ls [PATTERN]', 'list routes'
7
+ method_option :long, aliases: '-l', default: false, desc: 'Long listing'
8
+ def ls(name = nil)
9
+ fields = options[:long] ?
10
+ ->(r) { [ tag_name(r), r.route_table_id, r.vpc_id ] } :
11
+ ->(r) { [ tag_name(r) || r.route_table_id ] }
12
+
13
+ ec2.describe_route_tables.map(&:route_tables).flatten.select do |route|
14
+ name.nil? or route.tags.any? { |tag| tag.value.match(name) }
15
+ end.map do |route|
16
+ fields.call(route)
17
+ end.tap do |list|
18
+ print_table list
19
+ end
20
+ end
21
+
22
+ desc 'dump NAME', 'dump route with id or tag NAME as yaml'
23
+ def dump(name)
24
+ ec2.describe_route_tables.map(&:route_tables).flatten.find do |route|
25
+ route.route_table_id == name or route.tags.any? { |tag| tag.value == name }
26
+ end.tap do |route|
27
+ puts YAML.dump(stringify_keys(route.to_hash))
28
+ end
29
+ end
30
+
31
+ end
32
+
33
+ end
@@ -27,6 +27,26 @@ module Awful
27
27
  end
28
28
  end
29
29
 
30
+ desc 'create NAME', 'create subnet'
31
+ def create(name)
32
+ opt = load_cfg
33
+ whitelist = %i[vpc_id cidr_block availability_zone]
34
+ opt = remove_empty_strings(opt)
35
+ ec2.create_subnet(only_keys_matching(opt, whitelist)).tap do |response|
36
+ id = response.map(&:subnet).map(&:subnet_id)
37
+ ec2.create_tags(resources: Array(id), tags: opt[:tags]) if opt[:tags]
38
+ puts id
39
+ end
40
+ end
41
+
42
+ desc 'delete NAME', 'delete subnet with name or ID'
43
+ def delete(name)
44
+ id = find_subnet(name)
45
+ if id and yes?("really delete subnet #{name} (#{id})?")
46
+ ec2.delete_subnet(subnet_id: id)
47
+ end
48
+ end
49
+
30
50
  end
31
51
 
32
52
  end
@@ -1,3 +1,3 @@
1
1
  module Awful
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awful
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ric Lister
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-13 00:00:00.000000000 Z
11
+ date: 2015-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -75,6 +75,7 @@ executables:
75
75
  - elb
76
76
  - lc
77
77
  - rds
78
+ - route
78
79
  - sg
79
80
  - subnet
80
81
  - vpc
@@ -92,6 +93,7 @@ files:
92
93
  - bin/elb
93
94
  - bin/lc
94
95
  - bin/rds
96
+ - bin/route
95
97
  - bin/sg
96
98
  - bin/subnet
97
99
  - bin/vpc
@@ -101,6 +103,7 @@ files:
101
103
  - lib/awful/elb.rb
102
104
  - lib/awful/launch_config.rb
103
105
  - lib/awful/rds.rb
106
+ - lib/awful/route_table.rb
104
107
  - lib/awful/security_group.rb
105
108
  - lib/awful/subnet.rb
106
109
  - lib/awful/version.rb