fog 0.3.29 → 0.3.30
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +4 -4
- data/fog.gemspec +3 -3
- data/lib/fog.rb +2 -2
- data/lib/fog/aws/bin.rb +26 -16
- data/lib/fog/aws/cdn.rb +2 -2
- data/lib/fog/aws/compute.rb +2 -2
- data/lib/fog/aws/elb.rb +2 -2
- data/lib/fog/aws/iam.rb +2 -2
- data/lib/fog/aws/simpledb.rb +2 -2
- data/lib/fog/aws/storage.rb +2 -2
- data/lib/fog/bluebox/bin.rb +22 -16
- data/lib/fog/bluebox/compute.rb +2 -2
- data/lib/fog/brightbox/bin.rb +10 -4
- data/lib/fog/brightbox/compute.rb +2 -2
- data/lib/fog/core/bin.rb +8 -4
- data/lib/fog/core/service.rb +21 -1
- data/lib/fog/go_grid/bin.rb +11 -5
- data/lib/fog/go_grid/compute.rb +2 -2
- data/lib/fog/google/bin.rb +10 -5
- data/lib/fog/google/parsers/storage/access_control_list.rb +1 -1
- data/lib/fog/google/storage.rb +2 -2
- data/lib/fog/linode/bin.rb +11 -5
- data/lib/fog/linode/compute.rb +2 -2
- data/lib/fog/local/bin.rb +11 -5
- data/lib/fog/local/storage.rb +1 -1
- data/lib/fog/new_servers/bin.rb +11 -5
- data/lib/fog/new_servers/compute.rb +2 -2
- data/lib/fog/rackspace.rb +0 -6
- data/lib/fog/rackspace/bin.rb +18 -8
- data/lib/fog/rackspace/cdn.rb +2 -4
- data/lib/fog/rackspace/compute.rb +2 -4
- data/lib/fog/rackspace/storage.rb +2 -4
- data/lib/fog/slicehost/bin.rb +11 -5
- data/lib/fog/slicehost/compute.rb +2 -2
- data/lib/fog/terremark/ecloud.rb +2 -0
- data/lib/fog/terremark/parsers/shared/get_organization.rb +7 -2
- data/lib/fog/terremark/parsers/shared/get_organizations.rb +6 -1
- data/lib/fog/terremark/parsers/shared/get_vdc.rb +18 -3
- data/lib/fog/vcloud.rb +2 -2
- data/tests/google/requests/storage/bucket_tests.rb +7 -6
- metadata +6 -6
data/Gemfile.lock
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
fog (0.3.
|
4
|
+
fog (0.3.30)
|
5
5
|
builder
|
6
6
|
excon (>= 0.2.8)
|
7
7
|
formatador (>= 0.0.16)
|
8
8
|
json
|
9
9
|
mime-types
|
10
|
-
named-parameters (
|
10
|
+
named-parameters (>= 0.0.17)
|
11
11
|
net-ssh (>= 2.0.23)
|
12
12
|
nokogiri (>= 1.4.4)
|
13
13
|
ruby-hmac
|
@@ -22,7 +22,7 @@ GEM
|
|
22
22
|
formatador (>= 0.0.12)
|
23
23
|
json (1.4.6)
|
24
24
|
mime-types (1.16)
|
25
|
-
named-parameters (0.0.
|
25
|
+
named-parameters (0.0.17)
|
26
26
|
net-ssh (2.0.23)
|
27
27
|
nokogiri (1.4.4)
|
28
28
|
rake (0.8.7)
|
@@ -42,7 +42,7 @@ DEPENDENCIES
|
|
42
42
|
formatador (>= 0.0.16)
|
43
43
|
json
|
44
44
|
mime-types
|
45
|
-
named-parameters (
|
45
|
+
named-parameters (>= 0.0.17)
|
46
46
|
net-ssh (>= 2.0.23)
|
47
47
|
nokogiri (>= 1.4.4)
|
48
48
|
rake
|
data/fog.gemspec
CHANGED
@@ -7,8 +7,8 @@ Gem::Specification.new do |s|
|
|
7
7
|
## If your rubyforge_project name is different, then edit it and comment out
|
8
8
|
## the sub! line in the Rakefile
|
9
9
|
s.name = 'fog'
|
10
|
-
s.version = '0.3.
|
11
|
-
s.date = '2010-12-
|
10
|
+
s.version = '0.3.30'
|
11
|
+
s.date = '2010-12-08'
|
12
12
|
s.rubyforge_project = 'fog'
|
13
13
|
|
14
14
|
## Make sure your summary is short. The description may be as long
|
@@ -47,7 +47,7 @@ Gem::Specification.new do |s|
|
|
47
47
|
s.add_dependency('formatador', '>=0.0.16')
|
48
48
|
s.add_dependency('json')
|
49
49
|
s.add_dependency('mime-types')
|
50
|
-
s.add_dependency('named-parameters', '
|
50
|
+
s.add_dependency('named-parameters', '>=0.0.17')
|
51
51
|
s.add_dependency('net-ssh', '>=2.0.23')
|
52
52
|
s.add_dependency('nokogiri', '>=1.4.4')
|
53
53
|
s.add_dependency('ruby-hmac')
|
data/lib/fog.rb
CHANGED
@@ -3,8 +3,8 @@ require 'base64'
|
|
3
3
|
require 'cgi'
|
4
4
|
require 'excon'
|
5
5
|
require 'formatador'
|
6
|
-
require 'named-parameters'
|
7
6
|
require 'time'
|
7
|
+
require 'named-parameters'
|
8
8
|
|
9
9
|
__DIR__ = File.dirname(__FILE__)
|
10
10
|
|
@@ -19,7 +19,7 @@ module Fog
|
|
19
19
|
@mocking = false
|
20
20
|
|
21
21
|
unless const_defined?(:VERSION)
|
22
|
-
VERSION = '0.3.
|
22
|
+
VERSION = '0.3.30'
|
23
23
|
end
|
24
24
|
|
25
25
|
module Mock
|
data/lib/fog/aws/bin.rb
CHANGED
@@ -1,35 +1,45 @@
|
|
1
1
|
class AWS < Fog::Bin
|
2
2
|
class << self
|
3
3
|
|
4
|
+
def class_for(key)
|
5
|
+
case key
|
6
|
+
when :cdn
|
7
|
+
Fog::AWS::CDN
|
8
|
+
when :compute, :ec2
|
9
|
+
Fog::AWS::Compute
|
10
|
+
when :elb
|
11
|
+
Fog::AWS::ELB
|
12
|
+
when :iam
|
13
|
+
Fog::AWS::IAM
|
14
|
+
when :sdb
|
15
|
+
Fog::AWS::SimpleDB
|
16
|
+
when :eu_storage, :s3, :storage
|
17
|
+
Fog::AWS::Storage
|
18
|
+
else
|
19
|
+
raise ArgumentError, "Unsupported #{self} service: #{key}"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
4
23
|
def [](service)
|
5
24
|
@@connections ||= Hash.new do |hash, key|
|
6
|
-
|
7
|
-
|
8
|
-
Fog::AWS::CDN.new
|
9
|
-
when :compute
|
10
|
-
Fog::AWS::Compute.new
|
25
|
+
klazz = class_for(key)
|
26
|
+
hash[key] = case key
|
11
27
|
when :ec2
|
12
28
|
location = caller.first
|
13
29
|
warning = "[yellow][WARN] AWS[:ec2] is deprecated, use AWS[:compute] instead[/]"
|
14
30
|
warning << " [light_black](" << location << ")[/] "
|
15
31
|
Formatador.display_line(warning)
|
16
|
-
|
17
|
-
when :elb
|
18
|
-
Fog::AWS::ELB.new
|
32
|
+
klazz.new
|
19
33
|
when :eu_storage
|
20
|
-
|
21
|
-
when :iam
|
22
|
-
Fog::AWS::IAM.new
|
23
|
-
when :sdb
|
24
|
-
Fog::AWS::SimpleDB.new
|
34
|
+
klazz.new(:region => 'eu-west-1')
|
25
35
|
when :s3
|
26
36
|
location = caller.first
|
27
37
|
warning = "[yellow][WARN] AWS[:s3] is deprecated, use AWS[:storage] instead[/]"
|
28
38
|
warning << " [light_black](" << location << ")[/] "
|
29
39
|
Formatador.display_line(warning)
|
30
|
-
|
31
|
-
|
32
|
-
|
40
|
+
klazz.new
|
41
|
+
else
|
42
|
+
klazz.new
|
33
43
|
end
|
34
44
|
end
|
35
45
|
@@connections[service]
|
data/lib/fog/aws/cdn.rb
CHANGED
@@ -2,8 +2,8 @@ module Fog
|
|
2
2
|
module AWS
|
3
3
|
class CDN < Fog::Service
|
4
4
|
|
5
|
-
requires :aws_access_key_id, :aws_secret_access_key
|
6
|
-
recognizes :host, :path, :port, :scheme, :version, :persistent
|
5
|
+
requires :aws_access_key_id, :aws_secret_access_key, &inject_parameter_specs
|
6
|
+
recognizes :host, :path, :port, :scheme, :version, :persistent, &inject_parameter_specs
|
7
7
|
|
8
8
|
model_path 'fog/aws/models/cdn'
|
9
9
|
|
data/lib/fog/aws/compute.rb
CHANGED
@@ -2,8 +2,8 @@ module Fog
|
|
2
2
|
module AWS
|
3
3
|
class Compute < Fog::Service
|
4
4
|
|
5
|
-
requires :aws_access_key_id, :aws_secret_access_key
|
6
|
-
recognizes :endpoint, :region, :host, :path, :port, :scheme, :persistent
|
5
|
+
requires :aws_access_key_id, :aws_secret_access_key, &inject_parameter_specs
|
6
|
+
recognizes :endpoint, :region, :host, :path, :port, :scheme, :persistent, &inject_parameter_specs
|
7
7
|
|
8
8
|
model_path 'fog/aws/models/compute'
|
9
9
|
model :address
|
data/lib/fog/aws/elb.rb
CHANGED
@@ -2,8 +2,8 @@ module Fog
|
|
2
2
|
module AWS
|
3
3
|
class ELB < Fog::Service
|
4
4
|
|
5
|
-
requires :aws_access_key_id, :aws_secret_access_key
|
6
|
-
recognizes :region, :host, :path, :port, :scheme, :persistent
|
5
|
+
requires :aws_access_key_id, :aws_secret_access_key, &inject_parameter_specs
|
6
|
+
recognizes :region, :host, :path, :port, :scheme, :persistent, &inject_parameter_specs
|
7
7
|
|
8
8
|
request_path 'fog/aws/requests/elb'
|
9
9
|
request :create_load_balancer
|
data/lib/fog/aws/iam.rb
CHANGED
@@ -2,8 +2,8 @@ module Fog
|
|
2
2
|
module AWS
|
3
3
|
class IAM < Fog::Service
|
4
4
|
|
5
|
-
requires :aws_access_key_id, :aws_secret_access_key
|
6
|
-
recognizes :host, :path, :port, :scheme, :persistent
|
5
|
+
requires :aws_access_key_id, :aws_secret_access_key, &inject_parameter_specs
|
6
|
+
recognizes :host, :path, :port, :scheme, :persistent, &inject_parameter_specs
|
7
7
|
|
8
8
|
request_path 'fog/aws/requests/iam'
|
9
9
|
request :add_user_to_group
|
data/lib/fog/aws/simpledb.rb
CHANGED
@@ -2,8 +2,8 @@ module Fog
|
|
2
2
|
module AWS
|
3
3
|
class SimpleDB < Fog::Service
|
4
4
|
|
5
|
-
requires :aws_access_key_id, :aws_secret_access_key
|
6
|
-
recognizes :host, :nil_string, :path, :port, :scheme, :persistent
|
5
|
+
requires :aws_access_key_id, :aws_secret_access_key, &inject_parameter_specs
|
6
|
+
recognizes :host, :nil_string, :path, :port, :scheme, :persistent, &inject_parameter_specs
|
7
7
|
|
8
8
|
request_path 'fog/aws/requests/simpledb'
|
9
9
|
request :batch_put_attributes
|
data/lib/fog/aws/storage.rb
CHANGED
@@ -2,8 +2,8 @@ module Fog
|
|
2
2
|
module AWS
|
3
3
|
class Storage < Fog::Service
|
4
4
|
|
5
|
-
requires :aws_access_key_id, :aws_secret_access_key
|
6
|
-
recognizes :endpoint, :region, :host, :path, :port, :scheme, :persistent
|
5
|
+
requires :aws_access_key_id, :aws_secret_access_key, &inject_parameter_specs
|
6
|
+
recognizes :endpoint, :region, :host, :path, :port, :scheme, :persistent, &inject_parameter_specs
|
7
7
|
|
8
8
|
model_path 'fog/aws/models/storage'
|
9
9
|
collection :directories
|
data/lib/fog/bluebox/bin.rb
CHANGED
@@ -1,25 +1,31 @@
|
|
1
1
|
class Bluebox < Fog::Bin
|
2
2
|
class << self
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
warning << " [light_black](" << location << ")[/] "
|
11
|
-
Formatador.display_line(warning)
|
12
|
-
Fog::Bluebox::Compute.new
|
13
|
-
when :compute
|
14
|
-
Fog::Bluebox::Compute.new
|
15
|
-
end
|
16
|
-
end
|
17
|
-
@@connections[service]
|
4
|
+
def class_for(key)
|
5
|
+
case key
|
6
|
+
when :blocks, :compute
|
7
|
+
Fog::Bluebox::Compute
|
8
|
+
else
|
9
|
+
raise ArgumentError, "Unsupported #{self} service: #{key}"
|
18
10
|
end
|
11
|
+
end
|
19
12
|
|
20
|
-
|
21
|
-
|
13
|
+
def [](service)
|
14
|
+
@@connections ||= Hash.new do |hash, key|
|
15
|
+
if key == :blocks
|
16
|
+
location = caller.first
|
17
|
+
warning = "[yellow][WARN] Bluebox[:blocks] is deprecated, use Bluebox[:compute] instead[/]"
|
18
|
+
warning << " [light_black](" << location << ")[/] "
|
19
|
+
Formatador.display_line(warning)
|
20
|
+
end
|
21
|
+
hash[key] = class_for(key).new
|
22
22
|
end
|
23
|
+
@@connections[service]
|
24
|
+
end
|
25
|
+
|
26
|
+
def services
|
27
|
+
[:compute]
|
28
|
+
end
|
23
29
|
|
24
30
|
end
|
25
31
|
end
|
data/lib/fog/bluebox/compute.rb
CHANGED
@@ -2,8 +2,8 @@ module Fog
|
|
2
2
|
module Bluebox
|
3
3
|
class Compute < Fog::Service
|
4
4
|
|
5
|
-
requires :bluebox_api_key, :bluebox_customer_id
|
6
|
-
recognizes :bluebox_host, :bluebox_port, :bluebox_scheme, :persistent
|
5
|
+
requires :bluebox_api_key, :bluebox_customer_id, &inject_parameter_specs
|
6
|
+
recognizes :bluebox_host, :bluebox_port, :bluebox_scheme, :persistent, &inject_parameter_specs
|
7
7
|
|
8
8
|
model_path 'fog/bluebox/models/compute'
|
9
9
|
model :flavor
|
data/lib/fog/brightbox/bin.rb
CHANGED
@@ -1,12 +1,18 @@
|
|
1
1
|
class Brightbox < Fog::Bin
|
2
2
|
class << self
|
3
3
|
|
4
|
+
def class_for(key)
|
5
|
+
case key
|
6
|
+
when :compute
|
7
|
+
Fog::Brightbox::Compute
|
8
|
+
else
|
9
|
+
raise ArgumentError, "Unrecognized service: #{key}"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
4
13
|
def [](service)
|
5
14
|
@@connections ||= Hash.new do |hash, key|
|
6
|
-
hash[key] =
|
7
|
-
when :compute
|
8
|
-
Fog::Brightbox::Compute.new
|
9
|
-
end
|
15
|
+
hash[key] = class_for(key).new
|
10
16
|
end
|
11
17
|
@@connections[service]
|
12
18
|
end
|
@@ -4,8 +4,8 @@ module Fog
|
|
4
4
|
|
5
5
|
API_URL = "https://api.gb1.brightbox.com/"
|
6
6
|
|
7
|
-
requires :brightbox_client_id, :brightbox_secret
|
8
|
-
recognizes :brightbox_auth_url, :brightbox_api_url
|
7
|
+
requires :brightbox_client_id, :brightbox_secret, &inject_parameter_specs
|
8
|
+
recognizes :brightbox_auth_url, :brightbox_api_url, &inject_parameter_specs
|
9
9
|
|
10
10
|
model_path 'fog/brightbox/models/compute'
|
11
11
|
model :account # Singular resource, no collection
|
data/lib/fog/core/bin.rb
CHANGED
@@ -34,16 +34,20 @@ module Fog
|
|
34
34
|
availability = true
|
35
35
|
for service in services
|
36
36
|
begin
|
37
|
-
service =
|
38
|
-
availability &&= service.requirements.all? {|requirement| Fog.credentials.include?(requirement)}
|
39
|
-
rescue
|
37
|
+
service = self.class_for(service)
|
38
|
+
availability &&= service.requirements.all? { |requirement| Fog.credentials.include?(requirement) }
|
39
|
+
rescue ArgumentError => e
|
40
|
+
warning = "[yellow][WARN] #{e.message}[/]"
|
41
|
+
Formatador.display_line(warning)
|
42
|
+
availability = false
|
43
|
+
rescue => e
|
40
44
|
availability = false
|
41
45
|
end
|
42
46
|
end
|
43
47
|
|
44
48
|
if availability
|
45
49
|
for service in services
|
46
|
-
for collection in self
|
50
|
+
for collection in self.class_for(service).collections
|
47
51
|
unless self.respond_to?(collection)
|
48
52
|
self.class_eval <<-EOS, __FILE__, __LINE__
|
49
53
|
def self.#{collection}
|
data/lib/fog/core/service.rb
CHANGED
@@ -18,6 +18,26 @@ module Fog
|
|
18
18
|
|
19
19
|
class << self
|
20
20
|
|
21
|
+
# this is to accomodate Real implementations of Service subclasses
|
22
|
+
# NOTE: it might be good to enforce parameter specs to Mock classes as well.
|
23
|
+
def inject_parameter_specs
|
24
|
+
lambda do |spec|
|
25
|
+
implementation = "Real"
|
26
|
+
self.const_set(implementation, Class.new) unless self.const_defined? implementation
|
27
|
+
realclass = self.const_get implementation
|
28
|
+
|
29
|
+
if realclass.declared_parameters_for(:'self.new', :required).empty?
|
30
|
+
required = declared_parameters_for(:'self.new', :required)
|
31
|
+
realclass.send(:requires, *required)
|
32
|
+
end
|
33
|
+
|
34
|
+
if realclass.declared_parameters_for(:'self.new', :optional).empty?
|
35
|
+
optional = declared_parameters_for(:'self.new', :optional)
|
36
|
+
realclass.send(:recognizes, *optional)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
21
41
|
def inherited(child)
|
22
42
|
child.class_eval <<-EOS, __FILE__, __LINE__
|
23
43
|
module Collections
|
@@ -35,7 +55,7 @@ module Fog
|
|
35
55
|
end
|
36
56
|
|
37
57
|
def requirements
|
38
|
-
declared_parameters_for :new, :required
|
58
|
+
declared_parameters_for :'self.new', :required
|
39
59
|
end
|
40
60
|
|
41
61
|
def new(options={})
|
data/lib/fog/go_grid/bin.rb
CHANGED
@@ -1,18 +1,24 @@
|
|
1
1
|
class GoGrid < Fog::Bin
|
2
2
|
class << self
|
3
3
|
|
4
|
+
def class_for(key)
|
5
|
+
case key
|
6
|
+
when :compute, :servers
|
7
|
+
Fog::GoGrid::Compute
|
8
|
+
else
|
9
|
+
raise ArgumentError, "Unsupported #{self} service: #{key}"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
4
13
|
def [](service)
|
5
14
|
@@connections ||= Hash.new do |hash, key|
|
6
|
-
|
7
|
-
when :compute
|
8
|
-
Fog::GoGrid::Compute.new
|
9
|
-
when :servers
|
15
|
+
if key == :servers
|
10
16
|
location = caller.first
|
11
17
|
warning = "[yellow][WARN] GoGrid[:servers] is deprecated, use GoGrid[:compute] instead[/]"
|
12
18
|
warning << " [light_black](" << location << ")[/] "
|
13
19
|
Formatador.display_line(warning)
|
14
|
-
Fog::GoGrid::Compute.new
|
15
20
|
end
|
21
|
+
hash[key] = class_for(key).new
|
16
22
|
end
|
17
23
|
@@connections[service]
|
18
24
|
end
|
data/lib/fog/go_grid/compute.rb
CHANGED
@@ -2,8 +2,8 @@ module Fog
|
|
2
2
|
module GoGrid
|
3
3
|
class Compute < Fog::Service
|
4
4
|
|
5
|
-
requires :go_grid_api_key, :go_grid_shared_secret
|
6
|
-
recognizes :host, :path, :port, :scheme, :persistent
|
5
|
+
requires :go_grid_api_key, :go_grid_shared_secret, &inject_parameter_specs
|
6
|
+
recognizes :host, :path, :port, :scheme, :persistent, &inject_parameter_specs
|
7
7
|
|
8
8
|
model_path 'fog/go_grid/models/compute'
|
9
9
|
model :image
|
data/lib/fog/google/bin.rb
CHANGED
@@ -1,12 +1,18 @@
|
|
1
1
|
class Google < Fog::Bin
|
2
2
|
class << self
|
3
3
|
|
4
|
+
def class_for(key)
|
5
|
+
case key
|
6
|
+
when :storage
|
7
|
+
Fog::Google::Storage
|
8
|
+
else
|
9
|
+
raise ArgumentError, "Unsupported #{self} service: #{key}"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
4
13
|
def [](service)
|
5
14
|
@@connections ||= Hash.new do |hash, key|
|
6
|
-
hash[key] =
|
7
|
-
when :storage
|
8
|
-
Fog::Google::Storage.new
|
9
|
-
end
|
15
|
+
hash[key] = class_for(key).new
|
10
16
|
end
|
11
17
|
@@connections[service]
|
12
18
|
end
|
@@ -16,5 +22,4 @@ class Google < Fog::Bin
|
|
16
22
|
end
|
17
23
|
|
18
24
|
end
|
19
|
-
|
20
25
|
end
|
data/lib/fog/google/storage.rb
CHANGED
@@ -2,8 +2,8 @@ module Fog
|
|
2
2
|
module Google
|
3
3
|
class Storage < Fog::Service
|
4
4
|
|
5
|
-
requires :google_storage_access_key_id, :google_storage_secret_access_key
|
6
|
-
recognizes :host, :port, :scheme, :persistent
|
5
|
+
requires :google_storage_access_key_id, :google_storage_secret_access_key, &inject_parameter_specs
|
6
|
+
recognizes :host, :port, :scheme, :persistent, &inject_parameter_specs
|
7
7
|
|
8
8
|
model_path 'fog/google/models/storage'
|
9
9
|
collection :directories
|
data/lib/fog/linode/bin.rb
CHANGED
@@ -1,18 +1,24 @@
|
|
1
1
|
class Linode < Fog::Bin
|
2
2
|
class << self
|
3
3
|
|
4
|
+
def class_for(key)
|
5
|
+
case key
|
6
|
+
when :compute, :linode
|
7
|
+
Fog::Linode::Compute
|
8
|
+
else
|
9
|
+
raise ArgumentError, "Unsupported #{self} service: #{key}"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
4
13
|
def [](service)
|
5
14
|
@@connections ||= Hash.new do |hash, key|
|
6
|
-
|
7
|
-
when :compute
|
8
|
-
Fog::Linode::Compute.new
|
9
|
-
when :linode
|
15
|
+
if key == :linode
|
10
16
|
location = caller.first
|
11
17
|
warning = "[yellow][WARN] Linode[:linode] is deprecated, use Linode[:compute] instead[/]"
|
12
18
|
warning << " [light_black](" << location << ")[/] "
|
13
19
|
Formatador.display_line(warning)
|
14
|
-
Fog::Linode::Compute.new
|
15
20
|
end
|
21
|
+
hash[key] = class_for(key).new
|
16
22
|
end
|
17
23
|
@@connections[service]
|
18
24
|
end
|
data/lib/fog/linode/compute.rb
CHANGED
@@ -2,8 +2,8 @@ module Fog
|
|
2
2
|
module Linode
|
3
3
|
class Compute < Fog::Service
|
4
4
|
|
5
|
-
requires :linode_api_key
|
6
|
-
recognizes :port, :scheme, :persistent
|
5
|
+
requires :linode_api_key, &inject_parameter_specs
|
6
|
+
recognizes :port, :scheme, :persistent, &inject_parameter_specs
|
7
7
|
|
8
8
|
model_path 'fog/linode/models/compute'
|
9
9
|
|
data/lib/fog/local/bin.rb
CHANGED
@@ -1,18 +1,24 @@
|
|
1
1
|
class Local < Fog::Bin
|
2
2
|
class << self
|
3
3
|
|
4
|
+
def class_for(key)
|
5
|
+
case key
|
6
|
+
when :files, :storage
|
7
|
+
Fog::Local::Storage
|
8
|
+
else
|
9
|
+
raise ArgumentError, "Unsupported #{self} service: #{key}"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
4
13
|
def [](service)
|
5
14
|
@@connections ||= Hash.new do |hash, key|
|
6
|
-
|
7
|
-
when :files
|
15
|
+
if key == :files
|
8
16
|
location = caller.first
|
9
17
|
warning = "[yellow][WARN] Local[:files] is deprecated, use Local[:storage] instead[/]"
|
10
18
|
warning << " [light_black](" << location << ")[/] "
|
11
19
|
Formatador.display_line(warning)
|
12
|
-
Fog::Local::Storage.new
|
13
|
-
when :storage
|
14
|
-
Fog::Local::Storage.new
|
15
20
|
end
|
21
|
+
hash[key] = class_for(key).new
|
16
22
|
end
|
17
23
|
@@connections[service]
|
18
24
|
end
|
data/lib/fog/local/storage.rb
CHANGED
data/lib/fog/new_servers/bin.rb
CHANGED
@@ -1,18 +1,24 @@
|
|
1
1
|
class NewServers < Fog::Bin
|
2
2
|
class << self
|
3
3
|
|
4
|
+
def class_for(key)
|
5
|
+
case key
|
6
|
+
when :compute, :new_servers
|
7
|
+
Fog::NewServers::Compute
|
8
|
+
else
|
9
|
+
raise ArgumentError, "Unsupported #{self} service: #{key}"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
4
13
|
def [](service)
|
5
14
|
@@connections ||= Hash.new do |hash, key|
|
6
|
-
|
7
|
-
when :compute
|
8
|
-
Fog::NewServers::Compute.new
|
9
|
-
when :new_servers
|
15
|
+
if key == :new_servers
|
10
16
|
location = caller.first
|
11
17
|
warning = "[yellow][WARN] NewServers[:servers] is deprecated, use NewServers[:compute] instead[/]"
|
12
18
|
warning << " [light_black](" << location << ")[/] "
|
13
19
|
Formatador.display_line(warning)
|
14
|
-
Fog::NewServers::Compute.new
|
15
20
|
end
|
21
|
+
hash[key] = class_for(key).new
|
16
22
|
end
|
17
23
|
@@connections[service]
|
18
24
|
end
|
@@ -4,8 +4,8 @@ module Fog
|
|
4
4
|
module NewServers
|
5
5
|
class Compute < Fog::Service
|
6
6
|
|
7
|
-
requires :new_servers_password, :new_servers_username
|
8
|
-
recognizes :host, :port, :scheme, :persistent
|
7
|
+
requires :new_servers_password, :new_servers_username, &inject_parameter_specs
|
8
|
+
recognizes :host, :port, :scheme, :persistent, &inject_parameter_specs
|
9
9
|
|
10
10
|
model_path 'fog/new_servers/models/compute'
|
11
11
|
|
data/lib/fog/rackspace.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
module Fog
|
2
2
|
module Rackspace
|
3
3
|
|
4
|
-
include NamedParameters
|
5
4
|
extend Fog::Provider
|
6
5
|
|
7
6
|
service_path 'fog/rackspace'
|
@@ -11,11 +10,6 @@ module Fog
|
|
11
10
|
service 'servers'
|
12
11
|
service 'storage'
|
13
12
|
|
14
|
-
# NOTE: might be better to rely on the caller alone to enforce parameter
|
15
|
-
# requirements...
|
16
|
-
has_named_parameters :'self.authenticate',
|
17
|
-
:required => [ :rackspace_api_key, :rackspace_username ],
|
18
|
-
:optional => [ :rackspace_auth_url ]
|
19
13
|
def self.authenticate(options)
|
20
14
|
rackspace_auth_url = options[:rackspace_auth_url] || "auth.api.rackspacecloud.com"
|
21
15
|
connection = Fog::Connection.new("https://" + rackspace_auth_url)
|
data/lib/fog/rackspace/bin.rb
CHANGED
@@ -1,27 +1,37 @@
|
|
1
1
|
class Rackspace < Fog::Bin
|
2
2
|
class << self
|
3
3
|
|
4
|
+
def class_for(key)
|
5
|
+
case key
|
6
|
+
when :cdn
|
7
|
+
Fog::Rackspace::CDN
|
8
|
+
when :compute, :servers
|
9
|
+
Fog::Rackspace::Compute
|
10
|
+
when :files, :storage
|
11
|
+
Fog::Rackspace::Storage
|
12
|
+
else
|
13
|
+
raise ArgumentError, "Unrecognized service: #{key}"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
4
17
|
def [](service)
|
5
18
|
@@connections ||= Hash.new do |hash, key|
|
19
|
+
klazz = class_for(key)
|
6
20
|
hash[key] = case key
|
7
|
-
when :cdn
|
8
|
-
Fog::Rackspace::CDN.new
|
9
|
-
when :compute
|
10
|
-
Fog::Rackspace::Compute.new
|
11
21
|
when :files
|
12
22
|
location = caller.first
|
13
23
|
warning = "[yellow][WARN] Rackspace[:files] is deprecated, use Rackspace[:storage] instead[/]"
|
14
24
|
warning << " [light_black](" << location << ")[/] "
|
15
25
|
Formatador.display_line(warning)
|
16
|
-
|
26
|
+
klazz.new
|
17
27
|
when :servers
|
18
28
|
location = caller.first
|
19
29
|
warning = "[yellow][WARN] Rackspace[:servers] is deprecated, use Rackspace[:compute] instead[/]"
|
20
30
|
warning << " [light_black](" << location << ")[/] "
|
21
31
|
Formatador.display_line(warning)
|
22
|
-
|
23
|
-
|
24
|
-
|
32
|
+
klazz.new
|
33
|
+
else
|
34
|
+
klazz.new
|
25
35
|
end
|
26
36
|
end
|
27
37
|
@@connections[service]
|
data/lib/fog/rackspace/cdn.rb
CHANGED
@@ -2,10 +2,8 @@ module Fog
|
|
2
2
|
module Rackspace
|
3
3
|
class CDN < Fog::Service
|
4
4
|
|
5
|
-
requires :rackspace_api_key, :rackspace_username
|
6
|
-
|
7
|
-
# we also declare those parameters that the authenticate expects...
|
8
|
-
recognizes :rackspace_auth_url, :persistent
|
5
|
+
requires :rackspace_api_key, :rackspace_username, &inject_parameter_specs
|
6
|
+
recognizes :rackspace_auth_url, :persistent, &inject_parameter_specs
|
9
7
|
|
10
8
|
model_path 'fog/rackspace/models/cdn'
|
11
9
|
|
@@ -2,10 +2,8 @@ module Fog
|
|
2
2
|
module Rackspace
|
3
3
|
class Compute < Fog::Service
|
4
4
|
|
5
|
-
requires :rackspace_api_key, :rackspace_username
|
6
|
-
|
7
|
-
# we also declare those parameters that the authenticate expects...
|
8
|
-
recognizes :rackspace_auth_url, :persistent
|
5
|
+
requires :rackspace_api_key, :rackspace_username, &inject_parameter_specs
|
6
|
+
recognizes :rackspace_auth_url, :persistent, &inject_parameter_specs
|
9
7
|
|
10
8
|
model_path 'fog/rackspace/models/compute'
|
11
9
|
model :flavor
|
@@ -2,10 +2,8 @@ module Fog
|
|
2
2
|
module Rackspace
|
3
3
|
class Storage < Fog::Service
|
4
4
|
|
5
|
-
requires :rackspace_api_key, :rackspace_username
|
6
|
-
|
7
|
-
# we also declare those parameters that the authenticate expects...
|
8
|
-
recognizes :rackspace_auth_url, :persistent
|
5
|
+
requires :rackspace_api_key, :rackspace_username, &inject_parameter_specs
|
6
|
+
recognizes :rackspace_auth_url, :persistent, &inject_parameter_specs
|
9
7
|
|
10
8
|
model_path 'fog/rackspace/models/storage'
|
11
9
|
model :directory
|
data/lib/fog/slicehost/bin.rb
CHANGED
@@ -1,18 +1,24 @@
|
|
1
1
|
class Slicehost < Fog::Bin
|
2
2
|
class << self
|
3
3
|
|
4
|
+
def class_for(key)
|
5
|
+
case key
|
6
|
+
when :compute, :slices
|
7
|
+
Fog::Slicehost::Compute
|
8
|
+
else
|
9
|
+
raise ArgumentError, "Unrecognized service: #{key}"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
4
13
|
def [](service)
|
5
14
|
@@connections ||= Hash.new do |hash, key|
|
6
|
-
|
7
|
-
when :compute
|
8
|
-
Fog::Slicehost::Compute.new
|
9
|
-
when :slices
|
15
|
+
if key == :slices
|
10
16
|
location = caller.first
|
11
17
|
warning = "[yellow][WARN] Slicehost[:blocks] is deprecated, use Bluebox[:compute] instead[/]"
|
12
18
|
warning << " [light_black](" << location << ")[/] "
|
13
19
|
Formatador.display_line(warning)
|
14
|
-
Fog::Slicehost::Compute.new
|
15
20
|
end
|
21
|
+
hash[key] = class_for(key).new
|
16
22
|
end
|
17
23
|
@@connections[service]
|
18
24
|
end
|
@@ -2,8 +2,8 @@ module Fog
|
|
2
2
|
module Slicehost
|
3
3
|
class Compute < Fog::Service
|
4
4
|
|
5
|
-
requires :slicehost_password
|
6
|
-
recognizes :host, :port, :scheme, :persistent
|
5
|
+
requires :slicehost_password, &inject_parameter_specs
|
6
|
+
recognizes :host, :port, :scheme, :persistent, &inject_parameter_specs
|
7
7
|
|
8
8
|
model_path 'fog/slicehost/models/compute'
|
9
9
|
model :flavor
|
data/lib/fog/terremark/ecloud.rb
CHANGED
@@ -32,6 +32,8 @@ module Fog
|
|
32
32
|
end
|
33
33
|
|
34
34
|
class Real
|
35
|
+
# NOTE: When this vbecomes a service, take care to pass the &inject_parameter_specs
|
36
|
+
# block on call to requires and recognizes
|
35
37
|
requires :terremark_ecloud_password, :terremark_ecloud_username
|
36
38
|
recognizes :host, :path, :port, :scheme, :persistent
|
37
39
|
|
@@ -15,8 +15,13 @@ module Fog
|
|
15
15
|
when 'Link'
|
16
16
|
link = {}
|
17
17
|
until attributes.empty?
|
18
|
-
|
19
|
-
|
18
|
+
if attributes.first.is_a?(Array)
|
19
|
+
attribute = attributes.shift
|
20
|
+
link[attribute.first] = attribute.last
|
21
|
+
else
|
22
|
+
link[attributes.shift] = attributes.shift
|
23
|
+
end
|
24
|
+
end
|
20
25
|
@response['Links'] << link
|
21
26
|
when 'Org'
|
22
27
|
org = {}
|
@@ -14,7 +14,12 @@ module Fog
|
|
14
14
|
if name == 'Org'
|
15
15
|
organization = {}
|
16
16
|
until attributes.empty?
|
17
|
-
|
17
|
+
if attributes.first.is_a?(Array)
|
18
|
+
attribute = attributes.shift
|
19
|
+
organization[attribute.first] = attribute.last
|
20
|
+
else
|
21
|
+
organization[attributes.shift] = attributes.shift
|
22
|
+
end
|
18
23
|
end
|
19
24
|
@response['OrgList'] << organization
|
20
25
|
end
|
@@ -37,7 +37,12 @@ module Fog
|
|
37
37
|
when 'Link'
|
38
38
|
link = {}
|
39
39
|
until attributes.empty?
|
40
|
-
|
40
|
+
if attributes.first.is_a?(Array)
|
41
|
+
attribute = attributes.shift
|
42
|
+
link[attribute.first] = attribute.last
|
43
|
+
else
|
44
|
+
link[attributes.shift] = attributes.shift
|
45
|
+
end
|
41
46
|
end
|
42
47
|
@response['links'] << link
|
43
48
|
when 'Memory'
|
@@ -45,13 +50,23 @@ module Fog
|
|
45
50
|
when 'Network'
|
46
51
|
network = {}
|
47
52
|
until attributes.empty?
|
48
|
-
|
53
|
+
if attributes.first.is_a?(Array)
|
54
|
+
attribute = attributes.shift
|
55
|
+
network[attribute.first] = attribute.last
|
56
|
+
else
|
57
|
+
network[attributes.shift] = attributes.shift
|
58
|
+
end
|
49
59
|
end
|
50
60
|
@response['AvailableNetworks'] << network
|
51
61
|
when 'ResourceEntity'
|
52
62
|
resource_entity = {}
|
53
63
|
until attributes.empty?
|
54
|
-
|
64
|
+
if attributes.first.is_a?(Array)
|
65
|
+
attribute = attributes.shift
|
66
|
+
resource_entity[attribute.first] = attribute.last
|
67
|
+
else
|
68
|
+
resource_entity[attributes.shift] = attributes.shift
|
69
|
+
end
|
55
70
|
end
|
56
71
|
@response['ResourceEntities'] << resource_entity
|
57
72
|
when 'StorageCapacity'
|
data/lib/fog/vcloud.rb
CHANGED
@@ -19,8 +19,8 @@ end
|
|
19
19
|
module Fog
|
20
20
|
class Vcloud < Fog::Service
|
21
21
|
|
22
|
-
requires :username, :password, :module, :versions_uri
|
23
|
-
recognizes :version, :persistent
|
22
|
+
requires :username, :password, :module, :versions_uri, &inject_parameter_specs
|
23
|
+
recognizes :version, :persistent, &inject_parameter_specs
|
24
24
|
|
25
25
|
model_path 'fog/vcloud/models'
|
26
26
|
model :vdc
|
@@ -3,11 +3,12 @@ Shindo.tests('Google::Storage | bucket requests', ['google']) do
|
|
3
3
|
tests('success') do
|
4
4
|
|
5
5
|
@bucket_format = {
|
6
|
-
'
|
7
|
-
'
|
8
|
-
'
|
9
|
-
'
|
10
|
-
'
|
6
|
+
'CommonPrefixes' => [],
|
7
|
+
'IsTruncated' => Fog::Boolean,
|
8
|
+
'Marker' => NilClass,
|
9
|
+
'Name' => String,
|
10
|
+
'Prefix' => NilClass,
|
11
|
+
'Contents' => [{
|
11
12
|
'ETag' => String,
|
12
13
|
'Key' => String,
|
13
14
|
'LastModified' => Time,
|
@@ -16,7 +17,7 @@ Shindo.tests('Google::Storage | bucket requests', ['google']) do
|
|
16
17
|
'ID' => String
|
17
18
|
},
|
18
19
|
'Size' => Integer,
|
19
|
-
'StorageClass'
|
20
|
+
'StorageClass' => String
|
20
21
|
}]
|
21
22
|
}
|
22
23
|
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 3
|
8
|
-
-
|
9
|
-
version: 0.3.
|
8
|
+
- 30
|
9
|
+
version: 0.3.30
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- geemus (Wesley Beary)
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-12-
|
17
|
+
date: 2010-12-08 00:00:00 -08:00
|
18
18
|
default_executable: fog
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -86,13 +86,13 @@ dependencies:
|
|
86
86
|
type: :runtime
|
87
87
|
version_requirements: &id006 !ruby/object:Gem::Requirement
|
88
88
|
requirements:
|
89
|
-
- - "
|
89
|
+
- - ">="
|
90
90
|
- !ruby/object:Gem::Version
|
91
91
|
segments:
|
92
92
|
- 0
|
93
93
|
- 0
|
94
|
-
-
|
95
|
-
version: 0.0.
|
94
|
+
- 17
|
95
|
+
version: 0.0.17
|
96
96
|
requirement: *id006
|
97
97
|
name: named-parameters
|
98
98
|
- !ruby/object:Gem::Dependency
|