Sha256: a29e4fddc148947f5e9eb229fb103a157e41596302b75fc5fc134de0159b27b5

Contents?: true

Size: 1.87 KB

Versions: 9

Compression:

Stored size: 1.87 KB

Contents

# This file is part of the OpenStack-ActiveResource
#
# Copyright (C) 2012 Unidata S.p.A. (Davide Guerri - d.guerri@unidata.it)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

module OpenStack
  module Nova
    module Compute

      # An OpenStack KeyPair
      #
      # ==== Attributes
      # * +name+ - Bridge name for this network
      # * +public_key+ - Public key
      # * +private_key+ - Private key (write only)
      # * +fingerprint+ - The fingerprint for this keypair
      class KeyPair < Base
        self.collection_name = "os-keypairs"
        self.element_name = "keypair"

        schema do
          attribute :name, :string
          attribute :public_key, :string
          attribute :private_key, :string
          attribute :fingerprint, :string
        end

        def id # :nodoc:
          name
        end

        # The list of keypair with a given name
        #
        # ==== Attributes
        # * +name+ - A keypairs name
        def self.find_all_by_name(name)
          all.reject! { |key_pair| key_pair.name != name }
        end

        # The first keypair with a given name
        #
        # ==== Attributes
        # * +name+ - A keypair name
        def self.find_by_name(name)
          all.detect { |key_pair| key_pair.name == name }
        end

      end

    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
openstack_activeresource-0.7.1 lib/open_stack/nova/compute/key_pair.rb
openstack_activeresource-0.7.0 lib/open_stack/nova/compute/key_pair.rb
openstack_activeresource-0.6.3 lib/open_stack/nova/compute/key_pair.rb
openstack_activeresource-0.6.2 lib/open_stack/nova/compute/key_pair.rb
openstack_activeresource-0.6.1 lib/open_stack/nova/compute/key_pair.rb
openstack_activeresource-0.6.0 lib/open_stack/nova/compute/key_pair.rb
openstack_activeresource-0.5.2 lib/open_stack/nova/compute/key_pair.rb
openstack_activeresource-0.5.1 lib/open_stack/nova/compute/key_pair.rb
openstack_activeresource-0.5.0 lib/open_stack/nova/compute/key_pair.rb