Sha256: b3a52e1a650082848b569dd473712f492a21a61567429ed6595ffdf7b71d4c81

Contents?: true

Size: 1.14 KB

Versions: 3

Compression:

Stored size: 1.14 KB

Contents

module Smartdc::Cli
  class MachineTag < Thor
    include Smartdc::CliHelper

    namespace 'machine tag'
    class_option :id, type: :string, aliases: '-m', desc: 'Machine id'

    desc 'list', 'Returns the complete set of tags associated with this machine.'
    def list
      id = use_machine(options['id'])
      output Smartdc.machine_tags(id), options.merge(table: :vertical)
    end

    desc 'show [KEY]', 'Returns the value for a single tag on this machine.'
    def show(key)
      id = use_machine(options['id'])
      response = Smartdc.machine_tag(id, key)
      output response, options.merge(message: response.content)
    end

    desc 'add [KEY] [VALUE]', 'Allows you to add additional tags, other than those set at provisioning time.'
    def add(key, value)
      id = use_machine(options['id'])
      output Smartdc.create_machine_tag(id, {key => value}), options.merge(table: :vertical)
    end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
smartdc-2.0.2 lib/smartdc/cli/machine/tag.rb
smartdc-2.0.1 lib/smartdc/cli/machine/tag.rb
smartdc-2.0.0 lib/smartdc/cli/machine/tag.rb