Sha256: 2911f7a341bb5e679b0416412709a64d0809b7b36f88b8292c624f5567293498
Contents?: true
Size: 1.34 KB
Versions: 7
Compression:
Stored size: 1.34 KB
Contents
module Fog module Compute class Google 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) # We need to check if the image is owned by the user or a global image. if get_image(image_name, @project).data['code'] == 200 image_url = @api_url + @project + "/global/images/#{image_name}" else image_url = @api_url + "google/global/images/#{image_name}" end api_method = @compute.instances.insert parameters = { 'project' => @project, 'zone' => zone_name, } body_object = { 'name' => server_name, 'image' => image_url, 'machineType' => @api_url + @project + "/global/machineTypes/#{machine_name}", 'networkInterfaces' => [{ 'network' => @api_url + @project + "/global/networks/#{network_name}" }] } result = self.build_result(api_method, parameters, body_object=body_object) response = self.build_response(result) end end end end end
Version data entries
7 entries across 7 versions & 2 rubygems