awful 0.0.165 → 0.0.166

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/awful/kms.rb +20 -15
  3. data/lib/awful/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 56f13a4c518bf160a83d110f3cacdd7bbee62bbb
4
- data.tar.gz: 0612b58b2f7e8f9e9ffc93f65a4a3b147ede0040
3
+ metadata.gz: e5763dd9368f72a01140a54165474bf1c5a6e66c
4
+ data.tar.gz: daf29fb335285d6b67f53a6f25c23e9913f845b5
5
5
  SHA512:
6
- metadata.gz: 49d0de933e8d42b4b57e913e8c01a85030e4556d18b5d4e7af876db398da2f0d8170323545fab8d8ec690cbc52a64bbc313093689f6f684392a48bfb8d23c673
7
- data.tar.gz: 656f232bd3c93fad345ee5c1ccf79a14df01a367d404352e3ef29b70f226ef12d245e037c04a089c8b85d5d4409b21e0aefaf2fd535768dd97c44c400f6aa32d
6
+ metadata.gz: f08e8c54685dab14bd355174996c9a7a40189f4dfa58315ff1180e2f80fc114584d10171e328e480e086e8ce4fc9d41b18e5dd1fae0d7059d853b96cfd9c57e5
7
+ data.tar.gz: b09457b0392f90092adaf06486e131987bfaf128a7e00fb052a32bf2c2e44f1b78b9d359af9b5f7c51cd1c18a198b181b201af1634aa2fce7262299a8e6e91e9
data/lib/awful/kms.rb CHANGED
@@ -22,33 +22,21 @@ module Awful
22
22
  set_color(string, COLORS.fetch(string.to_sym, :yellow))
23
23
  end
24
24
 
25
- # def paginate(thing)
26
- # next_marker = nil
27
- # things = []
28
- # loop do
29
- # response = yield(next_marker)
30
- # things += response.send(thing)
31
- # next_marker = response.next_marker
32
- # break unless next_marker
33
- # end
34
- # things
35
- # end
36
-
37
- def aliases
25
+ def list_aliases
38
26
  paginate(:aliases) do |marker|
39
27
  kms.list_aliases(marker: marker)
40
28
  end
41
29
  end
42
30
 
43
31
  def aliases_hash
44
- @_aliases_hash ||= aliases.each_with_object({}) do |a, h|
32
+ @_aliases_hash ||= list_aliases.each_with_object({}) do |a, h|
45
33
  h[a.target_key_id] = a.alias_name.gsub(/^alias\//, '')
46
34
  end
47
35
  end
48
36
 
49
37
  ## return target id for alias
50
38
  def alias_by_name(name)
51
- aliases.find do |a|
39
+ list_aliases.find do |a|
52
40
  a.alias_name == "alias/#{name}"
53
41
  end.target_key_id
54
42
  end
@@ -129,5 +117,22 @@ module Awful
129
117
  end
130
118
  end
131
119
 
120
+ desc 'aliases', 'list aliases for account'
121
+ method_option :long, aliases: '-l', type: :boolean, default: false, desc: 'long listing'
122
+ def aliases
123
+ list_aliases.output do |list|
124
+ if options[:long]
125
+ print_table list.map { |a| [a.alias_name, a.target_key_id, a.alias_arn] }
126
+ else
127
+ puts list.map(&:alias_name)
128
+ end
129
+ end
130
+ end
131
+
132
+ desc 'id ALIAS', 'get key ID for given alias'
133
+ def id(name)
134
+ alias_by_name(name).output(&method(:puts))
135
+ end
136
+
132
137
  end
133
138
  end
data/lib/awful/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Awful
2
- VERSION = '0.0.165'
2
+ VERSION = '0.0.166'
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.165
4
+ version: 0.0.166
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ric Lister
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-16 00:00:00.000000000 Z
11
+ date: 2017-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler