mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
2a9224cfa7
Added basic spec framework; changed class names to match the template fog seems to prefer Servers tests pass; create and delete implemented. Added an example script Properly handle a 409 response from the API Fixed BBG code to work with the new api endpoint changes; tweaks to the (currently nonexistent) reboot api call Implement the reboot command for blocks
57 lines
1.1 KiB
Ruby
57 lines
1.1 KiB
Ruby
require File.join(File.dirname(__FILE__), 'credentials')
|
|
|
|
module Fog
|
|
class << self
|
|
|
|
def services
|
|
services = []
|
|
[::AWS, ::Local, ::Rackspace, ::Slicehost, ::Terremark, ::Vcloud, ::Bluebox].each do |service|
|
|
if service.initialized?
|
|
services << service
|
|
end
|
|
end
|
|
services
|
|
end
|
|
|
|
def directories
|
|
directories = {}
|
|
services.each do |service|
|
|
if service.respond_to?(:directories)
|
|
directories[service] = service.directories
|
|
end
|
|
end
|
|
directories
|
|
end
|
|
|
|
def flavors
|
|
flavors = {}
|
|
services.each do |service|
|
|
if service.respond_to?(:flavors)
|
|
flavors[service] = service.flavors
|
|
end
|
|
end
|
|
flavors
|
|
end
|
|
|
|
def images
|
|
images = {}
|
|
services.each do |service|
|
|
if service.respond_to?(:images)
|
|
images[service] = service.images
|
|
end
|
|
end
|
|
images
|
|
end
|
|
|
|
def servers
|
|
servers = {}
|
|
services.each do |service|
|
|
if service.respond_to?(:servers)
|
|
servers[service] = service.servers
|
|
end
|
|
end
|
|
servers
|
|
end
|
|
|
|
end
|
|
end
|