fog/fog — pull request #1912 by enterprise-rails (2013-06-24 21:26:12+00:00)
Title: OpenStack Temp URL Support and AWS::File compatibility

In the context of enabling the Cloud Foundry Cloud Controller to use OpenStack Swift using the Fog HP storage provider an inconsistency in creating temporary file urls has been discovered.

While Fog::Storage::AWS::File uses File#url to create a temporary url, Fog::Storage::HP::File uses File#temp_signed_url although semantically both methods are equal.
This pull requests adds a File#url method so that both File classes offer the same interface for creating temp urls.

In order to do that another change was needed:
Many OpenStack users suggest the HP adapter to access OpenStack Swift as is it much more stable.
BUT: the HP implementation of File#temp_signed_url is currently not OpenStack compatible.
HP uses a different strategy to create signature urls avoiding the usage of a so called "account meta key" which has to be set for the Swift account for a regular OpenStack Swift.

This pull requests adds a simple logic:
It allows OpenStack users to use the HP adapter and pass "hp_account_meta_key" when creating a storage object.
When hp_account_meta_key is set, the OpenStack signature url strategy is applied.

With this pull request the Cloud Foundry Cloud Controller will be able to use Fog seamlessly to use either AWS S3, HP or OpenStack Swift as a blob storage.

More than this all Fog users will benefit from the consistent API and OpenStack users will be able to use the HP provider's File#url method to create temp urls instead of implementing it separately.