2012-10-22 20:15:33 -04:00
|
|
|
module Fog
|
|
|
|
module Compute
|
2012-12-04 15:05:11 -05:00
|
|
|
class Google
|
2012-10-22 20:15:33 -04:00
|
|
|
class Mock
|
2014-04-09 20:52:05 -04:00
|
|
|
def insert_network(network_name, ip_range, options = {})
|
2012-10-22 20:15:33 -04:00
|
|
|
Fog::Mock.not_implemented
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class Real
|
2014-04-09 20:52:05 -04:00
|
|
|
def insert_network(network_name, ip_range, options = {})
|
2012-10-22 20:15:33 -04:00
|
|
|
api_method = @compute.networks.insert
|
|
|
|
parameters = {
|
|
|
|
'project' => @project,
|
|
|
|
}
|
|
|
|
body_object = {
|
|
|
|
'name' => network_name,
|
|
|
|
'IPv4Range' => ip_range
|
|
|
|
}
|
|
|
|
|
2014-04-09 20:52:05 -04:00
|
|
|
body_object['description'] = options[:description] if options[:description]
|
|
|
|
body_object['gatewayIPv4'] = options[:gateway_ipv4] if options[:gateway_ipv4]
|
|
|
|
|
2014-07-30 13:26:02 -04:00
|
|
|
request(api_method, parameters, body_object)
|
2012-10-22 20:15:33 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|