mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[stormondemand|compute] Add additional attributes to Image and CRUD methods to Images
This commit is contained in:
parent
8015dec890
commit
84fc5e0eed
9 changed files with 121 additions and 5 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
16
lib/fog/storm_on_demand/requests/compute/create_image.rb
Normal file
16
lib/fog/storm_on_demand/requests/compute/create_image.rb
Normal file
|
@ -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
|
16
lib/fog/storm_on_demand/requests/compute/delete_image.rb
Normal file
16
lib/fog/storm_on_demand/requests/compute/delete_image.rb
Normal file
|
@ -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
|
|
@ -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
|
|
@ -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
|
||||
|
||||
|
|
16
lib/fog/storm_on_demand/requests/compute/restore_image.rb
Normal file
16
lib/fog/storm_on_demand/requests/compute/restore_image.rb
Normal file
|
@ -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
|
16
lib/fog/storm_on_demand/requests/compute/update_image.rb
Normal file
16
lib/fog/storm_on_demand/requests/compute/update_image.rb
Normal file
|
@ -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
|
Loading…
Add table
Reference in a new issue