mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
add a provider module, working toward conistency and discoverability from top down
This commit is contained in:
parent
6d6eafbb2b
commit
e400c50860
4 changed files with 33 additions and 8 deletions
|
@ -24,6 +24,7 @@ require 'fog/errors'
|
|||
require 'fog/hmac'
|
||||
require 'fog/model'
|
||||
require 'fog/parser'
|
||||
require 'fog/provider'
|
||||
require 'fog/service'
|
||||
require 'fog/ssh'
|
||||
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
require 'fog/aws/ec2.rb'
|
||||
require 'fog/aws/elb.rb'
|
||||
require 'fog/aws/s3'
|
||||
require 'fog/aws/simpledb'
|
||||
|
||||
module Fog
|
||||
module AWS
|
||||
|
||||
extend Fog::Provider
|
||||
|
||||
service_path 'fog/aws'
|
||||
service 'ec2'
|
||||
service 'elb'
|
||||
service 's3'
|
||||
service 'simpledb'
|
||||
|
||||
def self.indexed_param(key, values, offset = 0)
|
||||
params = {}
|
||||
unless key.include?('%d')
|
||||
|
|
18
lib/fog/provider.rb
Normal file
18
lib/fog/provider.rb
Normal file
|
@ -0,0 +1,18 @@
|
|||
module Fog
|
||||
module Provider
|
||||
|
||||
def service_path(new_path)
|
||||
@service_path = new_path
|
||||
end
|
||||
|
||||
def service(new_service)
|
||||
services << new_service
|
||||
require File.join(@service_path, new_service.to_s)
|
||||
end
|
||||
|
||||
def services
|
||||
@services ||= []
|
||||
end
|
||||
|
||||
end
|
||||
end
|
|
@ -1,9 +1,12 @@
|
|||
require 'fog/rackspace/files'
|
||||
require 'fog/rackspace/servers'
|
||||
|
||||
module Fog
|
||||
module Rackspace
|
||||
|
||||
extend Fog::Provider
|
||||
|
||||
service_path 'fog/rackspace'
|
||||
service 'files'
|
||||
service 'servers'
|
||||
|
||||
def self.authenticate(options)
|
||||
rackspace_auth_url = options[:rackspace_auth_url] || "auth.api.rackspacecloud.com"
|
||||
connection = Fog::Connection.new("https://" + rackspace_auth_url)
|
||||
|
|
Loading…
Reference in a new issue