Method: NexClient::Commands::SslCertificates.destroy

Defined in:
lib/nex_client/commands/ssl_certificates.rb

.destroy(args, opts) ⇒ Object



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/nex_client/commands/ssl_certificates.rb', line 61

def self.destroy(args,opts)
  name = args.first
  e = NexClient::SslCertificate.find(cname: name).first

  # Display error
  unless e
    error("Error! Could not find cert: #{name}")
    return false
  end

  # Ask confirmation
  answer = ask("Enter the name of this cert to confirm: ")
  unless answer == e.cname
    error("Aborting deletion...")
    return false
  end

  e.destroy
  success("Successfully destroyed cert: #{name}")
end