def create_server(options)
if options[:switch]
switchs = options[:switch].split(',')
connectedswitches = switchs.map do |sw_id|
{
"ID" => sw_id
}
end
else
connectedswitches = [{"Scope"=>"shared", "BandWidthMbps"=>100}]
end
body = {
"Server" => {
"Name" => options[:name],
"ServerPlan" => {
"ID" => options[:serverplan].to_i
},
"ConnectedSwitches" => connectedswitches
}
}
request(
:headers => {
'Authorization' => "Basic #{@auth_encode}"
},
:expects => [201],
:method => 'POST',
:path => "#{Fog::SakuraCloud.build_endpoint(@api_zone)}/server",
:body => Fog::JSON.encode(body)
)
end