assertParameterNotNull(initiateMultipartUploadRequest,
"The request parameter must be specified when initiating a multipart upload");
String bucketName = initiateMultipartUploadRequest.getBucketName();
String key = initiateMultipartUploadRequest.getKey();
CannedAccessControlList cannedACL = initiateMultipartUploadRequest.getCannedACL();
StorageClass storageClass = initiateMultipartUploadRequest.getStorageClass();
ObjectMetadata objectMetadata = initiateMultipartUploadRequest.objectMetadata;
assertParameterNotNull(bucketName,
"The bucket name parameter must be specified when initiating a multipart upload");
assertParameterNotNull(key,
"The key parameter must be specified when initiating a multipart upload");
Request<Void> request = createRequest(bucketName, key, initiateMultipartUploadRequest);
request.addParameter("uploads", null);
if (storageClass != null)
request.addHeader(Headers.STORAGE_CLASS, storageClass.toString());
if (cannedACL != null)
request.addHeader(Headers.S3_CANNED_ACL, cannedACL.toString());
if (objectMetadata != null) populateRequestMetadata(request, objectMetadata);
// Be careful that we don't send the object's total size as the content
// length for the InitiateMultipartUpload request.
request.getHeaders().remove(Headers.CONTENT_LENGTH);