Sha256: 3e526d890b3d72cbc86504e1d5659f23ac4e1c44e0b98615bd629b03db16b3a0

Contents?: true

Size: 1.28 KB

Versions: 9

Compression:

Stored size: 1.28 KB

Contents

module Fog
  class Compute

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

  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
fog-0.5.3 lib/fog/compute.rb
fog-0.5.2 lib/fog/compute.rb
fog-0.5.1 lib/fog/compute.rb
fog-0.5.0 lib/fog/compute.rb
phpfog-fog-0.4.1.3 lib/fog/compute.rb
phpfog-fog-0.4.1.2 lib/fog/compute.rb
phpfog-fog-0.4.1.1 lib/fog/compute.rb
phpfog-fog-0.4.1 lib/fog/compute.rb
fog-0.4.1 lib/fog/compute.rb