Class: Fog::Compute::Ecloud::SshKeys

Inherits:
Ecloud::Collection show all
Defined in:
lib/fog/compute/ecloud/models/ssh_keys.rb

Instance Method Summary collapse

Methods inherited from Ecloud::Collection

#check_href!, #load

Instance Method Details

#allObject



11
12
13
14
# File 'lib/fog/compute/ecloud/models/ssh_keys.rb', line 11

def all
  data = service.get_ssh_keys(href).body[:SshKey]
  load(data)
end

#create(options = {}) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/fog/compute/ecloud/models/ssh_keys.rb', line 24

def create(options = {})
  # Make sure we only pass what we should
  new_options           = {}
  new_options[:Name]    = options[:Name] unless options[:Name].nil?
  new_options[:Default] = options[:Default] || false
  new_options[:uri]     = href + "/action/createSshKey"

  data = service.ssh_key_create(new_options)
  object = service.ssh_keys.new(data)
  object
end

#environment_idObject



36
37
38
# File 'lib/fog/compute/ecloud/models/ssh_keys.rb', line 36

def environment_id
  href.scan(/\d+/)[0]
end

#get(uri) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/fog/compute/ecloud/models/ssh_keys.rb', line 16

def get(uri)
  if data = service.get_ssh_key(uri).body
    new(data)
  end
rescue Excon::Errors::NotFound
  nil
end