allomov
12/4/2013 - 10:25 AM

Google Engine Fog usage for creating images.

Google Engine Fog usage for creating images.

@google_properties = {
  "client_email" => "some_value",
  "key_location" => "some_value",
  "project"      => "some_value",
  "storage" => {
    "access_key" => 'some_value', 
    'secret' => 'some_value'
  }
}

storage_params = {
  :provider => 'google',
  :google_storage_access_key_id => @google_properties['storage']['access_key'],
  :google_storage_secret_access_key => @google_properties['storage']['secret']
}

compute_params = {
  :provider => 'google',
  :google_client_email => @google_properties["client_email"],
  :google_key_location => @google_properties["key_location"],
  :google_project      => @google_properties["project"],
}


bucket_name = "bosh-name"
object_name = "object-name-#{id}"

storage.put_bucket(bucket_name) # , 'LocationConstraint' => 'US', 'x-amz-acl' => 'public-read') # acl ?

image_file = File.open(File.join(File.dirname(__FILE__), 'tmp', 'root.img'), 'r')

storage.put_object(bucket_name, object_name, image_file)