Class: Smartdc::Cli::Key

Inherits:
Thor
  • Object
show all
Includes:
Smartdc::CliHelper
Defined in:
lib/smartdc/cli/key.rb

Instance Method Summary collapse

Methods included from Smartdc::CliHelper

#describe, #horizontal, #output, #use_machine, #vertical

Instance Method Details

#add(name, file) ⇒ Object



16
17
18
19
# File 'lib/smartdc/cli/key.rb', line 16

def add(name, file)
  body = { name: name, key: File.read(file) }
  output Smartdc.create_key(body), options.merge(table: :vertical, exclude: %i[key])
end

#destroy(name) ⇒ Object



22
23
24
# File 'lib/smartdc/cli/key.rb', line 22

def destroy(name)
  output Smartdc.destroy_key(name), options.merge(message: "Key #{name} destroy.")
end

#listObject



6
7
8
# File 'lib/smartdc/cli/key.rb', line 6

def list
  output Smartdc.keys, options.merge(table: :horizontal, exclude: %i[key])
end

#show(name) ⇒ Object



11
12
13
# File 'lib/smartdc/cli/key.rb', line 11

def show(name)
  output Smartdc.key(name), options.merge(only: :key)
end