swa 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/swa/cli/kms_command.rb +65 -0
- data/lib/swa/cli/main_command.rb +2 -0
- data/lib/swa/ec2/instance.rb +2 -1
- data/lib/swa/iam/role.rb +1 -1
- data/lib/swa/iam/user.rb +1 -1
- data/lib/swa/kms/alias.rb +26 -0
- data/lib/swa/kms/key.rb +23 -0
- data/lib/swa/record.rb +28 -0
- data/lib/swa/version.rb +1 -1
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b8542e93e6b8679b57d7d15aa193605e3ac4a42
|
4
|
+
data.tar.gz: 999743b0934388671489d25c6c3af62621427a20
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ef747f274c1bfa947d6aa534ef380df524cd860f1dfafe1625c3589b0d0b0d247977945a059dedcd3c2bc07db6de1e1fba88b5886c49d643b7c258b9e5e61f5
|
7
|
+
data.tar.gz: 967358b2a172465734d695a5ffa8d5207980d59385bcf390870caa24641eae7943c212e489c357a10c054e74910e3325e4e88658ba79c28c538f1825edbbedd4
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require "aws-sdk-resources"
|
2
|
+
require "swa/cli/base_command"
|
3
|
+
require "swa/cli/collection_behaviour"
|
4
|
+
require "swa/cli/item_behaviour"
|
5
|
+
require "swa/kms/alias"
|
6
|
+
require "swa/kms/key"
|
7
|
+
|
8
|
+
module Swa
|
9
|
+
module CLI
|
10
|
+
|
11
|
+
class KmsCommand < BaseCommand
|
12
|
+
|
13
|
+
subcommand ["aliases"], "Show aliases" do
|
14
|
+
|
15
|
+
include CollectionBehaviour
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def collection
|
20
|
+
query_for(:list_aliases, :aliases, Swa::KMS::Alias)
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
subcommand ["key"], "Show key" do
|
26
|
+
|
27
|
+
parameter "ID", "key ID"
|
28
|
+
|
29
|
+
include ItemBehaviour
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def item
|
34
|
+
Swa::KMS::Key.new(kms_client.describe_key(:key_id => id).key_metadata)
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
subcommand ["keys"], "Show keys" do
|
40
|
+
|
41
|
+
include CollectionBehaviour
|
42
|
+
|
43
|
+
private
|
44
|
+
|
45
|
+
def collection
|
46
|
+
query_for(:list_keys, :keys, Swa::KMS::Key)
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
protected
|
52
|
+
|
53
|
+
def kms_client
|
54
|
+
::Aws::KMS::Client.new(aws_config)
|
55
|
+
end
|
56
|
+
|
57
|
+
def query_for(query_method, response_key, model)
|
58
|
+
records = kms_client.public_send(query_method).public_send(response_key)
|
59
|
+
model.list(records)
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
end
|
data/lib/swa/cli/main_command.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require "swa/cli/base_command"
|
2
2
|
require "swa/cli/ec2_command"
|
3
3
|
require "swa/cli/iam_command"
|
4
|
+
require "swa/cli/kms_command"
|
4
5
|
|
5
6
|
module Swa
|
6
7
|
module CLI
|
@@ -9,6 +10,7 @@ module Swa
|
|
9
10
|
|
10
11
|
subcommand "ec2", "EC2 stuff", Ec2Command
|
11
12
|
subcommand "iam", "IAM stuff", IamCommand
|
13
|
+
subcommand "kms", "KMS stuff", KmsCommand
|
12
14
|
|
13
15
|
end
|
14
16
|
|
data/lib/swa/ec2/instance.rb
CHANGED
data/lib/swa/iam/role.rb
CHANGED
data/lib/swa/iam/user.rb
CHANGED
@@ -0,0 +1,26 @@
|
|
1
|
+
require "swa/record"
|
2
|
+
|
3
|
+
module Swa
|
4
|
+
module KMS
|
5
|
+
|
6
|
+
class Alias < Record
|
7
|
+
|
8
|
+
def summary
|
9
|
+
[
|
10
|
+
pad(name, 36),
|
11
|
+
key
|
12
|
+
].join(" ")
|
13
|
+
end
|
14
|
+
|
15
|
+
def name
|
16
|
+
aws_record.alias_name
|
17
|
+
end
|
18
|
+
|
19
|
+
def key
|
20
|
+
aws_record.target_key_id
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
data/lib/swa/kms/key.rb
ADDED
data/lib/swa/record.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
require "forwardable"
|
2
|
+
require "swa/data_presentation"
|
3
|
+
|
4
|
+
module Swa
|
5
|
+
|
6
|
+
class Record
|
7
|
+
|
8
|
+
def self.list(records)
|
9
|
+
records.lazy.map(&method(:new))
|
10
|
+
end
|
11
|
+
|
12
|
+
def initialize(aws_record)
|
13
|
+
@aws_record = aws_record
|
14
|
+
end
|
15
|
+
|
16
|
+
include DataPresentation
|
17
|
+
|
18
|
+
def data
|
19
|
+
camelize_keys(aws_record.to_h)
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
attr_reader :aws_record
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
data/lib/swa/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: swa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -148,6 +148,7 @@ files:
|
|
148
148
|
- lib/swa/cli/filter_options.rb
|
149
149
|
- lib/swa/cli/iam_command.rb
|
150
150
|
- lib/swa/cli/item_behaviour.rb
|
151
|
+
- lib/swa/cli/kms_command.rb
|
151
152
|
- lib/swa/cli/main_command.rb
|
152
153
|
- lib/swa/cli/selector.rb
|
153
154
|
- lib/swa/cli/tag_filter_options.rb
|
@@ -165,6 +166,9 @@ files:
|
|
165
166
|
- lib/swa/iam/policy.rb
|
166
167
|
- lib/swa/iam/role.rb
|
167
168
|
- lib/swa/iam/user.rb
|
169
|
+
- lib/swa/kms/alias.rb
|
170
|
+
- lib/swa/kms/key.rb
|
171
|
+
- lib/swa/record.rb
|
168
172
|
- lib/swa/resource.rb
|
169
173
|
- lib/swa/version.rb
|
170
174
|
- swa.gemspec
|
@@ -188,7 +192,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
188
192
|
version: '0'
|
189
193
|
requirements: []
|
190
194
|
rubyforge_project:
|
191
|
-
rubygems_version: 2.
|
195
|
+
rubygems_version: 2.6.6
|
192
196
|
signing_key:
|
193
197
|
specification_version: 4
|
194
198
|
summary: AWS, backwards
|