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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.providers
|
||||||
|
Fog.services[:cdn]
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -55,9 +55,13 @@ module Fog
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.providers
|
||||||
|
Fog.services[:compute]
|
||||||
|
end
|
||||||
|
|
||||||
def self.servers
|
def self.servers
|
||||||
servers = []
|
servers = []
|
||||||
for provider in [:aws, :bluebox, :brightbox, :ecloud, :gogrid, :linode, :newservers, :ninefold, :rackspace, :slicehost, :stormondemand, :virtualbox, :voxel]
|
for provider in self.providers
|
||||||
begin
|
begin
|
||||||
servers.concat(self[provider].servers)
|
servers.concat(self[provider].servers)
|
||||||
rescue # ignore any missing credentials/etc
|
rescue # ignore any missing credentials/etc
|
||||||
|
|
|
@ -6,7 +6,9 @@ module Fog
|
||||||
end
|
end
|
||||||
|
|
||||||
def service(new_service, path)
|
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)
|
require File.join('fog', path)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
module Fog
|
module Fog
|
||||||
|
|
||||||
|
def self.services
|
||||||
|
@services ||= {}
|
||||||
|
end
|
||||||
|
|
||||||
class Service
|
class Service
|
||||||
|
|
||||||
class Error < Fog::Errors::Error; end
|
class Error < Fog::Errors::Error; end
|
||||||
|
|
|
@ -34,9 +34,13 @@ module Fog
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.providers
|
||||||
|
Fog.services[:dns]
|
||||||
|
end
|
||||||
|
|
||||||
def self.zones
|
def self.zones
|
||||||
zones = []
|
zones = []
|
||||||
for provider in [:aws, :bluebox, :dnsimple, :dnsmadeeasy, :linode, :slicehost, :zerigo]
|
for provider in self.providers
|
||||||
begin
|
begin
|
||||||
zones.concat(self[provider].zones)
|
zones.concat(self[provider].zones)
|
||||||
rescue # ignore any missing credentials/etc
|
rescue # ignore any missing credentials/etc
|
||||||
|
|
|
@ -30,7 +30,7 @@ module Fog
|
||||||
|
|
||||||
def self.directories
|
def self.directories
|
||||||
directories = []
|
directories = []
|
||||||
for provider in [:aws, :google, :local, :ninefold, :rackspace]
|
for provider in self.providers
|
||||||
begin
|
begin
|
||||||
directories.concat(self[provider].directories)
|
directories.concat(self[provider].directories)
|
||||||
rescue # ignore any missing credentials/etc
|
rescue # ignore any missing credentials/etc
|
||||||
|
@ -73,5 +73,9 @@ module Fog
|
||||||
metadata
|
metadata
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.providers
|
||||||
|
Fog.services[:storage]
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue