2011-04-27 21:49:56 -04:00
|
|
|
require 'fog/core/collection'
|
2011-08-24 21:14:00 -04:00
|
|
|
require 'fog/storm_on_demand/models/compute/image'
|
2011-04-27 21:49:56 -04:00
|
|
|
|
|
|
|
module Fog
|
2011-06-16 19:28:54 -04:00
|
|
|
module Compute
|
|
|
|
class StormOnDemand
|
2011-04-27 21:49:56 -04:00
|
|
|
|
|
|
|
class Images < Fog::Collection
|
|
|
|
|
2011-06-16 19:28:54 -04:00
|
|
|
model Fog::Compute::StormOnDemand::Image
|
2011-04-27 21:49:56 -04:00
|
|
|
|
2013-05-21 06:06:31 -04:00
|
|
|
def create(options={})
|
|
|
|
service.create_image(options)
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
def destroy
|
|
|
|
requires :identity
|
|
|
|
service.delete_image(:id => identity)
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
def get
|
|
|
|
requires :identity
|
|
|
|
img = service.get_image_details(:id => identity).body
|
|
|
|
new(img)
|
|
|
|
end
|
|
|
|
|
|
|
|
def update(options={})
|
|
|
|
requires :identity
|
|
|
|
img = service.update_image({:id => identity}.merge!(options)).body
|
|
|
|
new(img)
|
|
|
|
end
|
|
|
|
|
|
|
|
def restore(options={})
|
|
|
|
requires :identity
|
|
|
|
service.restore_image({:id => identity}.merge!(options))
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
def all(options={})
|
|
|
|
data = service.list_images(options).body['items']
|
2011-04-27 21:49:56 -04:00
|
|
|
load(data)
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|