fog 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +3 -11
- data/README.rdoc +21 -34
- data/bin/fog +1 -1
- data/examples/dns_tests.rb +2 -0
- data/examples/storage_tests.rb +2 -0
- data/fog.gemspec +3 -3
- data/lib/fog.rb +1 -1
- data/lib/fog/aws/requests/elb/create_load_balancer.rb +0 -9
- data/lib/fog/aws/requests/elb/delete_load_balancer.rb +0 -9
- data/lib/fog/aws/requests/elb/describe_instance_health.rb +0 -9
- data/lib/fog/aws/requests/elb/describe_load_balancers.rb +0 -8
- data/lib/fog/aws/requests/iam/add_user_to_group.rb +0 -8
- data/lib/fog/aws/requests/iam/create_access_key.rb +0 -8
- data/lib/fog/aws/requests/iam/create_group.rb +0 -8
- data/lib/fog/aws/requests/iam/create_user.rb +0 -8
- data/lib/fog/aws/requests/iam/delete_access_key.rb +0 -8
- data/lib/fog/aws/requests/iam/delete_group.rb +0 -8
- data/lib/fog/aws/requests/iam/delete_group_policy.rb +0 -8
- data/lib/fog/aws/requests/iam/delete_signing_certificate.rb +0 -8
- data/lib/fog/aws/requests/iam/delete_user.rb +0 -8
- data/lib/fog/aws/requests/iam/delete_user_policy.rb +0 -8
- data/lib/fog/aws/requests/iam/get_user.rb +0 -8
- data/lib/fog/aws/requests/iam/list_access_keys.rb +0 -8
- data/lib/fog/aws/requests/iam/list_group_policies.rb +0 -8
- data/lib/fog/aws/requests/iam/list_groups.rb +0 -8
- data/lib/fog/aws/requests/iam/list_groups_for_user.rb +0 -8
- data/lib/fog/aws/requests/iam/list_signing_certificates.rb +0 -8
- data/lib/fog/aws/requests/iam/list_user_policies.rb +0 -8
- data/lib/fog/aws/requests/iam/list_users.rb +0 -8
- data/lib/fog/aws/requests/iam/put_group_policy.rb +0 -8
- data/lib/fog/aws/requests/iam/put_user_policy.rb +0 -8
- data/lib/fog/aws/requests/iam/remove_user_from_group.rb +0 -8
- data/lib/fog/aws/requests/iam/update_access_key.rb +0 -8
- data/lib/fog/aws/requests/iam/upload_signing_certificate.rb +0 -8
- data/lib/fog/aws/requests/ses/delete_verified_email_address.rb +0 -9
- data/lib/fog/aws/requests/ses/get_send_quota.rb +0 -9
- data/lib/fog/aws/requests/ses/get_send_statistics.rb +0 -9
- data/lib/fog/aws/requests/ses/list_verified_email_addresses.rb +0 -9
- data/lib/fog/aws/requests/ses/send_email.rb +0 -9
- data/lib/fog/aws/requests/ses/send_raw_email.rb +0 -9
- data/lib/fog/aws/requests/ses/verify_email_address.rb +0 -9
- data/lib/fog/aws/requests/simpledb/select.rb +0 -8
- data/lib/fog/bin.rb +1 -15
- data/lib/fog/bin/aws.rb +4 -4
- data/lib/fog/bin/bluebox.rb +1 -1
- data/lib/fog/bin/brightbox.rb +5 -5
- data/lib/fog/bin/go_grid.rb +2 -2
- data/lib/fog/bin/google.rb +2 -2
- data/lib/fog/bin/linode.rb +2 -2
- data/lib/fog/bin/local.rb +2 -2
- data/lib/fog/bin/new_servers.rb +2 -2
- data/lib/fog/bin/rackspace.rb +2 -2
- data/lib/fog/bin/slicehost.rb +2 -2
- data/lib/fog/bin/terremark_ecloud.rb +1 -1
- data/lib/fog/bin/vcloud.rb +1 -1
- data/lib/fog/bin/zerigo.rb +2 -2
- data/lib/fog/cdn/requests/aws/delete_distribution.rb +0 -8
- data/lib/fog/cdn/requests/aws/get_distribution.rb +0 -8
- data/lib/fog/cdn/requests/aws/get_distribution_list.rb +0 -8
- data/lib/fog/cdn/requests/aws/post_distribution.rb +0 -8
- data/lib/fog/cdn/requests/aws/post_invalidation.rb +0 -8
- data/lib/fog/cdn/requests/aws/put_distribution_config.rb +0 -8
- data/lib/fog/cdn/requests/rackspace/get_containers.rb +0 -8
- data/lib/fog/cdn/requests/rackspace/head_container.rb +0 -8
- data/lib/fog/cdn/requests/rackspace/put_container.rb +0 -8
- data/lib/fog/compute/models/aws/server.rb +1 -1
- data/lib/fog/compute/models/bluebox/server.rb +1 -1
- data/lib/fog/compute/models/rackspace/server.rb +1 -1
- data/lib/fog/compute/models/slicehost/server.rb +1 -1
- data/lib/fog/compute/requests/aws/delete_tags.rb +1 -9
- data/lib/fog/compute/requests/aws/describe_reserved_instances.rb +0 -8
- data/lib/fog/compute/requests/aws/describe_reserved_instances_offerings.rb +0 -8
- data/lib/fog/compute/requests/aws/describe_tags.rb +0 -8
- data/lib/fog/compute/requests/aws/modify_image_attributes.rb +0 -8
- data/lib/fog/compute/requests/aws/modify_snapshot_attribute.rb +0 -8
- data/lib/fog/compute/requests/aws/start_instances.rb +0 -8
- data/lib/fog/compute/requests/aws/stop_instances.rb +0 -8
- data/lib/fog/compute/requests/bluebox/create_block.rb +0 -8
- data/lib/fog/compute/requests/bluebox/destroy_block.rb +0 -8
- data/lib/fog/compute/requests/bluebox/get_block.rb +0 -8
- data/lib/fog/compute/requests/bluebox/get_blocks.rb +0 -8
- data/lib/fog/compute/requests/bluebox/get_product.rb +0 -8
- data/lib/fog/compute/requests/bluebox/get_products.rb +0 -8
- data/lib/fog/compute/requests/bluebox/get_template.rb +0 -8
- data/lib/fog/compute/requests/bluebox/get_templates.rb +0 -8
- data/lib/fog/compute/requests/bluebox/reboot_block.rb +0 -8
- data/lib/fog/compute/requests/brightbox/add_nodes_load_balancer.rb +0 -8
- data/lib/fog/compute/requests/brightbox/create_api_client.rb +0 -8
- data/lib/fog/compute/requests/brightbox/create_cloud_ip.rb +0 -8
- data/lib/fog/compute/requests/brightbox/create_image.rb +0 -8
- data/lib/fog/compute/requests/brightbox/create_load_balancer.rb +0 -8
- data/lib/fog/compute/requests/brightbox/create_server.rb +0 -8
- data/lib/fog/compute/requests/brightbox/destroy_api_client.rb +0 -8
- data/lib/fog/compute/requests/brightbox/destroy_cloud_ip.rb +0 -8
- data/lib/fog/compute/requests/brightbox/destroy_image.rb +0 -8
- data/lib/fog/compute/requests/brightbox/destroy_load_balancer.rb +0 -8
- data/lib/fog/compute/requests/brightbox/destroy_server.rb +0 -8
- data/lib/fog/compute/requests/brightbox/get_account.rb +0 -8
- data/lib/fog/compute/requests/brightbox/get_api_client.rb +0 -8
- data/lib/fog/compute/requests/brightbox/get_cloud_ip.rb +0 -8
- data/lib/fog/compute/requests/brightbox/get_image.rb +0 -8
- data/lib/fog/compute/requests/brightbox/get_interface.rb +0 -8
- data/lib/fog/compute/requests/brightbox/get_load_balancer.rb +0 -8
- data/lib/fog/compute/requests/brightbox/get_server.rb +0 -8
- data/lib/fog/compute/requests/brightbox/get_server_type.rb +0 -8
- data/lib/fog/compute/requests/brightbox/get_user.rb +0 -8
- data/lib/fog/compute/requests/brightbox/get_zone.rb +0 -8
- data/lib/fog/compute/requests/brightbox/list_api_clients.rb +0 -8
- data/lib/fog/compute/requests/brightbox/list_cloud_ips.rb +0 -8
- data/lib/fog/compute/requests/brightbox/list_images.rb +0 -8
- data/lib/fog/compute/requests/brightbox/list_load_balancers.rb +0 -8
- data/lib/fog/compute/requests/brightbox/list_server_types.rb +0 -8
- data/lib/fog/compute/requests/brightbox/list_servers.rb +0 -8
- data/lib/fog/compute/requests/brightbox/list_users.rb +0 -8
- data/lib/fog/compute/requests/brightbox/list_zones.rb +0 -8
- data/lib/fog/compute/requests/brightbox/map_cloud_ip.rb +0 -8
- data/lib/fog/compute/requests/brightbox/remove_nodes_load_balancer.rb +0 -8
- data/lib/fog/compute/requests/brightbox/reset_ftp_password_account.rb +0 -8
- data/lib/fog/compute/requests/brightbox/resize_server.rb +0 -8
- data/lib/fog/compute/requests/brightbox/shutdown_server.rb +0 -8
- data/lib/fog/compute/requests/brightbox/snapshot_server.rb +0 -8
- data/lib/fog/compute/requests/brightbox/start_server.rb +0 -8
- data/lib/fog/compute/requests/brightbox/stop_server.rb +0 -8
- data/lib/fog/compute/requests/brightbox/unmap_cloud_ip.rb +0 -8
- data/lib/fog/compute/requests/brightbox/update_account.rb +0 -8
- data/lib/fog/compute/requests/brightbox/update_api_client.rb +0 -8
- data/lib/fog/compute/requests/brightbox/update_image.rb +0 -8
- data/lib/fog/compute/requests/brightbox/update_load_balancer.rb +0 -8
- data/lib/fog/compute/requests/brightbox/update_server.rb +0 -8
- data/lib/fog/compute/requests/brightbox/update_user.rb +0 -8
- data/lib/fog/compute/requests/go_grid/common_lookup_list.rb +0 -8
- data/lib/fog/compute/requests/go_grid/grid_ip_list.rb +0 -8
- data/lib/fog/compute/requests/go_grid/grid_loadbalancer_list.rb +0 -8
- data/lib/fog/compute/requests/go_grid/grid_server_add.rb +0 -8
- data/lib/fog/compute/requests/go_grid/grid_server_delete.rb +0 -8
- data/lib/fog/compute/requests/go_grid/grid_server_get.rb +0 -8
- data/lib/fog/compute/requests/go_grid/grid_server_list.rb +0 -8
- data/lib/fog/compute/requests/go_grid/grid_server_power.rb +0 -8
- data/lib/fog/compute/requests/go_grid/support_password_get.rb +2 -10
- data/lib/fog/compute/requests/go_grid/support_password_list.rb +0 -8
- data/lib/fog/compute/requests/linode/avail_datacenters.rb +0 -8
- data/lib/fog/compute/requests/linode/avail_distributions.rb +0 -8
- data/lib/fog/compute/requests/linode/avail_kernels.rb +0 -8
- data/lib/fog/compute/requests/linode/avail_linodeplans.rb +0 -8
- data/lib/fog/compute/requests/linode/avail_stackscripts.rb +0 -8
- data/lib/fog/compute/requests/linode/linode_create.rb +0 -8
- data/lib/fog/compute/requests/linode/linode_delete.rb +0 -8
- data/lib/fog/compute/requests/linode/linode_list.rb +0 -8
- data/lib/fog/compute/requests/linode/linode_reboot.rb +0 -8
- data/lib/fog/compute/requests/new_servers/add_server.rb +0 -8
- data/lib/fog/compute/requests/new_servers/cancel_server.rb +0 -8
- data/lib/fog/compute/requests/new_servers/get_server.rb +0 -8
- data/lib/fog/compute/requests/new_servers/list_images.rb +0 -8
- data/lib/fog/compute/requests/new_servers/list_plans.rb +0 -8
- data/lib/fog/compute/requests/new_servers/list_servers.rb +0 -8
- data/lib/fog/compute/requests/new_servers/reboot_server.rb +0 -8
- data/lib/fog/compute/requests/rackspace/get_image_details.rb +0 -8
- data/lib/fog/compute/requests/rackspace/server_action.rb +0 -8
- data/lib/fog/compute/requests/slicehost/create_slice.rb +0 -8
- data/lib/fog/compute/requests/slicehost/delete_slice.rb +0 -8
- data/lib/fog/compute/requests/slicehost/get_backups.rb +0 -8
- data/lib/fog/compute/requests/slicehost/get_flavor.rb +0 -8
- data/lib/fog/compute/requests/slicehost/get_flavors.rb +0 -8
- data/lib/fog/compute/requests/slicehost/get_image.rb +0 -8
- data/lib/fog/compute/requests/slicehost/get_images.rb +0 -8
- data/lib/fog/compute/requests/slicehost/get_slice.rb +0 -8
- data/lib/fog/compute/requests/slicehost/get_slices.rb +0 -8
- data/lib/fog/compute/requests/slicehost/reboot_slice.rb +0 -8
- data/lib/fog/compute/requests/terremark_ecloud/get_catalog.rb +0 -8
- data/lib/fog/compute/requests/terremark_ecloud/get_catalog_item.rb +0 -8
- data/lib/fog/compute/requests/terremark_ecloud/get_ip_addresses.rb +0 -8
- data/lib/fog/compute/requests/terremark_ecloud/get_network.rb +0 -8
- data/lib/fog/compute/requests/terremark_ecloud/get_organization.rb +0 -8
- data/lib/fog/compute/requests/terremark_ecloud/get_vdc.rb +0 -8
- data/lib/fog/compute/requests/terremark_ecloud/get_versions.rb +0 -8
- data/lib/fog/core/provider.rb +4 -0
- data/lib/fog/core/service.rb +17 -0
- data/lib/fog/dns/requests/aws/change_resource_record_sets.rb +0 -8
- data/lib/fog/dns/requests/aws/create_hosted_zone.rb +0 -9
- data/lib/fog/dns/requests/aws/delete_hosted_zone.rb +0 -9
- data/lib/fog/dns/requests/aws/get_change.rb +0 -9
- data/lib/fog/dns/requests/aws/get_hosted_zone.rb +0 -9
- data/lib/fog/dns/requests/aws/list_hosted_zones.rb +0 -9
- data/lib/fog/dns/requests/aws/list_resource_record_sets.rb +0 -8
- data/lib/fog/dns/requests/linode/domain_create.rb +0 -8
- data/lib/fog/dns/requests/linode/domain_delete.rb +0 -8
- data/lib/fog/dns/requests/linode/domain_list.rb +0 -8
- data/lib/fog/dns/requests/linode/domain_resource_create.rb +0 -8
- data/lib/fog/dns/requests/linode/domain_resource_delete.rb +0 -8
- data/lib/fog/dns/requests/linode/domain_resource_list.rb +0 -8
- data/lib/fog/dns/requests/linode/domain_resource_update.rb +0 -8
- data/lib/fog/dns/requests/linode/domain_update.rb +0 -8
- data/lib/fog/dns/requests/slicehost/create_record.rb +0 -8
- data/lib/fog/dns/requests/slicehost/create_zone.rb +0 -8
- data/lib/fog/dns/requests/slicehost/delete_record.rb +0 -8
- data/lib/fog/dns/requests/slicehost/delete_zone.rb +0 -8
- data/lib/fog/dns/requests/slicehost/get_record.rb +0 -8
- data/lib/fog/dns/requests/slicehost/get_records.rb +0 -8
- data/lib/fog/dns/requests/slicehost/get_zone.rb +0 -8
- data/lib/fog/dns/requests/slicehost/get_zones.rb +0 -8
- data/lib/fog/dns/requests/zerigo/count_hosts.rb +0 -8
- data/lib/fog/dns/requests/zerigo/count_zones.rb +0 -8
- data/lib/fog/dns/requests/zerigo/create_host.rb +0 -8
- data/lib/fog/dns/requests/zerigo/create_zone.rb +0 -8
- data/lib/fog/dns/requests/zerigo/delete_host.rb +0 -8
- data/lib/fog/dns/requests/zerigo/delete_zone.rb +0 -8
- data/lib/fog/dns/requests/zerigo/find_hosts.rb +0 -8
- data/lib/fog/dns/requests/zerigo/get_host.rb +0 -8
- data/lib/fog/dns/requests/zerigo/get_zone.rb +0 -8
- data/lib/fog/dns/requests/zerigo/get_zone_stats.rb +0 -8
- data/lib/fog/dns/requests/zerigo/list_hosts.rb +0 -8
- data/lib/fog/dns/requests/zerigo/list_zones.rb +0 -8
- data/lib/fog/dns/requests/zerigo/update_host.rb +0 -8
- data/lib/fog/dns/requests/zerigo/update_zone.rb +0 -8
- data/lib/fog/providers.rb +8 -0
- data/lib/fog/storage/aws.rb +21 -21
- data/lib/fog/storage/google.rb +12 -11
- data/lib/fog/storage/requests/aws/abort_multipart_upload.rb +0 -8
- data/lib/fog/storage/requests/aws/complete_multipart_upload.rb +0 -8
- data/lib/fog/storage/requests/aws/copy_object.rb +2 -1
- data/lib/fog/storage/requests/aws/get_bucket.rb +3 -3
- data/lib/fog/storage/requests/aws/get_bucket_logging.rb +0 -8
- data/lib/fog/storage/requests/aws/get_bucket_object_versions.rb +0 -8
- data/lib/fog/storage/requests/aws/get_bucket_versioning.rb +0 -8
- data/lib/fog/storage/requests/aws/get_object.rb +8 -8
- data/lib/fog/storage/requests/aws/get_object_torrent.rb +0 -8
- data/lib/fog/storage/requests/aws/initiate_multipart_upload.rb +0 -8
- data/lib/fog/storage/requests/aws/list_multipart_uploads.rb +0 -8
- data/lib/fog/storage/requests/aws/list_parts.rb +0 -8
- data/lib/fog/storage/requests/aws/post_object_hidden_fields.rb +0 -8
- data/lib/fog/storage/requests/aws/put_bucket_acl.rb +0 -8
- data/lib/fog/storage/requests/aws/put_bucket_logging.rb +0 -8
- data/lib/fog/storage/requests/aws/put_bucket_versioning.rb +0 -8
- data/lib/fog/storage/requests/aws/put_object.rb +18 -9
- data/lib/fog/storage/requests/aws/put_object_acl.rb +0 -8
- data/lib/fog/storage/requests/aws/upload_part.rb +0 -8
- data/lib/fog/storage/requests/google/copy_object.rb +1 -1
- data/lib/fog/storage/requests/google/get_bucket.rb +3 -3
- data/lib/fog/storage/requests/google/get_object.rb +8 -8
- data/lib/fog/storage/requests/google/get_object_torrent.rb +0 -8
- data/lib/fog/storage/requests/google/put_bucket_acl.rb +0 -8
- data/lib/fog/storage/requests/google/put_object.rb +17 -9
- data/lib/fog/storage/requests/rackspace/delete_container.rb +0 -8
- data/lib/fog/storage/requests/rackspace/delete_object.rb +0 -8
- data/lib/fog/storage/requests/rackspace/get_container.rb +0 -8
- data/lib/fog/storage/requests/rackspace/get_containers.rb +0 -8
- data/lib/fog/storage/requests/rackspace/get_object.rb +0 -8
- data/lib/fog/storage/requests/rackspace/head_container.rb +0 -8
- data/lib/fog/storage/requests/rackspace/head_containers.rb +0 -8
- data/lib/fog/storage/requests/rackspace/head_object.rb +0 -8
- data/lib/fog/storage/requests/rackspace/put_container.rb +0 -8
- data/lib/fog/storage/requests/rackspace/put_object.rb +0 -8
- data/lib/fog/terremark/requests/shared/add_internet_service.rb +0 -8
- data/lib/fog/terremark/requests/shared/add_node_service.rb +0 -8
- data/lib/fog/terremark/requests/shared/create_internet_service.rb +0 -8
- data/lib/fog/terremark/requests/shared/delete_internet_service.rb +0 -8
- data/lib/fog/terremark/requests/shared/delete_node_service.rb +0 -8
- data/lib/fog/terremark/requests/shared/delete_public_ip.rb +0 -8
- data/lib/fog/terremark/requests/shared/delete_vapp.rb +0 -8
- data/lib/fog/terremark/requests/shared/deploy_vapp.rb +0 -8
- data/lib/fog/terremark/requests/shared/get_catalog.rb +0 -8
- data/lib/fog/terremark/requests/shared/get_catalog_item.rb +0 -8
- data/lib/fog/terremark/requests/shared/get_internet_services.rb +0 -8
- data/lib/fog/terremark/requests/shared/get_network_ips.rb +0 -8
- data/lib/fog/terremark/requests/shared/get_node_services.rb +0 -8
- data/lib/fog/terremark/requests/shared/get_public_ip.rb +0 -8
- data/lib/fog/terremark/requests/shared/get_task.rb +0 -8
- data/lib/fog/terremark/requests/shared/get_tasks_list.rb +0 -7
- data/lib/fog/terremark/requests/shared/get_vapp.rb +0 -8
- data/lib/fog/terremark/requests/shared/get_vapp_template.rb +0 -8
- data/lib/fog/terremark/requests/shared/instantiate_vapp_template.rb +0 -8
- data/lib/fog/terremark/requests/shared/power_off.rb +0 -8
- data/lib/fog/terremark/requests/shared/power_on.rb +0 -8
- data/lib/fog/terremark/requests/shared/power_reset.rb +0 -8
- data/lib/fog/terremark/requests/shared/power_shutdown.rb +0 -8
- data/lib/fog/vcloud/terremark/ecloud/requests/clone_vapp.rb +0 -8
- data/lib/fog/vcloud/terremark/ecloud/requests/configure_network.rb +0 -7
- data/lib/fog/vcloud/terremark/ecloud/requests/get_firewall_acl.rb +0 -5
- data/lib/fog/vcloud/terremark/ecloud/requests/get_firewall_acls.rb +0 -5
- data/lib/fog/vcloud/terremark/ecloud/requests/get_task.rb +0 -5
- data/lib/fog/vcloud/terremark/ecloud/requests/get_task_list.rb +0 -5
- data/lib/fog/vcloud/terremark/ecloud/requests/get_vapp_template.rb +0 -5
- data/lib/fog/vcloud/terremark/ecloud/requests/power_reset.rb +0 -5
- data/lib/fog/vcloud/terremark/ecloud/requests/power_shutdown.rb +0 -5
- data/tests/helper.rb +2 -2
- data/tests/helpers/mock_helper.rb +1 -0
- metadata +42 -42
data/lib/fog/providers.rb
CHANGED
data/lib/fog/storage/aws.rb
CHANGED
@@ -286,26 +286,6 @@ module Fog
|
|
286
286
|
@connection.reset
|
287
287
|
end
|
288
288
|
|
289
|
-
private
|
290
|
-
|
291
|
-
def request(params, &block)
|
292
|
-
params[:headers]['Date'] = Fog::Time.now.to_date_header
|
293
|
-
params[:headers]['Authorization'] = "AWS #{@aws_access_key_id}:#{signature(params)}"
|
294
|
-
params[:expects] = [307, *params[:expects]].flatten
|
295
|
-
# FIXME: ToHashParser should make this not needed
|
296
|
-
original_params = params.dup
|
297
|
-
|
298
|
-
response = @connection.request(params, &block)
|
299
|
-
|
300
|
-
if response.status == 307
|
301
|
-
uri = URI.parse(response.headers['Location'])
|
302
|
-
Formatador.display_line("[yellow][WARN] fog: followed redirect to #{uri.host}, connecting to the matching region will be more performant[/]")
|
303
|
-
response = Fog::Connection.new("#{@scheme}://#{uri.host}:#{@port}", false).request(original_params, &block)
|
304
|
-
end
|
305
|
-
|
306
|
-
response
|
307
|
-
end
|
308
|
-
|
309
289
|
def signature(params)
|
310
290
|
string_to_sign =
|
311
291
|
<<-DATA
|
@@ -345,7 +325,7 @@ DATA
|
|
345
325
|
end
|
346
326
|
canonical_resource << params[:path].to_s
|
347
327
|
canonical_resource << '?'
|
348
|
-
for key in (params[:query] || {}).keys
|
328
|
+
for key in (params[:query] || {}).keys.sort
|
349
329
|
if %w{acl location logging notification partNumber policy requestPayment torrent uploadId uploads versionId versioning versions}.include?(key)
|
350
330
|
canonical_resource << "#{key}#{"=#{params[:query][key]}" unless params[:query][key].nil?}&"
|
351
331
|
end
|
@@ -356,6 +336,26 @@ DATA
|
|
356
336
|
signed_string = @hmac.sign(string_to_sign)
|
357
337
|
signature = Base64.encode64(signed_string).chomp!
|
358
338
|
end
|
339
|
+
|
340
|
+
private
|
341
|
+
|
342
|
+
def request(params, &block)
|
343
|
+
params[:headers]['Date'] = Fog::Time.now.to_date_header
|
344
|
+
params[:headers]['Authorization'] = "AWS #{@aws_access_key_id}:#{signature(params)}"
|
345
|
+
|
346
|
+
# FIXME: ToHashParser should make this not needed
|
347
|
+
original_params = params.dup
|
348
|
+
|
349
|
+
begin
|
350
|
+
response = @connection.request(params, &block)
|
351
|
+
rescue Excon::Errors::TemporaryRedirect => error
|
352
|
+
uri = URI.parse(error.response.headers['Location'])
|
353
|
+
Formatador.display_line("[yellow][WARN] fog: followed redirect to #{uri.host}, connecting to the matching region will be more performant[/]")
|
354
|
+
response = Fog::Connection.new("#{@scheme}://#{uri.host}:#{@port}", false).request(original_params, &block)
|
355
|
+
end
|
356
|
+
|
357
|
+
response
|
358
|
+
end
|
359
359
|
end
|
360
360
|
end
|
361
361
|
end
|