mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
43 lines
1.1 KiB
Ruby
43 lines
1.1 KiB
Ruby
module Fog
|
|
module Compute
|
|
class GCE
|
|
|
|
class Mock
|
|
|
|
def insert_server(server_name)
|
|
Fog::Mock.not_implemented
|
|
end
|
|
|
|
end
|
|
|
|
class Real
|
|
|
|
def insert_server(server_name, image_name,
|
|
zone_name, machine_name,
|
|
network_name=@default_network)
|
|
|
|
api_method = @compute.instances.insert
|
|
parameters = {
|
|
'project' => @project,
|
|
}
|
|
body_object = {
|
|
'name' => server_name,
|
|
'image' => @api_url + "google/images/#{image_name}",
|
|
'zone' => @api_url + @project + "/zones/#{zone_name}",
|
|
'machineType' => @api_url + @project +
|
|
"/machineTypes/#{machine_name}",
|
|
'networkInterfaces' => [{
|
|
'network' => @api_url + @project + "/networks/#{network_name}"
|
|
}]
|
|
}
|
|
|
|
result = self.build_result(api_method, parameters,
|
|
body_object=body_object)
|
|
response = self.build_response(result)
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
end
|
|
end
|