Skip to content

Commit

Permalink
Add user provided SSE-C arguments to CompleteMultipartUpload call (#274)
Browse files Browse the repository at this point in the history
  • Loading branch information
nateprewitt authored Sep 25, 2023
1 parent 3a2c99b commit 0fb0ba2
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 3 deletions.
8 changes: 7 additions & 1 deletion s3transfer/copies.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,13 @@ class CopySubmissionTask(SubmissionTask):
'TaggingDirective',
]

COMPLETE_MULTIPART_ARGS = ['RequestPayer', 'ExpectedBucketOwner']
COMPLETE_MULTIPART_ARGS = [
'SSECustomerKey',
'SSECustomerAlgorithm',
'SSECustomerKeyMD5',
'RequestPayer',
'ExpectedBucketOwner',
]

def _submit(
self, client, config, osutil, request_executor, transfer_future
Expand Down
8 changes: 7 additions & 1 deletion s3transfer/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,13 @@ class UploadSubmissionTask(SubmissionTask):
'ExpectedBucketOwner',
]

COMPLETE_MULTIPART_ARGS = ['RequestPayer', 'ExpectedBucketOwner']
COMPLETE_MULTIPART_ARGS = [
'SSECustomerKey',
'SSECustomerAlgorithm',
'SSECustomerKeyMD5',
'RequestPayer',
'ExpectedBucketOwner',
]

def _get_upload_input_manager_cls(self, transfer_future):
"""Retrieves a class for managing input for an upload based on file type
Expand Down
4 changes: 3 additions & 1 deletion tests/functional/test_copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,9 @@ def test_copy_passes_args_to_create_multipart_and_upload_part(self):
self.add_head_object_response(expected_params=head_params)

self._add_params_to_expected_params(
add_copy_kwargs, ['create_mpu', 'copy'], self.extra_args
add_copy_kwargs,
['create_mpu', 'copy', 'complete_mpu'],
self.extra_args,
)
self.add_successful_copy_responses(**add_copy_kwargs)

Expand Down
25 changes: 25 additions & 0 deletions tests/functional/test_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,3 +599,28 @@ def test_multipart_upload_passes_checksums(self):
)
future.result()
self.assert_expected_client_calls_were_correct()

def test_multipart_upload_with_ssec_args(self):
params = {
'RequestPayer': 'requester',
'SSECustomerKey': 'key',
'SSECustomerAlgorithm': 'AES256',
'SSECustomerKeyMD5': 'key-hash',
}
self.extra_args.update(params)

self.add_create_multipart_response_with_default_expected_params(
extra_expected_params=params
)

self.add_upload_part_responses_with_default_expected_params(
extra_expected_params=params
)
self.add_complete_multipart_response_with_default_expected_params(
extra_expected_params=params
)
future = self.manager.upload(
self.filename, self.bucket, self.key, self.extra_args
)
future.result()
self.assert_expected_client_calls_were_correct()

0 comments on commit 0fb0ba2

Please sign in to comment.