1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/serverlove/requests/compute/create_server.rb
Sean Handley e805e7577b Don't start servers by default.
This is handy if we haven't yet assigned a boot
disk.
2012-07-15 17:20:19 +02:00

34 lines
867 B
Ruby

module Fog
module Compute
class Serverlove
class Real
def create_server(options)
return nil if options.empty? || options.nil?
request(:method => "post", :path => "/servers/create/stopped", :expects => 200, :options => options)
end
end
class Mock
def create_server(options = {})
response = Excon::Response.new
response.status = 200
data = {
'server' => Fog::Mock.random_numbers(1000000).to_s,
'name' => options['name'] || 'Test',
'cpu' => options['cpu'] || 1000,
'persistent' => options['persistent'] || false,
'vnc:password' => options['vnc:password'] || 'T35tServER!'
}
response.body = data
response
end
end
end
end
end