2012-05-15 14:54:20 -04:00
|
|
|
require 'fog/storm_on_demand'
|
2011-08-31 16:52:53 -04:00
|
|
|
require 'fog/compute'
|
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 :balancer
|
|
|
|
collection :balancers
|
2013-05-21 22:57:14 -04:00
|
|
|
model :network_ip
|
|
|
|
collection :network_ips
|
2011-04-27 21:49:56 -04:00
|
|
|
model :private_ip
|
|
|
|
collection :private_ips
|
2013-05-21 23:21:35 -04:00
|
|
|
model :firewall
|
|
|
|
collection :firewalls
|
2013-05-22 03:00:55 -04:00
|
|
|
model :ruleset
|
|
|
|
collection :rulesets
|
2013-05-22 04:46:33 -04:00
|
|
|
model :pool
|
2013-05-22 05:24:34 -04:00
|
|
|
collection :pools
|
|
|
|
model :zone
|
|
|
|
collection :zones
|
2011-04-27 21:49:56 -04:00
|
|
|
model :stat
|
|
|
|
collection :stats
|
|
|
|
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 :remove_balancer_node
|
|
|
|
request :add_balancer_node
|
2013-05-21 08:19:58 -04:00
|
|
|
request :add_balancer_service
|
|
|
|
request :remove_balancer_service
|
|
|
|
request :check_balancer_available
|
|
|
|
request :create_balancer
|
|
|
|
request :delete_balancer
|
|
|
|
request :update_balancer
|
|
|
|
request :get_balancer_details
|
2011-04-27 21:49:56 -04:00
|
|
|
request :list_balancers
|
2013-05-21 08:19:58 -04:00
|
|
|
request :get_balancer_possible_nodes
|
|
|
|
request :get_balancer_strategies
|
|
|
|
|
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-21 08:19:58 -04:00
|
|
|
|
2011-04-27 21:49:56 -04:00
|
|
|
request :get_stats
|
2013-05-21 09:20:10 -04:00
|
|
|
request :get_stats_graph
|
|
|
|
|
2013-05-21 21:50:31 -04:00
|
|
|
request :list_private_ips
|
|
|
|
request :get_private_ip
|
|
|
|
request :attach_server_to_private_ip
|
|
|
|
request :detach_server_from_private_ip
|
2013-05-21 22:57:14 -04:00
|
|
|
request :check_server_attached
|
|
|
|
|
|
|
|
request :add_ip_to_server
|
|
|
|
request :get_ip_details
|
|
|
|
request :list_network_ips
|
|
|
|
request :list_ip_public_accounts
|
|
|
|
request :list_network_public_ips
|
|
|
|
request :remove_ip_from_server
|
|
|
|
request :request_new_ips
|
|
|
|
|
2013-05-21 23:21:35 -04:00
|
|
|
request :get_firewall
|
|
|
|
request :get_firewall_basic_options
|
|
|
|
request :get_firewall_rules
|
|
|
|
request :update_firewall
|
|
|
|
|
2013-05-22 03:00:55 -04:00
|
|
|
request :create_ruleset
|
|
|
|
request :get_ruleset
|
|
|
|
request :list_rulesets
|
|
|
|
request :update_ruleset
|
|
|
|
|
2013-05-22 04:46:33 -04:00
|
|
|
request :create_pool
|
|
|
|
request :delete_pool
|
|
|
|
request :get_pool
|
|
|
|
request :get_assignments
|
|
|
|
request :update_pool
|
|
|
|
|
2013-05-22 05:24:34 -04:00
|
|
|
request :get_zone
|
|
|
|
request :list_zones
|
|
|
|
request :set_default_zone
|
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
|
2013-05-22 05:24:34 -04: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
|