From f3cc199533066a01760432ad415e39c7f92d8f81 Mon Sep 17 00:00:00 2001 From: tomchiverton Date: Thu, 25 Oct 2012 10:07:33 +0200 Subject: [PATCH] Add support for reduced redundancy and server side encryption Just applied my patch from http://code.google.com/p/s3sync-s3cmd/issues/detail?id=8 --- s3sync.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/s3sync.rb b/s3sync.rb index c80e828..b8fe168 100644 --- a/s3sync.rb +++ b/s3sync.rb @@ -68,7 +68,9 @@ def S3sync.main [ '--cache-control', GetoptLong::REQUIRED_ARGUMENT ], [ '--exclude', GetoptLong::REQUIRED_ARGUMENT ], [ '--make-dirs', GetoptLong::NO_ARGUMENT ], - [ '--no-md5', GetoptLong::NO_ARGUMENT ] + [ '--no-md5', GetoptLong::NO_ARGUMENT ] , + [ '--reduced-redundancy', GetoptLong::NO_ARGUMENT], + [ '--server-side-encryption', GetoptLong::NO_ARGUMENT] ) def S3sync.usage(message = nil) @@ -80,7 +82,7 @@ def S3sync.usage(message = nil) --ssl -s --recursive -r --delete --public-read -p --expires="" --cache-control="" --exclude="" --progress --debug -d - --make-dirs --no-md5 + --make-dirs --no-md5 --reduced-redundancy --server-side-encryption One of or must be of S3 format, the other a local path. Reminders: * An S3 formatted item with bucket 'mybucket' and prefix 'mypre' looks like: @@ -505,6 +507,8 @@ def updateFrom(fromNode) headers['x-amz-acl'] = 'public-read' if $S3syncOptions['--public-read'] headers['Expires'] = $S3syncOptions['--expires'] if $S3syncOptions['--expires'] headers['Cache-Control'] = $S3syncOptions['--cache-control'] if $S3syncOptions['--cache-control'] + headers['x-amz-storage-class'] = 'REDUCED_REDUNDANCY' if $S3syncOptions['--reduced-redundancy'] + headers['x-amz-server-side-encryption'] = 'AES256' if $S3syncOptions['--server-side-encryption'] fType = @path.split('.').last debug("File extension: #{fType}") if defined?($mimeTypes) and fType != '' and (mType = $mimeTypes[fType]) and mType != ''