Class: Acmaker::Driver

Inherits:
Object
  • Object
show all
Includes:
Logger::Helper, Utils::Helper
Defined in:
lib/acmaker/driver.rb

Instance Method Summary collapse

Methods included from Utils::Helper

#diff, #matched?

Methods included from Logger::Helper

#log

Constructor Details

#initialize(client, options = {}) ⇒ Driver

Returns a new instance of Driver.



6
7
8
9
# File 'lib/acmaker/driver.rb', line 6

def initialize(client, options = {})
  @client = client
  @options = options
end

Instance Method Details

#create_certificate(domain_name, expected_certificate) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/acmaker/driver.rb', line 11

def create_certificate(domain_name, expected_certificate)
  log(:info, "Create Domain `#{domain_name}` Certificate", color: :cyan)

  unless @options[:dry_run]
    resp = @client.request_certificate(expected_certificate)
    log(:info, "Certificate arn `#{resp.certificate_arn}` has been created", color: :cyan)
  end
end

#delete_certificate(domain_name, certificate_arn) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/acmaker/driver.rb', line 20

def delete_certificate(domain_name, certificate_arn)
  log(:info, "Delete Domain `#{domain_name}` Certificate", color: :red)

  unless @options[:dry_run]
    @client.delete_certificate(certificate_arn: certificate_arn)
  end
end