Skip to content

Commit 3ffc4b2

Browse files
author
Anirav Kareddy
committed
method overloading for putInstructionFile to be able to handle the custom instruction file suffix if specified
1 parent 8fb7167 commit 3ffc4b2

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/main/java/software/amazon/encryption/s3/internal/InstructionFileConfig.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ boolean isInstructionFilePutEnabled() {
4949
}
5050

5151
PutObjectResponse putInstructionFile(PutObjectRequest request, String instructionFileContent) {
52+
return putInstructionFile(request, instructionFileContent, INSTRUCTION_FILE_SUFFIX);
53+
}
54+
55+
PutObjectResponse putInstructionFile(PutObjectRequest request, String instructionFileContent, String instructionFileSuffix) {
5256
// This shouldn't happen in practice because the metadata strategy will evaluate
5357
// if instruction file Puts are enabled before calling this method; check again anyway for robustness
5458
if (!_enableInstructionFilePut) {
@@ -60,12 +64,11 @@ PutObjectResponse putInstructionFile(PutObjectRequest request, String instructio
6064
// It contains a key with no value identifying it as an instruction file
6165
instFileMetadata.put(INSTRUCTION_FILE, "");
6266

63-
// In a future release, non-default suffixes will be supported.
6467
// Use toBuilder to keep all other fields the same as the actual request
6568
final PutObjectRequest instPutRequest = request.toBuilder()
66-
.key(request.key() + INSTRUCTION_FILE_SUFFIX)
67-
.metadata(instFileMetadata)
68-
.build();
69+
.key(request.key() + instructionFileSuffix)
70+
.metadata(instFileMetadata)
71+
.build();
6972
switch (_clientType) {
7073
case SYNCHRONOUS:
7174
return _s3Client.putObject(instPutRequest, RequestBody.fromString(instructionFileContent));

0 commit comments

Comments
 (0)