Class: Fog::Compute::Fifo::Servers

Inherits:
Fog::Collection
  • Object
show all
Defined in:
lib/fog/fifo/models/compute/servers.rb

Instance Method Summary collapse

Instance Method Details

#allObject



11
12
13
# File 'lib/fog/fifo/models/compute/servers.rb', line 11

def all
  service.list_vms().body.map{|id| get(id) }
end

#bootstrap(new_attributes = {}) ⇒ Object



22
23
24
25
26
# File 'lib/fog/fifo/models/compute/servers.rb', line 22

def bootstrap(new_attributes = {})
  server = create(new_attributes)
  server.wait_for { ready? }
  server
end

#create(params = {}) ⇒ Object



15
16
17
18
19
20
# File 'lib/fog/fifo/models/compute/servers.rb', line 15

def create(params = {})
  resp = service.create_vm(params)

	  #This will retrn a 303 with location = new vm url, so just get it.
	  get(resp.headers['location'].split('/').last)
end

#get(machine_id) ⇒ Object



28
29
30
31
# File 'lib/fog/fifo/models/compute/servers.rb', line 28

def get(machine_id)
  data = service.get_vm(machine_id).body
  new(data)
end