Sha256: e27150258dd8601133551b61566621db1f2fc522021f7f74c83020a67e16bc21

Contents?: true

Size: 655 Bytes

Versions: 13

Compression:

Stored size: 655 Bytes

Contents

require 'fog/core/collection'
require 'fog/openstack/models/compute/key_pair'

module Fog
  module Compute
    class OpenStack

      class KeyPairs < Fog::Collection

        model Fog::Compute::OpenStack::KeyPair

        def all
          items = Array.new
          connection.list_key_pairs.body['keypairs'].each do |kp|
            items = items + kp.values
          end
          load(items)
        end

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

      end
    end
  end
end

Version data entries

13 entries across 13 versions & 7 rubygems

Version Path
fog-nirvanix-1.8.2 lib/fog/openstack/models/compute/key_pairs.rb
fog-nirvanix-1.8.1 lib/fog/openstack/models/compute/key_pairs.rb
fog-parser-fix-1.6.1 lib/fog/openstack/models/compute/key_pairs.rb
fog-test-again-1.6.0 lib/fog/openstack/models/compute/key_pairs.rb
fog-parser-fix-1.6.0 lib/fog/openstack/models/compute/key_pairs.rb
ey-vendored-backup-3.0.27 vendor/gems/fog/lib/fog/openstack/models/compute/key_pairs.rb
fog-sgonyea-1.8.1 lib/fog/openstack/models/compute/key_pairs.rb
fog-1.8.0 lib/fog/openstack/models/compute/key_pairs.rb
fog-maestrodev-1.7.0.20121114190951 lib/fog/openstack/models/compute/key_pairs.rb
fog-1.7.0 lib/fog/openstack/models/compute/key_pairs.rb
fog-1.6.0 lib/fog/openstack/models/compute/key_pairs.rb
fog-1.5.0 lib/fog/openstack/models/compute/key_pairs.rb
fog-1.4.0 lib/fog/openstack/models/compute/key_pairs.rb