Class: Yun::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/yun/model/connection.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Connection

Returns a new instance of Connection.



5
6
7
# File 'lib/yun/model/connection.rb', line 5

def initialize options
  @servers = Fog::Compute.new(options).servers
end

Instance Method Details

#create(attributes = {}) ⇒ Object



9
10
11
12
13
14
# File 'lib/yun/model/connection.rb', line 9

def create attributes={}
  fog_attributes = FogAttributes.new attributes
  server = @servers.create fog_attributes
  server.wait_for { ready? }
  Node.new server
end

#find(node_name) ⇒ Object



22
23
24
25
26
# File 'lib/yun/model/connection.rb', line 22

def find node_name
  list.find do |node|
    node.name == node_name
  end
end

#listObject



16
17
18
19
20
# File 'lib/yun/model/connection.rb', line 16

def list
  @servers.map do |server|
    Node.new server
  end
end