mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[misc] provide #providers for shared services
This commit is contained in:
parent
368ce6ab0f
commit
87b07ba117
6 changed files with 27 additions and 4 deletions
|
@ -19,5 +19,9 @@ module Fog
|
|||
end
|
||||
end
|
||||
|
||||
def self.providers
|
||||
Fog.services[:cdn]
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -55,9 +55,13 @@ module Fog
|
|||
end
|
||||
end
|
||||
|
||||
def self.providers
|
||||
Fog.services[:compute]
|
||||
end
|
||||
|
||||
def self.servers
|
||||
servers = []
|
||||
for provider in [:aws, :bluebox, :brightbox, :ecloud, :gogrid, :linode, :newservers, :ninefold, :rackspace, :slicehost, :stormondemand, :virtualbox, :voxel]
|
||||
for provider in self.providers
|
||||
begin
|
||||
servers.concat(self[provider].servers)
|
||||
rescue # ignore any missing credentials/etc
|
||||
|
|
|
@ -6,7 +6,9 @@ module Fog
|
|||
end
|
||||
|
||||
def service(new_service, path)
|
||||
services << new_service
|
||||
Fog.services[new_service] ||= []
|
||||
Fog.services[new_service] << self.to_s.split('::').last.downcase.to_sym
|
||||
self.services << new_service
|
||||
require File.join('fog', path)
|
||||
end
|
||||
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
module Fog
|
||||
|
||||
def self.services
|
||||
@services ||= {}
|
||||
end
|
||||
|
||||
class Service
|
||||
|
||||
class Error < Fog::Errors::Error; end
|
||||
|
|
|
@ -34,9 +34,13 @@ module Fog
|
|||
end
|
||||
end
|
||||
|
||||
def self.providers
|
||||
Fog.services[:dns]
|
||||
end
|
||||
|
||||
def self.zones
|
||||
zones = []
|
||||
for provider in [:aws, :bluebox, :dnsimple, :dnsmadeeasy, :linode, :slicehost, :zerigo]
|
||||
for provider in self.providers
|
||||
begin
|
||||
zones.concat(self[provider].zones)
|
||||
rescue # ignore any missing credentials/etc
|
||||
|
|
|
@ -30,7 +30,7 @@ module Fog
|
|||
|
||||
def self.directories
|
||||
directories = []
|
||||
for provider in [:aws, :google, :local, :ninefold, :rackspace]
|
||||
for provider in self.providers
|
||||
begin
|
||||
directories.concat(self[provider].directories)
|
||||
rescue # ignore any missing credentials/etc
|
||||
|
@ -73,5 +73,9 @@ module Fog
|
|||
metadata
|
||||
end
|
||||
|
||||
def self.providers
|
||||
Fog.services[:storage]
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue