Class: Fog::Compute

Inherits:
Object
  • Object
show all
Defined in:
lib/fog/core/compute.rb

Class Method Summary collapse

Class Method Details

.new(attributes) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/fog/core/compute.rb', line 4

def self.new(attributes)
  case provider = attributes.delete(:provider)
  when 'AWS'
    require 'fog/aws'
    Fog::AWS::Compute.new(attributes)
  when 'Bluebox'
    require 'fog/bluebox'
    Fog::Bluebox::Compute.new(attributes)
  when 'Brightbox'
    require 'fog/brightbox'
    Fog::Brightbox::Compute.new(attributes)
  when 'GoGrid'
    require 'fog/go_grid'
    Fog::GoGrid::Compute.new(attributes)
  when 'Linode'
    require 'fog/linode'
    Fog::Linode::Compute.new(attributes)
  when 'NewServers'
    require 'fog/new_servers'
    Fog::NewServers::Compute.new(attributes)
  when 'Rackspace'
    require 'fog/rackspace'
    Fog::Rackspace::Compute.new(attributes)
  when 'Slicehost'
    require 'fog/slicehost'
    Fog::Slicehost::Compute.new(attributes)
  else
    raise ArgumentError.new("#{provider} is not a recognized compute provider")
  end
end