fog 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +11 -6
- data/changelog.txt +49 -0
- data/fog.gemspec +5 -4
- data/lib/fog.rb +1 -1
- data/lib/fog/aws/cloud_formation.rb +124 -0
- data/lib/fog/aws/elb.rb +4 -1
- data/lib/fog/aws/iam.rb +6 -0
- data/lib/fog/aws/parsers/cloud_formation/basic.rb +12 -0
- data/lib/fog/aws/parsers/cloud_formation/create_stack.rb +19 -0
- data/lib/fog/aws/parsers/cloud_formation/describe_stack_events.rb +31 -0
- data/lib/fog/aws/parsers/cloud_formation/describe_stack_resources.rb +31 -0
- data/lib/fog/aws/parsers/cloud_formation/describe_stacks.rb +72 -0
- data/lib/fog/aws/parsers/cloud_formation/get_template.rb +19 -0
- data/lib/fog/aws/parsers/cloud_formation/validate_template.rb +52 -0
- data/lib/fog/aws/parsers/iam/login_profile.rb +27 -0
- data/lib/fog/aws/parsers/iam/upload_server_certificate.rb +26 -0
- data/lib/fog/aws/parsers/rds/authorize_db_security_group_ingress.rb +38 -0
- data/lib/fog/aws/parsers/rds/create_db_instance.rb +34 -0
- data/lib/fog/aws/parsers/rds/create_db_instance_read_replica.rb +34 -0
- data/lib/fog/aws/parsers/rds/create_db_parameter_group.rb +35 -0
- data/lib/fog/aws/parsers/rds/create_db_security_group.rb +38 -0
- data/lib/fog/aws/parsers/rds/create_db_snapshot.rb +35 -0
- data/lib/fog/aws/parsers/rds/db_parser.rb +123 -0
- data/lib/fog/aws/parsers/rds/delete_db_instance.rb +35 -0
- data/lib/fog/aws/parsers/rds/delete_db_parameter_group.rb +27 -0
- data/lib/fog/aws/parsers/rds/delete_db_security_group.rb +33 -0
- data/lib/fog/aws/parsers/rds/delete_db_snapshot.rb +34 -0
- data/lib/fog/aws/parsers/rds/describe_db_instances.rb +36 -0
- data/lib/fog/aws/parsers/rds/describe_db_parameter_groups.rb +38 -0
- data/lib/fog/aws/parsers/rds/describe_db_parameters.rb +44 -0
- data/lib/fog/aws/parsers/rds/describe_db_security_groups.rb +39 -0
- data/lib/fog/aws/parsers/rds/describe_db_snapshots.rb +39 -0
- data/lib/fog/aws/parsers/rds/modify_db_instance.rb +34 -0
- data/lib/fog/aws/parsers/rds/modify_db_parameter_group.rb +28 -0
- data/lib/fog/aws/parsers/rds/reboot_db_instance.rb +35 -0
- data/lib/fog/aws/parsers/rds/restore_db_instance_from_db_snapshot.rb +34 -0
- data/lib/fog/aws/parsers/rds/restore_db_instance_to_point_in_time.rb +35 -0
- data/lib/fog/aws/parsers/rds/revoke_db_security_group_ingress.rb +39 -0
- data/lib/fog/aws/parsers/rds/security_group_parser.rb +39 -0
- data/lib/fog/aws/parsers/rds/snapshot_parser.rb +40 -0
- data/lib/fog/aws/rds.rb +161 -0
- data/lib/fog/aws/rds/models/parameter.rb +21 -0
- data/lib/fog/aws/rds/models/parameter_group.rb +36 -0
- data/lib/fog/aws/rds/models/parameter_groups.rb +27 -0
- data/lib/fog/aws/rds/models/parameters.rb +37 -0
- data/lib/fog/aws/rds/models/security_group.rb +73 -0
- data/lib/fog/aws/rds/models/security_groups.rb +43 -0
- data/lib/fog/aws/rds/models/server.rb +105 -0
- data/lib/fog/aws/rds/models/servers.rb +27 -0
- data/lib/fog/aws/rds/models/snapshot.rb +49 -0
- data/lib/fog/aws/rds/models/snapshots.rb +45 -0
- data/lib/fog/aws/requests/cloud_formation/create_stack.rb +71 -0
- data/lib/fog/aws/requests/cloud_formation/delete_stack.rb +30 -0
- data/lib/fog/aws/requests/cloud_formation/describe_stack_events.rb +44 -0
- data/lib/fog/aws/requests/cloud_formation/describe_stack_resources.rb +43 -0
- data/lib/fog/aws/requests/cloud_formation/describe_stacks.rb +42 -0
- data/lib/fog/aws/requests/cloud_formation/get_template.rb +32 -0
- data/lib/fog/aws/requests/cloud_formation/validate_template.rb +34 -0
- data/lib/fog/aws/requests/elb/create_load_balancer.rb +4 -0
- data/lib/fog/aws/requests/iam/create_login_profile.rb +36 -0
- data/lib/fog/aws/requests/iam/delete_login_profile.rb +31 -0
- data/lib/fog/aws/requests/iam/delete_server_certificate.rb +32 -0
- data/lib/fog/aws/requests/iam/get_login_profile.rb +35 -0
- data/lib/fog/aws/requests/iam/update_login_profile.rb +33 -0
- data/lib/fog/aws/requests/iam/upload_server_certificate.rb +45 -0
- data/lib/fog/aws/requests/rds/authorize_db_security_group_ingress.rb +43 -0
- data/lib/fog/aws/requests/rds/create_db_instance.rb +56 -0
- data/lib/fog/aws/requests/rds/create_db_instance_read_replica.rb +42 -0
- data/lib/fog/aws/requests/rds/create_db_parameter_group.rb +41 -0
- data/lib/fog/aws/requests/rds/create_db_security_group.rb +37 -0
- data/lib/fog/aws/requests/rds/create_db_snapshot.rb +36 -0
- data/lib/fog/aws/requests/rds/delete_db_instance.rb +40 -0
- data/lib/fog/aws/requests/rds/delete_db_parameter_group.rb +36 -0
- data/lib/fog/aws/requests/rds/delete_db_security_group.rb +36 -0
- data/lib/fog/aws/requests/rds/delete_db_snapshot.rb +36 -0
- data/lib/fog/aws/requests/rds/describe_db_instances.rb +42 -0
- data/lib/fog/aws/requests/rds/describe_db_parameter_groups.rb +45 -0
- data/lib/fog/aws/requests/rds/describe_db_parameters.rb +46 -0
- data/lib/fog/aws/requests/rds/describe_db_security_groups.rb +39 -0
- data/lib/fog/aws/requests/rds/describe_db_snapshots.rb +42 -0
- data/lib/fog/aws/requests/rds/modify_db_instance.rb +54 -0
- data/lib/fog/aws/requests/rds/modify_db_parameter_group.rb +55 -0
- data/lib/fog/aws/requests/rds/reboot_db_instance.rb +34 -0
- data/lib/fog/aws/requests/rds/restore_db_instance_from_db_snapshot.rb +34 -0
- data/lib/fog/aws/requests/rds/restore_db_instance_to_point_in_time.rb +35 -0
- data/lib/fog/aws/requests/rds/revoke_db_security_group_ingress.rb +44 -0
- data/lib/fog/aws/simpledb.rb +21 -7
- data/lib/fog/bin.rb +2 -1
- data/lib/fog/bin/aws.rb +8 -0
- data/lib/fog/bin/virtual_box.rb +52 -0
- data/lib/fog/cdn/aws.rb +9 -8
- data/lib/fog/cdn/rackspace.rb +6 -6
- data/lib/fog/cdn/requests/rackspace/post_container.rb +30 -0
- data/lib/fog/cdn/requests/rackspace/put_container.rb +1 -1
- data/lib/fog/compute.rb +6 -3
- data/lib/fog/compute/aws.rb +11 -7
- data/lib/fog/compute/bluebox.rb +5 -6
- data/lib/fog/compute/brightbox.rb +3 -0
- data/lib/fog/compute/go_grid.rb +5 -6
- data/lib/fog/compute/linode.rb +5 -6
- data/lib/fog/compute/models/aws/flavors.rb +19 -18
- data/lib/fog/compute/models/aws/server.rb +23 -0
- data/lib/fog/compute/models/aws/tag.rb +1 -1
- data/lib/fog/compute/models/brightbox/server.rb +7 -1
- data/lib/fog/compute/models/virtual_box/medium.rb +87 -0
- data/lib/fog/compute/models/virtual_box/medium_format.rb +34 -0
- data/lib/fog/compute/models/virtual_box/mediums.rb +32 -0
- data/lib/fog/compute/models/virtual_box/nat_engine.rb +65 -0
- data/lib/fog/compute/models/virtual_box/nat_redirect.rb +91 -0
- data/lib/fog/compute/models/virtual_box/nat_redirects.rb +41 -0
- data/lib/fog/compute/models/virtual_box/network_adapter.rb +82 -0
- data/lib/fog/compute/models/virtual_box/network_adapters.rb +42 -0
- data/lib/fog/compute/models/virtual_box/server.rb +241 -0
- data/lib/fog/compute/models/virtual_box/servers.rb +41 -0
- data/lib/fog/compute/models/virtual_box/storage_controller.rb +83 -0
- data/lib/fog/compute/models/virtual_box/storage_controllers.rb +38 -0
- data/lib/fog/compute/models/voxel/servers.rb +7 -6
- data/lib/fog/compute/new_servers.rb +5 -6
- data/lib/fog/compute/parsers/aws/monitor_unmonitor_instances.rb +35 -0
- data/lib/fog/compute/rackspace.rb +7 -7
- data/lib/fog/compute/requests/aws/delete_tags.rb +12 -9
- data/lib/fog/compute/requests/aws/monitor_instances.rb +52 -0
- data/lib/fog/compute/requests/aws/revoke_security_group_ingress.rb +24 -8
- data/lib/fog/compute/requests/aws/unmonitor_instances.rb +53 -0
- data/lib/fog/compute/requests/brightbox/activate_console_server.rb +20 -0
- data/lib/fog/compute/requests/brightbox/add_listeners_load_balancer.rb +20 -0
- data/lib/fog/compute/requests/brightbox/remove_listeners_load_balancer.rb +20 -0
- data/lib/fog/compute/slicehost.rb +5 -6
- data/lib/fog/compute/virtual_box.rb +48 -0
- data/lib/fog/compute/voxel.rb +30 -27
- data/lib/fog/core.rb +1 -0
- data/lib/fog/core/attributes.rb +3 -1
- data/lib/fog/core/collection.rb +2 -2
- data/lib/fog/core/credentials.rb +13 -3
- data/lib/fog/core/scp.rb +0 -4
- data/lib/fog/core/service.rb +0 -8
- data/lib/fog/core/ssh.rb +0 -4
- data/lib/fog/dns.rb +3 -3
- data/lib/fog/dns/aws.rb +8 -8
- data/lib/fog/dns/bluebox.rb +5 -7
- data/lib/fog/dns/dnsimple.rb +7 -7
- data/lib/fog/dns/linode.rb +5 -6
- data/lib/fog/dns/models/dnsimple/record.rb +11 -1
- data/lib/fog/dns/models/dnsimple/records.rb +7 -7
- data/lib/fog/dns/models/dnsimple/zones.rb +2 -1
- data/lib/fog/dns/requests/dnsimple/get_record.rb +34 -0
- data/lib/fog/dns/slicehost.rb +5 -6
- data/lib/fog/dns/zerigo.rb +5 -7
- data/lib/fog/providers.rb +2 -1
- data/lib/fog/providers/aws.rb +10 -8
- data/lib/fog/providers/virtual_box.rb +11 -0
- data/lib/fog/storage.rb +21 -0
- data/lib/fog/storage/aws.rb +16 -32
- data/lib/fog/storage/google.rb +6 -27
- data/lib/fog/storage/local.rb +7 -7
- data/lib/fog/storage/models/rackspace/directory.rb +1 -1
- data/lib/fog/storage/models/rackspace/file.rb +1 -0
- data/lib/fog/storage/rackspace.rb +5 -27
- data/lib/fog/storage/requests/aws/put_object.rb +2 -2
- data/lib/fog/storage/requests/aws/upload_part.rb +1 -1
- data/lib/fog/storage/requests/google/put_object.rb +2 -2
- data/lib/fog/storage/requests/rackspace/put_object.rb +1 -1
- data/tests/aws/requests/cloud_formation/stack_tests.rb +130 -0
- data/tests/aws/requests/iam/login_profile_tests.rb +64 -0
- data/tests/aws/requests/rds/helper.rb +169 -0
- data/tests/aws/requests/rds/instance_tests.rb +129 -0
- data/tests/aws/requests/rds/model_tests.rb +98 -0
- data/tests/aws/requests/rds/parameter_group_tests.rb +68 -0
- data/tests/aws/requests/rds/parameter_request_tests.rb +35 -0
- data/tests/compute/models/aws/server_monitor_tests.rb +47 -0
- data/tests/compute/models/server_tests.rb +7 -23
- data/tests/compute/parsers/aws/monitor_unmonitor_instances_tests.rb +49 -0
- data/tests/compute/requests/aws/security_group_tests.rb +69 -52
- data/tests/compute/requests/aws/tag_tests.rb +5 -5
- data/tests/compute/requests/brightbox/helper.rb +7 -6
- data/tests/compute/requests/brightbox/server_tests.rb +5 -0
- data/tests/compute/requests/voxel/server_tests.rb +2 -3
- data/tests/storage/requests/aws/bucket_tests.rb +10 -0
- metadata +148 -12
@@ -36,7 +36,17 @@ module Fog
|
|
36
36
|
options = {}
|
37
37
|
options[:prio] = priority if priority
|
38
38
|
options[:ttl] = ttl if ttl
|
39
|
-
|
39
|
+
|
40
|
+
# decide whether its a new record or update of an existing
|
41
|
+
if id.nil?
|
42
|
+
data = connection.create_record(zone.domain, name, type, ip, options)
|
43
|
+
else
|
44
|
+
options[:name] = name if name
|
45
|
+
options[:content] = ip if ip
|
46
|
+
options[:type] = type if type
|
47
|
+
data = connection.update_record(zone.domain, id, options)
|
48
|
+
end
|
49
|
+
|
40
50
|
merge_attributes(data.body["record"])
|
41
51
|
true
|
42
52
|
end
|
@@ -13,16 +13,16 @@ module Fog
|
|
13
13
|
|
14
14
|
def all
|
15
15
|
requires :zone
|
16
|
-
|
16
|
+
clear
|
17
|
+
data = connection.list_records(zone.id).body.map {|record| record['record']}
|
18
|
+
load(data)
|
17
19
|
end
|
18
20
|
|
19
21
|
def get(record_id)
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
end
|
25
|
-
|
22
|
+
requires :zone
|
23
|
+
data = connection.get_record(zone.id, record_id).body["record"]
|
24
|
+
new(data)
|
25
|
+
rescue Excon::Errors::NotFound
|
26
26
|
nil
|
27
27
|
end
|
28
28
|
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Fog
|
2
|
+
module DNSimple
|
3
|
+
class DNS
|
4
|
+
class Real
|
5
|
+
|
6
|
+
# Gets record from given domain.
|
7
|
+
#
|
8
|
+
# ==== Parameters
|
9
|
+
# * domain<~String>
|
10
|
+
# * record_id<~String>
|
11
|
+
# ==== Returns
|
12
|
+
# * response<~Excon::Response>:
|
13
|
+
# * record<~Hash>
|
14
|
+
# * name<~String>
|
15
|
+
# * ttl<~Integer>
|
16
|
+
# * created_at<~String>
|
17
|
+
# * special_type<~String>
|
18
|
+
# * updated_at<~String>
|
19
|
+
# * domain_id<~Integer>
|
20
|
+
# * id<~Integer>
|
21
|
+
# * content<~String>
|
22
|
+
# * record_type<~String>
|
23
|
+
# * prio<~Integer>
|
24
|
+
def get_record(domain, record_id)
|
25
|
+
|
26
|
+
request( :expects => 200,
|
27
|
+
:method => "GET",
|
28
|
+
:path => "/domains/#{domain}/records/#{record_id}" )
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/fog/dns/slicehost.rb
CHANGED
@@ -30,12 +30,6 @@ module Fog
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
-
def self.reset_data(keys=data.keys)
|
34
|
-
for key in [*keys]
|
35
|
-
data.delete(key)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
33
|
def initialize(options={})
|
40
34
|
unless options.delete(:provider)
|
41
35
|
location = caller.first
|
@@ -45,6 +39,11 @@ module Fog
|
|
45
39
|
end
|
46
40
|
|
47
41
|
@slicehost_password = options[:slicehost_password]
|
42
|
+
reset_data
|
43
|
+
end
|
44
|
+
|
45
|
+
def reset_data
|
46
|
+
self.class.data.delete(@slicehost_password)
|
48
47
|
@data = self.class.data[@slicehost_password]
|
49
48
|
end
|
50
49
|
|
data/lib/fog/dns/zerigo.rb
CHANGED
@@ -36,12 +36,6 @@ module Fog
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
-
def self.reset_data(keys=data.keys)
|
40
|
-
for key in [*keys]
|
41
|
-
data.delete(key)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
39
|
def initialize(options={})
|
46
40
|
unless options.delete(:provider)
|
47
41
|
location = caller.first
|
@@ -52,8 +46,12 @@ module Fog
|
|
52
46
|
|
53
47
|
@zerigo_email = options[:zerigo_email]
|
54
48
|
@zerigo_token = options[:zerigo_token]
|
49
|
+
reset_data
|
50
|
+
end
|
51
|
+
|
52
|
+
def reset_data
|
53
|
+
self.class.data.delete(@zerigo_email)
|
55
54
|
@data = self.class.data[@zerigo_email]
|
56
|
-
@data = self.class.data[@zerigo_password]
|
57
55
|
end
|
58
56
|
|
59
57
|
end
|
data/lib/fog/providers.rb
CHANGED
@@ -9,6 +9,7 @@ end
|
|
9
9
|
require 'fog/providers/aws'
|
10
10
|
require 'fog/providers/bluebox'
|
11
11
|
require 'fog/providers/brightbox'
|
12
|
+
require 'fog/providers/dnsimple'
|
12
13
|
require 'fog/providers/ecloud'
|
13
14
|
require 'fog/providers/go_grid'
|
14
15
|
require 'fog/providers/google'
|
@@ -17,6 +18,6 @@ require 'fog/providers/local'
|
|
17
18
|
require 'fog/providers/new_servers'
|
18
19
|
require 'fog/providers/rackspace'
|
19
20
|
require 'fog/providers/slicehost'
|
21
|
+
require 'fog/providers/virtual_box'
|
20
22
|
require 'fog/providers/voxel'
|
21
23
|
require 'fog/providers/zerigo'
|
22
|
-
require 'fog/providers/dnsimple'
|
data/lib/fog/providers/aws.rb
CHANGED
@@ -6,14 +6,16 @@ module Fog
|
|
6
6
|
|
7
7
|
extend Fog::Provider
|
8
8
|
|
9
|
-
service(:cdn,
|
10
|
-
service(:compute,
|
11
|
-
service(:
|
12
|
-
service(:
|
13
|
-
service(:
|
14
|
-
service(:
|
15
|
-
service(:
|
16
|
-
service(:
|
9
|
+
service(:cdn, 'cdn/aws')
|
10
|
+
service(:compute, 'compute/aws')
|
11
|
+
service(:cloud_formation, 'aws/cloud_formation')
|
12
|
+
service(:dns, 'dns/aws')
|
13
|
+
service(:elb, 'aws/elb')
|
14
|
+
service(:iam, 'aws/iam')
|
15
|
+
service(:rds, 'aws/rds')
|
16
|
+
service(:ses, 'aws/ses')
|
17
|
+
service(:simpledb, 'aws/simpledb')
|
18
|
+
service(:storage, 'storage/aws')
|
17
19
|
|
18
20
|
def self.indexed_param(key, values)
|
19
21
|
params = {}
|
data/lib/fog/storage.rb
CHANGED
@@ -21,5 +21,26 @@ module Fog
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
+
def self.parse_data(data)
|
25
|
+
metadata = {
|
26
|
+
:body => nil,
|
27
|
+
:headers => {}
|
28
|
+
}
|
29
|
+
|
30
|
+
if data.is_a?(String)
|
31
|
+
metadata[:body] = data
|
32
|
+
metadata[:headers]['Content-Length'] = metadata[:body].size
|
33
|
+
else
|
34
|
+
filename = ::File.basename(data.path)
|
35
|
+
unless (mime_types = MIME::Types.of(filename)).empty?
|
36
|
+
metadata[:headers]['Content-Type'] = mime_types.first.content_type
|
37
|
+
end
|
38
|
+
metadata[:body] = data
|
39
|
+
metadata[:headers]['Content-Length'] = ::File.size(data.path)
|
40
|
+
end
|
41
|
+
# metadata[:headers]['Content-MD5'] = Base64.encode64(Digest::MD5.digest(metadata[:body])).strip
|
42
|
+
metadata
|
43
|
+
end
|
44
|
+
|
24
45
|
end
|
25
46
|
end
|
data/lib/fog/storage/aws.rb
CHANGED
@@ -58,27 +58,6 @@ module Fog
|
|
58
58
|
)
|
59
59
|
end
|
60
60
|
|
61
|
-
def parse_data(data)
|
62
|
-
metadata = {
|
63
|
-
:body => nil,
|
64
|
-
:headers => {}
|
65
|
-
}
|
66
|
-
|
67
|
-
if data.is_a?(String)
|
68
|
-
metadata[:body] = data
|
69
|
-
metadata[:headers]['Content-Length'] = metadata[:body].size
|
70
|
-
else
|
71
|
-
filename = ::File.basename(data.path)
|
72
|
-
unless (mime_types = MIME::Types.of(filename)).empty?
|
73
|
-
metadata[:headers]['Content-Type'] = mime_types.first.content_type
|
74
|
-
end
|
75
|
-
metadata[:body] = data
|
76
|
-
metadata[:headers]['Content-Length'] = ::File.size(data.path)
|
77
|
-
end
|
78
|
-
# metadata[:headers]['Content-MD5'] = Base64.encode64(Digest::MD5.digest(metadata[:body])).strip
|
79
|
-
metadata
|
80
|
-
end
|
81
|
-
|
82
61
|
def url(params, expires)
|
83
62
|
params[:headers]['Date'] = expires.to_i
|
84
63
|
params[:path] = CGI.escape(params[:path]).gsub('%2F', '/')
|
@@ -169,12 +148,6 @@ module Fog
|
|
169
148
|
end
|
170
149
|
end
|
171
150
|
|
172
|
-
def self.reset_data(keys=data.keys)
|
173
|
-
for key in [*keys]
|
174
|
-
data.delete(key)
|
175
|
-
end
|
176
|
-
end
|
177
|
-
|
178
151
|
def initialize(options={})
|
179
152
|
unless options.delete(:provider)
|
180
153
|
location = caller.first
|
@@ -188,23 +161,32 @@ module Fog
|
|
188
161
|
@aws_secret_access_key = options[:aws_secret_access_key]
|
189
162
|
options[:region] ||= 'us-east-1'
|
190
163
|
@host = options[:host] || case options[:region]
|
164
|
+
when 'ap-northeast-1'
|
165
|
+
's3-ap-northeast-1.amazonaws.com'
|
166
|
+
when 'ap-southeast-1'
|
167
|
+
's3-ap-southeast-1.amazonaws.com'
|
191
168
|
when 'eu-west-1'
|
192
169
|
's3-eu-west-1.amazonaws.com'
|
193
170
|
when 'us-east-1'
|
194
171
|
's3.amazonaws.com'
|
195
|
-
when 'ap-southeast-1'
|
196
|
-
's3-ap-southeast-1.amazonaws.com'
|
197
172
|
when 'us-west-1'
|
198
173
|
's3-us-west-1.amazonaws.com'
|
199
174
|
else
|
200
175
|
raise ArgumentError, "Unknown region: #{options[:region].inspect}"
|
201
176
|
end
|
202
|
-
@
|
177
|
+
@region = options[:region]
|
178
|
+
reset_data
|
179
|
+
end
|
180
|
+
|
181
|
+
def reset_data
|
182
|
+
self.class.data[@region].delete(@aws_access_key_id)
|
183
|
+
@data = self.class.data[@region][@aws_access_key_id]
|
203
184
|
end
|
204
185
|
|
205
186
|
def signature(params)
|
206
187
|
"foo"
|
207
188
|
end
|
189
|
+
|
208
190
|
end
|
209
191
|
|
210
192
|
class Real
|
@@ -250,12 +232,14 @@ module Fog
|
|
250
232
|
else
|
251
233
|
options[:region] ||= 'us-east-1'
|
252
234
|
@host = options[:host] || case options[:region]
|
235
|
+
when 'ap-northeast-1'
|
236
|
+
's3-ap-northeast-1.amazonaws.com'
|
237
|
+
when 'ap-southeast-1'
|
238
|
+
's3-ap-southeast-1.amazonaws.com'
|
253
239
|
when 'eu-west-1'
|
254
240
|
's3-eu-west-1.amazonaws.com'
|
255
241
|
when 'us-east-1'
|
256
242
|
's3.amazonaws.com'
|
257
|
-
when 'ap-southeast-1'
|
258
|
-
's3-ap-southeast-1.amazonaws.com'
|
259
243
|
when 'us-west-1'
|
260
244
|
's3-us-west-1.amazonaws.com'
|
261
245
|
else
|
data/lib/fog/storage/google.rb
CHANGED
@@ -31,27 +31,6 @@ module Fog
|
|
31
31
|
|
32
32
|
module Utils
|
33
33
|
|
34
|
-
def parse_data(data)
|
35
|
-
metadata = {
|
36
|
-
:body => nil,
|
37
|
-
:headers => {}
|
38
|
-
}
|
39
|
-
|
40
|
-
if data.is_a?(String)
|
41
|
-
metadata[:body] = data
|
42
|
-
metadata[:headers]['Content-Length'] = metadata[:body].size
|
43
|
-
else
|
44
|
-
filename = ::File.basename(data.path)
|
45
|
-
unless (mime_types = MIME::Types.of(filename)).empty?
|
46
|
-
metadata[:headers]['Content-Type'] = mime_types.first.content_type
|
47
|
-
end
|
48
|
-
metadata[:body] = data
|
49
|
-
metadata[:headers]['Content-Length'] = ::File.size(data.path)
|
50
|
-
end
|
51
|
-
# metadata[:headers]['Content-MD5'] = Base64.encode64(Digest::MD5.digest(metadata[:body])).strip
|
52
|
-
metadata
|
53
|
-
end
|
54
|
-
|
55
34
|
def url(params, expires)
|
56
35
|
params[:headers]['Date'] = expires.to_i
|
57
36
|
params[:path] = CGI.escape(params[:path]).gsub('%2F', '/')
|
@@ -140,12 +119,6 @@ module Fog
|
|
140
119
|
end
|
141
120
|
end
|
142
121
|
|
143
|
-
def self.reset_data(keys=data.keys)
|
144
|
-
for key in [*keys]
|
145
|
-
data.delete(key)
|
146
|
-
end
|
147
|
-
end
|
148
|
-
|
149
122
|
def initialize(options={})
|
150
123
|
unless options.delete(:provider)
|
151
124
|
location = caller.first
|
@@ -156,12 +129,18 @@ module Fog
|
|
156
129
|
|
157
130
|
require 'mime/types'
|
158
131
|
@google_storage_access_key_id = options[:google_storage_access_key_id]
|
132
|
+
reset_data
|
133
|
+
end
|
134
|
+
|
135
|
+
def reset_data
|
136
|
+
self.class.data.delete(@google_storage_access_key_id)
|
159
137
|
@data = self.class.data[@google_storage_access_key_id]
|
160
138
|
end
|
161
139
|
|
162
140
|
def signature(params)
|
163
141
|
"foo"
|
164
142
|
end
|
143
|
+
|
165
144
|
end
|
166
145
|
|
167
146
|
|
data/lib/fog/storage/local.rb
CHANGED
@@ -19,12 +19,6 @@ module Fog
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
def self.reset_data(keys=data.keys)
|
23
|
-
for key in [*keys]
|
24
|
-
data.delete(key)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
22
|
def initialize(options={})
|
29
23
|
Fog::Mock.not_implemented
|
30
24
|
|
@@ -37,7 +31,7 @@ module Fog
|
|
37
31
|
end
|
38
32
|
|
39
33
|
@local_root = ::File.expand_path(options[:local_root])
|
40
|
-
|
34
|
+
reset_data
|
41
35
|
end
|
42
36
|
|
43
37
|
def local_root
|
@@ -47,6 +41,12 @@ module Fog
|
|
47
41
|
def path_to(partial)
|
48
42
|
::File.join(@local_root, partial)
|
49
43
|
end
|
44
|
+
|
45
|
+
def reset_data
|
46
|
+
self.class.data.delete(@local_root)
|
47
|
+
@data = self.class.data[@local_root]
|
48
|
+
end
|
49
|
+
|
50
50
|
end
|
51
51
|
|
52
52
|
class Real
|
@@ -15,7 +15,7 @@ module Fog
|
|
15
15
|
def destroy
|
16
16
|
requires :key
|
17
17
|
connection.delete_container(key)
|
18
|
-
connection.cdn.
|
18
|
+
connection.cdn.post_container(key, 'X-CDN-Enabled' => 'False')
|
19
19
|
true
|
20
20
|
rescue Excon::Errors::NotFound
|
21
21
|
false
|
@@ -34,27 +34,6 @@ module Fog
|
|
34
34
|
)
|
35
35
|
end
|
36
36
|
|
37
|
-
def parse_data(data)
|
38
|
-
metadata = {
|
39
|
-
:body => nil,
|
40
|
-
:headers => {}
|
41
|
-
}
|
42
|
-
|
43
|
-
if data.is_a?(String)
|
44
|
-
metadata[:body] = data
|
45
|
-
metadata[:headers]['Content-Length'] = metadata[:body].size.to_s
|
46
|
-
else
|
47
|
-
filename = ::File.basename(data.path)
|
48
|
-
unless (mime_types = MIME::Types.of(filename)).empty?
|
49
|
-
metadata[:headers]['Content-Type'] = mime_types.first.content_type
|
50
|
-
end
|
51
|
-
metadata[:body] = data.read
|
52
|
-
metadata[:headers]['Content-Length'] = ::File.size(data.path).to_s
|
53
|
-
end
|
54
|
-
# metadata[:headers]['Content-MD5'] = Base64.encode64(Digest::MD5.digest(metadata[:body])).strip
|
55
|
-
metadata
|
56
|
-
end
|
57
|
-
|
58
37
|
end
|
59
38
|
|
60
39
|
class Mock
|
@@ -66,12 +45,6 @@ module Fog
|
|
66
45
|
end
|
67
46
|
end
|
68
47
|
|
69
|
-
def self.reset_data(keys=data.keys)
|
70
|
-
for key in [*keys]
|
71
|
-
data.delete(key)
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
48
|
def initialize(options={})
|
76
49
|
unless options.delete(:provider)
|
77
50
|
location = caller.first
|
@@ -83,6 +56,11 @@ module Fog
|
|
83
56
|
require 'mime/types'
|
84
57
|
@rackspace_api_key = options[:rackspace_api_key]
|
85
58
|
@rackspace_username = options[:rackspace_username]
|
59
|
+
reset_data
|
60
|
+
end
|
61
|
+
|
62
|
+
def reset_data
|
63
|
+
self.class.data.delete(@rackspace_username)
|
86
64
|
@data = self.class.data[@rackspace_username]
|
87
65
|
end
|
88
66
|
|