Sha256: 562db84495e8c07c2d55daab75c6a1b18f49d734eb51745014dae6d8d862a800

Contents?: true

Size: 753 Bytes

Versions: 19

Compression:

Stored size: 753 Bytes

Contents

#
# Author:: Matt Eldridge (<matt.eldridge@us.ibm.com>)
# © Copyright IBM Corporation 2014.
#
# LICENSE: MIT (http://opensource.org/licenses/MIT)
#

require 'fog/softlayer/models/compute/key_pair'

module Fog
  module Compute
    class Softlayer
      class KeyPairs < Fog::Collection
        model Fog::Compute::Softlayer::KeyPair

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

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

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

      end
    end
  end
end

Version data entries

19 entries across 17 versions & 3 rubygems

Version Path
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-softlayer-1.1.4/lib/fog/softlayer/models/compute/key_pairs.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-softlayer-1.1.4/lib/fog/softlayer/models/compute/key_pairs.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-softlayer-1.1.4/lib/fog/softlayer/models/compute/key_pairs.rb
fog-softlayer-1.1.4 lib/fog/softlayer/models/compute/key_pairs.rb
fog-softlayer-1.1.3 lib/fog/softlayer/models/compute/key_pairs.rb
fog-softlayer-1.1.2 lib/fog/softlayer/models/compute/key_pairs.rb
fog-softlayer-1.1.1 lib/fog/softlayer/models/compute/key_pairs.rb
fog-softlayer-1.1.0 lib/fog/softlayer/models/compute/key_pairs.rb
fog-softlayer-1.0.3 lib/fog/softlayer/models/compute/key_pairs.rb
fog-softlayer-1.0.2 lib/fog/softlayer/models/compute/key_pairs.rb
fog-softlayer-1.0.1 lib/fog/softlayer/models/compute/key_pairs.rb
fog-softlayer-1.0.0 lib/fog/softlayer/models/compute/key_pairs.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-softlayer-0.4.7/lib/fog/softlayer/models/compute/key_pairs.rb
fog-softlayer-0.4.7 lib/fog/softlayer/models/compute/key_pairs.rb
fog-softlayer-0.4.6 lib/fog/softlayer/models/compute/key_pairs.rb
fog-softlayer-0.4.5 lib/fog/softlayer/models/compute/key_pairs.rb
fog-softlayer-0.4.4 lib/fog/softlayer/models/compute/key_pairs.rb
fog-softlayer-0.4.3 lib/fog/softlayer/models/compute/key_pairs.rb
fog-softlayer-0.4.2 lib/fog/softlayer/models/compute/key_pairs.rb