1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/compute.rb

50 lines
1.6 KiB
Ruby
Raw Normal View History

2010-10-29 19:24:34 -04:00
module Fog
class Compute
2010-10-29 19:24:34 -04:00
def self.new(attributes)
attributes = attributes.dup # prevent delete from having side effects
2011-01-07 21:14:39 -05:00
case provider = attributes[:provider] # attributes.delete(:provider)
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)
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)
when 'Brightbox'
2011-01-07 21:12:05 -05:00
require 'fog/compute/brightbox'
Fog::Brightbox::Compute.new(attributes)
when 'Ecloud'
require 'fog/compute/ecloud'
Fog::Ecloud::Compute.new(attributes)
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)
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)
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)
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)
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)
when 'StormOnDemand'
2011-05-10 16:58:22 -04:00
require 'fog/compute/storm_on_demand'
Fog::StormOnDemand::Compute.new(attributes)
when 'VirtualBox'
require 'fog/compute/virtual_box'
Fog::VirtualBox::Compute.new(attributes)
when 'Voxel'
require 'fog/compute/voxel'
Fog::Voxel::Compute.new(attributes)
2010-10-29 19:24:34 -04:00
else
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