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 +4 -4
- data/bin/route +7 -0
- data/lib/awful/route_table.rb +33 -0
- data/lib/awful/subnet.rb +20 -0
- data/lib/awful/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26f73b86154c9ea1c9f9a1118555121ec2ec4d6e
|
4
|
+
data.tar.gz: 129ef7375025775df791dc538a098a419c62c4a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e5f284806a404647de961a2fd325edca785c099376f1c56664e31268bfb1516cc6604ac6769631084d3cb9445009f65390e6b14dc4affb8962d115d309ea48f
|
7
|
+
data.tar.gz: 06052a701f4a304e7b6438bba4f9eb837fb329e559ff50dd3cc8f61aae7bf6f9c4015f7109ad4454b972e19bf05779e0161a6717b7ab7d8f0b88fcd20e467951
|
data/bin/route
ADDED
@@ -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
|
data/lib/awful/subnet.rb
CHANGED
@@ -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
|
data/lib/awful/version.rb
CHANGED
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.
|
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-
|
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
|