1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[core] more convenient accessors

closes #515
This commit is contained in:
geemus 2011-09-22 19:00:48 -05:00
parent aa1262a6ba
commit aa06767a89
25 changed files with 53 additions and 52 deletions

View file

@ -5,20 +5,20 @@ module Fog
extend Fog::Provider
service(:auto_scaling, 'aws/auto_scaling')
service(:cdn, 'aws/cdn')
service(:compute, 'aws/compute')
service(:cloud_formation, 'aws/cloud_formation')
service(:cloud_watch, 'aws/cloud_watch')
service(:dns, 'aws/dns')
service(:elb, 'aws/elb')
service(:iam, 'aws/iam')
service(:rds, 'aws/rds')
service(:ses, 'aws/ses')
service(:simpledb, 'aws/simpledb')
service(:sns, 'aws/sns')
service(:sqs, 'aws/sqs')
service(:storage, 'aws/storage')
service(:auto_scaling, 'aws/auto_scaling', 'AutoScaling')
service(:cdn, 'aws/cdn', 'CDN')
service(:compute, 'aws/compute', 'Compute')
service(:cloud_formation, 'aws/cloud_formation', 'CloudFormation')
service(:cloud_watch, 'aws/cloud_watch', 'CloudWatch')
service(:dns, 'aws/dns', 'DNS')
service(:elb, 'aws/elb', 'ELB')
service(:iam, 'aws/iam', 'IAM')
service(:rds, 'aws/rds', 'RDS')
service(:ses, 'aws/ses', 'SES')
service(:simpledb, 'aws/simpledb', 'SimpleDB')
service(:sns, 'aws/sns', 'SNS')
service(:sqs, 'aws/sqs', 'SQS')
service(:storage, 'aws/storage', 'Storage')
def self.indexed_param(key, values)
params = {}

View file

@ -5,8 +5,8 @@ module Fog
extend Fog::Provider
service(:compute, 'bluebox/compute')
service(:dns, 'bluebox/dns')
service(:compute, 'bluebox/compute', 'Compute')
service(:dns, 'bluebox/dns', 'DNS')
end
end

View file

@ -4,7 +4,7 @@ module Fog
module Brightbox
extend Fog::Provider
service(:compute, 'brightbox/compute')
service(:compute, 'brightbox/compute', 'Compute')
end
end

View file

@ -10,19 +10,20 @@ module Fog
Fog.providers << base.to_s.split('::').last
end
def service(new_service, path)
def [](service_key)
eval(@services_registry[service_key]).new
end
def service(new_service, path, constant_string)
Fog.services[new_service] ||= []
Fog.services[new_service] |= [self.to_s.split('::').last.downcase.to_sym]
self.services |= [new_service]
@services_registry ||= {}
@services_registry[new_service] = [self.to_s, constant_string].join('::')
require File.join('fog', path)
end
def services
@services ||= []
end
def services=(new_services)
@services = new_services
@services_registry.keys
end
end

View file

@ -5,7 +5,7 @@ module Fog
extend Fog::Provider
service(:dns, 'dnsimple/dns')
service(:dns, 'dnsimple/dns', 'DNS')
end
end

View file

@ -5,7 +5,7 @@ module Fog
extend Fog::Provider
service(:dns, 'dnsmadeeasy/dns')
service(:dns, 'dnsmadeeasy/dns', 'DNS')
end
end

View file

@ -7,7 +7,7 @@ module Fog
module Dynect
extend Fog::Provider
service(:dns, 'dynect/dns')
service(:dns, 'dynect/dns', 'DNS')
class Mock
def self.job_id

View file

@ -5,7 +5,7 @@ module Fog
extend Fog::Provider
service(:compute, 'ecloud/compute')
service(:compute, 'ecloud/compute', 'Compute')
end
end

View file

@ -5,7 +5,7 @@ module Fog
extend Fog::Provider
service(:compute, 'glesys/compute')
service(:compute, 'glesys/compute', 'Compute')
end
end

View file

@ -5,7 +5,7 @@ module Fog
extend Fog::Provider
service(:compute, 'go_grid/compute')
service(:compute, 'go_grid/compute', 'Compute')
end
end

View file

@ -5,7 +5,7 @@ module Fog
extend Fog::Provider
service(:storage, 'google/storage')
service(:storage, 'google/storage', 'Storage')
class Mock

View file

@ -5,7 +5,7 @@ module Fog
extend Fog::Provider
service(:compute, 'libvirt/compute')
service(:compute, 'libvirt/compute', 'Compute')
end
end

View file

@ -3,8 +3,8 @@ require(File.expand_path(File.join(File.dirname(__FILE__), 'core')))
module Fog
module Linode
extend Fog::Provider
service(:compute, 'linode/compute')
service(:dns, 'linode/dns')
service(:compute, 'linode/compute', 'Compute')
service(:dns, 'linode/dns', 'DNS')
end
end

View file

@ -5,7 +5,7 @@ module Fog
extend Fog::Provider
service(:storage, 'local/storage')
service(:storage, 'local/storage', 'Storage')
end
end

View file

@ -5,7 +5,7 @@ module Fog
extend Fog::Provider
service(:compute, 'new_servers/compute')
service(:compute, 'new_servers/compute', 'Compute')
end
end

View file

@ -5,8 +5,8 @@ module Fog
extend Fog::Provider
service(:compute, 'ninefold/compute')
service(:storage, 'ninefold/storage')
service(:compute, 'ninefold/compute', 'Compute')
service(:storage, 'ninefold/storage', 'Storage')
end
end

View file

@ -42,11 +42,11 @@ module Fog
end
end
service(:cdn, 'rackspace/cdn')
service(:compute, 'rackspace/compute')
service(:dns, 'rackspace/dns')
service(:storage, 'rackspace/storage')
service(:load_balancers, 'rackspace/load_balancers')
service(:cdn, 'rackspace/cdn', 'CDN')
service(:compute, 'rackspace/compute', 'Compute')
service(:dns, 'rackspace/dns', 'DNS')
service(:storage, 'rackspace/storage', 'Storage')
service(:load_balancers, 'rackspace/load_balancers', 'LoadBalancers')
def self.authenticate(options, connection_options = {})
rackspace_auth_url = options[:rackspace_auth_url] || "auth.api.rackspacecloud.com"

View file

@ -5,8 +5,8 @@ module Fog
extend Fog::Provider
service(:compute, 'slicehost/compute')
service(:dns, 'slicehost/dns')
service(:compute, 'slicehost/compute', 'Compute')
service(:dns, 'slicehost/dns', 'DNS')
end
end

View file

@ -5,7 +5,7 @@ module Fog
extend Fog::Provider
service(:compute, 'storm_on_demand/compute')
service(:compute, 'storm_on_demand/compute', 'Compute')
end
end

View file

@ -5,7 +5,7 @@ module Fog
extend Fog::Provider
service(:compute, 'vcloud/compute')
service(:compute, 'vcloud/compute', 'Compute')
end
end

View file

@ -5,7 +5,7 @@ module Fog
extend Fog::Provider
service(:compute, 'virtual_box/compute')
service(:compute, 'virtual_box/compute', 'Compute')
end
end

View file

@ -5,7 +5,7 @@ module Fog
extend Fog::Provider
service(:compute, 'vmfusion/compute')
service(:compute, 'vmfusion/compute', 'Compute')
end
end

View file

@ -6,7 +6,7 @@ module Fog
extend Fog::Provider
service(:compute, 'voxel/compute')
service(:compute, 'voxel/compute', 'Compute')
def self.create_signature(secret, options)
to_sign = options.keys.map { |k| k.to_s }.sort.map { |k| "#{k}#{options[k.to_sym]}" }.join("")

View file

@ -11,7 +11,7 @@ module Fog
class NotFound < ServiceError; end
end
service(:compute, 'vsphere/compute')
service(:compute, 'vsphere/compute', 'Compute')
end
end

View file

@ -5,7 +5,7 @@ module Fog
extend Fog::Provider
service(:dns, 'zerigo/dns')
service(:dns, 'zerigo/dns', 'DNS')
end
end