fog/fog — pull request #2501 by allomov (2013-12-22 17:05:22+00:00)
Title: Google Compute Engine v1 update and enhancement (Networks setup, Server metadata update and Disk attachment)

Since changes needed to move Fog to GCE v1 was made by @carlossg in #2494 I decided to share my work on this field. I plan to add support for Networks setup, Server metadata update and Disks attachment.
Currently **work is in progress** and I just want to hear feedback from @icco about following things:
- since GCE returns on every operation and as I understand we have synchronous API here, I think we need to add [wait](https://github.com/allomov/fog/blob/b73e99b1cd09da041a9f3493e3ad588886dc011b/lib/fog/google/models/compute/operation.rb#L45-L55) method to Operation and [use it to determine when operation ends](https://github.com/allomov/fog/blob/b73e99b1cd09da041a9f3493e3ad588886dc011b/lib/fog/google/models/compute/image.rb#L56-L57), `backoff_if_unfound` method can raise exception after 1 sec while inserting take more time;
- you can use `Fog.wait_for` [method](https://github.com/allomov/fog/blob/b73e99b1cd09da041a9f3493e3ad588886dc011b/lib/fog/core/wait_for.rb) within `Compute#backoff_if_unfound` [method](https://github.com/fog/fog/blob/master/lib/fog/google/compute.rb#L104-L122) to DRY this method;
- since we fill only `source` field of `raw_data` attribute for `Image` instance we can escape using additional hash and assign only source URL to `raw_data` attribute, it will reduce repetition (it is the worse idea I have because it will make new version incompatible with previous). Also this field can be refactored to accept `Fog::Storage::Google::File` object.

Thank you for your attention . :sparkling_heart: