Created
January 26, 2011 07:04
-
-
Save baldowl/796353 to your computer and use it in GitHub Desktop.
Interactive fog session: how to get a bunch of signed URLs for European buckets with fog 0.4.1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'active_support/time' | |
bucket = AWS.directories.select {|d| d.key == 'my_bucket'} | |
files = bucket.files.select {|f| f.content_length > 0 && | |
f.key =~ %r{client-name.*\.zip}} | |
expiration = Time.now.next_month.end_of_month | |
signed_urls = files.map {|f| f.url(expiration)} | |
fixed_signed_url = signed_urls.map do |su| | |
su.sub(%r{s3\.(.*)/my_bucket}, "my_bucket.s3.#{$1}") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment