Class: Fog::Compute::IBM::Keys

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

Instance Method Summary collapse

Instance Method Details

#allObject



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

def all
  load(service.list_keys.body['keys'])
end

#defaultObject



22
23
24
# File 'lib/fog/ibm/models/compute/keys.rb', line 22

def default
  find {|key| key.default? }
end

#default=(key_name) ⇒ Object



26
27
28
# File 'lib/fog/ibm/models/compute/keys.rb', line 26

def default=(key_name)
  service.modify_key(key_name, 'default' => true)
end

#get(key_id) ⇒ Object



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

def get(key_id)
  begin
    new(service.get_key(key_id).body)
  rescue Fog::Compute::IBM::NotFound
    nil
  end
end