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

requires and recognizes clauses for services now receives a block so that the declared parameters are applied to their Real implementation.

This commit is contained in:
Juris Galang 2010-12-06 20:00:04 -08:00 committed by geemus
parent 6f187b2f72
commit c37629e742
20 changed files with 37 additions and 47 deletions

View file

@ -2,8 +2,8 @@ module Fog
module AWS
class CDN < Fog::Service
requires :aws_access_key_id, :aws_secret_access_key
recognizes :host, :path, :port, :scheme, :version, :persistent
requires :aws_access_key_id, :aws_secret_access_key, &inject_parameter_specs
recognizes :host, :path, :port, :scheme, :version, :persistent, &inject_parameter_specs
model_path 'fog/aws/models/cdn'

View file

@ -2,8 +2,8 @@ module Fog
module AWS
class Compute < Fog::Service
requires :aws_access_key_id, :aws_secret_access_key
recognizes :endpoint, :region, :host, :path, :port, :scheme, :persistent
requires :aws_access_key_id, :aws_secret_access_key, &inject_parameter_specs
recognizes :endpoint, :region, :host, :path, :port, :scheme, :persistent, &inject_parameter_specs
model_path 'fog/aws/models/compute'
model :address

View file

@ -2,8 +2,8 @@ module Fog
module AWS
class ELB < Fog::Service
requires :aws_access_key_id, :aws_secret_access_key
recognizes :region, :host, :path, :port, :scheme, :persistent
requires :aws_access_key_id, :aws_secret_access_key, &inject_parameter_specs
recognizes :region, :host, :path, :port, :scheme, :persistent, &inject_parameter_specs
request_path 'fog/aws/requests/elb'
request :create_load_balancer

View file

@ -2,8 +2,8 @@ module Fog
module AWS
class IAM < Fog::Service
requires :aws_access_key_id, :aws_secret_access_key
recognizes :host, :path, :port, :scheme, :persistent
requires :aws_access_key_id, :aws_secret_access_key, &inject_parameter_specs
recognizes :host, :path, :port, :scheme, :persistent, &inject_parameter_specs
request_path 'fog/aws/requests/iam'
request :add_user_to_group

View file

@ -2,8 +2,8 @@ module Fog
module AWS
class SimpleDB < Fog::Service
requires :aws_access_key_id, :aws_secret_access_key
recognizes :host, :nil_string, :path, :port, :scheme, :persistent
requires :aws_access_key_id, :aws_secret_access_key, &inject_parameter_specs
recognizes :host, :nil_string, :path, :port, :scheme, :persistent, &inject_parameter_specs
request_path 'fog/aws/requests/simpledb'
request :batch_put_attributes

View file

@ -2,8 +2,8 @@ module Fog
module AWS
class Storage < Fog::Service
requires :aws_access_key_id, :aws_secret_access_key
recognizes :endpoint, :region, :host, :path, :port, :scheme, :persistent
requires :aws_access_key_id, :aws_secret_access_key, &inject_parameter_specs
recognizes :endpoint, :region, :host, :path, :port, :scheme, :persistent, &inject_parameter_specs
model_path 'fog/aws/models/storage'
collection :directories

View file

@ -2,8 +2,8 @@ module Fog
module Bluebox
class Compute < Fog::Service
requires :bluebox_api_key, :bluebox_customer_id
recognizes :bluebox_host, :bluebox_port, :bluebox_scheme, :persistent
requires :bluebox_api_key, :bluebox_customer_id, &inject_parameter_specs
recognizes :bluebox_host, :bluebox_port, :bluebox_scheme, :persistent, &inject_parameter_specs
model_path 'fog/bluebox/models/compute'
model :flavor

View file

@ -4,8 +4,8 @@ module Fog
API_URL = "https://api.gb1.brightbox.com/"
requires :brightbox_client_id, :brightbox_secret
recognizes :brightbox_auth_url, :brightbox_api_url
requires :brightbox_client_id, :brightbox_secret, &inject_parameter_specs
recognizes :brightbox_auth_url, :brightbox_api_url, &inject_parameter_specs
model_path 'fog/brightbox/models/compute'
model :account # Singular resource, no collection

View file

@ -2,8 +2,8 @@ module Fog
module GoGrid
class Compute < Fog::Service
requires :go_grid_api_key, :go_grid_shared_secret
recognizes :host, :path, :port, :scheme, :persistent
requires :go_grid_api_key, :go_grid_shared_secret, &inject_parameter_specs
recognizes :host, :path, :port, :scheme, :persistent, &inject_parameter_specs
model_path 'fog/go_grid/models/compute'
model :image

View file

@ -2,8 +2,8 @@ module Fog
module Google
class Storage < Fog::Service
requires :google_storage_access_key_id, :google_storage_secret_access_key
recognizes :host, :port, :scheme, :persistent
requires :google_storage_access_key_id, :google_storage_secret_access_key, &inject_parameter_specs
recognizes :host, :port, :scheme, :persistent, &inject_parameter_specs
model_path 'fog/google/models/storage'
collection :directories

View file

@ -2,8 +2,8 @@ module Fog
module Linode
class Compute < Fog::Service
requires :linode_api_key
recognizes :port, :scheme, :persistent
requires :linode_api_key, &inject_parameter_specs
recognizes :port, :scheme, :persistent, &inject_parameter_specs
model_path 'fog/linode/models/compute'

View file

@ -2,7 +2,7 @@ module Fog
module Local
class Storage < Fog::Service
requires :local_root
requires :local_root, &inject_parameter_specs
model_path 'fog/local/models/storage'
collection :directories

View file

@ -4,8 +4,8 @@ module Fog
module NewServers
class Compute < Fog::Service
requires :new_servers_password, :new_servers_username
recognizes :host, :port, :scheme, :persistent
requires :new_servers_password, :new_servers_username, &inject_parameter_specs
recognizes :host, :port, :scheme, :persistent, &inject_parameter_specs
model_path 'fog/new_servers/models/compute'

View file

@ -1,7 +1,6 @@
module Fog
module Rackspace
include NamedParameters
extend Fog::Provider
service_path 'fog/rackspace'
@ -11,11 +10,6 @@ module Fog
service 'servers'
service 'storage'
# NOTE: might be better to rely on the caller alone to enforce parameter
# requirements...
has_named_parameters :'self.authenticate',
:required => [ :rackspace_api_key, :rackspace_username ],
:optional => [ :rackspace_auth_url ]
def self.authenticate(options)
rackspace_auth_url = options[:rackspace_auth_url] || "auth.api.rackspacecloud.com"
connection = Fog::Connection.new("https://" + rackspace_auth_url)

View file

@ -2,10 +2,8 @@ module Fog
module Rackspace
class CDN < Fog::Service
requires :rackspace_api_key, :rackspace_username
# NOTE: recognizes clause delegates to Fog::Rackspace.authenticate's so
# we also declare those parameters that the authenticate expects...
recognizes :rackspace_auth_url, :persistent
requires :rackspace_api_key, :rackspace_username, &inject_parameter_specs
recognizes :rackspace_auth_url, :persistent, &inject_parameter_specs
model_path 'fog/rackspace/models/cdn'

View file

@ -2,10 +2,8 @@ module Fog
module Rackspace
class Compute < Fog::Service
requires :rackspace_api_key, :rackspace_username
# NOTE: recognizes clause delegates to Fog::Rackspace.authenticate's so
# we also declare those parameters that the authenticate expects...
recognizes :rackspace_auth_url, :persistent
requires :rackspace_api_key, :rackspace_username, &inject_parameter_specs
recognizes :rackspace_auth_url, :persistent, &inject_parameter_specs
model_path 'fog/rackspace/models/compute'
model :flavor

View file

@ -2,10 +2,8 @@ module Fog
module Rackspace
class Storage < Fog::Service
requires :rackspace_api_key, :rackspace_username
# NOTE: recognizes clause delegates to Fog::Rackspace.authenticate's so
# we also declare those parameters that the authenticate expects...
recognizes :rackspace_auth_url, :persistent
requires :rackspace_api_key, :rackspace_username, &inject_parameter_specs
recognizes :rackspace_auth_url, :persistent, &inject_parameter_specs
model_path 'fog/rackspace/models/storage'
model :directory

View file

@ -2,8 +2,8 @@ module Fog
module Slicehost
class Compute < Fog::Service
requires :slicehost_password
recognizes :host, :port, :scheme, :persistent
requires :slicehost_password, &inject_parameter_specs
recognizes :host, :port, :scheme, :persistent, &inject_parameter_specs
model_path 'fog/slicehost/models/compute'
model :flavor

View file

@ -32,6 +32,8 @@ module Fog
end
class Real
# NOTE: When this vbecomes a service, take care to pass the &inject_parameter_specs
# block on call to requires and recognizes
requires :terremark_ecloud_password, :terremark_ecloud_username
recognizes :host, :path, :port, :scheme, :persistent

View file

@ -19,8 +19,8 @@ end
module Fog
class Vcloud < Fog::Service
requires :username, :password, :module, :versions_uri
recognizes :version, :persistent
requires :username, :password, :module, :versions_uri, &inject_parameter_specs
recognizes :version, :persistent, &inject_parameter_specs
model_path 'fog/vcloud/models'
model :vdc