2011-06-16 17:14:19 -04:00
|
|
|
class HP < Fog::Bin
|
|
|
|
class << self
|
|
|
|
|
|
|
|
def class_for(key)
|
|
|
|
case key
|
|
|
|
when :cdn
|
2011-10-17 15:25:07 -04:00
|
|
|
Fog::CDN::HP
|
2011-06-16 17:14:19 -04:00
|
|
|
when :compute
|
2011-10-17 15:25:07 -04:00
|
|
|
Fog::Compute::HP
|
2011-06-16 17:14:19 -04:00
|
|
|
when :storage
|
2011-10-17 15:25:07 -04:00
|
|
|
Fog::Storage::HP
|
2012-07-09 15:24:07 -04:00
|
|
|
when :block_storage
|
|
|
|
Fog::BlockStorage::HP
|
2011-06-16 17:14:19 -04:00
|
|
|
else
|
2011-10-17 15:25:07 -04:00
|
|
|
# @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, "Unrecognized #{self} service: #{key}"
|
2011-06-16 17:14:19 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def [](service)
|
|
|
|
@@connections ||= Hash.new do |hash, key|
|
|
|
|
hash[key] = case key
|
|
|
|
when :cdn
|
2011-10-17 15:25:07 -04:00
|
|
|
Fog::Logger.warning("HP[:cdn] is deprecated, use CDN[:hp] instead")
|
2011-06-16 17:14:19 -04:00
|
|
|
Fog::CDN.new(:provider => 'HP')
|
|
|
|
when :compute
|
2011-10-17 15:25:07 -04:00
|
|
|
Fog::Logger.warning("HP[:compute] is deprecated, use Compute[:hp] instead")
|
2011-06-16 17:14:19 -04:00
|
|
|
Fog::Compute.new(:provider => 'HP')
|
|
|
|
when :storage
|
2011-10-17 15:25:07 -04:00
|
|
|
Fog::Logger.warning("HP[:storage] is deprecated, use Storage[:hp] instead")
|
2011-06-16 17:14:19 -04:00
|
|
|
Fog::Storage.new(:provider => 'HP')
|
2012-07-09 15:24:07 -04:00
|
|
|
when :block_storage
|
|
|
|
Fog::Logger.warning("HP[:block_storage] is deprecated, use BlockStorage[:hp] instead")
|
|
|
|
Fog::BlockStorage.new(:provider => 'HP')
|
2011-06-16 17:14:19 -04:00
|
|
|
else
|
|
|
|
raise ArgumentError, "Unrecognized service: #{key.inspect}"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
@@connections[service]
|
|
|
|
end
|
|
|
|
|
|
|
|
def services
|
|
|
|
Fog::HP.services
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|