2010-09-21 11:11:15 -07:00
|
|
|
class Terremark < Fog::Bin
|
2010-02-11 21:41:37 -08:00
|
|
|
class << self
|
|
|
|
|
2010-09-21 11:11:15 -07:00
|
|
|
def available?
|
|
|
|
Fog::Terremark::VCLOUD_OPTIONS.all? {|requirement| Fog.credentials.include?(requirement)}
|
|
|
|
end
|
2010-02-11 21:41:37 -08:00
|
|
|
|
2010-09-21 11:11:15 -07:00
|
|
|
def terremark_service(service)
|
|
|
|
case service
|
|
|
|
when :vcloud
|
|
|
|
Fog::Terremark::Vcloud
|
|
|
|
else
|
|
|
|
raise "Unsupported Terremark Service"
|
2010-04-18 16:27:22 -07:00
|
|
|
end
|
2010-09-21 11:11:15 -07:00
|
|
|
end
|
2010-04-18 16:27:22 -07:00
|
|
|
|
2010-09-21 11:11:15 -07:00
|
|
|
def [](service)
|
|
|
|
@@connections ||= Hash.new do |hash, key|
|
|
|
|
credentials = Fog.credentials.reject do |k,v|
|
|
|
|
case key
|
|
|
|
when :vcloud
|
|
|
|
!Fog::Terremark::VCLOUD_OPTIONS.include?(k)
|
2010-04-16 00:20:02 -07:00
|
|
|
end
|
2010-02-11 21:41:37 -08:00
|
|
|
end
|
2010-09-21 11:11:15 -07:00
|
|
|
hash[key] = terremark_service(key).new(credentials)
|
2010-02-11 21:41:37 -08:00
|
|
|
end
|
2010-09-21 11:11:15 -07:00
|
|
|
@@connections[service]
|
2010-02-11 21:41:37 -08:00
|
|
|
end
|
2010-09-21 11:11:15 -07:00
|
|
|
|
2010-02-11 21:41:37 -08:00
|
|
|
end
|
|
|
|
end
|