Class: RightScaleCLI::SSHKeys

Inherits:
Thor
  • Object
show all
Defined in:
lib/rightscale_cli/ssh_keys.rb

Overview

interface /api/clouds/ssh_keys

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ SSHKeys

Returns a new instance of SSHKeys.



26
27
28
29
30
# File 'lib/rightscale_cli/ssh_keys.rb', line 26

def initialize(*args)
  super
  @client = RightScaleCLI::Client.new(options)
  @logger = RightScaleCLI::Logger.new
end

Class Method Details



83
84
85
# File 'lib/rightscale_cli/ssh_keys.rb', line 83

def self.banner(task, namespace = true, subcommand = false)
  "#{basename} #{task.formatted_usage(self, true, subcommand)}"
end

Instance Method Details

#create(name) ⇒ Object



74
75
76
# File 'lib/rightscale_cli/ssh_keys.rb', line 74

def create(name)
  # todo
end

#destroy(server) ⇒ Object



79
80
81
# File 'lib/rightscale_cli/ssh_keys.rb', line 79

def destroy(server)
  # todo
end

#listObject



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/rightscale_cli/ssh_keys.rb', line 47

def list
  filter = [].push("resource_uid==#{options[:uid]}") if options[:uid]

  results = @client.client.clouds(
    id: options[:cloud]
  ).show.ssh_keys(filter: filter).index

  ssh_keys = []
  results.each do |result|
    ssh_key = result.raw
    ssh_key['href'] = result.href
    ssh_keys.push(ssh_key)
  end

  @client.render(ssh_keys, 'ssh_keys')
end

#show(ssh_key_id) ⇒ Object



69
70
71
# File 'lib/rightscale_cli/ssh_keys.rb', line 69

def show(ssh_key_id)
  @client.render(@client.client.clouds(id: options[:cloud]).show.ssh_keys(id: ssh_key_id).show.raw, 'ssh_key')
end