Class: Awful::Certs
Instance Method Summary
collapse
Methods inherited from Cli
#initialize, #ll, #version
Constructor Details
This class inherits a constructor from Awful::Cli
Instance Method Details
#delete(name) ⇒ Object
99
100
101
102
103
|
# File 'lib/awful/certs.rb', line 99
def delete(name)
if yes? "Really delete server certificate #{name}?", :yellow
iam.delete_server_certificate(server_certificate_name: name)
end
end
|
#dump(name) ⇒ Object
86
87
88
89
90
91
92
93
94
95
96
|
# File 'lib/awful/certs.rb', line 86
def dump(name)
iam.get_server_certificate(server_certificate_name: name).server_certificate.output do |cert|
if options[:body]
puts cert.certificate_body
elsif options[:chain]
puts cert.certificate_chain
else
puts YAML.dump(stringify_keys(cert.server_certificate_metadata.to_h))
end
end
end
|
#ls(path = nil) ⇒ Object
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/awful/certs.rb', line 32
def ls(path = nil)
marker = nil
certs = []
loop do
response = iam.list_server_certificates(path_prefix: path, marker: marker)
certs += response.server_certificate_metadata_list
marker = response.marker
break unless response.is_truncated
end
certs.output do |list|
if options[:long]
print_table list.map { |c|
[
c.server_certificate_name,
c.path,
c.server_certificate_id,
c.upload_date,
color_date(c.expiration),
]
}.sort
elsif options[:arns]
puts certs.map(&:arn)
else
puts certs.map(&:server_certificate_name).sort
end
end
end
|
#upload(name) ⇒ Object
71
72
73
74
75
76
77
78
79
80
81
|
# File 'lib/awful/certs.rb', line 71
def upload(name)
iam.upload_server_certificate(
server_certificate_name: name,
path: options[:path],
certificate_body: read_file(options[:body]),
private_key: read_file(options[:key]),
certificate_chain: read_file(options[:chain]),
).output do |cert|
puts cert.server_certificate_metadata.arn
end
end
|