awful 0.0.142 → 0.0.143
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/certs +7 -0
- data/lib/awful/certs.rb +92 -0
- data/lib/awful/iam.rb +0 -22
- 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: 3ba6f0063f4762f6292093fe718b9bef4100bd3a
|
4
|
+
data.tar.gz: 6002d077ed8c6384d3c011e42601978cd8aedf74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1eeb247f0f441de347dd14492ece3ef7aca2b2a17f843011c4162a4a8893da27c9936f8661f373f49cff9abee328f14700b802da6a5b1523ef405988babe2d7c
|
7
|
+
data.tar.gz: 8a598fd6e657197cda38f7cfc86344896699eb7a1aefa7c5544baf10dd4f7420f134f106ca5dd2b9cebbf54305045cbb7a4d0190f2b67f19409422a0c8e725cc
|
data/bin/certs
ADDED
data/lib/awful/certs.rb
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
module Awful
|
2
|
+
module Short
|
3
|
+
def certs(*args)
|
4
|
+
Awful::Certs.new.invoke(*args)
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
class Certs < Cli
|
9
|
+
no_commands do
|
10
|
+
def iam
|
11
|
+
@iam ||= Aws::IAM::Client.new
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
desc 'ls [PATH_PREFIX]', 'list server certificates'
|
16
|
+
method_option :long, aliases: '-l', default: false, desc: 'long listing'
|
17
|
+
method_option :arns, aliases: '-a', default: false, desc: 'list ARNs'
|
18
|
+
def ls(path = nil)
|
19
|
+
marker = nil
|
20
|
+
certs = []
|
21
|
+
loop do
|
22
|
+
response = iam.list_server_certificates(path_prefix: path, marker: marker)
|
23
|
+
certs += response.server_certificate_metadata_list
|
24
|
+
marker = response.marker
|
25
|
+
break unless response.is_truncated
|
26
|
+
end
|
27
|
+
certs.output do |list|
|
28
|
+
if options[:long]
|
29
|
+
print_table list.map { |c|
|
30
|
+
[
|
31
|
+
c.server_certificate_name,
|
32
|
+
c.path,
|
33
|
+
c.server_certificate_id,
|
34
|
+
c.upload_date,
|
35
|
+
c.expiration,
|
36
|
+
]
|
37
|
+
}.sort
|
38
|
+
elsif options[:arns]
|
39
|
+
puts certs.map(&:arn)
|
40
|
+
else
|
41
|
+
puts certs.map(&:server_certificate_name).sort
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
no_commands do
|
47
|
+
def read_file(name)
|
48
|
+
name.nil? ? nil : File.read(name)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
desc 'upload NAME', 'upload server certificate'
|
53
|
+
method_option :path, aliases: '-p', type: :string, default: nil, desc: 'path, e.g. /cloudfront/ for cf certs'
|
54
|
+
method_option :body, aliases: '-b', type: :string, default: nil, desc: 'file containing body of certificate'
|
55
|
+
method_option :key, aliases: '-k', type: :string, default: nil, desc: 'file containing private key'
|
56
|
+
method_option :chain, aliases: '-c', type: :string, default: nil, desc: 'file containing cert chain'
|
57
|
+
def upload(name)
|
58
|
+
iam.upload_server_certificate(
|
59
|
+
server_certificate_name: name,
|
60
|
+
path: options[:path],
|
61
|
+
certificate_body: read_file(options[:body]),
|
62
|
+
private_key: read_file(options[:key]),
|
63
|
+
certificate_chain: read_file(options[:chain]),
|
64
|
+
).output do |cert|
|
65
|
+
puts cert.server_certificate_metadata.arn
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
desc 'dump NAME', 'get details for server certificate'
|
70
|
+
method_option :body, aliases: '-b', type: :string, default: nil, desc: 'output contains cert body'
|
71
|
+
method_option :chain, aliases: '-c', type: :string, default: nil, desc: 'output contains cert chain'
|
72
|
+
def dump(name)
|
73
|
+
iam.get_server_certificate(server_certificate_name: name).server_certificate.output do |cert|
|
74
|
+
if options[:body]
|
75
|
+
puts cert.certificate_body
|
76
|
+
elsif options[:chain]
|
77
|
+
puts cert.certificate_chain
|
78
|
+
else
|
79
|
+
puts YAML.dump(stringify_keys(cert.server_certificate_metadata.to_h))
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
desc 'delete NAME', 'delete server certificate'
|
85
|
+
def delete(name)
|
86
|
+
if yes? "Really delete server certificate #{name}?", :yellow
|
87
|
+
iam.delete_server_certificate(server_certificate_name: name)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
end
|
data/lib/awful/iam.rb
CHANGED
@@ -43,28 +43,6 @@ module Awful
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
-
desc 'certificates [NAME]', 'list server certificates [matching NAME]'
|
47
|
-
method_option :long, aliases: '-l', default: false, desc: 'Long listing'
|
48
|
-
def certificates(name = /./)
|
49
|
-
iam.list_server_certificates.server_certificate_metadata_list.select do |cert|
|
50
|
-
cert.server_certificate_name.match(name)
|
51
|
-
end.output do |certs|
|
52
|
-
if options[:long]
|
53
|
-
print_table certs.map { |c|
|
54
|
-
[
|
55
|
-
c.server_certificate_name,
|
56
|
-
c.server_certificate_id,
|
57
|
-
c.arn,
|
58
|
-
c.upload_date,
|
59
|
-
c.expiration,
|
60
|
-
]
|
61
|
-
}.sort
|
62
|
-
else
|
63
|
-
puts certs.map(&:server_certificate_name).sort
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
46
|
desc 'roles [NAME]', 'list IAM roles [matching NAME]'
|
69
47
|
method_option :long, aliases: '-l', default: false, desc: 'Long listing'
|
70
48
|
method_option :arns, aliases: '-a', default: false, desc: 'Show ARNs instead of names'
|
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.143
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ric Lister
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -89,6 +89,7 @@ executables:
|
|
89
89
|
- apigw
|
90
90
|
- asg
|
91
91
|
- asgn
|
92
|
+
- certs
|
92
93
|
- cf
|
93
94
|
- cloudfront
|
94
95
|
- cwevents
|
@@ -128,6 +129,7 @@ files:
|
|
128
129
|
- bin/apigw
|
129
130
|
- bin/asg
|
130
131
|
- bin/asgn
|
132
|
+
- bin/certs
|
131
133
|
- bin/cf
|
132
134
|
- bin/cloudfront
|
133
135
|
- bin/cwevents
|
@@ -163,6 +165,7 @@ files:
|
|
163
165
|
- lib/awful/api_gateway_stages.rb
|
164
166
|
- lib/awful/auto_scaling.rb
|
165
167
|
- lib/awful/auto_scaling_notifications.rb
|
168
|
+
- lib/awful/certs.rb
|
166
169
|
- lib/awful/changesets.rb
|
167
170
|
- lib/awful/cloudformation.rb
|
168
171
|
- lib/awful/cloudfront.rb
|