1 /*
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
5 * the License. A copy of the License is located at
6 *
7 * http://aws.amazon.com/apache2.0
8 *
9 * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
10 * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
11 * and limitations under the License.
12 */
13
14 package software.amazon.awssdk.services.s3.model;
15
16 import java.time.Instant;
17 import java.util.Arrays;
18 import java.util.Collections;
19 import java.util.List;
20 import java.util.Map;
21 import java.util.Objects;
22 import java.util.Optional;
23 import java.util.function.BiConsumer;
24 import java.util.function.Consumer;
25 import java.util.function.Function;
26 import software.amazon.awssdk.annotations.Generated;
27 import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
28 import software.amazon.awssdk.core.SdkField;
29 import software.amazon.awssdk.core.SdkPojo;
30 import software.amazon.awssdk.core.protocol.MarshallLocation;
31 import software.amazon.awssdk.core.protocol.MarshallingType;
32 import software.amazon.awssdk.core.traits.LocationTrait;
33 import software.amazon.awssdk.core.traits.MapTrait;
34 import software.amazon.awssdk.core.traits.TimestampFormatTrait;
35 import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
36 import software.amazon.awssdk.core.util.SdkAutoConstructMap;
37 import software.amazon.awssdk.services.s3.internal.TaggingAdapter;
38 import software.amazon.awssdk.utils.ToString;
39 import software.amazon.awssdk.utils.builder.CopyableBuilder;
40 import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
41
42 /**
43 */
44 @Generated("software.amazon.awssdk:codegen")
45 public final class PutObjectRequest extends S3Request implements ToCopyableBuilder<PutObjectRequest.Builder, PutObjectRequest> {
46 private static final SdkField<String> ACL_FIELD = SdkField
47 .<String> builder(MarshallingType.STRING)
48 .getter(getter(PutObjectRequest::aclAsString))
49 .setter(setter(Builder::acl))
50 .traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("x-amz-acl")
51 .unmarshallLocationName("x-amz-acl").build()).build();
52
53 private static final SdkField<String> BUCKET_FIELD = SdkField
54 .<String> builder(MarshallingType.STRING)
55 .getter(getter(PutObjectRequest::bucket))
56 .setter(setter(Builder::bucket))
57 .traits(LocationTrait.builder().location(MarshallLocation.PATH).locationName("Bucket")
58 .unmarshallLocationName("Bucket").build()).build();
59
60 private static final SdkField<String> CACHE_CONTROL_FIELD = SdkField
61 .<String> builder(MarshallingType.STRING)
62 .getter(getter(PutObjectRequest::cacheControl))
63 .setter(setter(Builder::cacheControl))
64 .traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("Cache-Control")
65 .unmarshallLocationName("Cache-Control").build()).build();
66
67 private static final SdkField<String> CONTENT_DISPOSITION_FIELD = SdkField
68 .<String> builder(MarshallingType.STRING)
69 .getter(getter(PutObjectRequest::contentDisposition))
70 .setter(setter(Builder::contentDisposition))
71 .traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("Content-Disposition")
72 .unmarshallLocationName("Content-Disposition").build()).build();
73
74 private static final SdkField<String> CONTENT_ENCODING_FIELD = SdkField
75 .<String> builder(MarshallingType.STRING)
76 .getter(getter(PutObjectRequest::contentEncoding))
77 .setter(setter(Builder::contentEncoding))
78 .traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("Content-Encoding")
79 .unmarshallLocationName("Content-Encoding").build()).build();
80
81 private static final SdkField<String> CONTENT_LANGUAGE_FIELD = SdkField
82 .<String> builder(MarshallingType.STRING)
83 .getter(getter(PutObjectRequest::contentLanguage))
84 .setter(setter(Builder::contentLanguage))
85 .traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("Content-Language")
86 .unmarshallLocationName("Content-Language").build()).build();
87
88 private static final SdkField<Long> CONTENT_LENGTH_FIELD = SdkField
89 .<Long> builder(MarshallingType.LONG)
90 .getter(getter(PutObjectRequest::contentLength))
91 .setter(setter(Builder::contentLength))
92 .traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("Content-Length")
93 .unmarshallLocationName("Content-Length").build()).build();
94
95 private static final SdkField<String> CONTENT_MD5_FIELD = SdkField
96 .<String> builder(MarshallingType.STRING)
97 .getter(getter(PutObjectRequest::contentMD5))
98 .setter(setter(Builder::contentMD5))
99 .traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("Content-MD5")
100 .unmarshallLocationName("Content-MD5").build()).build();
101
102 private static final SdkField<String> CONTENT_TYPE_FIELD = SdkField
103 .<String> builder(MarshallingType.STRING)
104 .getter(getter(PutObjectRequest::contentType))
105 .setter(setter(Builder::contentType))
106 .traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("Content-Type")
107 .unmarshallLocationName("Content-Type").build()).build();
108
109 private static final SdkField<Instant> EXPIRES_FIELD = SdkField
110 .<Instant> builder(MarshallingType.INSTANT)
111 .getter(getter(PutObjectRequest::expires))
112 .setter(setter(Builder::expires))
113 .traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("Expires")
114 .unmarshallLocationName("Expires").build()).build();
115
116 private static final SdkField<String> GRANT_FULL_CONTROL_FIELD = SdkField
117 .<String> builder(MarshallingType.STRING)
118 .getter(getter(PutObjectRequest::grantFullControl))
119 .setter(setter(Builder::grantFullControl))
120 .traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("x-amz-grant-full-control")
121 .unmarshallLocationName("x-amz-grant-full-control").build()).build();
122
123 private static final SdkField<String> GRANT_READ_FIELD = SdkField
124 .<String> builder(MarshallingType.STRING)
125 .getter(getter(PutObjectRequest::grantRead))
126 .setter(setter(Builder::grantRead))
127 .traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("x-amz-grant-read")
128 .unmarshallLocationName("x-amz-grant-read").build()).build();
129
130 private static final SdkField<String> GRANT_READ_ACP_FIELD = SdkField
131 .<String> builder(MarshallingType.STRING)
132 .getter(getter(PutObjectRequest::grantReadACP))
133 .setter(setter(Builder::grantReadACP))
134 .traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("x-amz-grant-read-acp")
135 .unmarshallLocationName("x-amz-grant-read-acp").build()).build();
136
137 private static final SdkField<String> GRANT_WRITE_ACP_FIELD = SdkField
138 .<String> builder(MarshallingType.STRING)
139 .getter(getter(PutObjectRequest::grantWriteACP))
140 .setter(setter(Builder::grantWriteACP))
141 .traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("x-amz-grant-write-acp")
142 .unmarshallLocationName("x-amz-grant-write-acp").build()).build();
143
144 private static final SdkField<String> KEY_FIELD = SdkField
145 .<String> builder(MarshallingType.STRING)
146 .getter(getter(PutObjectRequest::key))
147 .setter(setter(Builder::key))
148 .traits(LocationTrait.builder().location(MarshallLocation.GREEDY_PATH).locationName("Key")
149 .unmarshallLocationName("Key").build()).build();
150
151 private static final SdkField<Map<String, String>> METADATA_FIELD = SdkField
152 .<Map<String, String>> builder(MarshallingType.MAP)
153 .getter(getter(PutObjectRequest::metadata))
154 .setter(setter(Builder::metadata))
155 .traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("x-amz-meta-")
156 .unmarshallLocationName("x-amz-meta-").build(),
157 MapTrait.builder()
158 .keyLocationName("key")
159 .valueLocationName("value")
160 .valueFieldInfo(
161 SdkField.<String> builder(MarshallingType.STRING)
162 .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
163 .locationName("value").unmarshallLocationName("value").build()).build())
164 .build()).build();
165
166 private static final SdkField<String> SERVER_SIDE_ENCRYPTION_FIELD = SdkField
167 .<String> builder(MarshallingType.STRING)
168 .getter(getter(PutObjectRequest::serverSideEncryptionAsString))
169 .setter(setter(Builder::serverSideEncryption))
170 .traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("x-amz-server-side-encryption")
171 .unmarshallLocationName("x-amz-server-side-encryption").build()).build();
172
173 private static final SdkField<String> STORAGE_CLASS_FIELD = SdkField
174 .<String> builder(MarshallingType.STRING)
175 .getter(getter(PutObjectRequest::storageClassAsString))
176 .setter(setter(Builder::storageClass))
177 .traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("x-amz-storage-class")
178 .unmarshallLocationName("x-amz-storage-class").build()).build();
179
180 private static final SdkField<String> WEBSITE_REDIRECT_LOCATION_FIELD = SdkField
181 .<String> builder(MarshallingType.STRING)
182 .getter(getter(PutObjectRequest::websiteRedirectLocation))
183 .setter(setter(Builder::websiteRedirectLocation))
184 .traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("x-amz-website-redirect-location")
185 .unmarshallLocationName("x-amz-website-redirect-location").build()).build();
186
187 private static final SdkField<String> SSE_CUSTOMER_ALGORITHM_FIELD = SdkField
188 .<String> builder(MarshallingType.STRING)
189 .getter(getter(PutObjectRequest::sseCustomerAlgorithm))
190 .setter(setter(Builder::sseCustomerAlgorithm))
191 .traits(LocationTrait.builder().location(MarshallLocation.HEADER)
192 .locationName("x-amz-server-side-encryption-customer-algorithm")
193 .unmarshallLocationName("x-amz-server-side-encryption-customer-algorithm").build()).build();
194
195 private static final SdkField<String> SSE_CUSTOMER_KEY_FIELD = SdkField
196 .<String> builder(MarshallingType.STRING)
197 .getter(getter(PutObjectRequest::sseCustomerKey))
198 .setter(setter(Builder::sseCustomerKey))
199 .traits(LocationTrait.builder().location(MarshallLocation.HEADER)
200 .locationName("x-amz-server-side-encryption-customer-key")
201 .unmarshallLocationName("x-amz-server-side-encryption-customer-key").build()).build();
202
203 private static final SdkField<String> SSE_CUSTOMER_KEY_MD5_FIELD = SdkField
204 .<String> builder(MarshallingType.STRING)
205 .getter(getter(PutObjectRequest::sseCustomerKeyMD5))
206 .setter(setter(Builder::sseCustomerKeyMD5))
207 .traits(LocationTrait.builder().location(MarshallLocation.HEADER)
208 .locationName("x-amz-server-side-encryption-customer-key-MD5")
209 .unmarshallLocationName("x-amz-server-side-encryption-customer-key-MD5").build()).build();
210
211 private static final SdkField<String> SSEKMS_KEY_ID_FIELD = SdkField
212 .<String> builder(MarshallingType.STRING)
213 .getter(getter(PutObjectRequest::ssekmsKeyId))
214 .setter(setter(Builder::ssekmsKeyId))
215 .traits(LocationTrait.builder().location(MarshallLocation.HEADER)
216 .locationName("x-amz-server-side-encryption-aws-kms-key-id")
217 .unmarshallLocationName("x-amz-server-side-encryption-aws-kms-key-id").build()).build();
218
219 private static final SdkField<String> SSEKMS_ENCRYPTION_CONTEXT_FIELD = SdkField
220 .<String> builder(MarshallingType.STRING)
221 .getter(getter(PutObjectRequest::ssekmsEncryptionContext))
222 .setter(setter(Builder::ssekmsEncryptionContext))
223 .traits(LocationTrait.builder().location(MarshallLocation.HEADER)
224 .locationName("x-amz-server-side-encryption-context")
225 .unmarshallLocationName("x-amz-server-side-encryption-context").build()).build();
226
227 private static final SdkField<String> REQUEST_PAYER_FIELD = SdkField
228 .<String> builder(MarshallingType.STRING)
229 .getter(getter(PutObjectRequest::requestPayerAsString))
230 .setter(setter(Builder::requestPayer))
231 .traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("x-amz-request-payer")
232 .unmarshallLocationName("x-amz-request-payer").build()).build();
233
234 private static final SdkField<String> TAGGING_FIELD = SdkField
235 .<String> builder(MarshallingType.STRING)
236 .getter(getter(PutObjectRequest::tagging))
237 .setter(setter(Builder::tagging))
238 .traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("x-amz-tagging")
239 .unmarshallLocationName("x-amz-tagging").build()).build();
240
241 private static final SdkField<String> OBJECT_LOCK_MODE_FIELD = SdkField
242 .<String> builder(MarshallingType.STRING)
243 .getter(getter(PutObjectRequest::objectLockModeAsString))
244 .setter(setter(Builder::objectLockMode))
245 .traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("x-amz-object-lock-mode")
246 .unmarshallLocationName("x-amz-object-lock-mode").build()).build();
247
248 private static final SdkField<Instant> OBJECT_LOCK_RETAIN_UNTIL_DATE_FIELD = SdkField
249 .<Instant> builder(MarshallingType.INSTANT)
250 .getter(getter(PutObjectRequest::objectLockRetainUntilDate))
251 .setter(setter(Builder::objectLockRetainUntilDate))
252 .traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("x-amz-object-lock-retain-until-date")
253 .unmarshallLocationName("x-amz-object-lock-retain-until-date").build(),
254 TimestampFormatTrait.create(TimestampFormatTrait.Format.ISO_8601)).build();
255
256 private static final SdkField<String> OBJECT_LOCK_LEGAL_HOLD_STATUS_FIELD = SdkField
257 .<String> builder(MarshallingType.STRING)
258 .getter(getter(PutObjectRequest::objectLockLegalHoldStatusAsString))
259 .setter(setter(Builder::objectLockLegalHoldStatus))
260 .traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("x-amz-object-lock-legal-hold")
261 .unmarshallLocationName("x-amz-object-lock-legal-hold").build()).build();
262
263 private static final List<SdkField<?>> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ACL_FIELD, BUCKET_FIELD,
264 CACHE_CONTROL_FIELD, CONTENT_DISPOSITION_FIELD, CONTENT_ENCODING_FIELD, CONTENT_LANGUAGE_FIELD, CONTENT_LENGTH_FIELD,
265 CONTENT_MD5_FIELD, CONTENT_TYPE_FIELD, EXPIRES_FIELD, GRANT_FULL_CONTROL_FIELD, GRANT_READ_FIELD,
266 GRANT_READ_ACP_FIELD, GRANT_WRITE_ACP_FIELD, KEY_FIELD, METADATA_FIELD, SERVER_SIDE_ENCRYPTION_FIELD,
267 STORAGE_CLASS_FIELD, WEBSITE_REDIRECT_LOCATION_FIELD, SSE_CUSTOMER_ALGORITHM_FIELD, SSE_CUSTOMER_KEY_FIELD,
268 SSE_CUSTOMER_KEY_MD5_FIELD, SSEKMS_KEY_ID_FIELD, SSEKMS_ENCRYPTION_CONTEXT_FIELD, REQUEST_PAYER_FIELD, TAGGING_FIELD,
269 OBJECT_LOCK_MODE_FIELD, OBJECT_LOCK_RETAIN_UNTIL_DATE_FIELD, OBJECT_LOCK_LEGAL_HOLD_STATUS_FIELD));
270
271 private final String acl;
272
273 private final String bucket;
274
275 private final String cacheControl;
276
277 private final String contentDisposition;
278
279 private final String contentEncoding;
280
281 private final String contentLanguage;
282
283 private final Long contentLength;
284
285 private final String contentMD5;
286
287 private final String contentType;
288
289 private final Instant expires;
290
291 private final String grantFullControl;
292
293 private final String grantRead;
294
295 private final String grantReadACP;
296
297 private final String grantWriteACP;
298
299 private final String key;
300
301 private final Map<String, String> metadata;
302
303 private final String serverSideEncryption;
304
305 private final String storageClass;
306
307 private final String websiteRedirectLocation;
308
309 private final String sseCustomerAlgorithm;
310
311 private final String sseCustomerKey;
312
313 private final String sseCustomerKeyMD5;
314
315 private final String ssekmsKeyId;
316
317 private final String ssekmsEncryptionContext;
318
319 private final String requestPayer;
320
321 private final String tagging;
322
323 private final String objectLockMode;
324
325 private final Instant objectLockRetainUntilDate;
326
327 private final String objectLockLegalHoldStatus;
328
329 private PutObjectRequest(BuilderImpl builder) {
330 super(builder);
331 this.acl = builder.acl;
332 this.bucket = builder.bucket;
333 this.cacheControl = builder.cacheControl;
334 this.contentDisposition = builder.contentDisposition;
335 this.contentEncoding = builder.contentEncoding;
336 this.contentLanguage = builder.contentLanguage;
337 this.contentLength = builder.contentLength;
338 this.contentMD5 = builder.contentMD5;
339 this.contentType = builder.contentType;
340 this.expires = builder.expires;
341 this.grantFullControl = builder.grantFullControl;
342 this.grantRead = builder.grantRead;
343 this.grantReadACP = builder.grantReadACP;
344 this.grantWriteACP = builder.grantWriteACP;
345 this.key = builder.key;
346 this.metadata = builder.metadata;
347 this.serverSideEncryption = builder.serverSideEncryption;
348 this.storageClass = builder.storageClass;
349 this.websiteRedirectLocation = builder.websiteRedirectLocation;
350 this.sseCustomerAlgorithm = builder.sseCustomerAlgorithm;
351 this.sseCustomerKey = builder.sseCustomerKey;
352 this.sseCustomerKeyMD5 = builder.sseCustomerKeyMD5;
353 this.ssekmsKeyId = builder.ssekmsKeyId;
354 this.ssekmsEncryptionContext = builder.ssekmsEncryptionContext;
355 this.requestPayer = builder.requestPayer;
356 this.tagging = builder.tagging;
357 this.objectLockMode = builder.objectLockMode;
358 this.objectLockRetainUntilDate = builder.objectLockRetainUntilDate;
359 this.objectLockLegalHoldStatus = builder.objectLockLegalHoldStatus;
360 }
361
362 /**
363 * <p>
364 * The canned ACL to apply to the object. For more information, see <a
365 * href="https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#CannedACL">Canned ACL</a>.
366 * </p>
367 * <p>
368 * If the service returns an enum value that is not available in the current SDK version, {@link #acl} will return
369 * {@link ObjectCannedACL#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
370 * {@link #aclAsString}.
371 * </p>
372 *
373 * @return The canned ACL to apply to the object. For more information, see <a
374 * href="https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#CannedACL">Canned ACL</a>.
375 * @see ObjectCannedACL
376 */
377 public ObjectCannedACL acl() {
378 return ObjectCannedACL.fromValue(acl);
379 }
380
381 /**
382 * <p>
383 * The canned ACL to apply to the object. For more information, see <a
384 * href="https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#CannedACL">Canned ACL</a>.
385 * </p>
386 * <p>
387 * If the service returns an enum value that is not available in the current SDK version, {@link #acl} will return
388 * {@link ObjectCannedACL#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
389 * {@link #aclAsString}.
390 * </p>
391 *
392 * @return The canned ACL to apply to the object. For more information, see <a
393 * href="https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#CannedACL">Canned ACL</a>.
394 * @see ObjectCannedACL
395 */
396 public String aclAsString() {
397 return acl;
398 }
399
400 /**
401 * <p>
402 * Bucket name to which the PUT operation was initiated.
403 * </p>
404 * <p>
405 * When using this API with an access point, you must direct requests to the access point hostname. The access point
406 * hostname takes the form <i>AccessPointName</i>-<i>AccountId</i>.s3-accesspoint.<i>Region</i>.amazonaws.com. When
407 * using this operation using an access point through the AWS SDKs, you provide the access point ARN in place of the
408 * bucket name. For more information about access point ARNs, see <a
409 * href="https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html">Using Access Points</a> in the
410 * <i>Amazon Simple Storage Service Developer Guide</i>.
411 * </p>
412 *
413 * @return Bucket name to which the PUT operation was initiated. </p>
414 * <p>
415 * When using this API with an access point, you must direct requests to the access point hostname. The
416 * access point hostname takes the form
417 * <i>AccessPointName</i>-<i>AccountId</i>.s3-accesspoint.<i>Region</i>.amazonaws.com. When using this
418 * operation using an access point through the AWS SDKs, you provide the access point ARN in place of the
419 * bucket name. For more information about access point ARNs, see <a
420 * href="https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html">Using Access Points</a>
421 * in the <i>Amazon Simple Storage Service Developer Guide</i>.
422 */
423 public String bucket() {
424 return bucket;
425 }
426
427 /**
428 * <p>
429 * Can be used to specify caching behavior along the request/reply chain. For more information, see <a
430 * href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9"
431 * >http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9</a>.
432 * </p>
433 *
434 * @return Can be used to specify caching behavior along the request/reply chain. For more information, see <a
435 * href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9"
436 * >http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9</a>.
437 */
438 public String cacheControl() {
439 return cacheControl;
440 }
441
442 /**
443 * <p>
444 * Specifies presentational information for the object. For more information, see <a
445 * href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.5.1"
446 * >http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.5.1</a>.
447 * </p>
448 *
449 * @return Specifies presentational information for the object. For more information, see <a
450 * href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.5.1"
451 * >http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.5.1</a>.
452 */
453 public String contentDisposition() {
454 return contentDisposition;
455 }
456
457 /**
458 * <p>
459 * Specifies what content encodings have been applied to the object and thus what decoding mechanisms must be
460 * applied to obtain the media-type referenced by the Content-Type header field. For more information, see <a
461 * href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.11"
462 * >http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.11</a>.
463 * </p>
464 *
465 * @return Specifies what content encodings have been applied to the object and thus what decoding mechanisms must
466 * be applied to obtain the media-type referenced by the Content-Type header field. For more information,
467 * see <a
468 * href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.11">http://www.w3.org/Protocols/
469 * rfc2616/rfc2616-sec14.html#sec14.11</a>.
470 */
471 public String contentEncoding() {
472 return contentEncoding;
473 }
474
475 /**
476 * <p>
477 * The language the content is in.
478 * </p>
479 *
480 * @return The language the content is in.
481 */
482 public String contentLanguage() {
483 return contentLanguage;
484 }
485
486 /**
487 * <p>
488 * Size of the body in bytes. This parameter is useful when the size of the body cannot be determined automatically.
489 * For more information, see <a
490 * href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.13">http://www.w3.
491 * org/Protocols/rfc2616/rfc2616-sec14.html#sec14.13</a>.
492 * </p>
493 *
494 * @return Size of the body in bytes. This parameter is useful when the size of the body cannot be determined
495 * automatically. For more information, see <a
496 * href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.13"
497 * >http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.13</a>.
498 */
499 public Long contentLength() {
500 return contentLength;
501 }
502
503 /**
504 * <p>
505 * The base64-encoded 128-bit MD5 digest of the message (without the headers) according to RFC 1864. This header can
506 * be used as a message integrity check to verify that the data is the same data that was originally sent. Although
507 * it is optional, we recommend using the Content-MD5 mechanism as an end-to-end integrity check. For more
508 * information about REST request authentication, see <a
509 * href="https://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html">REST Authentication</a>.
510 * </p>
511 *
512 * @return The base64-encoded 128-bit MD5 digest of the message (without the headers) according to RFC 1864. This
513 * header can be used as a message integrity check to verify that the data is the same data that was
514 * originally sent. Although it is optional, we recommend using the Content-MD5 mechanism as an end-to-end
515 * integrity check. For more information about REST request authentication, see <a
516 * href="https://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html">REST Authentication</a>.
517 */
518 public String contentMD5() {
519 return contentMD5;
520 }
521
522 /**
523 * <p>
524 * A standard MIME type describing the format of the contents. For more information, see <a
525 * href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17"
526 * >http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17</a>.
527 * </p>
528 *
529 * @return A standard MIME type describing the format of the contents. For more information, see <a
530 * href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17"
531 * >http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17</a>.
532 */
533 public String contentType() {
534 return contentType;
535 }
536
537 /**
538 * <p>
539 * The date and time at which the object is no longer cacheable. For more information, see <a
540 * href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.21"
541 * >http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.21</a>.
542 * </p>
543 *
544 * @return The date and time at which the object is no longer cacheable. For more information, see <a
545 * href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.21"
546 * >http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.21</a>.
547 */
548 public Instant expires() {
549 return expires;
550 }
551
552 /**
553 * <p>
554 * Gives the grantee READ, READ_ACP, and WRITE_ACP permissions on the object.
555 * </p>
556 *
557 * @return Gives the grantee READ, READ_ACP, and WRITE_ACP permissions on the object.
558 */
559 public String grantFullControl() {
560 return grantFullControl;
561 }
562
563 /**
564 * <p>
565 * Allows grantee to read the object data and its metadata.
566 * </p>
567 *
568 * @return Allows grantee to read the object data and its metadata.
569 */
570 public String grantRead() {
571 return grantRead;
572 }
573
574 /**
575 * <p>
576 * Allows grantee to read the object ACL.
577 * </p>
578 *
579 * @return Allows grantee to read the object ACL.
580 */
581 public String grantReadACP() {
582 return grantReadACP;
583 }
584
585 /**
586 * <p>
587 * Allows grantee to write the ACL for the applicable object.
588 * </p>
589 *
590 * @return Allows grantee to write the ACL for the applicable object.
591 */
592 public String grantWriteACP() {
593 return grantWriteACP;
594 }
595
596 /**
597 * <p>
598 * Object key for which the PUT operation was initiated.
599 * </p>
600 *
601 * @return Object key for which the PUT operation was initiated.
602 */
603 public String key() {
604 return key;
605 }
606
607 /**
608 * Returns true if the Metadata property was specified by the sender (it may be empty), or false if the sender did
609 * not specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS service.
610 */
611 public boolean hasMetadata() {
612 return metadata != null && !(metadata instanceof SdkAutoConstructMap);
613 }
614
615 /**
616 * <p>
617 * A map of metadata to store with the object in S3.
618 * </p>
619 * <p>
620 * Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
621 * </p>
622 * <p>
623 * You can use {@link #hasMetadata()} to see if a value was sent in this field.
624 * </p>
625 *
626 * @return A map of metadata to store with the object in S3.
627 */
628 public Map<String, String> metadata() {
629 return metadata;
630 }
631
632 /**
633 * <p>
634 * The server-side encryption algorithm used when storing this object in Amazon S3 (for example, AES256, aws:kms).
635 * </p>
636 * <p>
637 * If the service returns an enum value that is not available in the current SDK version,
638 * {@link #serverSideEncryption} will return {@link ServerSideEncryption#UNKNOWN_TO_SDK_VERSION}. The raw value
639 * returned by the service is available from {@link #serverSideEncryptionAsString}.
640 * </p>
641 *
642 * @return The server-side encryption algorithm used when storing this object in Amazon S3 (for example, AES256,
643 * aws:kms).
644 * @see ServerSideEncryption
645 */
646 public ServerSideEncryption serverSideEncryption() {
647 return ServerSideEncryption.fromValue(serverSideEncryption);
648 }
649
650 /**
651 * <p>
652 * The server-side encryption algorithm used when storing this object in Amazon S3 (for example, AES256, aws:kms).
653 * </p>
654 * <p>
655 * If the service returns an enum value that is not available in the current SDK version,
656 * {@link #serverSideEncryption} will return {@link ServerSideEncryption#UNKNOWN_TO_SDK_VERSION}. The raw value
657 * returned by the service is available from {@link #serverSideEncryptionAsString}.
658 * </p>
659 *
660 * @return The server-side encryption algorithm used when storing this object in Amazon S3 (for example, AES256,
661 * aws:kms).
662 * @see ServerSideEncryption
663 */
664 public String serverSideEncryptionAsString() {
665 return serverSideEncryption;
666 }
667
668 /**
669 * <p>
670 * If you don't specify, S3 Standard is the default storage class. Amazon S3 supports other storage classes.
671 * </p>
672 * <p>
673 * If the service returns an enum value that is not available in the current SDK version, {@link #storageClass} will
674 * return {@link StorageClass#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
675 * {@link #storageClassAsString}.
676 * </p>
677 *
678 * @return If you don't specify, S3 Standard is the default storage class. Amazon S3 supports other storage classes.
679 * @see StorageClass
680 */
681 public StorageClass storageClass() {
682 return StorageClass.fromValue(storageClass);
683 }
684
685 /**
686 * <p>
687 * If you don't specify, S3 Standard is the default storage class. Amazon S3 supports other storage classes.
688 * </p>
689 * <p>
690 * If the service returns an enum value that is not available in the current SDK version, {@link #storageClass} will
691 * return {@link StorageClass#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
692 * {@link #storageClassAsString}.
693 * </p>
694 *
695 * @return If you don't specify, S3 Standard is the default storage class. Amazon S3 supports other storage classes.
696 * @see StorageClass
697 */
698 public String storageClassAsString() {
699 return storageClass;
700 }
701
702 /**
703 * <p>
704 * If the bucket is configured as a website, redirects requests for this object to another object in the same bucket
705 * or to an external URL. Amazon S3 stores the value of this header in the object metadata. For information about
706 * object metadata, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html">Object Key and
707 * Metadata</a>.
708 * </p>
709 * <p>
710 * In the following example, the request header sets the redirect to an object (anotherPage.html) in the same
711 * bucket:
712 * </p>
713 * <p>
714 * <code>x-amz-website-redirect-location: /anotherPage.html</code>
715 * </p>
716 * <p>
717 * In the following example, the request header sets the object redirect to another website:
718 * </p>
719 * <p>
720 * <code>x-amz-website-redirect-location: http://www.example.com/</code>
721 * </p>
722 * <p>
723 * For more information about website hosting in Amazon S3, see <a
724 * href="https://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteHosting.html">Hosting Websites on Amazon S3</a> and
725 * <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/how-to-page-redirect.html">How to Configure Website Page
726 * Redirects</a>.
727 * </p>
728 *
729 * @return If the bucket is configured as a website, redirects requests for this object to another object in the
730 * same bucket or to an external URL. Amazon S3 stores the value of this header in the object metadata. For
731 * information about object metadata, see <a
732 * href="https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html">Object Key and
733 * Metadata</a>.</p>
734 * <p>
735 * In the following example, the request header sets the redirect to an object (anotherPage.html) in the
736 * same bucket:
737 * </p>
738 * <p>
739 * <code>x-amz-website-redirect-location: /anotherPage.html</code>
740 * </p>
741 * <p>
742 * In the following example, the request header sets the object redirect to another website:
743 * </p>
744 * <p>
745 * <code>x-amz-website-redirect-location: http://www.example.com/</code>
746 * </p>
747 * <p>
748 * For more information about website hosting in Amazon S3, see <a
749 * href="https://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteHosting.html">Hosting Websites on Amazon
750 * S3</a> and <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/how-to-page-redirect.html">How to
751 * Configure Website Page Redirects</a>.
752 */
753 public String websiteRedirectLocation() {
754 return websiteRedirectLocation;
755 }
756
757 /**
758 * <p>
759 * Specifies the algorithm to use to when encrypting the object (for example, AES256).
760 * </p>
761 *
762 * @return Specifies the algorithm to use to when encrypting the object (for example, AES256).
763 */
764 public String sseCustomerAlgorithm() {
765 return sseCustomerAlgorithm;
766 }
767
768 /**
769 * <p>
770 * Specifies the customer-provided encryption key for Amazon S3 to use in encrypting data. This value is used to
771 * store the object and then it is discarded; Amazon S3 does not store the encryption key. The key must be
772 * appropriate for use with the algorithm specified in the
773 * <code>x-amz-server-side​-encryption​-customer-algorithm</code> header.
774 * </p>
775 *
776 * @return Specifies the customer-provided encryption key for Amazon S3 to use in encrypting data. This value is
777 * used to store the object and then it is discarded; Amazon S3 does not store the encryption key. The key
778 * must be appropriate for use with the algorithm specified in the
779 * <code>x-amz-server-side​-encryption​-customer-algorithm</code> header.
780 */
781 public String sseCustomerKey() {
782 return sseCustomerKey;
783 }
784
785 /**
786 * <p>
787 * Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. Amazon S3 uses this header for a
788 * message integrity check to ensure that the encryption key was transmitted without error.
789 * </p>
790 *
791 * @return Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. Amazon S3 uses this header
792 * for a message integrity check to ensure that the encryption key was transmitted without error.
793 */
794 public String sseCustomerKeyMD5() {
795 return sseCustomerKeyMD5;
796 }
797
798 /**
799 * <p>
800 * If <code>x-amz-server-side-encryption</code> is present and has the value of <code>aws:kms</code>, this header
801 * specifies the ID of the AWS Key Management Service (AWS KMS) symmetrical customer managed customer master key
802 * (CMK) that was used for the object.
803 * </p>
804 * <p>
805 * If the value of <code>x-amz-server-side-encryption</code> is <code>aws:kms</code>, this header specifies the ID
806 * of the symmetric customer managed AWS KMS CMK that will be used for the object. If you specify
807 * <code>x-amz-server-side-encryption:aws:kms</code>, but do not provide
808 * <code> x-amz-server-side-encryption-aws-kms-key-id</code>, Amazon S3 uses the AWS managed CMK in AWS to protect
809 * the data.
810 * </p>
811 *
812 * @return If <code>x-amz-server-side-encryption</code> is present and has the value of <code>aws:kms</code>, this
813 * header specifies the ID of the AWS Key Management Service (AWS KMS) symmetrical customer managed customer
814 * master key (CMK) that was used for the object.</p>
815 * <p>
816 * If the value of <code>x-amz-server-side-encryption</code> is <code>aws:kms</code>, this header specifies
817 * the ID of the symmetric customer managed AWS KMS CMK that will be used for the object. If you specify
818 * <code>x-amz-server-side-encryption:aws:kms</code>, but do not provide
819 * <code> x-amz-server-side-encryption-aws-kms-key-id</code>, Amazon S3 uses the AWS managed CMK in AWS to
820 * protect the data.
821 */
822 public String ssekmsKeyId() {
823 return ssekmsKeyId;
824 }
825
826 /**
827 * <p>
828 * Specifies the AWS KMS Encryption Context to use for object encryption. The value of this header is a
829 * base64-encoded UTF-8 string holding JSON with the encryption context key-value pairs.
830 * </p>
831 *
832 * @return Specifies the AWS KMS Encryption Context to use for object encryption. The value of this header is a
833 * base64-encoded UTF-8 string holding JSON with the encryption context key-value pairs.
834 */
835 public String ssekmsEncryptionContext() {
836 return ssekmsEncryptionContext;
837 }
838
839 /**
840 * Returns the value of the RequestPayer property for this object.
841 * <p>
842 * If the service returns an enum value that is not available in the current SDK version, {@link #requestPayer} will
843 * return {@link RequestPayer#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
844 * {@link #requestPayerAsString}.
845 * </p>
846 *
847 * @return The value of the RequestPayer property for this object.
848 * @see RequestPayer
849 */
850 public RequestPayer requestPayer() {
851 return RequestPayer.fromValue(requestPayer);
852 }
853
854 /**
855 * Returns the value of the RequestPayer property for this object.
856 * <p>
857 * If the service returns an enum value that is not available in the current SDK version, {@link #requestPayer} will
858 * return {@link RequestPayer#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
859 * {@link #requestPayerAsString}.
860 * </p>
861 *
862 * @return The value of the RequestPayer property for this object.
863 * @see RequestPayer
864 */
865 public String requestPayerAsString() {
866 return requestPayer;
867 }
868
869 /**
870 * <p>
871 * The tag-set for the object. The tag-set must be encoded as URL Query parameters. (For example, "Key1=Value1")
872 * </p>
873 *
874 * @return The tag-set for the object. The tag-set must be encoded as URL Query parameters. (For example,
875 * "Key1=Value1")
876 */
877 public String tagging() {
878 return tagging;
879 }
880
881 /**
882 * <p>
883 * The Object Lock mode that you want to apply to this object.
884 * </p>
885 * <p>
886 * If the service returns an enum value that is not available in the current SDK version, {@link #objectLockMode}
887 * will return {@link ObjectLockMode#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
888 * from {@link #objectLockModeAsString}.
889 * </p>
890 *
891 * @return The Object Lock mode that you want to apply to this object.
892 * @see ObjectLockMode
893 */
894 public ObjectLockMode objectLockMode() {
895 return ObjectLockMode.fromValue(objectLockMode);
896 }
897
898 /**
899 * <p>
900 * The Object Lock mode that you want to apply to this object.
901 * </p>
902 * <p>
903 * If the service returns an enum value that is not available in the current SDK version, {@link #objectLockMode}
904 * will return {@link ObjectLockMode#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available
905 * from {@link #objectLockModeAsString}.
906 * </p>
907 *
908 * @return The Object Lock mode that you want to apply to this object.
909 * @see ObjectLockMode
910 */
911 public String objectLockModeAsString() {
912 return objectLockMode;
913 }
914
915 /**
916 * <p>
917 * The date and time when you want this object's Object Lock to expire.
918 * </p>
919 *
920 * @return The date and time when you want this object's Object Lock to expire.
921 */
922 public Instant objectLockRetainUntilDate() {
923 return objectLockRetainUntilDate;
924 }
925
926 /**
927 * <p>
928 * Specifies whether a legal hold will be applied to this object. For more information about S3 Object Lock, see <a
929 * href="https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lock.html">Object Lock</a>.
930 * </p>
931 * <p>
932 * If the service returns an enum value that is not available in the current SDK version,
933 * {@link #objectLockLegalHoldStatus} will return {@link ObjectLockLegalHoldStatus#UNKNOWN_TO_SDK_VERSION}. The raw
934 * value returned by the service is available from {@link #objectLockLegalHoldStatusAsString}.
935 * </p>
936 *
937 * @return Specifies whether a legal hold will be applied to this object. For more information about S3 Object Lock,
938 * see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lock.html">Object Lock</a>.
939 * @see ObjectLockLegalHoldStatus
940 */
941 public ObjectLockLegalHoldStatus objectLockLegalHoldStatus() {
942 return ObjectLockLegalHoldStatus.fromValue(objectLockLegalHoldStatus);
943 }
944
945 /**
946 * <p>
947 * Specifies whether a legal hold will be applied to this object. For more information about S3 Object Lock, see <a
948 * href="https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lock.html">Object Lock</a>.
949 * </p>
950 * <p>
951 * If the service returns an enum value that is not available in the current SDK version,
952 * {@link #objectLockLegalHoldStatus} will return {@link ObjectLockLegalHoldStatus#UNKNOWN_TO_SDK_VERSION}. The raw
953 * value returned by the service is available from {@link #objectLockLegalHoldStatusAsString}.
954 * </p>
955 *
956 * @return Specifies whether a legal hold will be applied to this object. For more information about S3 Object Lock,
957 * see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lock.html">Object Lock</a>.
958 * @see ObjectLockLegalHoldStatus
959 */
960 public String objectLockLegalHoldStatusAsString() {
961 return objectLockLegalHoldStatus;
962 }
963
964 @Override
965 public Builder toBuilder() {
966 return new BuilderImpl(this);
967 }
968
969 public static Builder builder() {
970 return new BuilderImpl();
971 }
972
973 public static Class<? extends Builder> serializableBuilderClass() {
974 return BuilderImpl.class;
975 }
976
977 @Override
978 public int hashCode() {
979 int hashCode = 1;
980 hashCode = 31 * hashCode + super.hashCode();
981 hashCode = 31 * hashCode + Objects.hashCode(aclAsString());
982 hashCode = 31 * hashCode + Objects.hashCode(bucket());
983 hashCode = 31 * hashCode + Objects.hashCode(cacheControl());
984 hashCode = 31 * hashCode + Objects.hashCode(contentDisposition());
985 hashCode = 31 * hashCode + Objects.hashCode(contentEncoding());
986 hashCode = 31 * hashCode + Objects.hashCode(contentLanguage());
987 hashCode = 31 * hashCode + Objects.hashCode(contentLength());
988 hashCode = 31 * hashCode + Objects.hashCode(contentMD5());
989 hashCode = 31 * hashCode + Objects.hashCode(contentType());
990 hashCode = 31 * hashCode + Objects.hashCode(expires());
991 hashCode = 31 * hashCode + Objects.hashCode(grantFullControl());
992 hashCode = 31 * hashCode + Objects.hashCode(grantRead());
993 hashCode = 31 * hashCode + Objects.hashCode(grantReadACP());
994 hashCode = 31 * hashCode + Objects.hashCode(grantWriteACP());
995 hashCode = 31 * hashCode + Objects.hashCode(key());
996 hashCode = 31 * hashCode + Objects.hashCode(metadata());
997 hashCode = 31 * hashCode + Objects.hashCode(serverSideEncryptionAsString());
998 hashCode = 31 * hashCode + Objects.hashCode(storageClassAsString());
999 hashCode = 31 * hashCode + Objects.hashCode(websiteRedirectLocation());
1000 hashCode = 31 * hashCode + Objects.hashCode(sseCustomerAlgorithm());
1001 hashCode = 31 * hashCode + Objects.hashCode(sseCustomerKey());
1002 hashCode = 31 * hashCode + Objects.hashCode(sseCustomerKeyMD5());
1003 hashCode = 31 * hashCode + Objects.hashCode(ssekmsKeyId());
1004 hashCode = 31 * hashCode + Objects.hashCode(ssekmsEncryptionContext());
1005 hashCode = 31 * hashCode + Objects.hashCode(requestPayerAsString());
1006 hashCode = 31 * hashCode + Objects.hashCode(tagging());
1007 hashCode = 31 * hashCode + Objects.hashCode(objectLockModeAsString());
1008 hashCode = 31 * hashCode + Objects.hashCode(objectLockRetainUntilDate());
1009 hashCode = 31 * hashCode + Objects.hashCode(objectLockLegalHoldStatusAsString());
1010 return hashCode;
1011 }
1012
1013 @Override
1014 public boolean equals(Object obj) {
1015 return super.equals(obj) && equalsBySdkFields(obj);
1016 }
1017
1018 @Override
1019 public boolean equalsBySdkFields(Object obj) {
1020 if (this == obj) {
1021 return true;
1022 }
1023 if (obj == null) {
1024 return false;
1025 }
1026 if (!(obj instanceof PutObjectRequest)) {
1027 return false;
1028 }
1029 PutObjectRequest other = (PutObjectRequest) obj;
1030 return Objects.equals(aclAsString(), other.aclAsString()) && Objects.equals(bucket(), other.bucket())
1031 && Objects.equals(cacheControl(), other.cacheControl())
1032 && Objects.equals(contentDisposition(), other.contentDisposition())
1033 && Objects.equals(contentEncoding(), other.contentEncoding())
1034 && Objects.equals(contentLanguage(), other.contentLanguage())
1035 && Objects.equals(contentLength(), other.contentLength()) && Objects.equals(contentMD5(), other.contentMD5())
1036 && Objects.equals(contentType(), other.contentType()) && Objects.equals(expires(), other.expires())
1037 && Objects.equals(grantFullControl(), other.grantFullControl()) && Objects.equals(grantRead(), other.grantRead())
1038 && Objects.equals(grantReadACP(), other.grantReadACP()) && Objects.equals(grantWriteACP(), other.grantWriteACP())
1039 && Objects.equals(key(), other.key()) && Objects.equals(metadata(), other.metadata())
1040 && Objects.equals(serverSideEncryptionAsString(), other.serverSideEncryptionAsString())
1041 && Objects.equals(storageClassAsString(), other.storageClassAsString())
1042 && Objects.equals(websiteRedirectLocation(), other.websiteRedirectLocation())
1043 && Objects.equals(sseCustomerAlgorithm(), other.sseCustomerAlgorithm())
1044 && Objects.equals(sseCustomerKey(), other.sseCustomerKey())
1045 && Objects.equals(sseCustomerKeyMD5(), other.sseCustomerKeyMD5())
1046 && Objects.equals(ssekmsKeyId(), other.ssekmsKeyId())
1047 && Objects.equals(ssekmsEncryptionContext(), other.ssekmsEncryptionContext())
1048 && Objects.equals(requestPayerAsString(), other.requestPayerAsString())
1049 && Objects.equals(tagging(), other.tagging())
1050 && Objects.equals(objectLockModeAsString(), other.objectLockModeAsString())
1051 && Objects.equals(objectLockRetainUntilDate(), other.objectLockRetainUntilDate())
1052 && Objects.equals(objectLockLegalHoldStatusAsString(), other.objectLockLegalHoldStatusAsString());
1053 }
1054
1055 /**
1056 * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
1057 * redacted from this string using a placeholder value.
1058 */
1059 @Override
1060 public String toString() {
1061 return ToString.builder("PutObjectRequest").add("ACL", aclAsString()).add("Bucket", bucket())
1062 .add("CacheControl", cacheControl()).add("ContentDisposition", contentDisposition())
1063 .add("ContentEncoding", contentEncoding()).add("ContentLanguage", contentLanguage())
1064 .add("ContentLength", contentLength()).add("ContentMD5", contentMD5()).add("ContentType", contentType())
1065 .add("Expires", expires()).add("GrantFullControl", grantFullControl()).add("GrantRead", grantRead())
1066 .add("GrantReadACP", grantReadACP()).add("GrantWriteACP", grantWriteACP()).add("Key", key())
1067 .add("Metadata", metadata()).add("ServerSideEncryption", serverSideEncryptionAsString())
1068 .add("StorageClass", storageClassAsString()).add("WebsiteRedirectLocation", websiteRedirectLocation())
1069 .add("SSECustomerAlgorithm", sseCustomerAlgorithm())
1070 .add("SSECustomerKey", sseCustomerKey() == null ? null : "*** Sensitive Data Redacted ***")
1071 .add("SSECustomerKeyMD5", sseCustomerKeyMD5())
1072 .add("SSEKMSKeyId", ssekmsKeyId() == null ? null : "*** Sensitive Data Redacted ***")
1073 .add("SSEKMSEncryptionContext", ssekmsEncryptionContext() == null ? null : "*** Sensitive Data Redacted ***")
1074 .add("RequestPayer", requestPayerAsString()).add("Tagging", tagging())
1075 .add("ObjectLockMode", objectLockModeAsString()).add("ObjectLockRetainUntilDate", objectLockRetainUntilDate())
1076 .add("ObjectLockLegalHoldStatus", objectLockLegalHoldStatusAsString()).build();
1077 }
1078
1079 public <T> Optional<T> getValueForField(String fieldName, Class<T> clazz) {
1080 switch (fieldName) {
1081 case "ACL":
1082 return Optional.ofNullable(clazz.cast(aclAsString()));
1083 case "Bucket":
1084 return Optional.ofNullable(clazz.cast(bucket()));
1085 case "CacheControl":
1086 return Optional.ofNullable(clazz.cast(cacheControl()));
1087 case "ContentDisposition":
1088 return Optional.ofNullable(clazz.cast(contentDisposition()));
1089 case "ContentEncoding":
1090 return Optional.ofNullable(clazz.cast(contentEncoding()));
1091 case "ContentLanguage":
1092 return Optional.ofNullable(clazz.cast(contentLanguage()));
1093 case "ContentLength":
1094 return Optional.ofNullable(clazz.cast(contentLength()));
1095 case "ContentMD5":
1096 return Optional.ofNullable(clazz.cast(contentMD5()));
1097 case "ContentType":
1098 return Optional.ofNullable(clazz.cast(contentType()));
1099 case "Expires":
1100 return Optional.ofNullable(clazz.cast(expires()));
1101 case "GrantFullControl":
1102 return Optional.ofNullable(clazz.cast(grantFullControl()));
1103 case "GrantRead":
1104 return Optional.ofNullable(clazz.cast(grantRead()));
1105 case "GrantReadACP":
1106 return Optional.ofNullable(clazz.cast(grantReadACP()));
1107 case "GrantWriteACP":
1108 return Optional.ofNullable(clazz.cast(grantWriteACP()));
1109 case "Key":
1110 return Optional.ofNullable(clazz.cast(key()));
1111 case "Metadata":
1112 return Optional.ofNullable(clazz.cast(metadata()));
1113 case "ServerSideEncryption":
1114 return Optional.ofNullable(clazz.cast(serverSideEncryptionAsString()));
1115 case "StorageClass":
1116 return Optional.ofNullable(clazz.cast(storageClassAsString()));
1117 case "WebsiteRedirectLocation":
1118 return Optional.ofNullable(clazz.cast(websiteRedirectLocation()));
1119 case "SSECustomerAlgorithm":
1120 return Optional.ofNullable(clazz.cast(sseCustomerAlgorithm()));
1121 case "SSECustomerKey":
1122 return Optional.ofNullable(clazz.cast(sseCustomerKey()));
1123 case "SSECustomerKeyMD5":
1124 return Optional.ofNullable(clazz.cast(sseCustomerKeyMD5()));
1125 case "SSEKMSKeyId":
1126 return Optional.ofNullable(clazz.cast(ssekmsKeyId()));
1127 case "SSEKMSEncryptionContext":
1128 return Optional.ofNullable(clazz.cast(ssekmsEncryptionContext()));
1129 case "RequestPayer":
1130 return Optional.ofNullable(clazz.cast(requestPayerAsString()));
1131 case "Tagging":
1132 return Optional.ofNullable(clazz.cast(tagging()));
1133 case "ObjectLockMode":
1134 return Optional.ofNullable(clazz.cast(objectLockModeAsString()));
1135 case "ObjectLockRetainUntilDate":
1136 return Optional.ofNullable(clazz.cast(objectLockRetainUntilDate()));
1137 case "ObjectLockLegalHoldStatus":
1138 return Optional.ofNullable(clazz.cast(objectLockLegalHoldStatusAsString()));
1139 default:
1140 return Optional.empty();
1141 }
1142 }
1143
1144 @Override
1145 public List<SdkField<?>> sdkFields() {
1146 return SDK_FIELDS;
1147 }
1148
1149 private static <T> Function<Object, T> getter(Function<PutObjectRequest, T> g) {
1150 return obj -> g.apply((PutObjectRequest) obj);
1151 }
1152
1153 private static <T> BiConsumer<Object, T> setter(BiConsumer<Builder, T> s) {
1154 return (obj, val) -> s.accept((Builder) obj, val);
1155 }
1156
1157 public interface Builder extends S3Request.Builder, SdkPojo, CopyableBuilder<Builder, PutObjectRequest> {
1158 /**
1159 * <p>
1160 * The canned ACL to apply to the object. For more information, see <a
1161 * href="https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#CannedACL">Canned ACL</a>.
1162 * </p>
1163 *
1164 * @param acl
1165 * The canned ACL to apply to the object. For more information, see <a
1166 * href="https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#CannedACL">Canned ACL</a>.
1167 * @see ObjectCannedACL
1168 * @return Returns a reference to this object so that method calls can be chained together.
1169 * @see ObjectCannedACL
1170 */
1171 Builder acl(String acl);
1172
1173 /**
1174 * <p>
1175 * The canned ACL to apply to the object. For more information, see <a
1176 * href="https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#CannedACL">Canned ACL</a>.
1177 * </p>
1178 *
1179 * @param acl
1180 * The canned ACL to apply to the object. For more information, see <a
1181 * href="https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#CannedACL">Canned ACL</a>.
1182 * @see ObjectCannedACL
1183 * @return Returns a reference to this object so that method calls can be chained together.
1184 * @see ObjectCannedACL
1185 */
1186 Builder acl(ObjectCannedACL acl);
1187
1188 /**
1189 * <p>
1190 * Bucket name to which the PUT operation was initiated.
1191 * </p>
1192 * <p>
1193 * When using this API with an access point, you must direct requests to the access point hostname. The access
1194 * point hostname takes the form
1195 * <i>AccessPointName</i>-<i>AccountId</i>.s3-accesspoint.<i>Region</i>.amazonaws.com. When using this operation
1196 * using an access point through the AWS SDKs, you provide the access point ARN in place of the bucket name. For
1197 * more information about access point ARNs, see <a
1198 * href="https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html">Using Access Points</a> in
1199 * the <i>Amazon Simple Storage Service Developer Guide</i>.
1200 * </p>
1201 *
1202 * @param bucket
1203 * Bucket name to which the PUT operation was initiated. </p>
1204 * <p>
1205 * When using this API with an access point, you must direct requests to the access point hostname. The
1206 * access point hostname takes the form
1207 * <i>AccessPointName</i>-<i>AccountId</i>.s3-accesspoint.<i>Region</i>.amazonaws.com. When using this
1208 * operation using an access point through the AWS SDKs, you provide the access point ARN in place of the
1209 * bucket name. For more information about access point ARNs, see <a
1210 * href="https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html">Using Access
1211 * Points</a> in the <i>Amazon Simple Storage Service Developer Guide</i>.
1212 * @return Returns a reference to this object so that method calls can be chained together.
1213 */
1214 Builder bucket(String bucket);
1215
1216 /**
1217 * <p>
1218 * Can be used to specify caching behavior along the request/reply chain. For more information, see <a
1219 * href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9"
1220 * >http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9</a>.
1221 * </p>
1222 *
1223 * @param cacheControl
1224 * Can be used to specify caching behavior along the request/reply chain. For more information, see <a
1225 * href
1226 * ="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9">http://www.w3.org/Protocols/rfc2616
1227 * /rfc2616-sec14.html#sec14.9</a>.
1228 * @return Returns a reference to this object so that method calls can be chained together.
1229 */
1230 Builder cacheControl(String cacheControl);
1231
1232 /**
1233 * <p>
1234 * Specifies presentational information for the object. For more information, see <a
1235 * href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.5.1"
1236 * >http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.5.1</a>.
1237 * </p>
1238 *
1239 * @param contentDisposition
1240 * Specifies presentational information for the object. For more information, see <a
1241 * href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.5.1"
1242 * >http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.5.1</a>.
1243 * @return Returns a reference to this object so that method calls can be chained together.
1244 */
1245 Builder contentDisposition(String contentDisposition);
1246
1247 /**
1248 * <p>
1249 * Specifies what content encodings have been applied to the object and thus what decoding mechanisms must be
1250 * applied to obtain the media-type referenced by the Content-Type header field. For more information, see <a
1251 * href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.11">http://www.w3.org/Protocols/rfc2616/
1252 * rfc2616-sec14.html#sec14.11</a>.
1253 * </p>
1254 *
1255 * @param contentEncoding
1256 * Specifies what content encodings have been applied to the object and thus what decoding mechanisms
1257 * must be applied to obtain the media-type referenced by the Content-Type header field. For more
1258 * information, see <a
1259 * href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.11">http://www.w3
1260 * .org/Protocols/rfc2616/rfc2616-sec14.html#sec14.11</a>.
1261 * @return Returns a reference to this object so that method calls can be chained together.
1262 */
1263 Builder contentEncoding(String contentEncoding);
1264
1265 /**
1266 * <p>
1267 * The language the content is in.
1268 * </p>
1269 *
1270 * @param contentLanguage
1271 * The language the content is in.
1272 * @return Returns a reference to this object so that method calls can be chained together.
1273 */
1274 Builder contentLanguage(String contentLanguage);
1275
1276 /**
1277 * <p>
1278 * Size of the body in bytes. This parameter is useful when the size of the body cannot be determined
1279 * automatically. For more information, see <a
1280 * href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.13"
1281 * >http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.13</a>.
1282 * </p>
1283 *
1284 * @param contentLength
1285 * Size of the body in bytes. This parameter is useful when the size of the body cannot be determined
1286 * automatically. For more information, see <a
1287 * href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.13"
1288 * >http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.13</a>.
1289 * @return Returns a reference to this object so that method calls can be chained together.
1290 */
1291 Builder contentLength(Long contentLength);
1292
1293 /**
1294 * <p>
1295 * The base64-encoded 128-bit MD5 digest of the message (without the headers) according to RFC 1864. This header
1296 * can be used as a message integrity check to verify that the data is the same data that was originally sent.
1297 * Although it is optional, we recommend using the Content-MD5 mechanism as an end-to-end integrity check. For
1298 * more information about REST request authentication, see <a
1299 * href="https://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html">REST Authentication</a>.
1300 * </p>
1301 *
1302 * @param contentMD5
1303 * The base64-encoded 128-bit MD5 digest of the message (without the headers) according to RFC 1864. This
1304 * header can be used as a message integrity check to verify that the data is the same data that was
1305 * originally sent. Although it is optional, we recommend using the Content-MD5 mechanism as an
1306 * end-to-end integrity check. For more information about REST request authentication, see <a
1307 * href="https://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html">REST
1308 * Authentication</a>.
1309 * @return Returns a reference to this object so that method calls can be chained together.
1310 */
1311 Builder contentMD5(String contentMD5);
1312
1313 /**
1314 * <p>
1315 * A standard MIME type describing the format of the contents. For more information, see <a
1316 * href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17"
1317 * >http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17</a>.
1318 * </p>
1319 *
1320 * @param contentType
1321 * A standard MIME type describing the format of the contents. For more information, see <a
1322 * href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17"
1323 * >http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17</a>.
1324 * @return Returns a reference to this object so that method calls can be chained together.
1325 */
1326 Builder contentType(String contentType);
1327
1328 /**
1329 * <p>
1330 * The date and time at which the object is no longer cacheable. For more information, see <a
1331 * href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.21"
1332 * >http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.21</a>.
1333 * </p>
1334 *
1335 * @param expires
1336 * The date and time at which the object is no longer cacheable. For more information, see <a
1337 * href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.21"
1338 * >http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.21</a>.
1339 * @return Returns a reference to this object so that method calls can be chained together.
1340 */
1341 Builder expires(Instant expires);
1342
1343 /**
1344 * <p>
1345 * Gives the grantee READ, READ_ACP, and WRITE_ACP permissions on the object.
1346 * </p>
1347 *
1348 * @param grantFullControl
1349 * Gives the grantee READ, READ_ACP, and WRITE_ACP permissions on the object.
1350 * @return Returns a reference to this object so that method calls can be chained together.
1351 */
1352 Builder grantFullControl(String grantFullControl);
1353
1354 /**
1355 * <p>
1356 * Allows grantee to read the object data and its metadata.
1357 * </p>
1358 *
1359 * @param grantRead
1360 * Allows grantee to read the object data and its metadata.
1361 * @return Returns a reference to this object so that method calls can be chained together.
1362 */
1363 Builder grantRead(String grantRead);
1364
1365 /**
1366 * <p>
1367 * Allows grantee to read the object ACL.
1368 * </p>
1369 *
1370 * @param grantReadACP
1371 * Allows grantee to read the object ACL.
1372 * @return Returns a reference to this object so that method calls can be chained together.
1373 */
1374 Builder grantReadACP(String grantReadACP);
1375
1376 /**
1377 * <p>
1378 * Allows grantee to write the ACL for the applicable object.
1379 * </p>
1380 *
1381 * @param grantWriteACP
1382 * Allows grantee to write the ACL for the applicable object.
1383 * @return Returns a reference to this object so that method calls can be chained together.
1384 */
1385 Builder grantWriteACP(String grantWriteACP);
1386
1387 /**
1388 * <p>
1389 * Object key for which the PUT operation was initiated.
1390 * </p>
1391 *
1392 * @param key
1393 * Object key for which the PUT operation was initiated.
1394 * @return Returns a reference to this object so that method calls can be chained together.
1395 */
1396 Builder key(String key);
1397
1398 /**
1399 * <p>
1400 * A map of metadata to store with the object in S3.
1401 * </p>
1402 *
1403 * @param metadata
1404 * A map of metadata to store with the object in S3.
1405 * @return Returns a reference to this object so that method calls can be chained together.
1406 */
1407 Builder metadata(Map<String, String> metadata);
1408
1409 /**
1410 * <p>
1411 * The server-side encryption algorithm used when storing this object in Amazon S3 (for example, AES256,
1412 * aws:kms).
1413 * </p>
1414 *
1415 * @param serverSideEncryption
1416 * The server-side encryption algorithm used when storing this object in Amazon S3 (for example, AES256,
1417 * aws:kms).
1418 * @see ServerSideEncryption
1419 * @return Returns a reference to this object so that method calls can be chained together.
1420 * @see ServerSideEncryption
1421 */
1422 Builder serverSideEncryption(String serverSideEncryption);
1423
1424 /**
1425 * <p>
1426 * The server-side encryption algorithm used when storing this object in Amazon S3 (for example, AES256,
1427 * aws:kms).
1428 * </p>
1429 *
1430 * @param serverSideEncryption
1431 * The server-side encryption algorithm used when storing this object in Amazon S3 (for example, AES256,
1432 * aws:kms).
1433 * @see ServerSideEncryption
1434 * @return Returns a reference to this object so that method calls can be chained together.
1435 * @see ServerSideEncryption
1436 */
1437 Builder serverSideEncryption(ServerSideEncryption serverSideEncryption);
1438
1439 /**
1440 * <p>
1441 * If you don't specify, S3 Standard is the default storage class. Amazon S3 supports other storage classes.
1442 * </p>
1443 *
1444 * @param storageClass
1445 * If you don't specify, S3 Standard is the default storage class. Amazon S3 supports other storage
1446 * classes.
1447 * @see StorageClass
1448 * @return Returns a reference to this object so that method calls can be chained together.
1449 * @see StorageClass
1450 */
1451 Builder storageClass(String storageClass);
1452
1453 /**
1454 * <p>
1455 * If you don't specify, S3 Standard is the default storage class. Amazon S3 supports other storage classes.
1456 * </p>
1457 *
1458 * @param storageClass
1459 * If you don't specify, S3 Standard is the default storage class. Amazon S3 supports other storage
1460 * classes.
1461 * @see StorageClass
1462 * @return Returns a reference to this object so that method calls can be chained together.
1463 * @see StorageClass
1464 */
1465 Builder storageClass(StorageClass storageClass);
1466
1467 /**
1468 * <p>
1469 * If the bucket is configured as a website, redirects requests for this object to another object in the same
1470 * bucket or to an external URL. Amazon S3 stores the value of this header in the object metadata. For
1471 * information about object metadata, see <a
1472 * href="https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html">Object Key and Metadata</a>.
1473 * </p>
1474 * <p>
1475 * In the following example, the request header sets the redirect to an object (anotherPage.html) in the same
1476 * bucket:
1477 * </p>
1478 * <p>
1479 * <code>x-amz-website-redirect-location: /anotherPage.html</code>
1480 * </p>
1481 * <p>
1482 * In the following example, the request header sets the object redirect to another website:
1483 * </p>
1484 * <p>
1485 * <code>x-amz-website-redirect-location: http://www.example.com/</code>
1486 * </p>
1487 * <p>
1488 * For more information about website hosting in Amazon S3, see <a
1489 * href="https://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteHosting.html">Hosting Websites on Amazon S3</a>
1490 * and <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/how-to-page-redirect.html">How to Configure
1491 * Website Page Redirects</a>.
1492 * </p>
1493 *
1494 * @param websiteRedirectLocation
1495 * If the bucket is configured as a website, redirects requests for this object to another object in the
1496 * same bucket or to an external URL. Amazon S3 stores the value of this header in the object metadata.
1497 * For information about object metadata, see <a
1498 * href="https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html">Object Key and
1499 * Metadata</a>.</p>
1500 * <p>
1501 * In the following example, the request header sets the redirect to an object (anotherPage.html) in the
1502 * same bucket:
1503 * </p>
1504 * <p>
1505 * <code>x-amz-website-redirect-location: /anotherPage.html</code>
1506 * </p>
1507 * <p>
1508 * In the following example, the request header sets the object redirect to another website:
1509 * </p>
1510 * <p>
1511 * <code>x-amz-website-redirect-location: http://www.example.com/</code>
1512 * </p>
1513 * <p>
1514 * For more information about website hosting in Amazon S3, see <a
1515 * href="https://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteHosting.html">Hosting Websites on Amazon
1516 * S3</a> and <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/how-to-page-redirect.html">How to
1517 * Configure Website Page Redirects</a>.
1518 * @return Returns a reference to this object so that method calls can be chained together.
1519 */
1520 Builder websiteRedirectLocation(String websiteRedirectLocation);
1521
1522 /**
1523 * <p>
1524 * Specifies the algorithm to use to when encrypting the object (for example, AES256).
1525 * </p>
1526 *
1527 * @param sseCustomerAlgorithm
1528 * Specifies the algorithm to use to when encrypting the object (for example, AES256).
1529 * @return Returns a reference to this object so that method calls can be chained together.
1530 */
1531 Builder sseCustomerAlgorithm(String sseCustomerAlgorithm);
1532
1533 /**
1534 * <p>
1535 * Specifies the customer-provided encryption key for Amazon S3 to use in encrypting data. This value is used to
1536 * store the object and then it is discarded; Amazon S3 does not store the encryption key. The key must be
1537 * appropriate for use with the algorithm specified in the
1538 * <code>x-amz-server-side​-encryption​-customer-algorithm</code> header.
1539 * </p>
1540 *
1541 * @param sseCustomerKey
1542 * Specifies the customer-provided encryption key for Amazon S3 to use in encrypting data. This value is
1543 * used to store the object and then it is discarded; Amazon S3 does not store the encryption key. The
1544 * key must be appropriate for use with the algorithm specified in the
1545 * <code>x-amz-server-side​-encryption​-customer-algorithm</code> header.
1546 * @return Returns a reference to this object so that method calls can be chained together.
1547 */
1548 Builder sseCustomerKey(String sseCustomerKey);
1549
1550 /**
1551 * <p>
1552 * Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. Amazon S3 uses this header for
1553 * a message integrity check to ensure that the encryption key was transmitted without error.
1554 * </p>
1555 *
1556 * @param sseCustomerKeyMD5
1557 * Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. Amazon S3 uses this
1558 * header for a message integrity check to ensure that the encryption key was transmitted without error.
1559 * @return Returns a reference to this object so that method calls can be chained together.
1560 */
1561 Builder sseCustomerKeyMD5(String sseCustomerKeyMD5);
1562
1563 /**
1564 * <p>
1565 * If <code>x-amz-server-side-encryption</code> is present and has the value of <code>aws:kms</code>, this
1566 * header specifies the ID of the AWS Key Management Service (AWS KMS) symmetrical customer managed customer
1567 * master key (CMK) that was used for the object.
1568 * </p>
1569 * <p>
1570 * If the value of <code>x-amz-server-side-encryption</code> is <code>aws:kms</code>, this header specifies the
1571 * ID of the symmetric customer managed AWS KMS CMK that will be used for the object. If you specify
1572 * <code>x-amz-server-side-encryption:aws:kms</code>, but do not provide
1573 * <code> x-amz-server-side-encryption-aws-kms-key-id</code>, Amazon S3 uses the AWS managed CMK in AWS to
1574 * protect the data.
1575 * </p>
1576 *
1577 * @param ssekmsKeyId
1578 * If <code>x-amz-server-side-encryption</code> is present and has the value of <code>aws:kms</code>,
1579 * this header specifies the ID of the AWS Key Management Service (AWS KMS) symmetrical customer managed
1580 * customer master key (CMK) that was used for the object.</p>
1581 * <p>
1582 * If the value of <code>x-amz-server-side-encryption</code> is <code>aws:kms</code>, this header
1583 * specifies the ID of the symmetric customer managed AWS KMS CMK that will be used for the object. If
1584 * you specify <code>x-amz-server-side-encryption:aws:kms</code>, but do not provide
1585 * <code> x-amz-server-side-encryption-aws-kms-key-id</code>, Amazon S3 uses the AWS managed CMK in AWS
1586 * to protect the data.
1587 * @return Returns a reference to this object so that method calls can be chained together.
1588 */
1589 Builder ssekmsKeyId(String ssekmsKeyId);
1590
1591 /**
1592 * <p>
1593 * Specifies the AWS KMS Encryption Context to use for object encryption. The value of this header is a
1594 * base64-encoded UTF-8 string holding JSON with the encryption context key-value pairs.
1595 * </p>
1596 *
1597 * @param ssekmsEncryptionContext
1598 * Specifies the AWS KMS Encryption Context to use for object encryption. The value of this header is a
1599 * base64-encoded UTF-8 string holding JSON with the encryption context key-value pairs.
1600 * @return Returns a reference to this object so that method calls can be chained together.
1601 */
1602 Builder ssekmsEncryptionContext(String ssekmsEncryptionContext);
1603
1604 /**
1605 * Sets the value of the RequestPayer property for this object.
1606 *
1607 * @param requestPayer
1608 * The new value for the RequestPayer property for this object.
1609 * @see RequestPayer
1610 * @return Returns a reference to this object so that method calls can be chained together.
1611 * @see RequestPayer
1612 */
1613 Builder requestPayer(String requestPayer);
1614
1615 /**
1616 * Sets the value of the RequestPayer property for this object.
1617 *
1618 * @param requestPayer
1619 * The new value for the RequestPayer property for this object.
1620 * @see RequestPayer
1621 * @return Returns a reference to this object so that method calls can be chained together.
1622 * @see RequestPayer
1623 */
1624 Builder requestPayer(RequestPayer requestPayer);
1625
1626 /**
1627 * <p>
1628 * The tag-set for the object. The tag-set must be encoded as URL Query parameters. (For example, "Key1=Value1")
1629 * </p>
1630 *
1631 * @param tagging
1632 * The tag-set for the object. The tag-set must be encoded as URL Query parameters. (For example,
1633 * "Key1=Value1")
1634 * @return Returns a reference to this object so that method calls can be chained together.
1635 */
1636 Builder tagging(String tagging);
1637
1638 Builder tagging(Tagging tagging);
1639
1640 /**
1641 * <p>
1642 * The Object Lock mode that you want to apply to this object.
1643 * </p>
1644 *
1645 * @param objectLockMode
1646 * The Object Lock mode that you want to apply to this object.
1647 * @see ObjectLockMode
1648 * @return Returns a reference to this object so that method calls can be chained together.
1649 * @see ObjectLockMode
1650 */
1651 Builder objectLockMode(String objectLockMode);
1652
1653 /**
1654 * <p>
1655 * The Object Lock mode that you want to apply to this object.
1656 * </p>
1657 *
1658 * @param objectLockMode
1659 * The Object Lock mode that you want to apply to this object.
1660 * @see ObjectLockMode
1661 * @return Returns a reference to this object so that method calls can be chained together.
1662 * @see ObjectLockMode
1663 */
1664 Builder objectLockMode(ObjectLockMode objectLockMode);
1665
1666 /**
1667 * <p>
1668 * The date and time when you want this object's Object Lock to expire.
1669 * </p>
1670 *
1671 * @param objectLockRetainUntilDate
1672 * The date and time when you want this object's Object Lock to expire.
1673 * @return Returns a reference to this object so that method calls can be chained together.
1674 */
1675 Builder objectLockRetainUntilDate(Instant objectLockRetainUntilDate);
1676
1677 /**
1678 * <p>
1679 * Specifies whether a legal hold will be applied to this object. For more information about S3 Object Lock, see
1680 * <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lock.html">Object Lock</a>.
1681 * </p>
1682 *
1683 * @param objectLockLegalHoldStatus
1684 * Specifies whether a legal hold will be applied to this object. For more information about S3 Object
1685 * Lock, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lock.html">Object Lock</a>.
1686 * @see ObjectLockLegalHoldStatus
1687 * @return Returns a reference to this object so that method calls can be chained together.
1688 * @see ObjectLockLegalHoldStatus
1689 */
1690 Builder objectLockLegalHoldStatus(String objectLockLegalHoldStatus);
1691
1692 /**
1693 * <p>
1694 * Specifies whether a legal hold will be applied to this object. For more information about S3 Object Lock, see
1695 * <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lock.html">Object Lock</a>.
1696 * </p>
1697 *
1698 * @param objectLockLegalHoldStatus
1699 * Specifies whether a legal hold will be applied to this object. For more information about S3 Object
1700 * Lock, see <a href="https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lock.html">Object Lock</a>.
1701 * @see ObjectLockLegalHoldStatus
1702 * @return Returns a reference to this object so that method calls can be chained together.
1703 * @see ObjectLockLegalHoldStatus
1704 */
1705 Builder objectLockLegalHoldStatus(ObjectLockLegalHoldStatus objectLockLegalHoldStatus);
1706
1707 @Override
1708 Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration);
1709
1710 @Override
1711 Builder overrideConfiguration(Consumer<AwsRequestOverrideConfiguration.Builder> builderConsumer);
1712 }
1713
1714 static final class BuilderImpl extends S3Request.BuilderImpl implements Builder {
1715 private String acl;
1716
1717 private String bucket;
1718
1719 private String cacheControl;
1720
1721 private String contentDisposition;
1722
1723 private String contentEncoding;
1724
1725 private String contentLanguage;
1726
1727 private Long contentLength;
1728
1729 private String contentMD5;
1730
1731 private String contentType;
1732
1733 private Instant expires;
1734
1735 private String grantFullControl;
1736
1737 private String grantRead;
1738
1739 private String grantReadACP;
1740
1741 private String grantWriteACP;
1742
1743 private String key;
1744
1745 private Map<String, String> metadata = DefaultSdkAutoConstructMap.getInstance();
1746
1747 private String serverSideEncryption;
1748
1749 private String storageClass;
1750
1751 private String websiteRedirectLocation;
1752
1753 private String sseCustomerAlgorithm;
1754
1755 private String sseCustomerKey;
1756
1757 private String sseCustomerKeyMD5;
1758
1759 private String ssekmsKeyId;
1760
1761 private String ssekmsEncryptionContext;
1762
1763 private String requestPayer;
1764
1765 private String tagging;
1766
1767 private String objectLockMode;
1768
1769 private Instant objectLockRetainUntilDate;
1770
1771 private String objectLockLegalHoldStatus;
1772
1773 private BuilderImpl() {
1774 }
1775
1776 private BuilderImpl(PutObjectRequest model) {
1777 super(model);
1778 acl(model.acl);
1779 bucket(model.bucket);
1780 cacheControl(model.cacheControl);
1781 contentDisposition(model.contentDisposition);
1782 contentEncoding(model.contentEncoding);
1783 contentLanguage(model.contentLanguage);
1784 contentLength(model.contentLength);
1785 contentMD5(model.contentMD5);
1786 contentType(model.contentType);
1787 expires(model.expires);
1788 grantFullControl(model.grantFullControl);
1789 grantRead(model.grantRead);
1790 grantReadACP(model.grantReadACP);
1791 grantWriteACP(model.grantWriteACP);
1792 key(model.key);
1793 metadata(model.metadata);
1794 serverSideEncryption(model.serverSideEncryption);
1795 storageClass(model.storageClass);
1796 websiteRedirectLocation(model.websiteRedirectLocation);
1797 sseCustomerAlgorithm(model.sseCustomerAlgorithm);
1798 sseCustomerKey(model.sseCustomerKey);
1799 sseCustomerKeyMD5(model.sseCustomerKeyMD5);
1800 ssekmsKeyId(model.ssekmsKeyId);
1801 ssekmsEncryptionContext(model.ssekmsEncryptionContext);
1802 requestPayer(model.requestPayer);
1803 tagging(model.tagging);
1804 objectLockMode(model.objectLockMode);
1805 objectLockRetainUntilDate(model.objectLockRetainUntilDate);
1806 objectLockLegalHoldStatus(model.objectLockLegalHoldStatus);
1807 }
1808
1809 public final String getAcl() {
1810 return acl;
1811 }
1812
1813 @Override
1814 public final Builder acl(String acl) {
1815 this.acl = acl;
1816 return this;
1817 }
1818
1819 @Override
1820 public final Builder acl(ObjectCannedACL acl) {
1821 this.acl(acl == null ? null : acl.toString());
1822 return this;
1823 }
1824
1825 public final void setAcl(String acl) {
1826 this.acl = acl;
1827 }
1828
1829 public final String getBucket() {
1830 return bucket;
1831 }
1832
1833 @Override
1834 public final Builder bucket(String bucket) {
1835 this.bucket = bucket;
1836 return this;
1837 }
1838
1839 public final void setBucket(String bucket) {
1840 this.bucket = bucket;
1841 }
1842
1843 public final String getCacheControl() {
1844 return cacheControl;
1845 }
1846
1847 @Override
1848 public final Builder cacheControl(String cacheControl) {
1849 this.cacheControl = cacheControl;
1850 return this;
1851 }
1852
1853 public final void setCacheControl(String cacheControl) {
1854 this.cacheControl = cacheControl;
1855 }
1856
1857 public final String getContentDisposition() {
1858 return contentDisposition;
1859 }
1860
1861 @Override
1862 public final Builder contentDisposition(String contentDisposition) {
1863 this.contentDisposition = contentDisposition;
1864 return this;
1865 }
1866
1867 public final void setContentDisposition(String contentDisposition) {
1868 this.contentDisposition = contentDisposition;
1869 }
1870
1871 public final String getContentEncoding() {
1872 return contentEncoding;
1873 }
1874
1875 @Override
1876 public final Builder contentEncoding(String contentEncoding) {
1877 this.contentEncoding = contentEncoding;
1878 return this;
1879 }
1880
1881 public final void setContentEncoding(String contentEncoding) {
1882 this.contentEncoding = contentEncoding;
1883 }
1884
1885 public final String getContentLanguage() {
1886 return contentLanguage;
1887 }
1888
1889 @Override
1890 public final Builder contentLanguage(String contentLanguage) {
1891 this.contentLanguage = contentLanguage;
1892 return this;
1893 }
1894
1895 public final void setContentLanguage(String contentLanguage) {
1896 this.contentLanguage = contentLanguage;
1897 }
1898
1899 public final Long getContentLength() {
1900 return contentLength;
1901 }
1902
1903 @Override
1904 public final Builder contentLength(Long contentLength) {
1905 this.contentLength = contentLength;
1906 return this;
1907 }
1908
1909 public final void setContentLength(Long contentLength) {
1910 this.contentLength = contentLength;
1911 }
1912
1913 public final String getContentMD5() {
1914 return contentMD5;
1915 }
1916
1917 @Override
1918 public final Builder contentMD5(String contentMD5) {
1919 this.contentMD5 = contentMD5;
1920 return this;
1921 }
1922
1923 public final void setContentMD5(String contentMD5) {
1924 this.contentMD5 = contentMD5;
1925 }
1926
1927 public final String getContentType() {
1928 return contentType;
1929 }
1930
1931 @Override
1932 public final Builder contentType(String contentType) {
1933 this.contentType = contentType;
1934 return this;
1935 }
1936
1937 public final void setContentType(String contentType) {
1938 this.contentType = contentType;
1939 }
1940
1941 public final Instant getExpires() {
1942 return expires;
1943 }
1944
1945 @Override
1946 public final Builder expires(Instant expires) {
1947 this.expires = expires;
1948 return this;
1949 }
1950
1951 public final void setExpires(Instant expires) {
1952 this.expires = expires;
1953 }
1954
1955 public final String getGrantFullControl() {
1956 return grantFullControl;
1957 }
1958
1959 @Override
1960 public final Builder grantFullControl(String grantFullControl) {
1961 this.grantFullControl = grantFullControl;
1962 return this;
1963 }
1964
1965 public final void setGrantFullControl(String grantFullControl) {
1966 this.grantFullControl = grantFullControl;
1967 }
1968
1969 public final String getGrantRead() {
1970 return grantRead;
1971 }
1972
1973 @Override
1974 public final Builder grantRead(String grantRead) {
1975 this.grantRead = grantRead;
1976 return this;
1977 }
1978
1979 public final void setGrantRead(String grantRead) {
1980 this.grantRead = grantRead;
1981 }
1982
1983 public final String getGrantReadACP() {
1984 return grantReadACP;
1985 }
1986
1987 @Override
1988 public final Builder grantReadACP(String grantReadACP) {
1989 this.grantReadACP = grantReadACP;
1990 return this;
1991 }
1992
1993 public final void setGrantReadACP(String grantReadACP) {
1994 this.grantReadACP = grantReadACP;
1995 }
1996
1997 public final String getGrantWriteACP() {
1998 return grantWriteACP;
1999 }
2000
2001 @Override
2002 public final Builder grantWriteACP(String grantWriteACP) {
2003 this.grantWriteACP = grantWriteACP;
2004 return this;
2005 }
2006
2007 public final void setGrantWriteACP(String grantWriteACP) {
2008 this.grantWriteACP = grantWriteACP;
2009 }
2010
2011 public final String getKey() {
2012 return key;
2013 }
2014
2015 @Override
2016 public final Builder key(String key) {
2017 this.key = key;
2018 return this;
2019 }
2020
2021 public final void setKey(String key) {
2022 this.key = key;
2023 }
2024
2025 public final Map<String, String> getMetadata() {
2026 return metadata;
2027 }
2028
2029 @Override
2030 public final Builder metadata(Map<String, String> metadata) {
2031 this.metadata = MetadataCopier.copy(metadata);
2032 return this;
2033 }
2034
2035 public final void setMetadata(Map<String, String> metadata) {
2036 this.metadata = MetadataCopier.copy(metadata);
2037 }
2038
2039 public final String getServerSideEncryption() {
2040 return serverSideEncryption;
2041 }
2042
2043 @Override
2044 public final Builder serverSideEncryption(String serverSideEncryption) {
2045 this.serverSideEncryption = serverSideEncryption;
2046 return this;
2047 }
2048
2049 @Override
2050 public final Builder serverSideEncryption(ServerSideEncryption serverSideEncryption) {
2051 this.serverSideEncryption(serverSideEncryption == null ? null : serverSideEncryption.toString());
2052 return this;
2053 }
2054
2055 public final void setServerSideEncryption(String serverSideEncryption) {
2056 this.serverSideEncryption = serverSideEncryption;
2057 }
2058
2059 public final String getStorageClass() {
2060 return storageClass;
2061 }
2062
2063 @Override
2064 public final Builder storageClass(String storageClass) {
2065 this.storageClass = storageClass;
2066 return this;
2067 }
2068
2069 @Override
2070 public final Builder storageClass(StorageClass storageClass) {
2071 this.storageClass(storageClass == null ? null : storageClass.toString());
2072 return this;
2073 }
2074
2075 public final void setStorageClass(String storageClass) {
2076 this.storageClass = storageClass;
2077 }
2078
2079 public final String getWebsiteRedirectLocation() {
2080 return websiteRedirectLocation;
2081 }
2082
2083 @Override
2084 public final Builder websiteRedirectLocation(String websiteRedirectLocation) {
2085 this.websiteRedirectLocation = websiteRedirectLocation;
2086 return this;
2087 }
2088
2089 public final void setWebsiteRedirectLocation(String websiteRedirectLocation) {
2090 this.websiteRedirectLocation = websiteRedirectLocation;
2091 }
2092
2093 public final String getSseCustomerAlgorithm() {
2094 return sseCustomerAlgorithm;
2095 }
2096
2097 @Override
2098 public final Builder sseCustomerAlgorithm(String sseCustomerAlgorithm) {
2099 this.sseCustomerAlgorithm = sseCustomerAlgorithm;
2100 return this;
2101 }
2102
2103 public final void setSseCustomerAlgorithm(String sseCustomerAlgorithm) {
2104 this.sseCustomerAlgorithm = sseCustomerAlgorithm;
2105 }
2106
2107 public final String getSseCustomerKey() {
2108 return sseCustomerKey;
2109 }
2110
2111 @Override
2112 public final Builder sseCustomerKey(String sseCustomerKey) {
2113 this.sseCustomerKey = sseCustomerKey;
2114 return this;
2115 }
2116
2117 public final void setSseCustomerKey(String sseCustomerKey) {
2118 this.sseCustomerKey = sseCustomerKey;
2119 }
2120
2121 public final String getSseCustomerKeyMD5() {
2122 return sseCustomerKeyMD5;
2123 }
2124
2125 @Override
2126 public final Builder sseCustomerKeyMD5(String sseCustomerKeyMD5) {
2127 this.sseCustomerKeyMD5 = sseCustomerKeyMD5;
2128 return this;
2129 }
2130
2131 public final void setSseCustomerKeyMD5(String sseCustomerKeyMD5) {
2132 this.sseCustomerKeyMD5 = sseCustomerKeyMD5;
2133 }
2134
2135 public final String getSsekmsKeyId() {
2136 return ssekmsKeyId;
2137 }
2138
2139 @Override
2140 public final Builder ssekmsKeyId(String ssekmsKeyId) {
2141 this.ssekmsKeyId = ssekmsKeyId;
2142 return this;
2143 }
2144
2145 public final void setSsekmsKeyId(String ssekmsKeyId) {
2146 this.ssekmsKeyId = ssekmsKeyId;
2147 }
2148
2149 public final String getSsekmsEncryptionContext() {
2150 return ssekmsEncryptionContext;
2151 }
2152
2153 @Override
2154 public final Builder ssekmsEncryptionContext(String ssekmsEncryptionContext) {
2155 this.ssekmsEncryptionContext = ssekmsEncryptionContext;
2156 return this;
2157 }
2158
2159 public final void setSsekmsEncryptionContext(String ssekmsEncryptionContext) {
2160 this.ssekmsEncryptionContext = ssekmsEncryptionContext;
2161 }
2162
2163 public final String getRequestPayer() {
2164 return requestPayer;
2165 }
2166
2167 @Override
2168 public final Builder requestPayer(String requestPayer) {
2169 this.requestPayer = requestPayer;
2170 return this;
2171 }
2172
2173 @Override
2174 public final Builder requestPayer(RequestPayer requestPayer) {
2175 this.requestPayer(requestPayer == null ? null : requestPayer.toString());
2176 return this;
2177 }
2178
2179 public final void setRequestPayer(String requestPayer) {
2180 this.requestPayer = requestPayer;
2181 }
2182
2183 public final String getTagging() {
2184 return tagging;
2185 }
2186
2187 @Override
2188 public final Builder tagging(String tagging) {
2189 this.tagging = tagging;
2190 return this;
2191 }
2192
2193 public final void setTagging(String tagging) {
2194 this.tagging = tagging;
2195 }
2196
2197 public Builder tagging(Tagging tagging) {
2198 tagging(TaggingAdapter.instance().adapt(tagging));
2199 return this;
2200 }
2201
2202 public final String getObjectLockMode() {
2203 return objectLockMode;
2204 }
2205
2206 @Override
2207 public final Builder objectLockMode(String objectLockMode) {
2208 this.objectLockMode = objectLockMode;
2209 return this;
2210 }
2211
2212 @Override
2213 public final Builder objectLockMode(ObjectLockMode objectLockMode) {
2214 this.objectLockMode(objectLockMode == null ? null : objectLockMode.toString());
2215 return this;
2216 }
2217
2218 public final void setObjectLockMode(String objectLockMode) {
2219 this.objectLockMode = objectLockMode;
2220 }
2221
2222 public final Instant getObjectLockRetainUntilDate() {
2223 return objectLockRetainUntilDate;
2224 }
2225
2226 @Override
2227 public final Builder objectLockRetainUntilDate(Instant objectLockRetainUntilDate) {
2228 this.objectLockRetainUntilDate = objectLockRetainUntilDate;
2229 return this;
2230 }
2231
2232 public final void setObjectLockRetainUntilDate(Instant objectLockRetainUntilDate) {
2233 this.objectLockRetainUntilDate = objectLockRetainUntilDate;
2234 }
2235
2236 public final String getObjectLockLegalHoldStatus() {
2237 return objectLockLegalHoldStatus;
2238 }
2239
2240 @Override
2241 public final Builder objectLockLegalHoldStatus(String objectLockLegalHoldStatus) {
2242 this.objectLockLegalHoldStatus = objectLockLegalHoldStatus;
2243 return this;
2244 }
2245
2246 @Override
2247 public final Builder objectLockLegalHoldStatus(ObjectLockLegalHoldStatus objectLockLegalHoldStatus) {
2248 this.objectLockLegalHoldStatus(objectLockLegalHoldStatus == null ? null : objectLockLegalHoldStatus.toString());
2249 return this;
2250 }
2251
2252 public final void setObjectLockLegalHoldStatus(String objectLockLegalHoldStatus) {
2253 this.objectLockLegalHoldStatus = objectLockLegalHoldStatus;
2254 }
2255
2256 @Override
2257 public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) {
2258 super.overrideConfiguration(overrideConfiguration);
2259 return this;
2260 }
2261
2262 @Override
2263 public Builder overrideConfiguration(Consumer<AwsRequestOverrideConfiguration.Builder> builderConsumer) {
2264 super.overrideConfiguration(builderConsumer);
2265 return this;
2266 }
2267
2268 @Override
2269 public PutObjectRequest build() {
2270 return new PutObjectRequest(this);
2271 }
2272
2273 @Override
2274 public List<SdkField<?>> sdkFields() {
2275 return SDK_FIELDS;
2276 }
2277 }
2278 }
2279