Class: Smartdc::Cli::MachineTag

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

Instance Method Summary collapse

Methods included from Smartdc::CliHelper

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

Instance Method Details

#add(key, value) ⇒ Object



22
23
24
25
# File 'lib/smartdc/cli/machine/tag.rb', line 22

def add(key, value)
  id = use_machine(options['id'])
  output Smartdc.create_machine_tag(id, {key => value}), options.merge(table: :vertical)
end

#destroy(key) ⇒ Object



28
29
30
31
# File 'lib/smartdc/cli/machine/tag.rb', line 28

def destroy(key)
  id = use_machine(options['id'])
  output Smartdc.destroy_machine_tag(id, key), options.merge(message: "Destroy [#{key}] of machine tag.")
end

#listObject



9
10
11
12
# File 'lib/smartdc/cli/machine/tag.rb', line 9

def list
  id = use_machine(options['id'])
  output Smartdc.machine_tags(id), options.merge(table: :vertical)
end

#show(key) ⇒ Object



15
16
17
18
19
# File 'lib/smartdc/cli/machine/tag.rb', line 15

def show(key)
  id = use_machine(options['id'])
  response = Smartdc.machine_tag(id, key)
  output response, options.merge(message: response.content)
end