Skip to content

Instantly share code, notes, and snippets.

@yuta-imai
Created July 23, 2013 07:30
Show Gist options
  • Save yuta-imai/6060483 to your computer and use it in GitHub Desktop.
Save yuta-imai/6060483 to your computer and use it in GitHub Desktop.
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