Class: Fog::Compute::Joyent::Keys

Inherits:
Fog::Collection
  • Object
show all
Defined in:
lib/fog/joyent/models/compute/keys.rb

Instance Method Summary collapse

Instance Method Details

#allObject



9
10
11
12
# File 'lib/fog/joyent/models/compute/keys.rb', line 9

def all
  data = service.list_keys.body
  load(data)
end

#create(params = {}) ⇒ Object

Raises:

  • (ArgumentError)


23
24
25
26
27
28
# File 'lib/fog/joyent/models/compute/keys.rb', line 23

def create(params = {})
  raise ArgumentError, "option [name] required" unless params.key?(:name)
  raise ArgumentError, "option [key] required" unless params.key?(:key)

  service.create_key(params)
end

#get(keyname) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/fog/joyent/models/compute/keys.rb', line 14

def get(keyname)
  data = service.get_key(keyname).body
  if data
    new(data)
  else
    nil
  end
end