Class: HP::Cloud::Servers

Inherits:
FogCollection show all
Defined in:
lib/hpcloud/servers.rb

Instance Attribute Summary

Attributes inherited from FogCollection

#items, #name

Instance Method Summary collapse

Methods inherited from FogCollection

#empty?, #filter, #get, #get_array, #matches, #unique

Constructor Details

#initializeServers

Returns a new instance of Servers.



28
29
30
31
# File 'lib/hpcloud/servers.rb', line 28

def initialize
  super("server")
  @items = @connection.compute.servers.all(:details=>true)
end

Instance Method Details

#create(item = nil) ⇒ Object



33
34
35
# File 'lib/hpcloud/servers.rb', line 33

def create(item = nil)
  return ServerHelper.new(@connection.compute, item)
end

#find_by_ip(ipaddy) ⇒ Object



37
38
39
40
41
42
43
44
# File 'lib/hpcloud/servers.rb', line 37

def find_by_ip(ipaddy)
  @items.each { |x| 
    if ipaddy == x.public_ip_address
      return create(x)
    end
  }
  return nil
end