2010-10-29 19:24:34 -04:00
|
|
|
module Fog
|
2010-11-08 11:58:02 -05:00
|
|
|
class Compute
|
2010-10-29 19:24:34 -04:00
|
|
|
|
|
|
|
def self.new(attributes)
|
2010-12-13 20:51:16 -05:00
|
|
|
attributes = attributes.dup # prevent delete from having side effects
|
2011-01-07 21:14:39 -05:00
|
|
|
case provider = attributes[:provider] # attributes.delete(:provider)
|
2010-11-03 20:31:07 -04:00
|
|
|
when 'AWS'
|
2011-01-07 21:12:05 -05:00
|
|
|
require 'fog/compute/aws'
|
2010-10-29 19:24:34 -04:00
|
|
|
Fog::AWS::Compute.new(attributes)
|
2010-11-03 20:31:07 -04:00
|
|
|
when 'Bluebox'
|
2011-01-07 21:12:05 -05:00
|
|
|
require 'fog/compute/bluebox'
|
2010-10-29 19:24:34 -04:00
|
|
|
Fog::Bluebox::Compute.new(attributes)
|
2010-11-08 07:21:31 -05:00
|
|
|
when 'Brightbox'
|
2011-01-07 21:12:05 -05:00
|
|
|
require 'fog/compute/brightbox'
|
2010-11-08 07:21:31 -05:00
|
|
|
Fog::Brightbox::Compute.new(attributes)
|
2011-02-17 13:44:46 -05:00
|
|
|
when 'Ecloud'
|
|
|
|
require 'fog/compute/ecloud'
|
|
|
|
Fog::Ecloud::Compute.new(attributes)
|
2010-11-03 20:31:07 -04:00
|
|
|
when 'GoGrid'
|
2011-01-07 21:12:05 -05:00
|
|
|
require 'fog/compute/go_grid'
|
2010-10-29 19:24:34 -04:00
|
|
|
Fog::GoGrid::Compute.new(attributes)
|
2010-11-03 20:31:07 -04:00
|
|
|
when 'Linode'
|
2011-01-07 21:12:05 -05:00
|
|
|
require 'fog/compute/linode'
|
2010-10-29 19:24:34 -04:00
|
|
|
Fog::Linode::Compute.new(attributes)
|
2010-11-03 20:31:07 -04:00
|
|
|
when 'NewServers'
|
2011-01-07 21:12:05 -05:00
|
|
|
require 'fog/compute/new_servers'
|
2010-10-29 19:24:34 -04:00
|
|
|
Fog::NewServers::Compute.new(attributes)
|
2010-11-03 20:31:07 -04:00
|
|
|
when 'Rackspace'
|
2011-01-07 21:12:05 -05:00
|
|
|
require 'fog/compute/rackspace'
|
2010-10-29 19:24:34 -04:00
|
|
|
Fog::Rackspace::Compute.new(attributes)
|
2011-01-19 15:47:35 -05:00
|
|
|
when 'Voxel'
|
|
|
|
require 'fog/compute/voxel'
|
|
|
|
Fog::Voxel::Compute.new(attributes)
|
2010-11-03 20:31:07 -04:00
|
|
|
when 'Slicehost'
|
2011-01-07 21:12:05 -05:00
|
|
|
require 'fog/compute/slicehost'
|
2010-10-29 19:24:34 -04:00
|
|
|
Fog::Slicehost::Compute.new(attributes)
|
|
|
|
else
|
2010-11-08 11:58:02 -05:00
|
|
|
raise ArgumentError.new("#{provider} is not a recognized compute provider")
|
2010-10-29 19:24:34 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
2011-01-07 19:52:09 -05:00
|
|
|
end
|