fog-brightbox 0.6.1 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/.rubocop.yml +20 -0
- data/.rubocop_todo.yml +81 -0
- data/CHANGELOG.md +17 -0
- data/README.md +6 -0
- data/fog-brightbox.gemspec +10 -9
- data/gemfiles/Gemfile.1.8.7 +1 -0
- data/lib/fog/brightbox.rb +2 -2
- data/lib/fog/brightbox/compute.rb +47 -48
- data/lib/fog/brightbox/compute/resource_locking.rb +26 -20
- data/lib/fog/brightbox/compute/shared.rb +2 -7
- data/lib/fog/brightbox/config.rb +12 -15
- data/lib/fog/brightbox/core.rb +5 -5
- data/lib/fog/brightbox/link_helper.rb +33 -0
- data/lib/fog/brightbox/models/compute/account.rb +0 -1
- data/lib/fog/brightbox/models/compute/accounts.rb +2 -6
- data/lib/fog/brightbox/models/compute/api_client.rb +2 -2
- data/lib/fog/brightbox/models/compute/application.rb +2 -2
- data/lib/fog/brightbox/models/compute/applications.rb +2 -6
- data/lib/fog/brightbox/models/compute/cloud_ip.rb +0 -4
- data/lib/fog/brightbox/models/compute/cloud_ips.rb +2 -6
- data/lib/fog/brightbox/models/compute/collaboration.rb +4 -4
- data/lib/fog/brightbox/models/compute/database_server.rb +11 -4
- data/lib/fog/brightbox/models/compute/database_servers.rb +2 -6
- data/lib/fog/brightbox/models/compute/database_snapshot.rb +1 -1
- data/lib/fog/brightbox/models/compute/database_snapshots.rb +2 -2
- data/lib/fog/brightbox/models/compute/database_types.rb +2 -4
- data/lib/fog/brightbox/models/compute/event.rb +0 -2
- data/lib/fog/brightbox/models/compute/events.rb +2 -4
- data/lib/fog/brightbox/models/compute/firewall_policies.rb +2 -6
- data/lib/fog/brightbox/models/compute/firewall_policy.rb +2 -3
- data/lib/fog/brightbox/models/compute/firewall_rule.rb +2 -3
- data/lib/fog/brightbox/models/compute/firewall_rules.rb +2 -6
- data/lib/fog/brightbox/models/compute/flavor.rb +0 -1
- data/lib/fog/brightbox/models/compute/flavors.rb +2 -6
- data/lib/fog/brightbox/models/compute/image.rb +3 -3
- data/lib/fog/brightbox/models/compute/images.rb +2 -6
- data/lib/fog/brightbox/models/compute/load_balancer.rb +5 -5
- data/lib/fog/brightbox/models/compute/load_balancers.rb +2 -6
- data/lib/fog/brightbox/models/compute/server.rb +15 -9
- data/lib/fog/brightbox/models/compute/server_group.rb +1 -1
- data/lib/fog/brightbox/models/compute/server_groups.rb +2 -6
- data/lib/fog/brightbox/models/compute/servers.rb +2 -6
- data/lib/fog/brightbox/models/compute/user.rb +0 -1
- data/lib/fog/brightbox/models/compute/user_collaboration.rb +2 -3
- data/lib/fog/brightbox/models/compute/users.rb +2 -5
- data/lib/fog/brightbox/models/compute/zones.rb +2 -6
- data/lib/fog/brightbox/models/storage/directories.rb +6 -13
- data/lib/fog/brightbox/models/storage/directory.rb +5 -7
- data/lib/fog/brightbox/models/storage/file.rb +37 -45
- data/lib/fog/brightbox/models/storage/files.rb +21 -25
- data/lib/fog/brightbox/oauth2.rb +136 -137
- data/lib/fog/brightbox/requests/compute/accept_user_collaboration.rb +0 -1
- data/lib/fog/brightbox/requests/compute/activate_console_server.rb +0 -1
- data/lib/fog/brightbox/requests/compute/add_listeners_load_balancer.rb +0 -1
- data/lib/fog/brightbox/requests/compute/add_nodes_load_balancer.rb +0 -1
- data/lib/fog/brightbox/requests/compute/add_servers_server_group.rb +0 -1
- data/lib/fog/brightbox/requests/compute/apply_to_firewall_policy.rb +0 -1
- data/lib/fog/brightbox/requests/compute/create_api_client.rb +0 -1
- data/lib/fog/brightbox/requests/compute/create_application.rb +0 -1
- data/lib/fog/brightbox/requests/compute/create_cloud_ip.rb +0 -1
- data/lib/fog/brightbox/requests/compute/create_collaboration.rb +0 -1
- data/lib/fog/brightbox/requests/compute/create_database_server.rb +0 -1
- data/lib/fog/brightbox/requests/compute/create_firewall_policy.rb +0 -1
- data/lib/fog/brightbox/requests/compute/create_firewall_rule.rb +0 -1
- data/lib/fog/brightbox/requests/compute/create_image.rb +0 -1
- data/lib/fog/brightbox/requests/compute/create_load_balancer.rb +0 -1
- data/lib/fog/brightbox/requests/compute/create_server.rb +0 -1
- data/lib/fog/brightbox/requests/compute/create_server_group.rb +0 -1
- data/lib/fog/brightbox/requests/compute/get_account.rb +0 -1
- data/lib/fog/brightbox/requests/compute/get_api_client.rb +0 -1
- data/lib/fog/brightbox/requests/compute/get_application.rb +0 -1
- data/lib/fog/brightbox/requests/compute/get_authenticated_user.rb +0 -2
- data/lib/fog/brightbox/requests/compute/get_cloud_ip.rb +0 -1
- data/lib/fog/brightbox/requests/compute/get_collaboration.rb +0 -1
- data/lib/fog/brightbox/requests/compute/get_database_server.rb +0 -1
- data/lib/fog/brightbox/requests/compute/get_database_snapshot.rb +0 -1
- data/lib/fog/brightbox/requests/compute/get_database_type.rb +0 -1
- data/lib/fog/brightbox/requests/compute/get_firewall_policy.rb +0 -1
- data/lib/fog/brightbox/requests/compute/get_firewall_rule.rb +0 -1
- data/lib/fog/brightbox/requests/compute/get_image.rb +0 -1
- data/lib/fog/brightbox/requests/compute/get_interface.rb +0 -1
- data/lib/fog/brightbox/requests/compute/get_load_balancer.rb +0 -1
- data/lib/fog/brightbox/requests/compute/get_scoped_account.rb +0 -1
- data/lib/fog/brightbox/requests/compute/get_server.rb +0 -1
- data/lib/fog/brightbox/requests/compute/get_server_group.rb +0 -1
- data/lib/fog/brightbox/requests/compute/get_server_type.rb +0 -1
- data/lib/fog/brightbox/requests/compute/get_user.rb +0 -1
- data/lib/fog/brightbox/requests/compute/get_user_collaboration.rb +0 -1
- data/lib/fog/brightbox/requests/compute/get_zone.rb +0 -1
- data/lib/fog/brightbox/requests/compute/list_accounts.rb +0 -1
- data/lib/fog/brightbox/requests/compute/list_api_clients.rb +0 -1
- data/lib/fog/brightbox/requests/compute/list_applications.rb +0 -1
- data/lib/fog/brightbox/requests/compute/list_cloud_ips.rb +0 -1
- data/lib/fog/brightbox/requests/compute/list_collaborations.rb +0 -1
- data/lib/fog/brightbox/requests/compute/list_database_servers.rb +0 -1
- data/lib/fog/brightbox/requests/compute/list_database_snapshots.rb +0 -1
- data/lib/fog/brightbox/requests/compute/list_database_types.rb +0 -1
- data/lib/fog/brightbox/requests/compute/list_events.rb +0 -1
- data/lib/fog/brightbox/requests/compute/list_firewall_policies.rb +0 -1
- data/lib/fog/brightbox/requests/compute/list_images.rb +0 -1
- data/lib/fog/brightbox/requests/compute/list_load_balancers.rb +0 -1
- data/lib/fog/brightbox/requests/compute/list_server_groups.rb +0 -1
- data/lib/fog/brightbox/requests/compute/list_server_types.rb +0 -1
- data/lib/fog/brightbox/requests/compute/list_servers.rb +0 -1
- data/lib/fog/brightbox/requests/compute/list_user_collaborations.rb +0 -1
- data/lib/fog/brightbox/requests/compute/list_users.rb +0 -1
- data/lib/fog/brightbox/requests/compute/list_zones.rb +0 -1
- data/lib/fog/brightbox/requests/compute/lock_resource_database_server.rb +0 -1
- data/lib/fog/brightbox/requests/compute/lock_resource_database_snapshot.rb +0 -1
- data/lib/fog/brightbox/requests/compute/lock_resource_image.rb +0 -1
- data/lib/fog/brightbox/requests/compute/lock_resource_load_balancer.rb +0 -1
- data/lib/fog/brightbox/requests/compute/lock_resource_server.rb +0 -1
- data/lib/fog/brightbox/requests/compute/map_cloud_ip.rb +0 -1
- data/lib/fog/brightbox/requests/compute/move_servers_server_group.rb +0 -1
- data/lib/fog/brightbox/requests/compute/reboot_server.rb +0 -1
- data/lib/fog/brightbox/requests/compute/reject_user_collaboration.rb +0 -1
- data/lib/fog/brightbox/requests/compute/remove_firewall_policy.rb +0 -1
- data/lib/fog/brightbox/requests/compute/remove_listeners_load_balancer.rb +0 -1
- data/lib/fog/brightbox/requests/compute/remove_nodes_load_balancer.rb +0 -1
- data/lib/fog/brightbox/requests/compute/remove_servers_server_group.rb +0 -1
- data/lib/fog/brightbox/requests/compute/resend_collaboration.rb +0 -1
- data/lib/fog/brightbox/requests/compute/reset_ftp_password_account.rb +0 -2
- data/lib/fog/brightbox/requests/compute/reset_ftp_password_scoped_account.rb +0 -1
- data/lib/fog/brightbox/requests/compute/reset_password_database_server.rb +0 -1
- data/lib/fog/brightbox/requests/compute/reset_secret_api_client.rb +0 -1
- data/lib/fog/brightbox/requests/compute/reset_secret_application.rb +0 -1
- data/lib/fog/brightbox/requests/compute/reset_server.rb +0 -1
- data/lib/fog/brightbox/requests/compute/shutdown_server.rb +0 -1
- data/lib/fog/brightbox/requests/compute/snapshot_database_server.rb +19 -3
- data/lib/fog/brightbox/requests/compute/snapshot_server.rb +19 -3
- data/lib/fog/brightbox/requests/compute/start_server.rb +0 -1
- data/lib/fog/brightbox/requests/compute/stop_server.rb +0 -1
- data/lib/fog/brightbox/requests/compute/unlock_resource_database_server.rb +0 -1
- data/lib/fog/brightbox/requests/compute/unlock_resource_database_snapshot.rb +0 -1
- data/lib/fog/brightbox/requests/compute/unlock_resource_image.rb +0 -1
- data/lib/fog/brightbox/requests/compute/unlock_resource_load_balancer.rb +0 -1
- data/lib/fog/brightbox/requests/compute/unlock_resource_server.rb +0 -1
- data/lib/fog/brightbox/requests/compute/unmap_cloud_ip.rb +0 -1
- data/lib/fog/brightbox/requests/compute/update_account.rb +0 -1
- data/lib/fog/brightbox/requests/compute/update_api_client.rb +0 -1
- data/lib/fog/brightbox/requests/compute/update_application.rb +0 -1
- data/lib/fog/brightbox/requests/compute/update_cloud_ip.rb +0 -1
- data/lib/fog/brightbox/requests/compute/update_database_server.rb +0 -1
- data/lib/fog/brightbox/requests/compute/update_database_snapshot.rb +0 -1
- data/lib/fog/brightbox/requests/compute/update_firewall_policy.rb +0 -1
- data/lib/fog/brightbox/requests/compute/update_firewall_rule.rb +0 -1
- data/lib/fog/brightbox/requests/compute/update_image.rb +0 -1
- data/lib/fog/brightbox/requests/compute/update_load_balancer.rb +0 -1
- data/lib/fog/brightbox/requests/compute/update_scoped_account.rb +0 -1
- data/lib/fog/brightbox/requests/compute/update_server.rb +0 -1
- data/lib/fog/brightbox/requests/compute/update_server_group.rb +0 -1
- data/lib/fog/brightbox/requests/compute/update_user.rb +0 -1
- data/lib/fog/brightbox/requests/storage/copy_object.rb +8 -10
- data/lib/fog/brightbox/requests/storage/delete_container.rb +1 -3
- data/lib/fog/brightbox/requests/storage/delete_multiple_objects.rb +7 -9
- data/lib/fog/brightbox/requests/storage/delete_object.rb +1 -3
- data/lib/fog/brightbox/requests/storage/delete_static_large_object.rb +7 -9
- data/lib/fog/brightbox/requests/storage/get_container.rb +3 -5
- data/lib/fog/brightbox/requests/storage/get_containers.rb +4 -6
- data/lib/fog/brightbox/requests/storage/get_object.rb +1 -3
- data/lib/fog/brightbox/requests/storage/get_object_https_url.rb +5 -10
- data/lib/fog/brightbox/requests/storage/head_container.rb +2 -4
- data/lib/fog/brightbox/requests/storage/head_containers.rb +3 -5
- data/lib/fog/brightbox/requests/storage/head_object.rb +4 -6
- data/lib/fog/brightbox/requests/storage/post_set_meta_temp_url_key.rb +2 -6
- data/lib/fog/brightbox/requests/storage/put_container.rb +3 -5
- data/lib/fog/brightbox/requests/storage/put_dynamic_obj_manifest.rb +2 -4
- data/lib/fog/brightbox/requests/storage/put_object.rb +1 -2
- data/lib/fog/brightbox/requests/storage/put_object_manifest.rb +0 -2
- data/lib/fog/brightbox/requests/storage/put_static_obj_manifest.rb +2 -4
- data/lib/fog/brightbox/storage.rb +26 -29
- data/lib/fog/brightbox/storage/connection.rb +10 -10
- data/lib/fog/brightbox/version.rb +1 -1
- data/spec/fog/brightbox/link_helper_spec.rb +18 -0
- data/spec/fog/brightbox/storage/authentication_request_spec.rb +16 -16
- data/spec/fog/brightbox/storage/connection_spec.rb +12 -12
- data/spec/fog/compute/brightbox/database_server_spec.rb +31 -0
- data/spec/fog/compute/brightbox/server_spec.rb +31 -0
- data/spec/fog/storage/brightbox_spec.rb +3 -3
- data/spec/spec_helper.rb +1 -1
- metadata +28 -10
- data/spec/model_helper.rb +0 -22
@@ -2,7 +2,6 @@ module Fog
|
|
2
2
|
module Storage
|
3
3
|
class Brightbox
|
4
4
|
class Real
|
5
|
-
|
6
5
|
# Copy object
|
7
6
|
#
|
8
7
|
# ==== Parameters
|
@@ -11,16 +10,15 @@ module Fog
|
|
11
10
|
# * target_container_name<~String> - Name of bucket to create copy in
|
12
11
|
# * target_object_name<~String> - Name for new copy of object
|
13
12
|
# * options<~Hash> - Additional headers
|
14
|
-
def copy_object(source_container_name, source_object_name, target_container_name, target_object_name, options={})
|
15
|
-
headers = {
|
16
|
-
request(
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
13
|
+
def copy_object(source_container_name, source_object_name, target_container_name, target_object_name, options = {})
|
14
|
+
headers = { "X-Copy-From" => "/#{source_container_name}/#{source_object_name}" }.merge(options)
|
15
|
+
request(
|
16
|
+
:expects => 201,
|
17
|
+
:headers => headers,
|
18
|
+
:method => "PUT",
|
19
|
+
:path => "#{Fog::Storage::Brightbox.escape(target_container_name)}/#{Fog::Storage::Brightbox.escape(target_object_name)}"
|
20
|
+
)
|
22
21
|
end
|
23
|
-
|
24
22
|
end
|
25
23
|
end
|
26
24
|
end
|
@@ -2,7 +2,6 @@ module Fog
|
|
2
2
|
module Storage
|
3
3
|
class Brightbox
|
4
4
|
class Real
|
5
|
-
|
6
5
|
# Delete an existing container
|
7
6
|
#
|
8
7
|
# ==== Parameters
|
@@ -11,11 +10,10 @@ module Fog
|
|
11
10
|
def delete_container(name)
|
12
11
|
request(
|
13
12
|
:expects => 204,
|
14
|
-
:method =>
|
13
|
+
:method => "DELETE",
|
15
14
|
:path => Fog::Storage::Brightbox.escape(name)
|
16
15
|
)
|
17
16
|
end
|
18
|
-
|
19
17
|
end
|
20
18
|
end
|
21
19
|
end
|
@@ -2,7 +2,6 @@ module Fog
|
|
2
2
|
module Storage
|
3
3
|
class Brightbox
|
4
4
|
class Real
|
5
|
-
|
6
5
|
# Deletes multiple objects or containers with a single request.
|
7
6
|
#
|
8
7
|
# To delete objects from a single container, +container+ may be provided
|
@@ -50,17 +49,16 @@ module Fog
|
|
50
49
|
end.join("\n")
|
51
50
|
|
52
51
|
response = request({
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
52
|
+
:expects => 200,
|
53
|
+
:method => "DELETE",
|
54
|
+
:headers => options.merge("Content-Type" => "text/plain",
|
55
|
+
"Accept" => "application/json"),
|
56
|
+
:body => body,
|
57
|
+
:query => { "bulk-delete" => true }
|
58
|
+
}, false)
|
60
59
|
response.body = Fog::JSON.decode(response.body)
|
61
60
|
response
|
62
61
|
end
|
63
|
-
|
64
62
|
end
|
65
63
|
end
|
66
64
|
end
|
@@ -2,7 +2,6 @@ module Fog
|
|
2
2
|
module Storage
|
3
3
|
class Brightbox
|
4
4
|
class Real
|
5
|
-
|
6
5
|
# Delete an existing object
|
7
6
|
#
|
8
7
|
# ==== Parameters
|
@@ -12,11 +11,10 @@ module Fog
|
|
12
11
|
def delete_object(container, object)
|
13
12
|
request(
|
14
13
|
:expects => 204,
|
15
|
-
:method =>
|
14
|
+
:method => "DELETE",
|
16
15
|
:path => "#{Fog::Storage::Brightbox.escape(container)}/#{Fog::Storage::Brightbox.escape(object)}"
|
17
16
|
)
|
18
17
|
end
|
19
|
-
|
20
18
|
end
|
21
19
|
end
|
22
20
|
end
|
@@ -2,7 +2,6 @@ module Fog
|
|
2
2
|
module Storage
|
3
3
|
class Brightbox
|
4
4
|
class Real
|
5
|
-
|
6
5
|
# Delete a static large object.
|
7
6
|
#
|
8
7
|
# Deletes the SLO manifest +object+ and all segments that it references.
|
@@ -26,17 +25,16 @@ module Fog
|
|
26
25
|
# @see http://docs.brightbox.org/api/brightbox-object-storage/1.0/content/static-large-objects.html
|
27
26
|
def delete_static_large_object(container, object, options = {})
|
28
27
|
response = request({
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
28
|
+
:expects => 200,
|
29
|
+
:method => "DELETE",
|
30
|
+
:headers => options.merge("Content-Type" => "text/plain",
|
31
|
+
"Accept" => "application/json"),
|
32
|
+
:path => "#{Fog::Storage::Brightbox.escape(container)}/#{Fog::Storage::Brightbox.escape(object)}",
|
33
|
+
:query => { "multipart-manifest" => "delete" }
|
34
|
+
}, false)
|
36
35
|
response.body = Fog::JSON.decode(response.body)
|
37
36
|
response
|
38
37
|
end
|
39
|
-
|
40
38
|
end
|
41
39
|
end
|
42
40
|
end
|
@@ -2,7 +2,6 @@ module Fog
|
|
2
2
|
module Storage
|
3
3
|
class Brightbox
|
4
4
|
class Real
|
5
|
-
|
6
5
|
# Get details for container and total bytes stored
|
7
6
|
#
|
8
7
|
# ==== Parameters
|
@@ -29,15 +28,14 @@ module Fog
|
|
29
28
|
# * 'last_modified'<~String> - Last modified timestamp
|
30
29
|
# * 'name'<~String> - Name of object
|
31
30
|
def get_container(container, options = {})
|
32
|
-
options = options.reject {|
|
31
|
+
options = options.reject { |_key, value| value.nil? }
|
33
32
|
request(
|
34
33
|
:expects => 200,
|
35
|
-
:method =>
|
34
|
+
:method => "GET",
|
36
35
|
:path => Fog::Storage::Brightbox.escape(container),
|
37
|
-
:query => {
|
36
|
+
:query => { "format" => "json" }.merge!(options)
|
38
37
|
)
|
39
38
|
end
|
40
|
-
|
41
39
|
end
|
42
40
|
end
|
43
41
|
end
|
@@ -2,7 +2,6 @@ module Fog
|
|
2
2
|
module Storage
|
3
3
|
class Brightbox
|
4
4
|
class Real
|
5
|
-
|
6
5
|
# List existing storage containers
|
7
6
|
#
|
8
7
|
# ==== Parameters
|
@@ -18,15 +17,14 @@ module Fog
|
|
18
17
|
# * 'count'<~Integer>: - Number of items in container
|
19
18
|
# * 'name'<~String>: - Name of container
|
20
19
|
def get_containers(options = {})
|
21
|
-
options = options.reject {|
|
20
|
+
options = options.reject { |_key, value| value.nil? }
|
22
21
|
request(
|
23
22
|
:expects => [200, 204],
|
24
|
-
:method =>
|
25
|
-
:path =>
|
26
|
-
:query => {
|
23
|
+
:method => "GET",
|
24
|
+
:path => "",
|
25
|
+
:query => { "format" => "json" }.merge!(options)
|
27
26
|
)
|
28
27
|
end
|
29
|
-
|
30
28
|
end
|
31
29
|
end
|
32
30
|
end
|
@@ -2,7 +2,6 @@ module Fog
|
|
2
2
|
module Storage
|
3
3
|
class Brightbox
|
4
4
|
class Real
|
5
|
-
|
6
5
|
# Get details for object
|
7
6
|
#
|
8
7
|
# ==== Parameters
|
@@ -12,7 +11,7 @@ module Fog
|
|
12
11
|
def get_object(container, object, &block)
|
13
12
|
params = {
|
14
13
|
:expects => 200,
|
15
|
-
:method =>
|
14
|
+
:method => "GET",
|
16
15
|
:path => "#{Fog::Storage::Brightbox.escape(container)}/#{Fog::Storage::Brightbox.escape(object)}"
|
17
16
|
}
|
18
17
|
|
@@ -22,7 +21,6 @@ module Fog
|
|
22
21
|
|
23
22
|
request(params, false)
|
24
23
|
end
|
25
|
-
|
26
24
|
end
|
27
25
|
end
|
28
26
|
end
|
@@ -1,9 +1,7 @@
|
|
1
1
|
module Fog
|
2
2
|
module Storage
|
3
3
|
class Brightbox
|
4
|
-
|
5
4
|
class Real
|
6
|
-
|
7
5
|
# Get an expiring object https url from Cloud Files
|
8
6
|
#
|
9
7
|
# ==== Parameters
|
@@ -35,24 +33,23 @@ module Fog
|
|
35
33
|
# ==== See Also
|
36
34
|
# http://docs.rackspace.com/files/api/v1/cf-devguide/content/Create_TempURL-d1a444.html
|
37
35
|
def create_temp_url(container, object, expires, method, options = {})
|
38
|
-
raise ArgumentError, "Insufficient parameters specified." unless
|
36
|
+
raise ArgumentError, "Insufficient parameters specified." unless container && object && expires && method
|
39
37
|
raise ArgumentError, "Storage must be instantiated with the :brightbox_temp_url_key option" if @brightbox_temp_url_key.nil?
|
40
38
|
|
41
39
|
scheme = options[:scheme] || @scheme
|
42
40
|
|
43
41
|
# POST not allowed
|
44
|
-
allowed_methods = %w
|
42
|
+
allowed_methods = %w(GET PUT HEAD)
|
45
43
|
unless allowed_methods.include?(method)
|
46
|
-
raise ArgumentError.new("Invalid method '#{method}' specified. Valid methods are: #{allowed_methods.join(
|
44
|
+
raise ArgumentError.new("Invalid method '#{method}' specified. Valid methods are: #{allowed_methods.join(", ")}")
|
47
45
|
end
|
48
46
|
|
49
|
-
|
50
47
|
expires = expires.to_i
|
51
|
-
object_path_escaped = "#{@path}/#{Fog::Storage::Brightbox.escape(container)}/#{Fog::Storage::Brightbox.escape(object,"/")}"
|
48
|
+
object_path_escaped = "#{@path}/#{Fog::Storage::Brightbox.escape(container)}/#{Fog::Storage::Brightbox.escape(object, "/")}"
|
52
49
|
object_path_unescaped = "#{@path}/#{Fog::Storage::Brightbox.escape(container)}/#{object}"
|
53
50
|
string_to_sign = "#{method}\n#{expires}\n#{object_path_unescaped}"
|
54
51
|
|
55
|
-
hmac = Fog::HMAC.new(
|
52
|
+
hmac = Fog::HMAC.new("sha1", @brightbox_temp_url_key)
|
56
53
|
sig = sig_to_hex(hmac.sign(string_to_sign))
|
57
54
|
|
58
55
|
temp_url_options = {
|
@@ -77,9 +74,7 @@ module Fog
|
|
77
74
|
h.size == 1 ? "0#{h}" : h
|
78
75
|
}.join
|
79
76
|
end
|
80
|
-
|
81
77
|
end
|
82
|
-
|
83
78
|
end
|
84
79
|
end
|
85
80
|
end
|
@@ -2,7 +2,6 @@ module Fog
|
|
2
2
|
module Storage
|
3
3
|
class Brightbox
|
4
4
|
class Real
|
5
|
-
|
6
5
|
# List number of objects and total bytes stored
|
7
6
|
#
|
8
7
|
# ==== Parameters
|
@@ -16,12 +15,11 @@ module Fog
|
|
16
15
|
def head_container(container)
|
17
16
|
request(
|
18
17
|
:expects => 204,
|
19
|
-
:method =>
|
18
|
+
:method => "HEAD",
|
20
19
|
:path => Fog::Storage::Brightbox.escape(container),
|
21
|
-
:query => {
|
20
|
+
:query => { "format" => "json" }
|
22
21
|
)
|
23
22
|
end
|
24
|
-
|
25
23
|
end
|
26
24
|
end
|
27
25
|
end
|
@@ -2,7 +2,6 @@ module Fog
|
|
2
2
|
module Storage
|
3
3
|
class Brightbox
|
4
4
|
class Real
|
5
|
-
|
6
5
|
# List number of containers and total bytes stored
|
7
6
|
#
|
8
7
|
# ==== Returns
|
@@ -13,12 +12,11 @@ module Fog
|
|
13
12
|
def head_containers
|
14
13
|
request(
|
15
14
|
:expects => 204,
|
16
|
-
:method =>
|
17
|
-
:path =>
|
18
|
-
:query => {
|
15
|
+
:method => "HEAD",
|
16
|
+
:path => "",
|
17
|
+
:query => { "format" => "json" }
|
19
18
|
)
|
20
19
|
end
|
21
|
-
|
22
20
|
end
|
23
21
|
end
|
24
22
|
end
|
@@ -2,7 +2,6 @@ module Fog
|
|
2
2
|
module Storage
|
3
3
|
class Brightbox
|
4
4
|
class Real
|
5
|
-
|
6
5
|
# Get headers for object
|
7
6
|
#
|
8
7
|
# ==== Parameters
|
@@ -11,12 +10,11 @@ module Fog
|
|
11
10
|
#
|
12
11
|
def head_object(container, object)
|
13
12
|
request({
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
:expects => 200,
|
14
|
+
:method => "HEAD",
|
15
|
+
:path => "#{Fog::Storage::Brightbox.escape(container)}/#{Fog::Storage::Brightbox.escape(object)}"
|
16
|
+
}, false)
|
18
17
|
end
|
19
|
-
|
20
18
|
end
|
21
19
|
end
|
22
20
|
end
|
@@ -1,9 +1,7 @@
|
|
1
1
|
module Fog
|
2
2
|
module Storage
|
3
3
|
class Brightbox
|
4
|
-
|
5
4
|
class Real
|
6
|
-
|
7
5
|
# Set the account wide Temp URL Key. This is a secret key that's
|
8
6
|
# used to generate signed expiring URLs.
|
9
7
|
#
|
@@ -25,13 +23,11 @@ module Fog
|
|
25
23
|
def post_set_meta_temp_url_key(key)
|
26
24
|
request(
|
27
25
|
:expects => [201, 202, 204],
|
28
|
-
:method =>
|
29
|
-
:headers => {
|
26
|
+
:method => "POST",
|
27
|
+
:headers => { "X-Account-Meta-Temp-Url-Key" => key }
|
30
28
|
)
|
31
29
|
end
|
32
|
-
|
33
30
|
end
|
34
|
-
|
35
31
|
end
|
36
32
|
end
|
37
33
|
end
|
@@ -2,7 +2,6 @@ module Fog
|
|
2
2
|
module Storage
|
3
3
|
class Brightbox
|
4
4
|
class Real
|
5
|
-
|
6
5
|
# Create a new container
|
7
6
|
#
|
8
7
|
# ==== Parameters
|
@@ -10,17 +9,16 @@ module Fog
|
|
10
9
|
#
|
11
10
|
def put_container(name, options = {})
|
12
11
|
headers = options[:headers] || {}
|
13
|
-
headers[
|
14
|
-
headers[
|
12
|
+
headers["X-Container-Read"] ||= options.delete(:read_permissions)
|
13
|
+
headers["X-Container-Write"] ||= options.delete(:write_permissions)
|
15
14
|
|
16
15
|
request(
|
17
16
|
:expects => [201, 202],
|
18
|
-
:method =>
|
17
|
+
:method => "PUT",
|
19
18
|
:path => Fog::Storage::Brightbox.escape(name),
|
20
19
|
:headers => headers
|
21
20
|
)
|
22
21
|
end
|
23
|
-
|
24
22
|
end
|
25
23
|
end
|
26
24
|
end
|