Sha256: f56dd2ac18eac0e7e9a870cb27cbda8c2e8d714004b1eedde908955faf6625c8

Contents?: true

Size: 1.02 KB

Versions: 3

Compression:

Stored size: 1.02 KB

Contents

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

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

    desc 'list', 'Returns the complete set of metadata associated with this machine.'
    def list
      id = use_machine(options['id'])
      output Smartdc.machine_metadata(id), options.merge(table: :vertical, exclude: %i[
        root_authorized_keys
      ])
    end

    desc 'update [KEY] [VALUE]', 'Allows you to update the metadata for a given machine.'
    def update(key, value)
      id = use_machine(options['id'])
      output Smartdc.update_machine_metadata(id, {key => value}), options.merge(table: :vertical, exclude: %i[
        root_authorized_keys
      ])
    end

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

Version data entries

3 entries across 3 versions & 1 rubygems

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