Module: HPKeyPairs

Defined in:
lib/process/cloud/providers/hpcloud/security_groups.rb

Overview

HPCloud keypairs

Class Method Summary collapse

Class Method Details

.create_keypair(oComputeConnect, name, pubkey) ⇒ Object



65
66
67
# File 'lib/process/cloud/providers/hpcloud/security_groups.rb', line 65

def self.create_keypair(oComputeConnect, name, pubkey)
  oComputeConnect.key_pairs.create(:name => name, :public_key => pubkey)
end

.get_keypair(oComputeConnect, sId) ⇒ Object



61
62
63
# File 'lib/process/cloud/providers/hpcloud/security_groups.rb', line 61

def self.get_keypair(oComputeConnect, sId)
  oComputeConnect.key_pairs.get(sId)
end

.query_keypair(oComputeConnect, sQuery) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/process/cloud/providers/hpcloud/security_groups.rb', line 44

def self.query_keypair(oComputeConnect, sQuery)
  keypairs = oComputeConnect.key_pairs.all
  results = []
  keypairs.each do |sElem|
    is_selected = true
    attributes = sElem.instance_variable_get(:@attributes)
    sQuery.each do |key, value|
      if attributes[key] != value
        is_selected = false
        break
      end
    end
    results.push sElem if is_selected
  end
  results
end