2010-09-21 14:11:15 -04:00
|
|
|
class Slicehost < Fog::Bin
|
2010-02-12 00:41:37 -05:00
|
|
|
class << self
|
|
|
|
|
2010-12-06 22:49:58 -05:00
|
|
|
def class_for(key)
|
|
|
|
case key
|
|
|
|
when :compute, :slices
|
|
|
|
Fog::Slicehost::Compute
|
2010-12-21 18:24:14 -05:00
|
|
|
when :dns
|
|
|
|
Fog::Slicehost::DNS
|
2010-12-06 22:49:58 -05:00
|
|
|
else
|
|
|
|
raise ArgumentError, "Unrecognized service: #{key}"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2010-09-21 14:11:15 -04:00
|
|
|
def [](service)
|
|
|
|
@@connections ||= Hash.new do |hash, key|
|
2010-12-06 22:49:58 -05:00
|
|
|
if key == :slices
|
2010-09-21 14:11:15 -04:00
|
|
|
location = caller.first
|
|
|
|
warning = "[yellow][WARN] Slicehost[:blocks] is deprecated, use Bluebox[:compute] instead[/]"
|
|
|
|
warning << " [light_black](" << location << ")[/] "
|
|
|
|
Formatador.display_line(warning)
|
2010-02-12 00:41:37 -05:00
|
|
|
end
|
2011-01-14 13:41:12 -05:00
|
|
|
hash[key] = case key
|
2011-01-12 20:55:24 -05:00
|
|
|
when :compute, :slices
|
|
|
|
Fog::Compute.new(:provider => 'Slicehost')
|
|
|
|
when :dns
|
|
|
|
Fog::DNS.new(:provider => 'Slicehost')
|
|
|
|
else
|
|
|
|
raise ArgumentError, "Unrecognized service: #{service}"
|
|
|
|
end
|
2010-02-12 00:41:37 -05:00
|
|
|
end
|
2010-09-21 14:11:15 -04:00
|
|
|
@@connections[service]
|
|
|
|
end
|
2010-02-12 00:41:37 -05:00
|
|
|
|
2010-09-21 14:11:15 -04:00
|
|
|
def services
|
2010-12-23 18:36:08 -05:00
|
|
|
[:compute, :dns]
|
2010-02-12 00:41:37 -05:00
|
|
|
end
|
2010-09-21 14:11:15 -04:00
|
|
|
|
2010-02-12 00:41:37 -05:00
|
|
|
end
|
|
|
|
end
|