2014-02-01 21:13:17 -05:00
|
|
|
require 'fog/storm_on_demand/core'
|
2013-05-23 21:12:44 -04:00
|
|
|
require 'fog/storm_on_demand/shared'
|
2011-08-31 16:52:53 -04:00
|
|
|
|
2011-04-27 21:49:56 -04:00
|
|
|
module Fog
|
2011-06-16 19:28:54 -04:00
|
|
|
module Compute
|
|
|
|
class StormOnDemand < Fog::Service
|
2011-05-10 16:58:22 -04:00
|
|
|
requires :storm_on_demand_username, :storm_on_demand_password
|
|
|
|
recognizes :storm_on_demand_auth_url
|
2011-04-27 21:49:56 -04:00
|
|
|
|
2011-08-24 21:14:00 -04:00
|
|
|
model_path 'fog/storm_on_demand/models/compute'
|
2011-04-27 21:49:56 -04:00
|
|
|
model :config
|
|
|
|
collection :configs
|
|
|
|
model :image
|
|
|
|
collection :images
|
|
|
|
model :server
|
|
|
|
collection :servers
|
|
|
|
model :template
|
|
|
|
collection :templates
|
2013-05-23 09:05:46 -04:00
|
|
|
model :product
|
|
|
|
collection :products
|
2013-05-23 10:29:42 -04:00
|
|
|
model :notification
|
|
|
|
collection :notifications
|
2011-04-27 21:49:56 -04:00
|
|
|
|
2011-08-24 21:14:00 -04:00
|
|
|
request_path 'fog/storm_on_demand/requests/compute'
|
2011-04-27 21:49:56 -04:00
|
|
|
request :clone_server
|
|
|
|
request :delete_server
|
|
|
|
request :reboot_server
|
|
|
|
request :list_servers
|
|
|
|
request :get_server
|
|
|
|
request :create_server
|
|
|
|
request :resize_server
|
2013-05-21 09:01:23 -04:00
|
|
|
request :server_history
|
|
|
|
request :shutdown_server
|
|
|
|
request :start_server
|
|
|
|
request :server_status
|
|
|
|
request :update_server
|
2013-05-21 08:19:58 -04:00
|
|
|
|
2011-04-27 21:49:56 -04:00
|
|
|
request :list_configs
|
2013-05-21 05:35:57 -04:00
|
|
|
request :get_config_details
|
2013-05-21 08:19:58 -04:00
|
|
|
|
2011-04-27 21:49:56 -04:00
|
|
|
request :list_templates
|
2013-05-21 09:11:06 -04:00
|
|
|
request :get_template_details
|
|
|
|
request :restore_template
|
2013-05-21 08:19:58 -04:00
|
|
|
|
2011-04-27 21:49:56 -04:00
|
|
|
request :list_images
|
2013-05-21 06:06:31 -04:00
|
|
|
request :create_image
|
|
|
|
request :delete_image
|
|
|
|
request :get_image_details
|
|
|
|
request :update_image
|
|
|
|
request :restore_image
|
2013-05-23 09:05:46 -04:00
|
|
|
|
|
|
|
request :get_product
|
|
|
|
request :get_product_code
|
|
|
|
request :list_products
|
|
|
|
request :get_product_price
|
|
|
|
request :get_product_starting_price
|
2013-05-23 10:29:42 -04:00
|
|
|
|
|
|
|
request :list_notifications
|
|
|
|
request :current_notifications
|
|
|
|
request :get_notification
|
|
|
|
request :resolve_notification
|
2014-02-19 07:30:59 -05:00
|
|
|
|
2011-04-27 21:49:56 -04:00
|
|
|
class Mock
|
|
|
|
def self.data
|
|
|
|
@data ||= Hash.new do |hash, key|
|
|
|
|
hash[key] = {
|
|
|
|
:last_modified => {
|
|
|
|
:images => {},
|
|
|
|
:servers => {}
|
|
|
|
},
|
|
|
|
:images => {},
|
|
|
|
:servers => {}
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2011-05-17 22:40:17 -04:00
|
|
|
def self.reset
|
|
|
|
@data = nil
|
|
|
|
end
|
|
|
|
|
2011-04-27 21:49:56 -04:00
|
|
|
def self.reset_data(keys=data.keys)
|
|
|
|
for key in [*keys]
|
|
|
|
data.delete(key)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def initialize(options={})
|
2011-05-10 16:58:22 -04:00
|
|
|
@storm_on_demand_username = options[:storm_on_demand_username]
|
2011-05-19 18:35:33 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def data
|
|
|
|
self.class.data[@storm_on_demand_username]
|
|
|
|
end
|
|
|
|
|
|
|
|
def reset_data
|
|
|
|
self.class.data.delete(@storm_on_demand_username)
|
2011-04-27 21:49:56 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class Real
|
2013-05-23 21:12:44 -04:00
|
|
|
include Fog::StormOnDemand::RealShared
|
2011-04-27 21:49:56 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|