module Dawn::CLI::Key

Public Class Methods

add() click to toggle source

“Adds this machine’s sshkey to Dawn”

# File lib/dawn/cli/commands/key.rb, line 18
def self.add
  filename = File.join(Dir.home, ".ssh/id_rsa.pub")
  pubkey = File.read filename
  key    = Dawn::Key.create(key: pubkey)
rescue Excon::Errors::UnprocessableEntity => ex
  handle_abort_exception("dawn key add", ex)
end
delete(id) click to toggle source

“Delete a Key by ID” @param [String] id

# File lib/dawn/cli/commands/key.rb, line 40
def self.delete(id)
  Dawn::Key.destroy(id: id)
rescue Excon::Errors::NotFound => ex
  handle_abort_exception("dawn key delete", ex)
end
get(id) click to toggle source

“Retrieve a Key by ID” @param [String] id

# File lib/dawn/cli/commands/key.rb, line 30
def self.get(id)
  say Dawn::Key.find(id: id).key
rescue Excon::Errors::NotFound => ex
  handle_abort_exception("dawn key get", ex)
end
list() click to toggle source

“Lists all your Keys currently on dawn”

# File lib/dawn/cli/commands/key.rb, line 11
def self.list
  say format_keys(Dawn::Key.all)
end