2010-09-29 16:22:30 -04:00
|
|
|
require 'fog/core/credentials'
|
2010-06-23 20:22:44 -04:00
|
|
|
|
2010-02-12 00:41:37 -05:00
|
|
|
module Fog
|
|
|
|
class << self
|
|
|
|
|
2011-05-24 20:31:05 -04:00
|
|
|
def available_providers
|
2011-10-20 11:52:36 -04:00
|
|
|
@available_providers ||= Fog.providers.values.select {|provider| Kernel.const_get(provider).available?}.sort
|
2011-02-09 19:39:37 -05:00
|
|
|
end
|
|
|
|
|
2010-02-12 00:41:37 -05:00
|
|
|
end
|
2010-09-21 14:11:15 -04:00
|
|
|
|
|
|
|
class Bin
|
|
|
|
class << self
|
|
|
|
|
|
|
|
def available?
|
|
|
|
availability = true
|
|
|
|
for service in services
|
|
|
|
begin
|
2010-12-06 22:49:58 -05:00
|
|
|
service = self.class_for(service)
|
|
|
|
availability &&= service.requirements.all? { |requirement| Fog.credentials.include?(requirement) }
|
|
|
|
rescue ArgumentError => e
|
2011-09-02 13:30:10 -04:00
|
|
|
Fog::Logger.warning(e.message)
|
2010-12-06 22:49:58 -05:00
|
|
|
availability = false
|
|
|
|
rescue => e
|
2010-09-21 14:11:15 -04:00
|
|
|
availability = false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
if availability
|
|
|
|
for service in services
|
2010-12-06 22:49:58 -05:00
|
|
|
for collection in self.class_for(service).collections
|
2010-09-21 18:57:27 -04:00
|
|
|
unless self.respond_to?(collection)
|
|
|
|
self.class_eval <<-EOS, __FILE__, __LINE__
|
|
|
|
def self.#{collection}
|
|
|
|
self[:#{service}].#{collection}
|
|
|
|
end
|
|
|
|
EOS
|
|
|
|
end
|
2010-09-21 14:11:15 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
availability
|
|
|
|
end
|
|
|
|
|
|
|
|
def collections
|
|
|
|
services.map {|service| self[service].collections}.flatten.sort_by {|service| service.to_s}
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2010-04-03 03:29:42 -04:00
|
|
|
end
|
2010-09-21 14:11:15 -04:00
|
|
|
|
2011-01-07 18:41:51 -05:00
|
|
|
require 'fog/bin/aws'
|
|
|
|
require 'fog/bin/bluebox'
|
|
|
|
require 'fog/bin/brightbox'
|
2011-08-02 11:58:18 -04:00
|
|
|
require 'fog/bin/cloudstack'
|
2011-09-30 17:46:05 -04:00
|
|
|
require 'fog/bin/clodo'
|
2011-03-09 20:03:15 -05:00
|
|
|
require 'fog/bin/dnsimple'
|
2011-05-29 19:41:27 -04:00
|
|
|
require 'fog/bin/dnsmadeeasy'
|
2011-07-14 20:22:43 -04:00
|
|
|
require 'fog/bin/dynect'
|
2011-02-17 13:44:46 -05:00
|
|
|
require 'fog/bin/ecloud'
|
2011-08-10 09:03:51 -04:00
|
|
|
require 'fog/bin/glesys'
|
2011-01-07 18:41:51 -05:00
|
|
|
require 'fog/bin/go_grid'
|
|
|
|
require 'fog/bin/google'
|
2011-06-15 02:10:54 -04:00
|
|
|
require 'fog/bin/hp'
|
2011-12-02 13:27:44 -05:00
|
|
|
require 'fog/bin/ibm'
|
2012-02-10 10:10:49 -05:00
|
|
|
require 'fog/bin/joyent'
|
2011-06-28 09:47:16 -04:00
|
|
|
require 'fog/bin/libvirt'
|
2011-01-07 18:41:51 -05:00
|
|
|
require 'fog/bin/linode'
|
|
|
|
require 'fog/bin/local'
|
2012-03-01 21:54:49 -05:00
|
|
|
require 'fog/bin/bare_metal_cloud'
|
2011-04-16 20:43:30 -04:00
|
|
|
require 'fog/bin/ninefold'
|
2011-01-07 18:41:51 -05:00
|
|
|
require 'fog/bin/rackspace'
|
2011-09-29 14:10:21 -04:00
|
|
|
require 'fog/bin/openstack'
|
2012-02-02 07:58:46 -05:00
|
|
|
require 'fog/bin/ovirt'
|
2011-04-27 21:49:56 -04:00
|
|
|
require 'fog/bin/stormondemand'
|
2011-01-07 18:41:51 -05:00
|
|
|
require 'fog/bin/terremark'
|
2011-05-23 21:17:16 -04:00
|
|
|
require 'fog/bin/vcloud'
|
2011-03-09 20:03:15 -05:00
|
|
|
require 'fog/bin/virtual_box'
|
2011-09-16 08:57:00 -04:00
|
|
|
require 'fog/bin/vmfusion'
|
2011-08-29 23:04:04 -04:00
|
|
|
require 'fog/bin/vsphere'
|
2011-01-19 15:47:35 -05:00
|
|
|
require 'fog/bin/voxel'
|
2012-04-02 07:25:03 -04:00
|
|
|
require 'fog/bin/xenserver'
|
2011-01-07 18:41:51 -05:00
|
|
|
require 'fog/bin/zerigo'
|