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/rackspace/requests/compute_v2/create_server.rb
Brian Hartsock 49300e6260 Merge remote-tracking branch 'scotje/master'
Conflicts:
	lib/fog/rackspace/models/compute_v2/server.rb
2012-11-09 20:37:22 -05:00

31 lines
1,004 B
Ruby

module Fog
module Compute
class RackspaceV2
class Real
def create_server(name, image_id, flavor_id, min_count, max_count, options = {})
data = {
'server' => {
'name' => name,
'imageRef' => image_id,
'flavorRef' => flavor_id,
'minCount' => min_count,
'maxCount' => max_count
}
}
data['server']['metadata'] = options[:metadata] unless options[:metadata].nil?
data['server']['OS-DCF:diskConfig'] = options[:disk_config] unless options[:disk_config].nil?
data['server']['metadata'] = options[:metadata] unless options[:metadata].nil?
data['server']['personality'] = options[:personality] unless options[:personality].nil?
request(
:body => Fog::JSON.encode(data),
:expects => [202],
:method => 'POST',
:path => "servers"
)
end
end
end
end
end