3
3
import software .amazon .awssdk .annotations .NotThreadSafe ;
4
4
import software .amazon .awssdk .services .s3 .S3AsyncClient ;
5
5
import software .amazon .awssdk .services .s3 .model .ObjectCannedACL ;
6
+ import software .amazon .awssdk .utils .StringUtils ;
6
7
import software .amazon .payloadoffloading .PayloadStorageAsyncConfiguration ;
7
8
import software .amazon .payloadoffloading .ServerSideEncryptionStrategy ;
8
9
@@ -16,6 +17,7 @@ public class ExtendedAsyncClientConfiguration extends PayloadStorageAsyncConfigu
16
17
private boolean cleanupS3Payload = true ;
17
18
private boolean useLegacyReservedAttributeName = true ;
18
19
private boolean ignorePayloadNotFound = false ;
20
+ private String s3KeyPrefix = "" ;
19
21
20
22
public ExtendedAsyncClientConfiguration () {
21
23
this .setPayloadSizeThreshold (SQSExtendedClientConstants .DEFAULT_MESSAGE_SIZE_THRESHOLD );
@@ -26,6 +28,7 @@ public ExtendedAsyncClientConfiguration(ExtendedAsyncClientConfiguration other)
26
28
this .cleanupS3Payload = other .doesCleanupS3Payload ();
27
29
this .useLegacyReservedAttributeName = other .usesLegacyReservedAttributeName ();
28
30
this .ignorePayloadNotFound = other .ignoresPayloadNotFound ();
31
+ this .s3KeyPrefix = other .s3KeyPrefix ;
29
32
}
30
33
31
34
/**
@@ -117,6 +120,36 @@ public ExtendedAsyncClientConfiguration withIgnorePayloadNotFound(boolean ignore
117
120
setIgnorePayloadNotFound (ignorePayloadNotFound );
118
121
return this ;
119
122
}
123
+ /**
124
+ * Sets a string that will be used as prefix of the S3 Key.
125
+ *
126
+ * @param s3KeyPrefix
127
+ * A S3 key prefix value
128
+ */
129
+ public void setS3KeyPrefix (String s3KeyPrefix ) {
130
+ this .s3KeyPrefix = AmazonSQSExtendedClientUtil .trimAndValidateS3KeyPrefix (s3KeyPrefix );
131
+ }
132
+
133
+ /**
134
+ * Sets a string that will be used as prefix of the S3 Key.
135
+ *
136
+ * @param s3KeyPrefix
137
+ * A S3 key prefix value
138
+ *
139
+ * @return the updated ExtendedClientConfiguration object.
140
+ */
141
+ public ExtendedAsyncClientConfiguration withS3KeyPrefix (String s3KeyPrefix ) {
142
+ setS3KeyPrefix (s3KeyPrefix );
143
+ return this ;
144
+ }
145
+
146
+ /**
147
+ * Gets the S3 key prefix
148
+ * @return the prefix value which is being used for compose the S3 key.
149
+ */
150
+ public String getS3KeyPrefix () {
151
+ return this .s3KeyPrefix ;
152
+ }
120
153
121
154
/**
122
155
* Checks whether or not clean up large objects in S3 is enabled.
0 commit comments