mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Add fog-softlayer module .
This commit is contained in:
parent
12cc559864
commit
1eefff1191
4 changed files with 56 additions and 0 deletions
|
@ -49,6 +49,7 @@ Gem::Specification.new do |s|
|
|||
|
||||
# Modular providers
|
||||
s.add_dependency("fog-brightbox")
|
||||
s.add_dependency("fog-softlayer")
|
||||
|
||||
## List your development dependencies here. Development dependencies are
|
||||
## those that are only needed during development
|
||||
|
|
|
@ -50,6 +50,7 @@ require 'fog/openstack'
|
|||
require 'fog/ovirt'
|
||||
require 'fog/sakuracloud'
|
||||
require 'fog/serverlove'
|
||||
require 'fog/softlayer'
|
||||
require 'fog/storm_on_demand'
|
||||
require 'fog/terremark'
|
||||
require 'fog/vcloud'
|
||||
|
|
|
@ -83,6 +83,7 @@ require 'fog/bin/openstack'
|
|||
require 'fog/bin/ovirt'
|
||||
require 'fog/bin/sakuracloud'
|
||||
require 'fog/bin/serverlove'
|
||||
require 'fog/bin/softlayer'
|
||||
require 'fog/bin/stormondemand'
|
||||
require 'fog/bin/terremark'
|
||||
require 'fog/bin/vcloud'
|
||||
|
|
53
lib/fog/bin/softlayer.rb
Normal file
53
lib/fog/bin/softlayer.rb
Normal file
|
@ -0,0 +1,53 @@
|
|||
#
|
||||
# Author:: Matt Eldridge (<matt.eldridge@us.ibm.com>)
|
||||
# © Copyright IBM Corporation 2014.
|
||||
#
|
||||
# LICENSE: MIT (http://opensource.org/licenses/MIT)
|
||||
#
|
||||
|
||||
class Softlayer < Fog::Bin
|
||||
class << self
|
||||
def class_for(key)
|
||||
case key
|
||||
when :compute
|
||||
Fog::Compute::Softlayer
|
||||
when :dns
|
||||
Fog::DNS::Softlayer
|
||||
when :network
|
||||
Fog::Network::Softlayer
|
||||
when :storage
|
||||
Fog::Storage::Softlayer
|
||||
else
|
||||
# @todo Replace most instances of ArgumentError with NotImplementedError
|
||||
# @todo For a list of widely supported Exceptions, see:
|
||||
# => http://www.zenspider.com/Languages/Ruby/QuickRef.html#35
|
||||
raise ArgumentError, "Unsupported #{self} service: #{key}"
|
||||
end
|
||||
end
|
||||
|
||||
def [](service)
|
||||
@@connections ||= Hash.new do |hash, key|
|
||||
hash[key] = case key
|
||||
when :compute
|
||||
Fog::Logger.warning("Softlayer[:compute] is not recommended, use Compute[:aws] for portability")
|
||||
Fog::Compute.new(:provider => :softlayer)
|
||||
when :dns
|
||||
Fog::Logger.warning("Softlayer[:dns] is not recommended, use DNS[:aws] for portability")
|
||||
Fog::DNS.new(:provider => :softlayer)
|
||||
when :network
|
||||
Fog::Network.new(:provider => :softlayer)
|
||||
when :storage
|
||||
Fog::Storage.new(:provider => :softlayer)
|
||||
else
|
||||
raise ArgumentError, "Unrecognized service: #{key.inspect}"
|
||||
end
|
||||
end
|
||||
@@connections[service]
|
||||
end
|
||||
|
||||
def services
|
||||
Fog::Softlayer.services
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in a new issue