lucid-cumulus 0.11.2 → 0.11.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/Gemfile +1 -0
- data/Gemfile.lock +19 -4
- data/README.md +2 -0
- data/bin/cumulus +22 -546
- data/lib/autoscaling/Commands.rb +20 -0
- data/lib/aws_extensions/s3/BucketPolicy.rb +22 -4
- data/lib/cloudfront/Commands.rb +51 -0
- data/lib/common/BaseLoader.rb +6 -4
- data/lib/common/Commands.rb +131 -0
- data/lib/conf/Configuration.rb +23 -6
- data/lib/ec2/Commands.rb +51 -0
- data/lib/ec2/models/InstanceConfig.rb +1 -1
- data/lib/elb/Commands.rb +40 -0
- data/lib/iam/Commands.rb +49 -0
- data/lib/iam/models/ResourceWithPolicy.rb +10 -3
- data/lib/iam/models/StatementConfig.rb +2 -2
- data/lib/kinesis/Commands.rb +20 -0
- data/lib/route53/Commands.rb +20 -0
- data/lib/s3/Commands.rb +20 -0
- data/lib/s3/loader/Loader.rb +2 -1
- data/lib/security/Commands.rb +24 -0
- data/lib/sqs/Commands.rb +34 -0
- data/lib/sqs/SQS.rb +6 -0
- data/lib/sqs/loader/Loader.rb +9 -4
- data/lib/sqs/manager/Manager.rb +6 -7
- data/lib/vpc/Commands.rb +43 -0
- data/lucid-cumulus.gemspec +2 -1
- data/rakefile.rb +7 -2
- data/spec/mocks/ClientSpy.rb +43 -0
- data/spec/mocks/MockedConfiguration.rb +61 -0
- data/spec/mocks/MockedLoader.rb +37 -0
- data/spec/mocks/MockedStatusCodes.rb +17 -0
- data/spec/rspec_config.rb +5 -0
- data/spec/sqs/SQSUtil.rb +231 -0
- data/spec/sqs/SingleChangeTest.rb +101 -0
- data/spec/sqs/diff_spec.rb +152 -0
- data/spec/sqs/sync_spec.rb +137 -0
- data/spec/util/DeepMerge.rb +25 -0
- data/spec/util/ManagerUtil.rb +12 -0
- metadata +39 -3
- data/cumulus +0 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YjEyYTM3MTYyNGM3MGJmN2I4MGVmNTJlYjYwYmQwOTlhMjYwMTUxYw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OTA3NWQ3N2NhYmUyZDBjNzk2MTRjYzcxMTEzNzA5ZGE1YTNlODQ5Mw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZTE1ZmViZDAyMzUxNWJkNmMxODljNzJmZWI0YWU2NGFkOWQzMmE3YzQ3ZWRi
|
10
|
+
ZjlhZWQ5ZTc1NTk3MTI3NTRmNjE3MGY3NzIxZDgyYjA2OTI3NDgxZDFiZmIz
|
11
|
+
YTRmMzcwY2FlNTAxMTA3NjhjNWQ4OTU3N2U5NWQ0NDYxOGIyOWI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZTBlMjNkYTllZmI5NTI1NDljZWEyNmIwYWUyNGJiYjgyZjE4YjVmOTFkN2U4
|
14
|
+
YTlhN2ExMGU2Yjc0Yjk2YTI5MDA5OGYzZDkxOTIwYmQ0NDA2N2M1NjYzYjhl
|
15
|
+
ZjQ4ZTQxNzU4YWYzMWI3ZmU1ODAxMGU4ODc1Yzg0ZDJkODBmOTk=
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
lucid-cumulus (0.11.
|
4
|
+
lucid-cumulus (0.11.3)
|
5
5
|
aws-sdk (= 2.2.30)
|
6
|
+
deepsort (~> 0.1)
|
6
7
|
parse-cron (~> 0.1.4)
|
7
8
|
|
8
9
|
GEM
|
@@ -14,11 +15,24 @@ GEM
|
|
14
15
|
jmespath (~> 1.0)
|
15
16
|
aws-sdk-resources (2.2.30)
|
16
17
|
aws-sdk-core (= 2.2.30)
|
17
|
-
|
18
|
-
|
19
|
-
|
18
|
+
deepsort (0.2.1)
|
19
|
+
diff-lcs (1.2.5)
|
20
|
+
jmespath (1.3.1)
|
20
21
|
parse-cron (0.1.4)
|
21
22
|
rake (11.2.2)
|
23
|
+
rspec (3.4.0)
|
24
|
+
rspec-core (~> 3.4.0)
|
25
|
+
rspec-expectations (~> 3.4.0)
|
26
|
+
rspec-mocks (~> 3.4.0)
|
27
|
+
rspec-core (3.4.4)
|
28
|
+
rspec-support (~> 3.4.0)
|
29
|
+
rspec-expectations (3.4.0)
|
30
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
31
|
+
rspec-support (~> 3.4.0)
|
32
|
+
rspec-mocks (3.4.1)
|
33
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
34
|
+
rspec-support (~> 3.4.0)
|
35
|
+
rspec-support (3.4.1)
|
22
36
|
|
23
37
|
PLATFORMS
|
24
38
|
ruby
|
@@ -26,6 +40,7 @@ PLATFORMS
|
|
26
40
|
DEPENDENCIES
|
27
41
|
lucid-cumulus!
|
28
42
|
rake
|
43
|
+
rspec
|
29
44
|
|
30
45
|
BUNDLED WITH
|
31
46
|
1.12.5
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# cumulus
|
2
2
|
|
3
|
+
[![Build Status](https://travis-ci.org/lucidsoftware/cumulus.svg?branch=master)](https://travis-ci.org/lucidsoftware/cumulus)
|
4
|
+
|
3
5
|
[![Join the chat at https://gitter.im/lucidsoftware/cumulus](https://badges.gitter.im/lucidsoftware/cumulus.svg)](https://gitter.im/lucidsoftware/cumulus?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
4
6
|
|
5
7
|
[![Stories in Ready](https://badge.waffle.io/lucidsoftware/cumulus.png?label=ready&title=Ready)](https://waffle.io/lucidsoftware/cumulus)
|
data/bin/cumulus
CHANGED
@@ -2,541 +2,6 @@
|
|
2
2
|
|
3
3
|
require "optparse"
|
4
4
|
|
5
|
-
module Modules
|
6
|
-
# Public: Run the IAM module
|
7
|
-
def self.iam
|
8
|
-
if ARGV.size < 2 or
|
9
|
-
(ARGV.size == 2 and ARGV[1] != "help") or
|
10
|
-
(ARGV.size >= 3 and ((ARGV[1] != "groups" and ARGV[1] != "roles" and ARGV[1] != "users") or (ARGV[2] != "diff" and ARGV[2] != "list" and ARGV[2] != "migrate" and ARGV[2] != "sync")))
|
11
|
-
puts "Usage: cumulus iam [help|groups|roles|users] [diff|list|migrate|sync] <asset>"
|
12
|
-
exit
|
13
|
-
end
|
14
|
-
|
15
|
-
if ARGV[1] == "help"
|
16
|
-
puts "iam: Manage IAMs."
|
17
|
-
puts "\tCompiles IAM assets and policies that are defined with configuration files and syncs the resulting IAM assets with AWS."
|
18
|
-
puts
|
19
|
-
puts "Usage: cumulus iam [groups|help|roles|users] [diff|list|migrate|sync] <asset>"
|
20
|
-
puts
|
21
|
-
puts "Commands"
|
22
|
-
puts "\tgroups - Manage IAM groups and users associated with those groups"
|
23
|
-
puts "\t\tdiff\t- get a list of groups that have different definitions locally than in AWS (supplying the name of the group will diff only that group)"
|
24
|
-
puts "\t\tlist\t- list the groups defined in configuration"
|
25
|
-
puts "\t\tmigrate\t- create group configuration files that match the definitions in AWS"
|
26
|
-
puts "\t\tsync\t- sync the local group definition with AWS (supplying the name of the group will sync only that group). Also adds and removes users from groups"
|
27
|
-
puts "\troles - Manage IAM roles"
|
28
|
-
puts "\t\tdiff\t- get a list of roles that have different definitions locally than in AWS (supplying the name of the role will diff only that role)"
|
29
|
-
puts "\t\tlist\t- list the roles defined in configuration"
|
30
|
-
puts "\t\tmigrate\t - create role configuration files that match the definitions in AWS"
|
31
|
-
puts "\t\tsync\t- sync the local role definition with AWS (supplying the name of the role will sync only that role)"
|
32
|
-
puts "\tusers - Manager IAM users"
|
33
|
-
puts "\t\tdiff\t- get a list of users that have different definitions locally than in AWS (supplying the name of the user will diff only that user)"
|
34
|
-
puts "\t\tlist\t- list the users defined in configuration"
|
35
|
-
puts "\t\tmigrate\t - create user configuration files that match the definitions in AWS"
|
36
|
-
puts "\t\tsync\t- sync the local user definition with AWS (supplying the name of the user will sync only that user)"
|
37
|
-
exit
|
38
|
-
end
|
39
|
-
|
40
|
-
# run the application with the desired command
|
41
|
-
require "iam/manager/Manager"
|
42
|
-
iam = Cumulus::IAM::Manager.new
|
43
|
-
resource = nil
|
44
|
-
if ARGV[1] == "roles"
|
45
|
-
resource = iam.roles
|
46
|
-
elsif ARGV[1] == "users"
|
47
|
-
resource = iam.users
|
48
|
-
elsif ARGV[1] == "groups"
|
49
|
-
resource = iam.groups
|
50
|
-
end
|
51
|
-
if ARGV[2] == "diff"
|
52
|
-
if ARGV.size < 4
|
53
|
-
resource.diff
|
54
|
-
else
|
55
|
-
resource.diff_one(ARGV[3])
|
56
|
-
end
|
57
|
-
elsif ARGV[2] == "list"
|
58
|
-
resource.list
|
59
|
-
elsif ARGV[2] == "migrate"
|
60
|
-
resource.migrate
|
61
|
-
elsif ARGV[2] == "sync"
|
62
|
-
if ARGV.size < 4
|
63
|
-
resource.sync
|
64
|
-
else
|
65
|
-
resource.sync_one(ARGV[3])
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
# Public: Run the AutoScaling Group module
|
71
|
-
def self.autoscaling
|
72
|
-
if ARGV.size < 2 or
|
73
|
-
(ARGV.size >= 2 and ARGV[1] != "help" and ARGV[1] != "diff" and ARGV[1] != "list" and ARGV[1] != "migrate" and ARGV[1] != "sync")
|
74
|
-
puts "Usage: cumulus autoscaling [diff|help|list|migrate|sync] <asset>"
|
75
|
-
exit
|
76
|
-
end
|
77
|
-
|
78
|
-
if ARGV[1] == "help"
|
79
|
-
puts "autoscaling: Manage AutoScaling groups."
|
80
|
-
puts "\tCompiles AutoScaling groups, scaling policies, and alarms that are defined in configuration files and syncs the resulting AutoScaling groups with AWS."
|
81
|
-
puts
|
82
|
-
puts "Usage: cumulus autoscaling [diff|help|list|migrate|sync] <asset>"
|
83
|
-
puts
|
84
|
-
puts "Commands"
|
85
|
-
puts "\tdiff\t- print out differences between local configuration and AWS (supplying the name of an AutoScaling group will diff only that group)"
|
86
|
-
puts "\tlist\t- list the AutoScaling groups defined locally"
|
87
|
-
puts "\tmigrate\t- produce Cumulus configuration from current configuration in AWS"
|
88
|
-
puts "\tsync\t- sync local AutoScaling definitions with AWS (supplying the name of an AutoScaling group will sync only that group)"
|
89
|
-
end
|
90
|
-
|
91
|
-
require "autoscaling/manager/Manager"
|
92
|
-
autoscaling = Cumulus::AutoScaling::Manager.new
|
93
|
-
if ARGV[1] == "diff"
|
94
|
-
if ARGV.size == 2
|
95
|
-
autoscaling.diff
|
96
|
-
else
|
97
|
-
autoscaling.diff_one(ARGV[2])
|
98
|
-
end
|
99
|
-
elsif ARGV[1] == "list"
|
100
|
-
autoscaling.list
|
101
|
-
elsif ARGV[1] == "migrate"
|
102
|
-
autoscaling.migrate
|
103
|
-
elsif ARGV[1] == "sync"
|
104
|
-
if ARGV.size == 2
|
105
|
-
autoscaling.sync
|
106
|
-
else
|
107
|
-
autoscaling.sync_one(ARGV[2])
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
# Public: Run the route53 module
|
113
|
-
def self.route53
|
114
|
-
if ARGV.size < 2 or (ARGV[1] != "help" and ARGV[1] != "diff" and ARGV[1] != "list" and ARGV[1] != "migrate" and ARGV[1] != "sync")
|
115
|
-
puts "Usage: cumulus route53 [diff|help|list|migrate|sync] <asset>"
|
116
|
-
exit
|
117
|
-
end
|
118
|
-
|
119
|
-
if ARGV[1] == "help"
|
120
|
-
puts "route53: Manage Route53"
|
121
|
-
puts "\tDiff and sync Route53 configuration with AWS."
|
122
|
-
puts
|
123
|
-
puts "Usage: cumulus route53 [diff|help|list|migrate|sync] <asset>"
|
124
|
-
puts "Commands"
|
125
|
-
puts "\tdiff\t- print out differences between local configuration and AWS (supplying the name of the zone will diff only that zone)"
|
126
|
-
puts "\tlist\t- list the locally defined zones"
|
127
|
-
puts "\tmigrate\t- produce Cumulus zone configuration from current AWS configuration"
|
128
|
-
puts "\tsync\t- sync local zone definitions with AWS (supplying the name of the zone will sync only that zone)"
|
129
|
-
exit
|
130
|
-
end
|
131
|
-
|
132
|
-
require "route53/manager/Manager"
|
133
|
-
route53 = Cumulus::Route53::Manager.new
|
134
|
-
if ARGV[1] == "diff"
|
135
|
-
if ARGV.size == 2
|
136
|
-
route53.diff
|
137
|
-
else
|
138
|
-
route53.diff_one(ARGV[2])
|
139
|
-
end
|
140
|
-
elsif ARGV[1] == "list"
|
141
|
-
route53.list
|
142
|
-
elsif ARGV[1] == "migrate"
|
143
|
-
route53.migrate
|
144
|
-
elsif ARGV[1] == "sync"
|
145
|
-
if ARGV.size == 2
|
146
|
-
route53.sync
|
147
|
-
else
|
148
|
-
route53.sync_one(ARGV[2])
|
149
|
-
end
|
150
|
-
end
|
151
|
-
end
|
152
|
-
|
153
|
-
# Public: Run the Security Group module
|
154
|
-
def self.security
|
155
|
-
if ARGV.size < 2 or (ARGV[1] != "help" and ARGV[1] != "diff" and ARGV[1] != "list" and ARGV[1] != "migrate" and ARGV[1] != "sync")
|
156
|
-
puts "Usage: cumulus security-groups [diff|help|list|migrate|sync] <asset>"
|
157
|
-
exit
|
158
|
-
end
|
159
|
-
|
160
|
-
if ARGV[1] == "help"
|
161
|
-
puts "security-groups: Manage EC2 Security Groups"
|
162
|
-
puts "\tDiff and sync EC2 security group configuration with AWS."
|
163
|
-
puts
|
164
|
-
puts "Usage: cumulus security-groups [diff|help|list|migrate|sync] <asset>"
|
165
|
-
puts
|
166
|
-
puts "Commands"
|
167
|
-
puts "\tdiff\t- print out differences between local configuration and AWS (supplying the name of the security group will diff only that security group)"
|
168
|
-
puts "\tlist\t- list the locally defined security groups"
|
169
|
-
puts "\tmigrate\t- produce Cumulus security group configuration from current AWS configuration"
|
170
|
-
puts "\tsync\t- sync local security group definitions with AWS (supplying the name of the security group will sync only that security group)"
|
171
|
-
exit
|
172
|
-
end
|
173
|
-
|
174
|
-
require "security/manager/Manager"
|
175
|
-
security = Cumulus::SecurityGroups::Manager.new
|
176
|
-
if ARGV[1] == "diff"
|
177
|
-
if ARGV.size == 2
|
178
|
-
security.diff
|
179
|
-
else
|
180
|
-
security.diff_one(ARGV[2])
|
181
|
-
end
|
182
|
-
elsif ARGV[1] == "list"
|
183
|
-
security.list
|
184
|
-
elsif ARGV[1] == "migrate"
|
185
|
-
security.migrate
|
186
|
-
elsif ARGV[1] == "sync"
|
187
|
-
if ARGV.size == 2
|
188
|
-
security.sync
|
189
|
-
else
|
190
|
-
security.sync_one(ARGV[2])
|
191
|
-
end
|
192
|
-
end
|
193
|
-
|
194
|
-
end
|
195
|
-
|
196
|
-
# Public: Run the Cloudfront module
|
197
|
-
def self.cloudfront
|
198
|
-
if ARGV.size < 2 or (ARGV[1] != "help" and ARGV[1] != "diff" and ARGV[1] != "list" and ARGV[1] != "sync" and ARGV[1] != "invalidate" and ARGV[1] != "migrate")
|
199
|
-
puts "Usage: cumulus cloudfront [diff|help|invalidate|list|migrate|sync] <asset>"
|
200
|
-
exit
|
201
|
-
end
|
202
|
-
|
203
|
-
if ARGV[1] == "help"
|
204
|
-
puts "cloudfront: Manage CloudFront"
|
205
|
-
puts "\tDiff and sync CloudFront configuration with AWS."
|
206
|
-
puts
|
207
|
-
puts "Usage: cumulus cloudfront [diff|help|invalidate|list] <asset>"
|
208
|
-
puts "Commands"
|
209
|
-
puts "\tdiff\t\t- print out differences between local configuration and AWS (supplying the id of the distribution will diff only that distribution)"
|
210
|
-
puts "\tinvalidate\t- create an invalidation. Must supply the name of the invalidation to run. Specifying 'list' as an argument lists the local invalidation configurations"
|
211
|
-
puts "\tlist\t\t- list the locally defined distributions"
|
212
|
-
puts "\tmigrate\t\t- produce Cumulus CloudFront distribution configuration from current AWS configuration"
|
213
|
-
puts "\tsync\t\t- sync local cloudfront distribution configuration with AWS (supplying the id of the distribution will sync only that distribution)"
|
214
|
-
exit
|
215
|
-
end
|
216
|
-
|
217
|
-
require "cloudfront/manager/Manager"
|
218
|
-
|
219
|
-
cloudfront = Cumulus::CloudFront::Manager.new
|
220
|
-
|
221
|
-
if ARGV[1] == "list"
|
222
|
-
cloudfront.list
|
223
|
-
elsif ARGV[1] == "diff"
|
224
|
-
if ARGV.size == 2
|
225
|
-
cloudfront.diff
|
226
|
-
else
|
227
|
-
cloudfront.diff_one(ARGV[2])
|
228
|
-
end
|
229
|
-
elsif ARGV[1] == "sync"
|
230
|
-
if ARGV.size == 2
|
231
|
-
cloudfront.sync
|
232
|
-
else
|
233
|
-
cloudfront.sync_one(ARGV[2])
|
234
|
-
end
|
235
|
-
elsif ARGV[1] == "invalidate"
|
236
|
-
if ARGV.size != 3
|
237
|
-
puts "Specify one invalidation to run"
|
238
|
-
exit
|
239
|
-
else
|
240
|
-
if ARGV[2] == "list"
|
241
|
-
cloudfront.list_invalidations
|
242
|
-
else
|
243
|
-
cloudfront.invalidate(ARGV[2])
|
244
|
-
end
|
245
|
-
end
|
246
|
-
elsif ARGV[1] == "migrate"
|
247
|
-
cloudfront.migrate
|
248
|
-
end
|
249
|
-
|
250
|
-
end
|
251
|
-
|
252
|
-
# Public: Run the S3 module
|
253
|
-
def self.s3
|
254
|
-
if ARGV.size < 2 or (ARGV[1] != "help" and ARGV[1] != "diff" and ARGV[1] != "list" and ARGV[1] != "migrate" and ARGV[1] != "sync")
|
255
|
-
puts "Usage: cumulus s3 [diff|help|list|migrate|sync] <asset>"
|
256
|
-
exit
|
257
|
-
end
|
258
|
-
|
259
|
-
if ARGV[1] == "help"
|
260
|
-
puts "s3: Manage S3 Buckets"
|
261
|
-
puts "\tDiff and sync S3 bucket configuration with AWS."
|
262
|
-
puts
|
263
|
-
puts "Usage: cumulus s3 [diff|help|list|migrate|sync] <asset>"
|
264
|
-
puts
|
265
|
-
puts "Commands"
|
266
|
-
puts "\tdiff\t- print out differences between local configuration and AWS (supplying the name of the bucket will diff only that bucket)"
|
267
|
-
puts "\tlist\t- list the locally defined S3 buckets"
|
268
|
-
puts "\tmigrate\t- produce Cumulus S3 configuration from current AWS configuration"
|
269
|
-
puts "\tsync\t- sync local bucket definitions with AWS (supplying the name of the bucket will sync only that bucket)"
|
270
|
-
exit
|
271
|
-
end
|
272
|
-
|
273
|
-
require "s3/manager/Manager"
|
274
|
-
s3 = Cumulus::S3::Manager.new
|
275
|
-
if ARGV[1] == "diff"
|
276
|
-
if ARGV.size == 2
|
277
|
-
s3.diff
|
278
|
-
else
|
279
|
-
s3.diff_one(ARGV[2])
|
280
|
-
end
|
281
|
-
elsif ARGV[1] == "list"
|
282
|
-
s3.list
|
283
|
-
elsif ARGV[1] == "migrate"
|
284
|
-
s3.migrate
|
285
|
-
elsif ARGV[1] == "sync"
|
286
|
-
if ARGV.size == 2
|
287
|
-
s3.sync
|
288
|
-
else
|
289
|
-
s3.sync_one(ARGV[2])
|
290
|
-
end
|
291
|
-
end
|
292
|
-
end
|
293
|
-
|
294
|
-
# Public: Run the elb module
|
295
|
-
def self.elb
|
296
|
-
if ARGV.size < 2 or (ARGV[1] != "help" and ARGV[1] != "diff" and ARGV[1] != "list" and ARGV[1] != "sync" and ARGV[1] != "migrate")
|
297
|
-
puts "Usage: cumulus elb [diff|help|list|migrate|sync] <asset>"
|
298
|
-
exit
|
299
|
-
end
|
300
|
-
|
301
|
-
if ARGV[1] == "help"
|
302
|
-
puts "elb: Manage Elastic Load Balancers"
|
303
|
-
puts "\tDiff and sync ELB configuration with AWS."
|
304
|
-
puts
|
305
|
-
puts "Usage: cumulus elb [diff|help|list|migrate|sync] <asset>"
|
306
|
-
puts
|
307
|
-
puts "Commands"
|
308
|
-
puts "\tdiff\t- print out differences between local configuration and AWS (supplying the name of the elb will diff only that elb)"
|
309
|
-
puts "\tlist\t- list the locally defined ELBs"
|
310
|
-
puts "\tsync\t- sync local ELB definitions with AWS (supplying the name of the elb will sync only that elb)"
|
311
|
-
puts "\tmigrate\t- migrate AWS configuration to Cumulus"
|
312
|
-
puts "\t\tdefault-policies- migrate default ELB policies from AWS to Cumulus"
|
313
|
-
puts "\t\telbs\t\t- migrate the current ELB configuration from AWS to Cumulus"
|
314
|
-
exit
|
315
|
-
end
|
316
|
-
|
317
|
-
require "elb/manager/Manager"
|
318
|
-
elb = Cumulus::ELB::Manager.new
|
319
|
-
if ARGV[1] == "diff"
|
320
|
-
if ARGV.size == 2
|
321
|
-
elb.diff
|
322
|
-
else
|
323
|
-
elb.diff_one(ARGV[2])
|
324
|
-
end
|
325
|
-
elsif ARGV[1] == "list"
|
326
|
-
elb.list
|
327
|
-
elsif ARGV[1] == "sync"
|
328
|
-
if ARGV.size == 2
|
329
|
-
elb.sync
|
330
|
-
else
|
331
|
-
elb.sync_one(ARGV[2])
|
332
|
-
end
|
333
|
-
elsif ARGV[1] == "migrate"
|
334
|
-
if ARGV[2] == "default-policies"
|
335
|
-
elb.migrate_default_policies
|
336
|
-
elsif ARGV[2] == "elbs"
|
337
|
-
elb.migrate_elbs
|
338
|
-
else
|
339
|
-
puts "Usage: cumulus elb migrate [default-policies|elbs]"
|
340
|
-
end
|
341
|
-
end
|
342
|
-
end
|
343
|
-
|
344
|
-
# Public: Run the vpc module
|
345
|
-
def self.vpc
|
346
|
-
if ARGV.size < 2 or (ARGV[1] != "help" and ARGV[1] != "diff" and ARGV[1] != "list" and ARGV[1] != "sync" and ARGV[1] != "migrate" and ARGV[1] != "rename")
|
347
|
-
puts "Usage: cumulus vpc [diff|help|list|migrate|sync|rename] <asset>"
|
348
|
-
exit
|
349
|
-
end
|
350
|
-
|
351
|
-
if ARGV[1] == "help"
|
352
|
-
puts "vpc: Manage Virtual Private Cloud"
|
353
|
-
puts "\tDiff and sync VPC configuration with AWS."
|
354
|
-
puts
|
355
|
-
puts "Usage: cumulus vpc [diff|help|list|migrate|sync|rename] <asset>"
|
356
|
-
puts
|
357
|
-
puts "Commands"
|
358
|
-
puts "\tdiff\t- print out differences between local configuration and AWS (supplying the name of the VPC will diff only that VPC)"
|
359
|
-
puts "\tlist\t- list the locally defined VPCs"
|
360
|
-
puts "\tsync\t- sync local VPC definitions with AWS (supplying the name of the VPC will sync only that VPC)"
|
361
|
-
puts "\tmigrate\t- migrate AWS configuration to Cumulus"
|
362
|
-
puts "\trename\t- renames a cumulus asset and all references to it"
|
363
|
-
exit
|
364
|
-
end
|
365
|
-
|
366
|
-
require "vpc/manager/Manager"
|
367
|
-
vpc = Cumulus::VPC::Manager.new
|
368
|
-
if ARGV[1] == "diff"
|
369
|
-
if ARGV.size == 2
|
370
|
-
vpc.diff
|
371
|
-
else
|
372
|
-
vpc.diff_one(ARGV[2])
|
373
|
-
end
|
374
|
-
elsif ARGV[1] == "sync"
|
375
|
-
if ARGV.size == 2
|
376
|
-
vpc.sync
|
377
|
-
else
|
378
|
-
vpc.sync_one(ARGV[2])
|
379
|
-
end
|
380
|
-
elsif ARGV[1] == "list"
|
381
|
-
vpc.list
|
382
|
-
elsif ARGV[1] == "migrate"
|
383
|
-
vpc.migrate
|
384
|
-
elsif ARGV[1] == "rename"
|
385
|
-
if ARGV.size == 5
|
386
|
-
vpc.rename(ARGV[2], ARGV[3], ARGV[4])
|
387
|
-
else
|
388
|
-
puts "Usage: cumulus vpc rename [network-acl|policy|route-table|subnet|vpc] <old-asset-name> <new-asset-name>"
|
389
|
-
end
|
390
|
-
end
|
391
|
-
end
|
392
|
-
|
393
|
-
# Public: Run the kinesis module
|
394
|
-
def self.kinesis
|
395
|
-
if ARGV.size < 2 or (ARGV[1] != "help" and ARGV[1] != "diff" and ARGV[1] != "list" and ARGV[1] != "sync" and ARGV[1] != "migrate")
|
396
|
-
puts "Usage: cumulus kinesis [diff|help|list|migrate|sync] <asset>"
|
397
|
-
exit
|
398
|
-
end
|
399
|
-
|
400
|
-
if ARGV[1] == "help"
|
401
|
-
puts "kinesis: Manage Kinesis Streams"
|
402
|
-
puts "\tDiff and sync Kinesis configuration with AWS."
|
403
|
-
puts
|
404
|
-
puts "Usage: cumulus kinesis [diff|help|list|migrate|sync] <asset>"
|
405
|
-
puts
|
406
|
-
puts "Commands"
|
407
|
-
puts "\tdiff\t- print out differences between local configuration and AWS (supplying the name of the stream will diff only that stream)"
|
408
|
-
puts "\tlist\t- list the locally defined VPCs"
|
409
|
-
puts "\tsync\t- sync local stream definitions with AWS (supplying the name of the stream will sync only that stream)"
|
410
|
-
puts "\tmigrate\t- migrate AWS configuration to Cumulus"
|
411
|
-
exit
|
412
|
-
end
|
413
|
-
|
414
|
-
require "kinesis/manager/Manager"
|
415
|
-
kinesis = Cumulus::Kinesis::Manager.new
|
416
|
-
if ARGV[1] == "diff"
|
417
|
-
if ARGV.size == 2
|
418
|
-
kinesis.diff
|
419
|
-
else
|
420
|
-
kinesis.diff_one(ARGV[2])
|
421
|
-
end
|
422
|
-
elsif ARGV[1] == "sync"
|
423
|
-
if ARGV.size == 2
|
424
|
-
kinesis.sync
|
425
|
-
else
|
426
|
-
kinesis.sync_one(ARGV[2])
|
427
|
-
end
|
428
|
-
elsif ARGV[1] == "list"
|
429
|
-
kinesis.list
|
430
|
-
elsif ARGV[1] == "migrate"
|
431
|
-
kinesis.migrate
|
432
|
-
end
|
433
|
-
end
|
434
|
-
|
435
|
-
# Public: Run the SQS module
|
436
|
-
def self.sqs
|
437
|
-
if ARGV.size < 2 or (ARGV[1] != "help" and ARGV[1] != "diff" and ARGV[1] != "list" and ARGV[1] != "urls" and ARGV[1] != "sync" and ARGV[1] != "migrate")
|
438
|
-
puts "Usage: cumulus sqs [diff|help|list|migrate|sync|urls] <asset>"
|
439
|
-
end
|
440
|
-
|
441
|
-
if ARGV[1] == "help"
|
442
|
-
puts "SQS: Manage SQS"
|
443
|
-
puts "\tDiff and sync SQS configuration with AWS."
|
444
|
-
puts
|
445
|
-
puts "Usage: cumulus sqs [diff|help|list|migrate|sync|urls] <asset>"
|
446
|
-
puts
|
447
|
-
puts "Commands"
|
448
|
-
puts "\tdiff\t- print out differences between local configuration and AWS (supplying the name of the queue will diff only that queue)"
|
449
|
-
puts "\tlist\t- list the locally defined queues"
|
450
|
-
puts "\turls\t- list the url for each locally defined queue"
|
451
|
-
puts "\tsync\t- sync local queue definitions with AWS (supplying the name of the queue will sync only that queue)"
|
452
|
-
puts "\tmigrate\t- migrate AWS configuration to Cumulus"
|
453
|
-
exit
|
454
|
-
end
|
455
|
-
|
456
|
-
require "sqs/manager/Manager"
|
457
|
-
sqs = Cumulus::SQS::Manager.new
|
458
|
-
if ARGV[1] == "diff"
|
459
|
-
if ARGV.size == 2
|
460
|
-
sqs.diff
|
461
|
-
else
|
462
|
-
sqs.diff_one(ARGV[2])
|
463
|
-
end
|
464
|
-
elsif ARGV[1] == "sync"
|
465
|
-
if ARGV.size == 2
|
466
|
-
sqs.sync
|
467
|
-
else
|
468
|
-
sqs.sync_one(ARGV[2])
|
469
|
-
end
|
470
|
-
elsif ARGV[1] == "list"
|
471
|
-
sqs.list
|
472
|
-
elsif ARGV[1] == "urls"
|
473
|
-
sqs.urls
|
474
|
-
elsif ARGV[1] == "migrate"
|
475
|
-
sqs.migrate
|
476
|
-
end
|
477
|
-
end
|
478
|
-
|
479
|
-
# Public: Run the EC2 module
|
480
|
-
def self.ec2
|
481
|
-
if ARGV.size < 2 or
|
482
|
-
(ARGV.size == 2 and ARGV[1] != "help") or
|
483
|
-
(ARGV.size >= 3 and ((ARGV[1] != "ebs" and ARGV[1] != "instances") or (ARGV[2] != "diff" and ARGV[2] != "list" and ARGV[2] != "migrate" and ARGV[2] != "sync")))
|
484
|
-
puts "Usage: cumulus ec2 [help|ebs|instances] [diff|list|migrate|sync] <asset>"
|
485
|
-
exit
|
486
|
-
end
|
487
|
-
|
488
|
-
if ARGV[1] == "help"
|
489
|
-
puts "ec2: Manage EC2 instances and related configuration."
|
490
|
-
puts
|
491
|
-
puts "Usage: cumulus ec2 [help|ebs|instances] [diff|list|migrate|sync] <asset>"
|
492
|
-
puts
|
493
|
-
puts "Commands"
|
494
|
-
puts "\tebs - Manage EBS volumes in groups"
|
495
|
-
puts "\t\tdiff\t- get a list of groups that have different definitions locally than in AWS (supplying the name of the group will diff only that group)"
|
496
|
-
puts "\t\tlist\t- list the groups defined in configuration"
|
497
|
-
puts "\t\tmigrate\t- create group configuration files that match the definitions in AWS"
|
498
|
-
puts "\t\tsync\t- sync the local group definition with AWS (supplying the name of the group will sync only that group). Also creates volumes in a group"
|
499
|
-
puts "\tinstances - Manage EC2 instances"
|
500
|
-
puts "\t\tdiff\t- get a list of instances that have different definitions locally than in AWS (supplying the name of the instance will diff only that instance)"
|
501
|
-
puts "\t\tlist\t- list the instances defined in configuration"
|
502
|
-
puts "\t\tmigrate\t - create instances configuration files that match the definitions in AWS"
|
503
|
-
puts "\t\tsync\t- sync the local instance definition with AWS (supplying the name of the instance will sync only that instance)"
|
504
|
-
exit
|
505
|
-
end
|
506
|
-
|
507
|
-
require "ec2/managers/EbsManager"
|
508
|
-
require "ec2/managers/InstanceManager"
|
509
|
-
|
510
|
-
# Get the manager depending on which submodule is ran
|
511
|
-
manager = nil
|
512
|
-
if ARGV[1] == "ebs"
|
513
|
-
manager = Cumulus::EC2::EbsManager.new
|
514
|
-
elsif ARGV[1] == "instances"
|
515
|
-
manager = Cumulus::EC2::InstanceManager.new
|
516
|
-
end
|
517
|
-
|
518
|
-
# Run actions on the manager
|
519
|
-
if ARGV[2] == "diff"
|
520
|
-
if ARGV.size < 4
|
521
|
-
manager.diff
|
522
|
-
else
|
523
|
-
manager.diff_one(ARGV[3])
|
524
|
-
end
|
525
|
-
elsif ARGV[2] == "list"
|
526
|
-
manager.list
|
527
|
-
elsif ARGV[2] == "migrate"
|
528
|
-
manager.migrate
|
529
|
-
elsif ARGV[2] == "sync"
|
530
|
-
if ARGV.size < 4
|
531
|
-
manager.sync
|
532
|
-
else
|
533
|
-
manager.sync_one(ARGV[3])
|
534
|
-
end
|
535
|
-
end
|
536
|
-
end
|
537
|
-
|
538
|
-
end
|
539
|
-
|
540
5
|
def usage_message
|
541
6
|
"Usage: cumulus [autoscaling|cloudfront|ec2|elb|help|iam|kinesis|route53|s3|security-groups|sqs|vpc]"
|
542
7
|
end
|
@@ -634,25 +99,36 @@ puts "Using assume role '#{options[:assume_role]}'" if options[:verbose]
|
|
634
99
|
|
635
100
|
|
636
101
|
if ARGV[0] == "iam"
|
637
|
-
|
102
|
+
require "iam/Commands"
|
103
|
+
Cumulus::IAM::Commands.parse(ARGV[1..-1])
|
638
104
|
elsif ARGV[0] == "autoscaling"
|
639
|
-
|
105
|
+
require "autoscaling/Commands"
|
106
|
+
Cumulus::AutoScaling::Commands.parse(ARGV[1..-1])
|
640
107
|
elsif ARGV[0] == "cloudfront"
|
641
|
-
|
108
|
+
require "cloudfront/Commands"
|
109
|
+
Cumulus::CloudFront::Commands.parse(ARGV[1..-1])
|
642
110
|
elsif ARGV[0] == "ec2"
|
643
|
-
|
111
|
+
require "ec2/Commands"
|
112
|
+
Cumulus::EC2::Commands.parse(ARGV[1..-1])
|
644
113
|
elsif ARGV[0] == "elb"
|
645
|
-
|
114
|
+
require "elb/Commands"
|
115
|
+
Cumulus::ELB::Commands.parse(ARGV[1..-1])
|
646
116
|
elsif ARGV[0] == "kinesis"
|
647
|
-
|
117
|
+
require "kinesis/Commands"
|
118
|
+
Cumulus::Kinesis::Commands.parse(ARGV[1..-1])
|
648
119
|
elsif ARGV[0] == "route53"
|
649
|
-
|
120
|
+
require "route53/Commands"
|
121
|
+
Cumulus::Route53::Commands.parse(ARGV[1..-1])
|
650
122
|
elsif ARGV[0] == "security-groups"
|
651
|
-
|
123
|
+
require "security/Commands"
|
124
|
+
Cumulus::SecurityGroups::Commands.parse(ARGV[1..-1])
|
652
125
|
elsif ARGV[0] == "s3"
|
653
|
-
|
126
|
+
require "s3/Commands"
|
127
|
+
Cumulus::S3::Commands.parse(ARGV[1..-1])
|
654
128
|
elsif ARGV[0] == "sqs"
|
655
|
-
|
129
|
+
require "sqs/Commands"
|
130
|
+
Cumulus::SQS::Commands.parse(ARGV[1..-1])
|
656
131
|
elsif ARGV[0] == "vpc"
|
657
|
-
|
132
|
+
require "vpc/Commands"
|
133
|
+
Cumulus::VPC::Commands.parse(ARGV[1..-1])
|
658
134
|
end
|