fog 0.3.13 → 0.3.14
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/fog.gemspec +26 -20
- data/lib/fog.rb +1 -11
- data/lib/fog/aws.rb +5 -0
- data/lib/fog/aws/bin.rb +5 -1
- data/lib/fog/aws/cdn.rb +98 -0
- data/lib/fog/aws/iam.rb +86 -0
- data/lib/fog/aws/models/compute/volume.rb +10 -0
- data/lib/fog/aws/models/storage/directory.rb +11 -0
- data/lib/fog/aws/models/storage/file.rb +9 -11
- data/lib/fog/aws/parsers/cdn/distribution.rb +44 -0
- data/lib/fog/aws/parsers/cdn/get_distribution_list.rb +48 -0
- data/lib/fog/aws/parsers/cdn/post_invalidation.rb +28 -0
- data/lib/fog/aws/parsers/iam/basic.rb +19 -0
- data/lib/fog/aws/parsers/iam/create_group.rb +26 -0
- data/lib/fog/aws/parsers/iam/list_groups.rb +32 -0
- data/lib/fog/aws/requests/cdn/delete_distribution.rb +36 -0
- data/lib/fog/aws/requests/cdn/get_distribution.rb +55 -0
- data/lib/fog/aws/requests/cdn/get_distribution_list.rb +59 -0
- data/lib/fog/aws/requests/cdn/post_distribution.rb +88 -0
- data/lib/fog/aws/requests/cdn/post_invalidation.rb +59 -0
- data/lib/fog/aws/requests/compute/create_volume.rb +1 -0
- data/lib/fog/aws/requests/compute/describe_snapshots.rb +3 -0
- data/lib/fog/aws/requests/iam/create_group.rb +43 -0
- data/lib/fog/aws/requests/iam/delete_group.rb +36 -0
- data/lib/fog/aws/requests/iam/list_groups.rb +45 -0
- data/lib/fog/aws/requests/storage/copy_object.rb +4 -1
- data/lib/fog/aws/requests/storage/delete_bucket.rb +5 -1
- data/lib/fog/aws/requests/storage/delete_object.rb +5 -1
- data/lib/fog/aws/requests/storage/get_bucket.rb +4 -1
- data/lib/fog/aws/requests/storage/get_bucket_acl.rb +4 -1
- data/lib/fog/aws/requests/storage/get_bucket_location.rb +5 -1
- data/lib/fog/aws/requests/storage/get_bucket_logging.rb +4 -1
- data/lib/fog/aws/requests/storage/get_bucket_object_versions.rb +4 -1
- data/lib/fog/aws/requests/storage/get_bucket_versioning.rb +4 -1
- data/lib/fog/aws/requests/storage/get_object.rb +4 -1
- data/lib/fog/aws/requests/storage/get_object_acl.rb +4 -1
- data/lib/fog/aws/requests/storage/get_object_torrent.rb +4 -1
- data/lib/fog/aws/requests/storage/get_object_url.rb +4 -1
- data/lib/fog/aws/requests/storage/get_request_payment.rb +5 -1
- data/lib/fog/aws/requests/storage/get_service.rb +5 -1
- data/lib/fog/aws/requests/storage/head_object.rb +5 -1
- data/lib/fog/aws/requests/storage/post_object_hidden_fields.rb +4 -3
- data/lib/fog/aws/requests/storage/put_bucket.rb +11 -6
- data/lib/fog/aws/requests/storage/put_bucket_acl.rb +5 -1
- data/lib/fog/aws/requests/storage/put_bucket_logging.rb +5 -1
- data/lib/fog/aws/requests/storage/put_bucket_versioning.rb +5 -1
- data/lib/fog/aws/requests/storage/put_object.rb +5 -1
- data/lib/fog/aws/requests/storage/put_object_url.rb +4 -1
- data/lib/fog/aws/requests/storage/put_request_payment.rb +5 -1
- data/lib/fog/aws/storage.rb +2 -0
- data/lib/fog/bluebox/compute.rb +1 -0
- data/lib/fog/core.rb +4 -2
- data/lib/fog/core/attributes.rb +9 -5
- data/lib/fog/core/compute.rb +33 -0
- data/lib/fog/core/credentials.rb +0 -1
- data/lib/fog/core/model.rb +2 -11
- data/lib/fog/core/ssh.rb +1 -0
- data/lib/fog/core/storage.rb +24 -0
- data/lib/fog/go_grid/compute.rb +2 -0
- data/lib/fog/google.rb +3 -0
- data/lib/fog/google/models/storage/directory.rb +11 -0
- data/lib/fog/google/models/storage/file.rb +19 -10
- data/lib/fog/google/requests/storage/put_bucket.rb +5 -4
- data/lib/fog/google/storage.rb +2 -0
- data/lib/fog/linode/compute.rb +1 -0
- data/lib/fog/new_servers.rb +3 -0
- data/lib/fog/rackspace.rb +1 -0
- data/lib/fog/rackspace/bin.rb +3 -1
- data/lib/fog/rackspace/cdn.rb +81 -0
- data/lib/fog/rackspace/compute.rb +1 -0
- data/lib/fog/rackspace/models/storage/file.rb +2 -2
- data/lib/fog/rackspace/requests/{storage → cdn}/get_cdn_containers.rb +1 -1
- data/lib/fog/rackspace/requests/{storage → cdn}/head_cdn_container.rb +1 -1
- data/lib/fog/rackspace/requests/{storage → cdn}/put_cdn_container.rb +1 -1
- data/lib/fog/rackspace/requests/storage/delete_container.rb +1 -1
- data/lib/fog/rackspace/requests/storage/delete_object.rb +1 -1
- data/lib/fog/rackspace/requests/storage/get_container.rb +1 -1
- data/lib/fog/rackspace/requests/storage/get_containers.rb +1 -1
- data/lib/fog/rackspace/requests/storage/get_object.rb +1 -1
- data/lib/fog/rackspace/requests/storage/head_container.rb +1 -1
- data/lib/fog/rackspace/requests/storage/head_containers.rb +1 -1
- data/lib/fog/rackspace/requests/storage/head_object.rb +1 -1
- data/lib/fog/rackspace/requests/storage/put_container.rb +1 -1
- data/lib/fog/rackspace/requests/storage/put_object.rb +1 -1
- data/lib/fog/rackspace/storage.rb +13 -47
- data/lib/fog/slicehost.rb +4 -1
- data/lib/fog/terremark.rb +3 -0
- data/lib/fog/vcloud.rb +3 -0
- data/spec/aws/models/storage/directory_spec.rb +1 -0
- data/spec/bluebox/models/compute/flavors_spec.rb +5 -2
- data/spec/bluebox/models/compute/server_spec.rb +5 -1
- data/spec/bluebox/models/compute/servers_spec.rb +5 -1
- data/spec/google/models/storage/files_spec.rb +1 -2
- data/spec/rackspace/models/compute/flavors_spec.rb +5 -1
- data/spec/rackspace/models/compute/server_spec.rb +5 -1
- data/spec/slicehost/models/compute/flavors_spec.rb +5 -1
- data/spec/slicehost/models/compute/server_spec.rb +5 -1
- data/spec/slicehost/models/compute/servers_spec.rb +5 -1
- data/tests/aws/requests/compute/volume_tests.rb +8 -7
- data/tests/aws/requests/storage/bucket_tests.rb +55 -0
- data/tests/aws/requests/storage/object_tests.rb +18 -0
- data/tests/rackspace/requests/storage/container_tests.rb +64 -0
- data/tests/rackspace/requests/storage/object_tests.rb +69 -0
- metadata +27 -21
- data/spec/aws/requests/storage/copy_object_spec.rb +0 -61
- data/spec/aws/requests/storage/get_bucket_location_spec.rb +0 -30
- data/spec/aws/requests/storage/get_bucket_spec.rb +0 -114
- data/spec/aws/requests/storage/get_request_payment_spec.rb +0 -30
- data/spec/aws/requests/storage/put_request_payment_spec.rb +0 -29
- data/spec/rackspace/requests/storage/delete_container_spec.rb +0 -24
- data/spec/rackspace/requests/storage/delete_object_spec.rb +0 -37
- data/spec/rackspace/requests/storage/get_container_spec.rb +0 -35
- data/spec/rackspace/requests/storage/get_containers_spec.rb +0 -22
- data/spec/rackspace/requests/storage/get_object_spec.rb +0 -21
- data/spec/rackspace/requests/storage/head_container_spec.rb +0 -30
- data/spec/rackspace/requests/storage/head_containers_spec.rb +0 -19
- data/spec/rackspace/requests/storage/head_object_spec.rb +0 -21
- data/spec/rackspace/requests/storage/put_container_spec.rb +0 -15
- data/spec/rackspace/requests/storage/put_object_spec.rb +0 -20
@@ -14,6 +14,10 @@ module Fog
|
|
14
14
|
# * response<~Excon::Response>:
|
15
15
|
# * body<~Hash>:
|
16
16
|
# * 'Payer'<~String> - Specifies who pays for download and requests
|
17
|
+
#
|
18
|
+
# ==== See Also
|
19
|
+
# http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTrequestPaymentGET.html
|
20
|
+
|
17
21
|
def get_request_payment(bucket_name)
|
18
22
|
request({
|
19
23
|
:expects => 200,
|
@@ -28,7 +32,7 @@ module Fog
|
|
28
32
|
|
29
33
|
end
|
30
34
|
|
31
|
-
class Mock
|
35
|
+
class Mock # :nodoc:all
|
32
36
|
|
33
37
|
def get_request_payment(bucket_name)
|
34
38
|
response = Excon::Response.new
|
@@ -16,6 +16,10 @@ module Fog
|
|
16
16
|
# * 'Owner'<~Hash>:
|
17
17
|
# * 'DisplayName'<~String> - Display name of bucket owner
|
18
18
|
# * 'ID'<~String> - Id of bucket owner
|
19
|
+
#
|
20
|
+
# ==== See Also
|
21
|
+
# http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTServiceGET.html
|
22
|
+
|
19
23
|
def get_service
|
20
24
|
request({
|
21
25
|
:expects => 200,
|
@@ -30,7 +34,7 @@ module Fog
|
|
30
34
|
|
31
35
|
end
|
32
36
|
|
33
|
-
class Mock
|
37
|
+
class Mock # :nodoc:all
|
34
38
|
|
35
39
|
def get_service
|
36
40
|
response = Excon::Response.new
|
@@ -24,6 +24,10 @@ module Fog
|
|
24
24
|
# * 'Content-Type'<~String> - MIME type of object
|
25
25
|
# * 'ETag'<~String> - Etag of object
|
26
26
|
# * 'Last-Modified'<~String> - Last modified timestamp for object
|
27
|
+
#
|
28
|
+
# ==== See Also
|
29
|
+
# http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTObjectHEAD.html
|
30
|
+
|
27
31
|
def head_object(bucket_name, object_name, options={})
|
28
32
|
unless bucket_name
|
29
33
|
raise ArgumentError.new('bucket_name is required')
|
@@ -50,7 +54,7 @@ module Fog
|
|
50
54
|
|
51
55
|
end
|
52
56
|
|
53
|
-
class Mock
|
57
|
+
class Mock # :nodoc:all
|
54
58
|
|
55
59
|
def head_object(bucket_name, object_name, options = {})
|
56
60
|
response = get_object(bucket_name, object_name, options)
|
@@ -22,8 +22,9 @@ module Fog
|
|
22
22
|
# * x-amz-security-token - devpay security token
|
23
23
|
# * x-amz-meta-... - meta data tags
|
24
24
|
#
|
25
|
-
# See
|
26
|
-
#
|
25
|
+
# ==== See Also
|
26
|
+
# http://docs.amazonwebservices.com/AmazonS3/latest/dev/HTTPPOSTForms.html
|
27
|
+
|
27
28
|
def post_object_hidden_fields(options = {})
|
28
29
|
if options['policy']
|
29
30
|
options['policy'] = options['policy'].to_json
|
@@ -37,7 +38,7 @@ module Fog
|
|
37
38
|
|
38
39
|
end
|
39
40
|
|
40
|
-
class Mock
|
41
|
+
class Mock # :nodoc:all
|
41
42
|
|
42
43
|
def post_object_hidden_fields(options = {})
|
43
44
|
Fog::Mock.not_implemented
|
@@ -8,17 +8,22 @@ module Fog
|
|
8
8
|
# ==== Parameters
|
9
9
|
# * bucket_name<~String> - name of bucket to create
|
10
10
|
# * options<~Hash> - config arguments for bucket. Defaults to {}.
|
11
|
-
# *
|
11
|
+
# * 'LocationConstraint'<~Symbol> - sets the location for the bucket
|
12
|
+
# * 'x-amz-acl'<~String> - Permissions, must be in ['private', 'public-read', 'public-read-write', 'authenticated-read']
|
12
13
|
#
|
13
14
|
# ==== Returns
|
14
15
|
# * response<~Excon::Response>:
|
15
16
|
# * status<~Integer> - 200
|
17
|
+
#
|
18
|
+
# ==== See Also
|
19
|
+
# http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTBucketPUT.html
|
20
|
+
|
16
21
|
def put_bucket(bucket_name, options = {})
|
17
|
-
if options
|
22
|
+
if location_constraint = options.delete('LocationConstraint')
|
18
23
|
data =
|
19
24
|
<<-DATA
|
20
25
|
<CreateBucketConfiguration>
|
21
|
-
<LocationConstraint>#{
|
26
|
+
<LocationConstraint>#{location_constraint}</LocationConstraint>
|
22
27
|
</CreateBucketConfiguration>
|
23
28
|
DATA
|
24
29
|
else
|
@@ -27,7 +32,7 @@ DATA
|
|
27
32
|
request({
|
28
33
|
:expects => 200,
|
29
34
|
:body => data,
|
30
|
-
:headers =>
|
35
|
+
:headers => options,
|
31
36
|
:idempotent => true,
|
32
37
|
:host => "#{bucket_name}.#{@host}",
|
33
38
|
:method => 'PUT'
|
@@ -36,7 +41,7 @@ DATA
|
|
36
41
|
|
37
42
|
end
|
38
43
|
|
39
|
-
class Mock
|
44
|
+
class Mock # :nodoc:all
|
40
45
|
|
41
46
|
def put_bucket(bucket_name, options = {})
|
42
47
|
response = Excon::Response.new
|
@@ -51,7 +56,7 @@ DATA
|
|
51
56
|
if options['LocationConstraint']
|
52
57
|
bucket['LocationConstraint'] = options['LocationConstraint']
|
53
58
|
else
|
54
|
-
bucket['LocationConstraint'] =
|
59
|
+
bucket['LocationConstraint'] = nil
|
55
60
|
end
|
56
61
|
unless @data[:buckets][bucket_name]
|
57
62
|
@data[:buckets][bucket_name] = bucket
|
@@ -20,6 +20,10 @@ module Fog
|
|
20
20
|
# or
|
21
21
|
# * 'URI'<~String> - URI of group to grant access for
|
22
22
|
# * Permission<~String> - Permission, in [FULL_CONTROL, WRITE, WRITE_ACP, READ, READ_ACP]
|
23
|
+
#
|
24
|
+
# ==== See Also
|
25
|
+
# http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTBucketPUTacl.html
|
26
|
+
|
23
27
|
def put_bucket_acl(bucket_name, acl)
|
24
28
|
data =
|
25
29
|
<<-DATA
|
@@ -68,7 +72,7 @@ DATA
|
|
68
72
|
|
69
73
|
end
|
70
74
|
|
71
|
-
class Mock
|
75
|
+
class Mock # :nodoc:all
|
72
76
|
|
73
77
|
def put_bucket_acl(bucket_name, acl)
|
74
78
|
Fog::Mock.not_implemented
|
@@ -20,6 +20,10 @@ module Fog
|
|
20
20
|
# or
|
21
21
|
# * 'URI'<~String> - URI of group to grant access for
|
22
22
|
# * Permission<~String> - Permission, in [FULL_CONTROL, WRITE, WRITE_ACP, READ, READ_ACP]
|
23
|
+
#
|
24
|
+
# ==== See Also
|
25
|
+
# http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTBucketPUTlogging.html
|
26
|
+
|
23
27
|
def put_bucket_logging(bucket_name, logging_status)
|
24
28
|
if logging_status['LoggingEnabled'].empty?
|
25
29
|
data =
|
@@ -75,7 +79,7 @@ DATA
|
|
75
79
|
|
76
80
|
end
|
77
81
|
|
78
|
-
class Mock
|
82
|
+
class Mock # :nodoc:all
|
79
83
|
|
80
84
|
def put_bucket_logging(bucket_name, logging_status)
|
81
85
|
Fog::Mock.not_implemented
|
@@ -8,6 +8,10 @@ module Fog
|
|
8
8
|
# ==== Parameters
|
9
9
|
# * bucket_name<~String> - name of bucket to modify
|
10
10
|
# * status<~String> - Status to change to in ['Enabled', 'Suspended']
|
11
|
+
#
|
12
|
+
# ==== See Also
|
13
|
+
# http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTBucketPUTVersioningStatus.html
|
14
|
+
|
11
15
|
def put_bucket_versioning(bucket_name, status)
|
12
16
|
data =
|
13
17
|
<<-DATA
|
@@ -28,7 +32,7 @@ DATA
|
|
28
32
|
|
29
33
|
end
|
30
34
|
|
31
|
-
class Mock
|
35
|
+
class Mock # :nodoc:all
|
32
36
|
|
33
37
|
def put_bucket_versioning(bucket_name, status)
|
34
38
|
Fog::Mock.not_implemented
|
@@ -23,6 +23,10 @@ module Fog
|
|
23
23
|
# * response<~Excon::Response>:
|
24
24
|
# * headers<~Hash>:
|
25
25
|
# * 'ETag'<~String> - etag of new object
|
26
|
+
#
|
27
|
+
# ==== See Also
|
28
|
+
# http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTObjectPUT.html
|
29
|
+
|
26
30
|
def put_object(bucket_name, object_name, data, options = {})
|
27
31
|
data = parse_data(data)
|
28
32
|
headers = data[:headers].merge!(options)
|
@@ -39,7 +43,7 @@ module Fog
|
|
39
43
|
|
40
44
|
end
|
41
45
|
|
42
|
-
class Mock
|
46
|
+
class Mock # :nodoc:all
|
43
47
|
|
44
48
|
def put_object(bucket_name, object_name, data, options = {})
|
45
49
|
data = parse_data(data)
|
@@ -14,6 +14,9 @@ module Fog
|
|
14
14
|
# * response<~Excon::Response>:
|
15
15
|
# * body<~String> - url for object
|
16
16
|
#
|
17
|
+
# ==== See Also
|
18
|
+
# http://docs.amazonwebservices.com/AmazonS3/latest/dev/S3_QSAuth.html
|
19
|
+
|
17
20
|
def put_object_url(bucket_name, object_name, expires)
|
18
21
|
unless bucket_name
|
19
22
|
raise ArgumentError.new('bucket_name is required')
|
@@ -31,7 +34,7 @@ module Fog
|
|
31
34
|
|
32
35
|
end
|
33
36
|
|
34
|
-
class Mock
|
37
|
+
class Mock # :nodoc:all
|
35
38
|
|
36
39
|
def put_object_url(bucket_name, object_name, expires)
|
37
40
|
unless bucket_name
|
@@ -8,6 +8,10 @@ module Fog
|
|
8
8
|
# ==== Parameters
|
9
9
|
# * bucket_name<~String> - name of bucket to modify
|
10
10
|
# * payer<~String> - valid values are BucketOwner or Requester
|
11
|
+
#
|
12
|
+
# ==== See Also
|
13
|
+
# http://docs.amazonwebservices.com/AmazonS3/latest/API/RESTrequestPaymentPUT.html
|
14
|
+
|
11
15
|
def put_request_payment(bucket_name, payer)
|
12
16
|
data =
|
13
17
|
<<-DATA
|
@@ -27,7 +31,7 @@ DATA
|
|
27
31
|
|
28
32
|
end
|
29
33
|
|
30
|
-
class Mock
|
34
|
+
class Mock # :nodoc:all
|
31
35
|
|
32
36
|
def put_request_payment(bucket_name, payer)
|
33
37
|
response = Excon::Response.new
|
data/lib/fog/aws/storage.rb
CHANGED
@@ -91,6 +91,7 @@ module Fog
|
|
91
91
|
end
|
92
92
|
|
93
93
|
def initialize(options={})
|
94
|
+
require 'mime/types'
|
94
95
|
@aws_access_key_id = options[:aws_access_key_id]
|
95
96
|
options[:region] ||= 'us-east-1'
|
96
97
|
@host = options[:host] || case options[:region]
|
@@ -136,6 +137,7 @@ module Fog
|
|
136
137
|
# ==== Returns
|
137
138
|
# * S3 object with connection to aws.
|
138
139
|
def initialize(options={})
|
140
|
+
require 'mime/types'
|
139
141
|
@aws_access_key_id = options[:aws_access_key_id]
|
140
142
|
@aws_secret_access_key = options[:aws_secret_access_key]
|
141
143
|
@hmac = Fog::HMAC.new('sha1', @aws_secret_access_key)
|
data/lib/fog/bluebox/compute.rb
CHANGED
data/lib/fog/core.rb
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
require 'fog/core/attributes'
|
2
2
|
require 'fog/core/collection'
|
3
|
+
require 'fog/core/compute'
|
3
4
|
require 'fog/core/connection'
|
4
5
|
require 'fog/core/deprecation'
|
5
6
|
require 'fog/core/errors'
|
6
7
|
require 'fog/core/hmac'
|
7
8
|
require 'fog/core/model'
|
8
|
-
require 'fog/core/parser'
|
9
|
+
# require 'fog/core/parser'
|
9
10
|
require 'fog/core/provider'
|
10
11
|
require 'fog/core/service'
|
11
|
-
require 'fog/core/ssh'
|
12
|
+
require 'fog/core/ssh'
|
13
|
+
require 'fog/core/storage'
|
data/lib/fog/core/attributes.rb
CHANGED
@@ -118,11 +118,13 @@ module Fog
|
|
118
118
|
end
|
119
119
|
|
120
120
|
def attributes
|
121
|
-
attributes
|
122
|
-
|
123
|
-
|
121
|
+
@attributes ||= begin
|
122
|
+
attributes = {}
|
123
|
+
for attribute in self.class.attributes
|
124
|
+
attributes[attribute] = send("#{attribute}")
|
125
|
+
end
|
126
|
+
attributes
|
124
127
|
end
|
125
|
-
attributes
|
126
128
|
end
|
127
129
|
|
128
130
|
def identity
|
@@ -138,8 +140,10 @@ module Fog
|
|
138
140
|
unless self.class.ignored_attributes.include?(key)
|
139
141
|
if aliased_key = self.class.aliases[key]
|
140
142
|
send("#{aliased_key}=", value)
|
141
|
-
|
143
|
+
elsif (methods | private_methods ).include?("#{key}=")
|
142
144
|
send("#{key}=", value)
|
145
|
+
else
|
146
|
+
attributes[key] = value
|
143
147
|
end
|
144
148
|
end
|
145
149
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Fog
|
2
|
+
class Storage
|
3
|
+
|
4
|
+
def self.new(attributes)
|
5
|
+
case attributes.delete(:provider)
|
6
|
+
when 'AWS'
|
7
|
+
require 'fog/aws'
|
8
|
+
Fog::AWS::Compute.new(attributes)
|
9
|
+
when 'Bluebox'
|
10
|
+
require 'fog/bluebox'
|
11
|
+
Fog::Bluebox::Compute.new(attributes)
|
12
|
+
when 'GoGrid'
|
13
|
+
require 'fog/go_grid'
|
14
|
+
Fog::GoGrid::Compute.new(attributes)
|
15
|
+
when 'Linode'
|
16
|
+
require 'fog/linode'
|
17
|
+
Fog::Linode::Compute.new(attributes)
|
18
|
+
when 'NewServers'
|
19
|
+
require 'fog/new_servers'
|
20
|
+
Fog::NewServers::Compute.new(attributes)
|
21
|
+
when 'Rackspace'
|
22
|
+
require 'fog/rackspace'
|
23
|
+
Fog::Rackspace::Compute.new(attributes)
|
24
|
+
when 'Slicehost'
|
25
|
+
require 'fog/slicehost'
|
26
|
+
Fog::Slicehost::Compute.new(attributes)
|
27
|
+
else
|
28
|
+
raise ArgumentError.new("#{provider} is not a recognized storage provider")
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
data/lib/fog/core/credentials.rb
CHANGED
data/lib/fog/core/model.rb
CHANGED
@@ -4,11 +4,7 @@ module Fog
|
|
4
4
|
extend Fog::Attributes::ClassMethods
|
5
5
|
include Fog::Attributes::InstanceMethods
|
6
6
|
|
7
|
-
attr_accessor :connection
|
8
|
-
|
9
|
-
def collection
|
10
|
-
@collection
|
11
|
-
end
|
7
|
+
attr_accessor :collection, :connection
|
12
8
|
|
13
9
|
def initialize(new_attributes = {})
|
14
10
|
merge_attributes(new_attributes)
|
@@ -28,6 +24,7 @@ module Fog
|
|
28
24
|
end
|
29
25
|
|
30
26
|
def reload
|
27
|
+
requires :identity
|
31
28
|
if data = collection.get(identity)
|
32
29
|
new_attributes = data.attributes
|
33
30
|
merge_attributes(new_attributes)
|
@@ -47,11 +44,5 @@ module Fog
|
|
47
44
|
end
|
48
45
|
end
|
49
46
|
|
50
|
-
private
|
51
|
-
|
52
|
-
def collection=(new_collection)
|
53
|
-
@collection = new_collection
|
54
|
-
end
|
55
|
-
|
56
47
|
end
|
57
48
|
end
|
data/lib/fog/core/ssh.rb
CHANGED
@@ -0,0 +1,24 @@
|
|
1
|
+
module Fog
|
2
|
+
class Storage
|
3
|
+
|
4
|
+
def self.new(attributes)
|
5
|
+
case provider = attributes.delete(:provider)
|
6
|
+
when 'AWS'
|
7
|
+
require 'fog/aws'
|
8
|
+
Fog::AWS::Storage.new(attributes)
|
9
|
+
when 'Google'
|
10
|
+
require 'fog/google'
|
11
|
+
Fog::Google::Storage.new(attributes)
|
12
|
+
when 'Local'
|
13
|
+
require 'fog/local'
|
14
|
+
Fog::Local::Storage.new(attributes)
|
15
|
+
when 'Rackspace'
|
16
|
+
require 'fog/rackspace'
|
17
|
+
Fog::Rackspace::Storage.new(attributes)
|
18
|
+
else
|
19
|
+
raise ArgumentError.new("#{provider} is not a recognized storage provider")
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
data/lib/fog/go_grid/compute.rb
CHANGED