Class: Softlayer

Inherits:
Fog::Bin show all
Defined in:
lib/fog/bin/softlayer.rb

Overview

Author

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

© Copyright IBM Corporation 2014.

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

Class Method Summary collapse

Methods inherited from Fog::Bin

available?, collections

Class Method Details

.[](service) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# 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) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# 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

.servicesObject



48
49
50
# File 'lib/fog/bin/softlayer.rb', line 48

def services
  Fog::Softlayer.services
end