Class: HP::Cloud::Servers
- Inherits:
-
FogCollection
- Object
- FogCollection
- HP::Cloud::Servers
- Defined in:
- lib/hpcloud/servers.rb
Instance Attribute Summary
Attributes inherited from FogCollection
Instance Method Summary collapse
- #create(item = nil) ⇒ Object
- #find_by_ip(ipaddy) ⇒ Object
-
#initialize ⇒ Servers
constructor
A new instance of Servers.
Methods inherited from FogCollection
#empty?, #filter, #get, #get_array, #matches, #unique
Constructor Details
#initialize ⇒ Servers
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 |