class Awful::Acm
Public Instance Methods
acm()
click to toggle source
# File lib/awful/acm.rb, line 12 def acm @_acm ||= Aws::ACM::Client.new end
delete(n)
click to toggle source
# File lib/awful/acm.rb, line 69 def delete(n) acm.delete_certificate(certificate_arn: find_cert(n).certificate_arn) end
dump(n)
click to toggle source
# File lib/awful/acm.rb, line 50 def dump(n) acm.describe_certificate(certificate_arn: find_cert(n).certificate_arn).certificate.output do |cert| puts YAML.dump(stringify_keys(cert.to_hash)) end end
find_cert(n)
click to toggle source
# File lib/awful/acm.rb, line 16 def find_cert(n) paginate(:certificate_summary_list) do |next_token| acm.list_certificates(next_token: next_token) end.find do |cert| (n == cert.domain_name) || (n == cert.certificate_arn) end end
get(n)
click to toggle source
# File lib/awful/acm.rb, line 58 def get(n) acm.get_certificate(certificate_arn: find_cert(n).certificate_arn).output do |cert| if options[:chain] puts cert.certificate_chain else puts cert.certificate end end end
ls()
click to toggle source
# File lib/awful/acm.rb, line 29 def ls paginate(:certificate_summary_list) do |next_token| acm.list_certificates( certificate_statuses: options[:statuses].map(&:upcase), next_token: next_token ) end.output do |certs| if options[:long] print_table certs.map { |cert| c = acm.describe_certificate(certificate_arn: cert.certificate_arn).certificate [c.domain_name, c.subject_alternative_names.join(','), c.status, c.type, (c.in_use_by.empty? ? 'in use' : 'not in use')] } elsif options[:arn] print_table certs.map { |c| [c.domain_name, c.certificate_arn] } else puts certs.map(&:domain_name) end end end