@@ -74,6 +74,8 @@ public CreateMultipartUploadResponse createMultipartUpload(CreateMultipartUpload
7474 .overrideConfiguration (API_NAME_INTERCEPTOR )
7575 .build ();
7676
77+ //= specification/s3-encryption/client.md#api-operations
78+ //# If implemented, CreateMultipartUpload MUST initiate a multipart upload.
7779 CreateMultipartUploadResponse response = _s3AsyncClient .createMultipartUpload (request ).join ();
7880
7981 MultipartUploadMaterials mpuMaterials = MultipartUploadMaterials .builder ()
@@ -133,13 +135,18 @@ public UploadPartResponse uploadPart(UploadPartRequest request, RequestBody requ
133135 throw new S3EncryptionClientException ("No client-side information available on upload ID " + uploadId );
134136 }
135137 final UploadPartResponse response ;
136- // Checks the parts are uploaded in series
138+ //= specification/s3-encryption/client.md#api-operations
139+ //# Each part MUST be encrypted in sequence.
137140 materials .beginPartUpload (actualRequest .partNumber (), partContentLength );
141+ //= specification/s3-encryption/client.md#api-operations
142+ //# Each part MUST be encrypted using the same cipher instance for each part.
138143 Cipher cipher = materials .getCipher (materials .getIv ());
139144
140145 ExecutorService singleThreadExecutor = Executors .newSingleThreadExecutor ();
141146
142147 try {
148+ //= specification/s3-encryption/client.md#api-operations
149+ //# UploadPart MUST encrypt each part.
143150 final AsyncRequestBody cipherAsyncRequestBody = new CipherAsyncRequestBody (
144151 AsyncRequestBody .fromInputStream (
145152 requestBody .contentStreamProvider ().newStream (),
@@ -159,6 +166,7 @@ public UploadPartResponse uploadPart(UploadPartRequest request, RequestBody requ
159166 }
160167 // Ensures parts are not retried to avoid corrupting ciphertext
161168 AsyncRequestBody noRetryBody = new NoRetriesAsyncRequestBody (cipherAsyncRequestBody );
169+ //= specification/s3-encryption/client.md#api-operations
162170 response = _s3AsyncClient .uploadPart (actualRequest , noRetryBody ).join ();
163171 } finally {
164172 materials .endPartUpload ();
@@ -187,6 +195,8 @@ public CompleteMultipartUploadResponse completeMultipartUpload(CompleteMultipart
187195 .overrideConfiguration (API_NAME_INTERCEPTOR )
188196 .build ();
189197
198+ //= specification/s3-encryption/client.md#api-operations
199+ //# CompleteMultipartUpload MUST complete the multipart upload.
190200 CompleteMultipartUploadResponse response = _s3AsyncClient .completeMultipartUpload (actualRequest ).join ();
191201
192202 _multipartUploadMaterials .remove (uploadId );
@@ -198,6 +208,8 @@ public AbortMultipartUploadResponse abortMultipartUpload(AbortMultipartUploadReq
198208 AbortMultipartUploadRequest actualRequest = request .toBuilder ()
199209 .overrideConfiguration (API_NAME_INTERCEPTOR )
200210 .build ();
211+ //= specification/s3-encryption/client.md#api-operations
212+ //# AbortMultipartUpload MUST abort the multipart upload.
201213 return _s3AsyncClient .abortMultipartUpload (actualRequest ).join ();
202214 }
203215
0 commit comments