Class: Fog::Compute::Softlayer::KeyPairs

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

Instance Method Summary collapse

Instance Method Details

#allObject



16
17
18
19
# File 'lib/fog/softlayer/models/compute/key_pairs.rb', line 16

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

#by_label(label) ⇒ Object



29
30
31
# File 'lib/fog/softlayer/models/compute/key_pairs.rb', line 29

def by_label(label)
  all.select { |key_pair| key_pair.label == label }.first
end

#get(id) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/fog/softlayer/models/compute/key_pairs.rb', line 21

def get(id)
  if key_pair = service.get_key_pair(id).body
    new(key_pair)
  end
rescue Fog::Network::Softlayer::NotFound
  nil
end