Created
July 23, 2013 07:30
-
-
Save yuta-imai/6060483 to your computer and use it in GitHub Desktop.
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 "aws-sdk" | |
AWS.config( | |
:access_key_id => 'YOUR_ACCESS_KEY', | |
:secret_access_key => 'YOUR_SECRET_KEY' | |
) | |
s3 = AWS::S3.new | |
bucket = s3.buckets['bucket'] | |
obj1 = bucket.objects['hoge'] | |
obj2 = bucket.objects['fuga'] | |
begin | |
print obj1.restore() #Succeeds only in a first attempt. | |
rescue => e | |
print e | |
end | |
begin | |
print obj2.restore() #Also succeeds only in a first attempt. | |
rescue => e | |
print e | |
end | |
while true do | |
print "obj1 is restoring? " + obj1.restore_in_progress?.to_s + "\n" | |
print "obj2 is restoring? " + obj2.restore_in_progress?.to_s + "\n" | |
sleep 1 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment