miam 0.2.0.beta2 → 0.2.0.beta3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/bin/miam +1 -0
- data/lib/miam.rb +1 -0
- data/lib/miam/exporter.rb +32 -0
- data/lib/miam/ext/aws_ext.rb +1 -1
- data/lib/miam/version.rb +1 -1
- data/miam.gemspec +1 -0
- data/spec/spec_helper.rb +2 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 02ea3a9eccf5a34002ed0775537a780f4084bdb4
|
4
|
+
data.tar.gz: 12e7a9bb92969303b5655486a404d74247bfda51
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ba2d9553831f37ebb328b76cddfab99ba150772bfddb9ac3f52922ab448a5be4cd2b7e97b123d1aa83013319746f8855793c222802d387d75a5f7e31f5db9415
|
7
|
+
data.tar.gz: fc93bbd87a16930836fa06d94c0b04157325e6fa0da3a7a083d9efd75f356b11c89ede4dff1512585f6f2ee095fc7fe733d61b026f186155c94ae957f88d5f02
|
data/README.md
CHANGED
@@ -12,7 +12,6 @@ It defines the state of IAM using DSL, and updates IAM according to DSL.
|
|
12
12
|
|
13
13
|
* `>= 0.2.0`
|
14
14
|
* Use [get_account_authorization_details](http://docs.aws.amazon.com/sdkforruby/api/Aws/IAM/Client.html#get_account_authorization_details-instance_method).
|
15
|
-
* Remove progress bar.
|
16
15
|
|
17
16
|
## Installation
|
18
17
|
|
@@ -62,6 +61,7 @@ Usage: miam [options]
|
|
62
61
|
--export-concurrency N
|
63
62
|
--target REGEXP
|
64
63
|
--no-color
|
64
|
+
--no-progress
|
65
65
|
--debug
|
66
66
|
```
|
67
67
|
|
data/bin/miam
CHANGED
@@ -46,6 +46,7 @@ ARGV.options do |opt|
|
|
46
46
|
opt.on('' , '--export-concurrency N', Integer) {|v| options[:export_concurrency] = v }
|
47
47
|
opt.on('' , '--target REGEXP') {|v| options[:target] = Regexp.new(v) }
|
48
48
|
opt.on('' , '--no-color') { options[:color] = false }
|
49
|
+
opt.on('' , '--no-progress') { options[:no_progress] = true }
|
49
50
|
opt.on('' , '--debug') { options[:debug] = true }
|
50
51
|
opt.parse!
|
51
52
|
|
data/lib/miam.rb
CHANGED
data/lib/miam/exporter.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# coding: utf-8
|
1
2
|
class Miam::Exporter
|
2
3
|
def self.export(iam, options = {})
|
3
4
|
self.new(iam, options).export
|
@@ -20,6 +21,17 @@ class Miam::Exporter
|
|
20
21
|
group_users = {}
|
21
22
|
instance_profile_roles = {}
|
22
23
|
|
24
|
+
unless @options[:no_progress]
|
25
|
+
progress_total = users.length + groups.length + roles.length + instance_profiles.length
|
26
|
+
|
27
|
+
@progressbar = ProgressBar.create(
|
28
|
+
:format => ' %bᗧ%i %p%%',
|
29
|
+
:progress_mark => ' ',
|
30
|
+
:remainder_mark => '・',
|
31
|
+
:total => progress_total,
|
32
|
+
:output => $stderr)
|
33
|
+
end
|
34
|
+
|
23
35
|
expected = {
|
24
36
|
:users => export_users(users, group_users),
|
25
37
|
:groups => export_groups(groups),
|
@@ -56,6 +68,8 @@ class Miam::Exporter
|
|
56
68
|
if login_profile
|
57
69
|
result[user_name][:login_profile] = login_profile
|
58
70
|
end
|
71
|
+
|
72
|
+
progress
|
59
73
|
end
|
60
74
|
end
|
61
75
|
|
@@ -94,6 +108,8 @@ class Miam::Exporter
|
|
94
108
|
:path => group.path,
|
95
109
|
:policies => policies,
|
96
110
|
}
|
111
|
+
|
112
|
+
progress
|
97
113
|
end
|
98
114
|
end
|
99
115
|
|
@@ -133,6 +149,8 @@ class Miam::Exporter
|
|
133
149
|
:instance_profiles => instance_profiles,
|
134
150
|
:policies => policies,
|
135
151
|
}
|
152
|
+
|
153
|
+
progress
|
136
154
|
end
|
137
155
|
end
|
138
156
|
|
@@ -160,6 +178,8 @@ class Miam::Exporter
|
|
160
178
|
result[instance_profile_name] = {
|
161
179
|
:path => instance_profile.path,
|
162
180
|
}
|
181
|
+
|
182
|
+
progress
|
163
183
|
end
|
164
184
|
end
|
165
185
|
|
@@ -175,6 +195,10 @@ class Miam::Exporter
|
|
175
195
|
def get_account_authorization_details
|
176
196
|
account_authorization_details = {}
|
177
197
|
|
198
|
+
unless @options[:no_progress]
|
199
|
+
progressbar = ProgressBar.create(:title => 'Loading', :total => nil, :output => $stderr)
|
200
|
+
end
|
201
|
+
|
178
202
|
keys = [
|
179
203
|
:user_detail_list,
|
180
204
|
:group_detail_list,
|
@@ -188,9 +212,17 @@ class Miam::Exporter
|
|
188
212
|
@iam.get_account_authorization_details.each do |resp|
|
189
213
|
keys.each do |key|
|
190
214
|
account_authorization_details[key].concat(resp[key])
|
215
|
+
|
216
|
+
unless @options[:no_progress]
|
217
|
+
progressbar.increment
|
218
|
+
end
|
191
219
|
end
|
192
220
|
end
|
193
221
|
|
194
222
|
account_authorization_details
|
195
223
|
end
|
224
|
+
|
225
|
+
def progress
|
226
|
+
@progressbar.increment if @progressbar
|
227
|
+
end
|
196
228
|
end
|
data/lib/miam/ext/aws_ext.rb
CHANGED
@@ -19,7 +19,7 @@ module Seahorse
|
|
19
19
|
private
|
20
20
|
|
21
21
|
def add_GetAccountAuthorizationDetails_paginator(json)
|
22
|
-
json["GetAccountAuthorizationDetails"] = {
|
22
|
+
json["pagination"]["GetAccountAuthorizationDetails"] = {
|
23
23
|
"input_token" => "Marker",
|
24
24
|
"output_token" => "Marker",
|
25
25
|
"more_results" => "IsTruncated",
|
data/lib/miam/version.rb
CHANGED
data/miam.gemspec
CHANGED
@@ -21,6 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.require_paths = ['lib']
|
22
22
|
|
23
23
|
spec.add_dependency 'aws-sdk-core', '~> 2.0.3'
|
24
|
+
spec.add_dependency 'ruby-progressbar'
|
24
25
|
spec.add_dependency 'parallel'
|
25
26
|
spec.add_dependency 'term-ansicolor'
|
26
27
|
spec.add_development_dependency 'bundler', '~> 1.7'
|
data/spec/spec_helper.rb
CHANGED
@@ -29,6 +29,7 @@ end
|
|
29
29
|
def client(user_options = {})
|
30
30
|
options = {
|
31
31
|
logger: Logger.new('/dev/null'),
|
32
|
+
no_progress: true
|
32
33
|
}
|
33
34
|
|
34
35
|
options[:password_manager] = Miam::PasswordManager.new('/dev/null', options)
|
@@ -75,7 +76,7 @@ def apply(cli = client)
|
|
75
76
|
end
|
76
77
|
|
77
78
|
def export(options = {})
|
78
|
-
options = {}.merge(options)
|
79
|
+
options = {no_progress: true}.merge(options)
|
79
80
|
cli = options.delete(:client) || Aws::IAM::Client.new
|
80
81
|
Miam::Exporter.export(cli, options)[0]
|
81
82
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: miam
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.0.
|
4
|
+
version: 0.2.0.beta3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Genki Sugawara
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-core
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 2.0.3
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: ruby-progressbar
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: parallel
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|