Class: Awful::Acm

Inherits:
Cli show all
Defined in:
lib/awful/acm.rb

Instance Method Summary collapse

Methods inherited from Cli

#initialize

Constructor Details

This class inherits a constructor from Awful::Cli

Instance Method Details

#delete(n) ⇒ Object



69
70
71
# File 'lib/awful/acm.rb', line 69

def delete(n)
  acm.delete_certificate(certificate_arn: find_cert(n).certificate_arn)
end

#dump(n) ⇒ Object



50
51
52
53
54
# 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

#get(n) ⇒ Object



58
59
60
61
62
63
64
65
66
# 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

#lsObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# 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