Sha256: c9602f7956be44d283727e2dac57209686840aaefb5f62948ebb3ac4b8393fda

Contents?: true

Size: 851 Bytes

Versions: 3

Compression:

Stored size: 851 Bytes

Contents

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

    desc 'list', 'Lists all public keys we have on record for the specified account.'
    def list
      output Smartdc.keys, options.merge(table: :horizontal, exclude: %i[key])
    end

    desc 'show [NAME]', 'Retrieves the record for an individual key.'
    def show(name)
      output Smartdc.key(name), options.merge(only: :key)
    end

    desc 'add [NAME] [FILE]', 'Uploads a new OpenSSH key.'
    def add(name, file)
      body = { name: name, key: File.read(file) }
      output Smartdc.create_key(body), options.merge(table: :vertical, exclude: %i[key])
    end

    desc 'destroy [NAME]', 'Deletes a single SSH key, by name or fingerprint.'
    def destroy(name)
      output Smartdc.destroy_key(name), options.merge(message: "Key #{name} destroy.")
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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