Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

[google|compute] more additions and corrections #2535

Closed
wants to merge 1 commit into from

4 participants

@neillturner

No description provided.

@coveralls

Coverage Status

Coverage remained the same when pulling fc1d34f on neillturner:master into 86bf2d8 on fog:master.

@geemus
Owner

@icco - could you review? Thanks!

@icco icco commented on the diff
lib/fog/google/requests/compute/list_addresses.rb
@@ -4,7 +4,7 @@ class Google
class Mock
- def list_addresses(region_name)
@icco Collaborator
icco added a note

Could you revert this file? None of these changes are necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@icco icco was assigned
@icco
Collaborator

This was fixed in other pull requests.

@icco icco closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
24 lib/fog/google/requests/compute/attach_disk.rb
@@ -3,27 +3,35 @@ module Compute
class Google
class Mock
- def attach_disk(instance, zone, deviceName)
- Fog::Mock.not_implemented
+ def attach_disk(instance, zone_name, disk_name, device_name=nil, disk_mode='READ_WRITE', disk_type='PERSISTENT')
+ Fog::Mock.not_implemented
end
+
end
class Real
-
- def attach_disk(instance, zone, deviceName)
+
+ def attach_disk(instance, zone_name, disk_name, device_name=nil, disk_mode='READ_WRITE', disk_type='PERSISTENT')
api_method = @compute.instances.attach_disk
parameters = {
'project' => @project,
- 'instance' => instance,
- 'zone' => zone
+ 'instance' => instance,
+ 'zone' => zone_name
}
body_object = {
- "deviceName" => deviceName
+ "source" => "https://www.googleapis.com/compute/#{api_version}/projects/#{@project}/zones/#{zone_name}/disks/#{disk_name}",
+ "type" => disk_type,
+ "mode" => disk_mode,
+ "boot" => false
}
- result = self.build_result(api_method, parameters, body_object=body_object)
+ body_object['deviceName'] = device_name if device_name!=nil
+ result = self.build_result(api_method, parameters,
+ body_object=body_object)
response = self.build_response(result)
end
+
end
+
end
end
end
View
15 lib/fog/google/requests/compute/detach_disk.rb
@@ -3,22 +3,23 @@ module Compute
class Google
class Mock
- def detach_disk(instance, zone, deviceName)
+ def detach_disk(instance, zone_name, device_name)
Fog::Mock.not_implemented
end
+
end
class Real
-
- def detach_disk(instance, zone, deviceName)
+
+ def detach_disk(instance, zone_name, device_name)
api_method = @compute.instances.detach_disk
parameters = {
'project' => @project,
- 'instance' => instance,
- 'zone' => zone,
+ 'instance' => instance,
+ 'zone' => zone_name,
+ 'deviceName' => device_name
}
- body_object = { "deviceName" => deviceName }
- result = self.build_result(api_method, parameters, body_object=body_object)
+ result = self.build_result(api_method, parameters)
response = self.build_response(result)
end
View
29 lib/fog/google/requests/compute/get_project.rb
@@ -0,0 +1,29 @@
+module Fog
+ module Compute
+ class Google
+
+ class Mock
+
+ def get_project(project_name=@project)
+ Fog::Mock.not_implemented
+ end
+
+ end
+
+ class Real
+
+ def get_project(project_name=@project)
+ api_method = @compute.projects.get
+ parameters = {
+ 'project' => project_name
+ }
+
+ result = self.build_result(api_method, parameters)
+ response = self.build_response(result)
+ end
+
+ end
+
+ end
+ end
+end
View
4 lib/fog/google/requests/compute/list_addresses.rb
@@ -4,7 +4,7 @@ class Google
class Mock
- def list_addresses(region_name)
@icco Collaborator
icco added a note

Could you revert this file? None of these changes are necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ def list_addresses
Fog::Mock.not_implemented
end
@@ -22,7 +22,9 @@ def list_addresses(region_name)
result = self.build_result(api_method, parameters)
response = self.build_response(result)
end
+
end
+
end
end
end
View
29 lib/fog/google/requests/compute/list_regions.rb
@@ -0,0 +1,29 @@
+module Fog
+ module Compute
+ class Google
+
+ class Mock
+
+ def list_regions
+ Fog::Mock.not_implemented
+ end
+
+ end
+
+ class Real
+
+ def list_regions
+ api_method = @compute.regions.list
+ parameters = {
+ 'project' => @project
+ }
+
+ result = self.build_result(api_method, parameters)
+ response = self.build_response(result)
+ end
+
+ end
+
+ end
+ end
+end
View
34 lib/fog/google/requests/compute/set_common_instance_metadata.rb
@@ -0,0 +1,34 @@
+module Fog
+ module Compute
+ class Google
+
+ class Mock
+
+ def set_common_instance_metadata(metadata={}, project_name=@project)
+ Fog::Mock.not_implemented
+ end
+
+ end
+
+ class Real
+
+ def set_common_instance_metadata(metadata={}, project_name=@project)
+ api_method = @compute.projects.set_common_instance_metadata
+ parameters = {
+ 'project' => project_name
+ }
+ body_object = {
+ "items" => metadata.to_a.map {|pair| { :key => pair[0], :value => pair[1] } }
+ }
+ result = self.build_result(
+ api_method,
+ parameters,
+ body_object=body_object)
+ response = self.build_response(result)
+ end
+
+ end
+
+ end
+ end
+end
Something went wrong with that request. Please try again.