mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
49300e6260
Conflicts: lib/fog/rackspace/models/compute_v2/server.rb
31 lines
1,004 B
Ruby
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
|