Class: Fog::Compute::HPV2::KeyPairs

Inherits:
Fog::Collection
  • Object
show all
Defined in:
lib/fog/hp/models/compute_v2/key_pairs.rb

Instance Method Summary collapse

Instance Method Details

#allObject



10
11
12
13
14
15
16
# File 'lib/fog/hp/models/compute_v2/key_pairs.rb', line 10

def all
  items = []
  service.list_key_pairs.body['keypairs'].each do |kp|
    items = items + kp.map { |_, value| value }
  end
  load(items)
end

#get(key_pair_name) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/fog/hp/models/compute_v2/key_pairs.rb', line 18

def get(key_pair_name)
  if key_pair_name
    self.all.select {|kp| kp.name == key_pair_name}.first
  end
rescue Fog::Compute::HPV2::NotFound
  nil
end