2012-07-15 06:24:36 -04:00
|
|
|
module Fog
|
|
|
|
module Compute
|
|
|
|
class Serverlove
|
|
|
|
class Real
|
|
|
|
|
|
|
|
def create_server(options)
|
|
|
|
return nil if options.empty? || options.nil?
|
2012-07-15 11:20:19 -04:00
|
|
|
request(:method => "post", :path => "/servers/create/stopped", :expects => 200, :options => options)
|
2012-07-15 06:24:36 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
class Mock
|
|
|
|
|
|
|
|
def create_server(options = {})
|
|
|
|
response = Excon::Response.new
|
|
|
|
response.status = 200
|
|
|
|
|
|
|
|
data = {
|
2012-07-15 07:55:06 -04:00
|
|
|
'server' => Fog::Mock.random_numbers(1000000).to_s,
|
2012-07-15 06:24:36 -04:00
|
|
|
'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
|