1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

format isn't write, but valid API requests.

This commit is contained in:
Nat Welch 2013-04-29 14:48:25 -07:00
parent 1055bfeb06
commit 34feaa4650
5 changed files with 22 additions and 11 deletions

View file

@ -12,10 +12,11 @@ module Fog
class Real
def delete_server(server_name)
def delete_server(server_name, zone_name)
api_method = @compute.instances.delete
parameters = {
'project' => @project,
'zone' => zone_name,
'instance' => server_name
}

View file

@ -12,10 +12,11 @@ module Fog
class Real
def get_server(server_name)
def get_server(server_name, zone_name)
api_method = @compute.instances.get
parameters = {
'project' => @project,
'zone' => zone_name,
'instance' => server_name
}

View file

@ -19,15 +19,15 @@ module Fog
api_method = @compute.instances.insert
parameters = {
'project' => @project,
'zone' => zone_name,
}
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}",
'machineType' => @api_url + @project + "/machineTypes/#{machine_name}",
'networkInterfaces' => [{
'network' => @api_url + @project + "/networks/#{network_name}"
'network' => @api_url + @project + "/global/networks/#{network_name}"
}]
}

View file

@ -12,10 +12,11 @@ module Fog
class Real
def list_servers
def list_servers(zone_name)
api_method = @compute.instances.list
parameters = {
'project' => @project
'project' => @project,
'zone' => zone_name,
}
result = self.build_result(api_method, parameters)

View file

@ -55,21 +55,29 @@ Shindo.tests('Fog::Compute[:google] | server requests', ['google']) do
tests('success') do
server_name = 'new-server-test'
image_name = "gcel-12-04-v20130225"
machine_type = "n1-standard-1"
zone_name = "us-central1-a"
tests("#insert_server").formats(@insert_server_format) do
@google.insert_server(server_name).body
@google.insert_server(
server_name,
image_name,
zone_name,
machine_type
).body
end
tests("#get_server").formats(@get_server_format) do
@google.get_server(server_name).body
@google.get_server(server_name, zone_name).body
end
tests("#list_servers").formats(@list_servers_format) do
@google.list_servers.body
@google.list_servers(zone_name).body
end
tests("#delete_server").formats(@delete_server_format) do
@google.delete_server(server_name).body
@google.delete_server(server_name, zone_name).body
end
end