2010-05-24 10:29:01 -07:00
|
|
|
module Bluebox
|
|
|
|
class << self
|
2010-05-24 11:03:52 -07:00
|
|
|
|
2010-05-24 10:29:01 -07:00
|
|
|
if Fog.credentials[:bluebox_api_key]
|
|
|
|
|
|
|
|
def initialized?
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
def [](service)
|
|
|
|
@@connections ||= Hash.new do |hash, key|
|
|
|
|
credentials = Fog.credentials.reject do |k,v|
|
2010-06-02 09:06:26 -07:00
|
|
|
![:bluebox_api_key, :bluebox_customer_id].include?(k)
|
2010-05-24 10:29:01 -07:00
|
|
|
end
|
|
|
|
hash[key] = case key
|
2010-05-24 11:03:52 -07:00
|
|
|
when :blocks
|
2010-05-24 10:29:01 -07:00
|
|
|
Fog::Bluebox.new(credentials)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
@@connections[service]
|
|
|
|
end
|
|
|
|
|
|
|
|
def flavors
|
2010-05-24 11:03:52 -07:00
|
|
|
self[:blocks].flavors
|
2010-05-24 10:29:01 -07:00
|
|
|
end
|
|
|
|
|
|
|
|
def images
|
2010-05-24 11:03:52 -07:00
|
|
|
self[:blocks].images
|
2010-05-24 10:29:01 -07:00
|
|
|
end
|
|
|
|
|
|
|
|
def servers
|
2010-05-24 11:03:52 -07:00
|
|
|
self[:blocks].servers
|
2010-05-24 10:29:01 -07:00
|
|
|
end
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
def initialized?
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|