mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[stormondemand|compute] Add all template APIs
This commit is contained in:
parent
4e2a7aa453
commit
297d2be06c
6 changed files with 50 additions and 5 deletions
|
@ -58,6 +58,8 @@ module Fog
|
|||
request :get_config_details
|
||||
|
||||
request :list_templates
|
||||
request :get_template_details
|
||||
request :restore_template
|
||||
|
||||
request :list_images
|
||||
request :create_image
|
||||
|
|
|
@ -7,16 +7,22 @@ module Fog
|
|||
class Template < Fog::Model
|
||||
identity :id
|
||||
attribute :name
|
||||
attribute :deprecated
|
||||
attribute :description
|
||||
attribute :manage_level
|
||||
attribute :os
|
||||
attribute :price
|
||||
attribute :zone_availability
|
||||
end
|
||||
|
||||
def initialize(attributes={})
|
||||
super
|
||||
end
|
||||
|
||||
def restore(options)
|
||||
requires :identity
|
||||
service.restore_template({:id => identity}.merge!(options))
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -9,11 +9,16 @@ module Fog
|
|||
|
||||
model Fog::Compute::StormOnDemand::Template
|
||||
|
||||
def all
|
||||
data = service.list_templates.body['items']
|
||||
def all(options={})
|
||||
data = service.list_templates(options).body['items']
|
||||
load(data)
|
||||
end
|
||||
|
||||
def get(template_id)
|
||||
tpl = service.get_template_details(:id => template_id).body
|
||||
new(tpl)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class StormOnDemand
|
||||
class Real
|
||||
|
||||
def get_template_details(options={})
|
||||
request(
|
||||
:path => '/Storm/Template/details',
|
||||
:body => Fog::JSON.encode(:params => options)
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -5,8 +5,8 @@ module Fog
|
|||
|
||||
def list_templates(options = {})
|
||||
request(
|
||||
:path => "/server/template/list",
|
||||
:body => Fog::JSON.encode(options)
|
||||
:path => "/Storm/Template/list",
|
||||
:body => Fog::JSON.encode(:params => options)
|
||||
)
|
||||
end
|
||||
|
||||
|
|
16
lib/fog/storm_on_demand/requests/compute/restore_template.rb
Normal file
16
lib/fog/storm_on_demand/requests/compute/restore_template.rb
Normal file
|
@ -0,0 +1,16 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class StormOnDemand
|
||||
class Real
|
||||
|
||||
def restore_template(options={})
|
||||
request(
|
||||
:path => '/Storm/Template/restore',
|
||||
:body => Fog::JSON.encode(:params => options)
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Reference in a new issue