diff --git a/lib/fog/storm_on_demand/compute.rb b/lib/fog/storm_on_demand/compute.rb index 255f2c68c..1ab28f5c1 100644 --- a/lib/fog/storm_on_demand/compute.rb +++ b/lib/fog/storm_on_demand/compute.rb @@ -42,6 +42,11 @@ module Fog request :get_config_details request :list_templates request :list_images + request :create_image + request :delete_image + request :get_image_details + request :update_image + request :restore_image request :get_stats request :list_private_ips diff --git a/lib/fog/storm_on_demand/models/compute/image.rb b/lib/fog/storm_on_demand/models/compute/image.rb index 02018ab6e..0ebf4b70a 100644 --- a/lib/fog/storm_on_demand/models/compute/image.rb +++ b/lib/fog/storm_on_demand/models/compute/image.rb @@ -7,9 +7,11 @@ module Fog class Image < Fog::Model identity :id attribute :accnt + attribute :features + attribute :hv_type attribute :name attribute :source_hostname - attribute :source_subaccnt + attribute :source_uniq_id attribute :template attribute :template_description attribute :time_taken diff --git a/lib/fog/storm_on_demand/models/compute/images.rb b/lib/fog/storm_on_demand/models/compute/images.rb index ef4cd1098..716d4db8c 100644 --- a/lib/fog/storm_on_demand/models/compute/images.rb +++ b/lib/fog/storm_on_demand/models/compute/images.rb @@ -9,8 +9,37 @@ module Fog model Fog::Compute::StormOnDemand::Image - def all - data = service.list_images.body['items'] + 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'] load(data) end diff --git a/lib/fog/storm_on_demand/requests/compute/create_image.rb b/lib/fog/storm_on_demand/requests/compute/create_image.rb new file mode 100644 index 000000000..3615dedb1 --- /dev/null +++ b/lib/fog/storm_on_demand/requests/compute/create_image.rb @@ -0,0 +1,16 @@ +module Fog + module Compute + class StormOnDemand + class Real + + def create_image(options={}) + request( + :path => '/Storm/Image/create', + :body => Fog::JSON.encode(:params => options) + ) + end + + end + end + end +end \ No newline at end of file diff --git a/lib/fog/storm_on_demand/requests/compute/delete_image.rb b/lib/fog/storm_on_demand/requests/compute/delete_image.rb new file mode 100644 index 000000000..f1493ef18 --- /dev/null +++ b/lib/fog/storm_on_demand/requests/compute/delete_image.rb @@ -0,0 +1,16 @@ +module Fog + module Compute + class StormOnDemand + class Real + + def delete_image(options={}) + request( + :path => '/Storm/Image/delete', + :body => Fog::JSON.encode(:params => options) + ) + end + + end + end + end +end diff --git a/lib/fog/storm_on_demand/requests/compute/get_image_details.rb b/lib/fog/storm_on_demand/requests/compute/get_image_details.rb new file mode 100644 index 000000000..793c663a9 --- /dev/null +++ b/lib/fog/storm_on_demand/requests/compute/get_image_details.rb @@ -0,0 +1,16 @@ +module Fog + module Compute + class StormOnDemand + class Real + + def get_image_details(options={}) + request( + :path => '/Storm/Image/details', + :body => Fog::JSON.encode(:params => options) + ) + end + + end + end + end +end diff --git a/lib/fog/storm_on_demand/requests/compute/list_images.rb b/lib/fog/storm_on_demand/requests/compute/list_images.rb index b50b7c3cb..bface6882 100644 --- a/lib/fog/storm_on_demand/requests/compute/list_images.rb +++ b/lib/fog/storm_on_demand/requests/compute/list_images.rb @@ -5,8 +5,8 @@ module Fog def list_images(options = {}) request( - :path => "/server/image/list", - :body => Fog::JSON.encode(options) + :path => "/Storm/Image/list", + :body => Fog::JSON.encode(:params => options) ) end diff --git a/lib/fog/storm_on_demand/requests/compute/restore_image.rb b/lib/fog/storm_on_demand/requests/compute/restore_image.rb new file mode 100644 index 000000000..24fe53ad4 --- /dev/null +++ b/lib/fog/storm_on_demand/requests/compute/restore_image.rb @@ -0,0 +1,16 @@ +module Fog + module Compute + class StormOnDemand + class Real + + def restore_image(options={}) + request( + :path => '/Storm/Image/restore', + :body => Fog::JSON.encode(params => options) + ) + end + + end + end + end +end diff --git a/lib/fog/storm_on_demand/requests/compute/update_image.rb b/lib/fog/storm_on_demand/requests/compute/update_image.rb new file mode 100644 index 000000000..b8c3aba08 --- /dev/null +++ b/lib/fog/storm_on_demand/requests/compute/update_image.rb @@ -0,0 +1,16 @@ +module Fog + module Compute + class StormOnDemand + class Real + + def update_image(options={}) + request( + :path => '/Storm/Image/update', + :body => Fog::JSON.encode(:params => options) + ) + end + + end + end + end +end