class Softlayer

Author

Matt Eldridge (<matt.eldridge@us.ibm.com>)

© Copyright IBM Corporation 2014.

LICENSE: MIT (opensource.org/licenses/MIT)

Public Class Methods

[](service) click to toggle source
# File lib/fog/bin/softlayer.rb, line 28
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
class_for(key) click to toggle source
# File lib/fog/bin/softlayer.rb, line 10
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
services() click to toggle source
# File lib/fog/bin/softlayer.rb, line 48
def services
  Fog::Softlayer.services
end