Class: Certman::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/certman/cli.rb

Instance Method Summary collapse

Instance Method Details

#delete(domain) ⇒ Object



28
29
30
31
32
# File 'lib/certman/cli.rb', line 28

def delete(domain)
  Certman::Client.new(domain).delete
  puts 'Done.'
  puts ''
end

#request(domain) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/certman/cli.rb', line 5

def request(domain)
  pastel = Pastel.new
  prompt = TTY::Prompt.new
  return unless prompt.yes?(pastel.red("NOTICE! Your selected region is *#{Aws.config[:region]}*. \
Certman create certificate on *#{Aws.config[:region]}*. OK?"))
  unless Certman::Resource::SES::REGIONS.include?(Aws.config[:region])
    return unless prompt.yes?(pastel.red('NOTICE! Certman use *us-east-1* S3/SES. OK?'))
  end
  return unless prompt.yes?(pastel.red('NOTICE! When requesting, Certman replace Active Receipt Rule Set. OK?'))
  client = Certman::Client.new(domain)
  Signal.trap(:INT) do
    puts ''
    puts pastel.red('Rollback start.')
    client.rollback
  end
  cert_arn = client.request(options[:remain_resources])
  puts 'Done.'
  puts ''
  puts "certificate_arn: #{pastel.cyan(cert_arn)}"
  puts ''
end