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.Objects;
21 import java.util.Optional;
22 import java.util.function.BiConsumer;
23 import java.util.function.Consumer;
24 import java.util.function.Function;
25 import software.amazon.awssdk.annotations.Generated;
26 import software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration;
27 import software.amazon.awssdk.core.SdkField;
28 import software.amazon.awssdk.core.SdkPojo;
29 import software.amazon.awssdk.core.protocol.MarshallLocation;
30 import software.amazon.awssdk.core.protocol.MarshallingType;
31 import software.amazon.awssdk.core.traits.LocationTrait;
32 import software.amazon.awssdk.utils.ToString;
33 import software.amazon.awssdk.utils.builder.CopyableBuilder;
34 import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
35
36 /**
37  */

38 @Generated("software.amazon.awssdk:codegen")
39 public final class HeadObjectRequest extends S3Request implements ToCopyableBuilder<HeadObjectRequest.Builder, HeadObjectRequest> {
40     private static final SdkField<String> BUCKET_FIELD = SdkField
41             .<String> builder(MarshallingType.STRING)
42             .getter(getter(HeadObjectRequest::bucket))
43             .setter(setter(Builder::bucket))
44             .traits(LocationTrait.builder().location(MarshallLocation.PATH).locationName("Bucket")
45                     .unmarshallLocationName("Bucket").build()).build();
46
47     private static final SdkField<String> IF_MATCH_FIELD = SdkField
48             .<String> builder(MarshallingType.STRING)
49             .getter(getter(HeadObjectRequest::ifMatch))
50             .setter(setter(Builder::ifMatch))
51             .traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("If-Match")
52                     .unmarshallLocationName("If-Match").build()).build();
53
54     private static final SdkField<Instant> IF_MODIFIED_SINCE_FIELD = SdkField
55             .<Instant> builder(MarshallingType.INSTANT)
56             .getter(getter(HeadObjectRequest::ifModifiedSince))
57             .setter(setter(Builder::ifModifiedSince))
58             .traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("If-Modified-Since")
59                     .unmarshallLocationName("If-Modified-Since").build()).build();
60
61     private static final SdkField<String> IF_NONE_MATCH_FIELD = SdkField
62             .<String> builder(MarshallingType.STRING)
63             .getter(getter(HeadObjectRequest::ifNoneMatch))
64             .setter(setter(Builder::ifNoneMatch))
65             .traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("If-None-Match")
66                     .unmarshallLocationName("If-None-Match").build()).build();
67
68     private static final SdkField<Instant> IF_UNMODIFIED_SINCE_FIELD = SdkField
69             .<Instant> builder(MarshallingType.INSTANT)
70             .getter(getter(HeadObjectRequest::ifUnmodifiedSince))
71             .setter(setter(Builder::ifUnmodifiedSince))
72             .traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("If-Unmodified-Since")
73                     .unmarshallLocationName("If-Unmodified-Since").build()).build();
74
75     private static final SdkField<String> KEY_FIELD = SdkField
76             .<String> builder(MarshallingType.STRING)
77             .getter(getter(HeadObjectRequest::key))
78             .setter(setter(Builder::key))
79             .traits(LocationTrait.builder().location(MarshallLocation.GREEDY_PATH).locationName("Key")
80                     .unmarshallLocationName("Key").build()).build();
81
82     private static final SdkField<String> RANGE_FIELD = SdkField
83             .<String> builder(MarshallingType.STRING)
84             .getter(getter(HeadObjectRequest::range))
85             .setter(setter(Builder::range))
86             .traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("Range")
87                     .unmarshallLocationName("Range").build()).build();
88
89     private static final SdkField<String> VERSION_ID_FIELD = SdkField
90             .<String> builder(MarshallingType.STRING)
91             .getter(getter(HeadObjectRequest::versionId))
92             .setter(setter(Builder::versionId))
93             .traits(LocationTrait.builder().location(MarshallLocation.QUERY_PARAM).locationName("versionId")
94                     .unmarshallLocationName("versionId").build()).build();
95
96     private static final SdkField<String> SSE_CUSTOMER_ALGORITHM_FIELD = SdkField
97             .<String> builder(MarshallingType.STRING)
98             .getter(getter(HeadObjectRequest::sseCustomerAlgorithm))
99             .setter(setter(Builder::sseCustomerAlgorithm))
100             .traits(LocationTrait.builder().location(MarshallLocation.HEADER)
101                     .locationName("x-amz-server-side-encryption-customer-algorithm")
102                     .unmarshallLocationName("x-amz-server-side-encryption-customer-algorithm").build()).build();
103
104     private static final SdkField<String> SSE_CUSTOMER_KEY_FIELD = SdkField
105             .<String> builder(MarshallingType.STRING)
106             .getter(getter(HeadObjectRequest::sseCustomerKey))
107             .setter(setter(Builder::sseCustomerKey))
108             .traits(LocationTrait.builder().location(MarshallLocation.HEADER)
109                     .locationName("x-amz-server-side-encryption-customer-key")
110                     .unmarshallLocationName("x-amz-server-side-encryption-customer-key").build()).build();
111
112     private static final SdkField<String> SSE_CUSTOMER_KEY_MD5_FIELD = SdkField
113             .<String> builder(MarshallingType.STRING)
114             .getter(getter(HeadObjectRequest::sseCustomerKeyMD5))
115             .setter(setter(Builder::sseCustomerKeyMD5))
116             .traits(LocationTrait.builder().location(MarshallLocation.HEADER)
117                     .locationName("x-amz-server-side-encryption-customer-key-MD5")
118                     .unmarshallLocationName("x-amz-server-side-encryption-customer-key-MD5").build()).build();
119
120     private static final SdkField<String> REQUEST_PAYER_FIELD = SdkField
121             .<String> builder(MarshallingType.STRING)
122             .getter(getter(HeadObjectRequest::requestPayerAsString))
123             .setter(setter(Builder::requestPayer))
124             .traits(LocationTrait.builder().location(MarshallLocation.HEADER).locationName("x-amz-request-payer")
125                     .unmarshallLocationName("x-amz-request-payer").build()).build();
126
127     private static final SdkField<Integer> PART_NUMBER_FIELD = SdkField
128             .<Integer> builder(MarshallingType.INTEGER)
129             .getter(getter(HeadObjectRequest::partNumber))
130             .setter(setter(Builder::partNumber))
131             .traits(LocationTrait.builder().location(MarshallLocation.QUERY_PARAM).locationName("partNumber")
132                     .unmarshallLocationName("partNumber").build()).build();
133
134     private static final List<SdkField<?>> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(BUCKET_FIELD, IF_MATCH_FIELD,
135             IF_MODIFIED_SINCE_FIELD, IF_NONE_MATCH_FIELD, IF_UNMODIFIED_SINCE_FIELD, KEY_FIELD, RANGE_FIELD, VERSION_ID_FIELD,
136             SSE_CUSTOMER_ALGORITHM_FIELD, SSE_CUSTOMER_KEY_FIELD, SSE_CUSTOMER_KEY_MD5_FIELD, REQUEST_PAYER_FIELD,
137             PART_NUMBER_FIELD));
138
139     private final String bucket;
140
141     private final String ifMatch;
142
143     private final Instant ifModifiedSince;
144
145     private final String ifNoneMatch;
146
147     private final Instant ifUnmodifiedSince;
148
149     private final String key;
150
151     private final String range;
152
153     private final String versionId;
154
155     private final String sseCustomerAlgorithm;
156
157     private final String sseCustomerKey;
158
159     private final String sseCustomerKeyMD5;
160
161     private final String requestPayer;
162
163     private final Integer partNumber;
164
165     private HeadObjectRequest(BuilderImpl builder) {
166         super(builder);
167         this.bucket = builder.bucket;
168         this.ifMatch = builder.ifMatch;
169         this.ifModifiedSince = builder.ifModifiedSince;
170         this.ifNoneMatch = builder.ifNoneMatch;
171         this.ifUnmodifiedSince = builder.ifUnmodifiedSince;
172         this.key = builder.key;
173         this.range = builder.range;
174         this.versionId = builder.versionId;
175         this.sseCustomerAlgorithm = builder.sseCustomerAlgorithm;
176         this.sseCustomerKey = builder.sseCustomerKey;
177         this.sseCustomerKeyMD5 = builder.sseCustomerKeyMD5;
178         this.requestPayer = builder.requestPayer;
179         this.partNumber = builder.partNumber;
180     }
181
182     /**
183      * <p>
184      * The name of the bucket containing the object.
185      * </p>
186      * 
187      * @return The name of the bucket containing the object.
188      */

189     public String bucket() {
190         return bucket;
191     }
192
193     /**
194      * <p>
195      * Return the object only if its entity tag (ETag) is the same as the one specified, otherwise return a 412
196      * (precondition failed).
197      * </p>
198      * 
199      * @return Return the object only if its entity tag (ETag) is the same as the one specified, otherwise return a 412
200      *         (precondition failed).
201      */

202     public String ifMatch() {
203         return ifMatch;
204     }
205
206     /**
207      * <p>
208      * Return the object only if it has been modified since the specified time, otherwise return a 304 (not modified).
209      * </p>
210      * 
211      * @return Return the object only if it has been modified since the specified time, otherwise return a 304 (not
212      *         modified).
213      */

214     public Instant ifModifiedSince() {
215         return ifModifiedSince;
216     }
217
218     /**
219      * <p>
220      * Return the object only if its entity tag (ETag) is different from the one specified, otherwise return a 304 (not
221      * modified).
222      * </p>
223      * 
224      * @return Return the object only if its entity tag (ETag) is different from the one specified, otherwise return a
225      *         304 (not modified).
226      */

227     public String ifNoneMatch() {
228         return ifNoneMatch;
229     }
230
231     /**
232      * <p>
233      * Return the object only if it has not been modified since the specified time, otherwise return a 412 (precondition
234      * failed).
235      * </p>
236      * 
237      * @return Return the object only if it has not been modified since the specified time, otherwise return a 412
238      *         (precondition failed).
239      */

240     public Instant ifUnmodifiedSince() {
241         return ifUnmodifiedSince;
242     }
243
244     /**
245      * <p>
246      * The object key.
247      * </p>
248      * 
249      * @return The object key.
250      */

251     public String key() {
252         return key;
253     }
254
255     /**
256      * <p>
257      * Downloads the specified range bytes of an object. For more information about the HTTP Range header, see <a
258      * href="">http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35</a>.
259      * </p>
260      * <note>
261      * <p>
262      * Amazon S3 doesn't support retrieving multiple ranges of data per <code>GET</code> request.
263      * </p>
264      * </note>
265      * 
266      * @return Downloads the specified range bytes of an object. For more information about the HTTP Range header, see
267      *         <a href="">http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35</a>.</p> <note>
268      *         <p>
269      *         Amazon S3 doesn't support retrieving multiple ranges of data per <code>GET</code> request.
270      *         </p>
271      */

272     public String range() {
273         return range;
274     }
275
276     /**
277      * <p>
278      * VersionId used to reference a specific version of the object.
279      * </p>
280      * 
281      * @return VersionId used to reference a specific version of the object.
282      */

283     public String versionId() {
284         return versionId;
285     }
286
287     /**
288      * <p>
289      * Specifies the algorithm to use to when encrypting the object (for example, AES256).
290      * </p>
291      * 
292      * @return Specifies the algorithm to use to when encrypting the object (for example, AES256).
293      */

294     public String sseCustomerAlgorithm() {
295         return sseCustomerAlgorithm;
296     }
297
298     /**
299      * <p>
300      * Specifies the customer-provided encryption key for Amazon S3 to use in encrypting data. This value is used to
301      * store the object and then it is discarded; Amazon S3 does not store the encryption key. The key must be
302      * appropriate for use with the algorithm specified in the
303      * <code>x-amz-server-side​-encryption​-customer-algorithm</code> header.
304      * </p>
305      * 
306      * @return Specifies the customer-provided encryption key for Amazon S3 to use in encrypting data. This value is
307      *         used to store the object and then it is discarded; Amazon S3 does not store the encryption key. The key
308      *         must be appropriate for use with the algorithm specified in the
309      *         <code>x-amz-server-side​-encryption​-customer-algorithm</code> header.
310      */

311     public String sseCustomerKey() {
312         return sseCustomerKey;
313     }
314
315     /**
316      * <p>
317      * Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. Amazon S3 uses this header for a
318      * message integrity check to ensure that the encryption key was transmitted without error.
319      * </p>
320      * 
321      * @return Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. Amazon S3 uses this header
322      *         for a message integrity check to ensure that the encryption key was transmitted without error.
323      */

324     public String sseCustomerKeyMD5() {
325         return sseCustomerKeyMD5;
326     }
327
328     /**
329      * Returns the value of the RequestPayer property for this object.
330      * <p>
331      * If the service returns an enum value that is not available in the current SDK version, {@link #requestPayer} will
332      * return {@link RequestPayer#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
333      * {@link #requestPayerAsString}.
334      * </p>
335      * 
336      * @return The value of the RequestPayer property for this object.
337      * @see RequestPayer
338      */

339     public RequestPayer requestPayer() {
340         return RequestPayer.fromValue(requestPayer);
341     }
342
343     /**
344      * Returns the value of the RequestPayer property for this object.
345      * <p>
346      * If the service returns an enum value that is not available in the current SDK version, {@link #requestPayer} will
347      * return {@link RequestPayer#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
348      * {@link #requestPayerAsString}.
349      * </p>
350      * 
351      * @return The value of the RequestPayer property for this object.
352      * @see RequestPayer
353      */

354     public String requestPayerAsString() {
355         return requestPayer;
356     }
357
358     /**
359      * <p>
360      * Part number of the object being read. This is a positive integer between 1 and 10,000. Effectively performs a
361      * 'ranged' HEAD request for the part specified. Useful querying about the size of the part and the number of parts
362      * in this object.
363      * </p>
364      * 
365      * @return Part number of the object being read. This is a positive integer between 1 and 10,000. Effectively
366      *         performs a 'ranged' HEAD request for the part specified. Useful querying about the size of the part and
367      *         the number of parts in this object.
368      */

369     public Integer partNumber() {
370         return partNumber;
371     }
372
373     @Override
374     public Builder toBuilder() {
375         return new BuilderImpl(this);
376     }
377
378     public static Builder builder() {
379         return new BuilderImpl();
380     }
381
382     public static Class<? extends Builder> serializableBuilderClass() {
383         return BuilderImpl.class;
384     }
385
386     @Override
387     public int hashCode() {
388         int hashCode = 1;
389         hashCode = 31 * hashCode + super.hashCode();
390         hashCode = 31 * hashCode + Objects.hashCode(bucket());
391         hashCode = 31 * hashCode + Objects.hashCode(ifMatch());
392         hashCode = 31 * hashCode + Objects.hashCode(ifModifiedSince());
393         hashCode = 31 * hashCode + Objects.hashCode(ifNoneMatch());
394         hashCode = 31 * hashCode + Objects.hashCode(ifUnmodifiedSince());
395         hashCode = 31 * hashCode + Objects.hashCode(key());
396         hashCode = 31 * hashCode + Objects.hashCode(range());
397         hashCode = 31 * hashCode + Objects.hashCode(versionId());
398         hashCode = 31 * hashCode + Objects.hashCode(sseCustomerAlgorithm());
399         hashCode = 31 * hashCode + Objects.hashCode(sseCustomerKey());
400         hashCode = 31 * hashCode + Objects.hashCode(sseCustomerKeyMD5());
401         hashCode = 31 * hashCode + Objects.hashCode(requestPayerAsString());
402         hashCode = 31 * hashCode + Objects.hashCode(partNumber());
403         return hashCode;
404     }
405
406     @Override
407     public boolean equals(Object obj) {
408         return super.equals(obj) && equalsBySdkFields(obj);
409     }
410
411     @Override
412     public boolean equalsBySdkFields(Object obj) {
413         if (this == obj) {
414             return true;
415         }
416         if (obj == null) {
417             return false;
418         }
419         if (!(obj instanceof HeadObjectRequest)) {
420             return false;
421         }
422         HeadObjectRequest other = (HeadObjectRequest) obj;
423         return Objects.equals(bucket(), other.bucket()) && Objects.equals(ifMatch(), other.ifMatch())
424                 && Objects.equals(ifModifiedSince(), other.ifModifiedSince())
425                 && Objects.equals(ifNoneMatch(), other.ifNoneMatch())
426                 && Objects.equals(ifUnmodifiedSince(), other.ifUnmodifiedSince()) && Objects.equals(key(), other.key())
427                 && Objects.equals(range(), other.range()) && Objects.equals(versionId(), other.versionId())
428                 && Objects.equals(sseCustomerAlgorithm(), other.sseCustomerAlgorithm())
429                 && Objects.equals(sseCustomerKey(), other.sseCustomerKey())
430                 && Objects.equals(sseCustomerKeyMD5(), other.sseCustomerKeyMD5())
431                 && Objects.equals(requestPayerAsString(), other.requestPayerAsString())
432                 && Objects.equals(partNumber(), other.partNumber());
433     }
434
435     /**
436      * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
437      * redacted from this string using a placeholder value.
438      */

439     @Override
440     public String toString() {
441         return ToString.builder("HeadObjectRequest").add("Bucket", bucket()).add("IfMatch", ifMatch())
442                 .add("IfModifiedSince", ifModifiedSince()).add("IfNoneMatch", ifNoneMatch())
443                 .add("IfUnmodifiedSince", ifUnmodifiedSince()).add("Key", key()).add("Range", range())
444                 .add("VersionId", versionId()).add("SSECustomerAlgorithm", sseCustomerAlgorithm())
445                 .add("SSECustomerKey", sseCustomerKey() == null ? null : "*** Sensitive Data Redacted ***")
446                 .add("SSECustomerKeyMD5", sseCustomerKeyMD5()).add("RequestPayer", requestPayerAsString())
447                 .add("PartNumber", partNumber()).build();
448     }
449
450     public <T> Optional<T> getValueForField(String fieldName, Class<T> clazz) {
451         switch (fieldName) {
452         case "Bucket":
453             return Optional.ofNullable(clazz.cast(bucket()));
454         case "IfMatch":
455             return Optional.ofNullable(clazz.cast(ifMatch()));
456         case "IfModifiedSince":
457             return Optional.ofNullable(clazz.cast(ifModifiedSince()));
458         case "IfNoneMatch":
459             return Optional.ofNullable(clazz.cast(ifNoneMatch()));
460         case "IfUnmodifiedSince":
461             return Optional.ofNullable(clazz.cast(ifUnmodifiedSince()));
462         case "Key":
463             return Optional.ofNullable(clazz.cast(key()));
464         case "Range":
465             return Optional.ofNullable(clazz.cast(range()));
466         case "VersionId":
467             return Optional.ofNullable(clazz.cast(versionId()));
468         case "SSECustomerAlgorithm":
469             return Optional.ofNullable(clazz.cast(sseCustomerAlgorithm()));
470         case "SSECustomerKey":
471             return Optional.ofNullable(clazz.cast(sseCustomerKey()));
472         case "SSECustomerKeyMD5":
473             return Optional.ofNullable(clazz.cast(sseCustomerKeyMD5()));
474         case "RequestPayer":
475             return Optional.ofNullable(clazz.cast(requestPayerAsString()));
476         case "PartNumber":
477             return Optional.ofNullable(clazz.cast(partNumber()));
478         default:
479             return Optional.empty();
480         }
481     }
482
483     @Override
484     public List<SdkField<?>> sdkFields() {
485         return SDK_FIELDS;
486     }
487
488     private static <T> Function<Object, T> getter(Function<HeadObjectRequest, T> g) {
489         return obj -> g.apply((HeadObjectRequest) obj);
490     }
491
492     private static <T> BiConsumer<Object, T> setter(BiConsumer<Builder, T> s) {
493         return (obj, val) -> s.accept((Builder) obj, val);
494     }
495
496     public interface Builder extends S3Request.Builder, SdkPojo, CopyableBuilder<Builder, HeadObjectRequest> {
497         /**
498          * <p>
499          * The name of the bucket containing the object.
500          * </p>
501          * 
502          * @param bucket
503          *        The name of the bucket containing the object.
504          * @return Returns a reference to this object so that method calls can be chained together.
505          */

506         Builder bucket(String bucket);
507
508         /**
509          * <p>
510          * Return the object only if its entity tag (ETag) is the same as the one specified, otherwise return a 412
511          * (precondition failed).
512          * </p>
513          * 
514          * @param ifMatch
515          *        Return the object only if its entity tag (ETag) is the same as the one specified, otherwise return a
516          *        412 (precondition failed).
517          * @return Returns a reference to this object so that method calls can be chained together.
518          */

519         Builder ifMatch(String ifMatch);
520
521         /**
522          * <p>
523          * Return the object only if it has been modified since the specified time, otherwise return a 304 (not
524          * modified).
525          * </p>
526          * 
527          * @param ifModifiedSince
528          *        Return the object only if it has been modified since the specified time, otherwise return a 304 (not
529          *        modified).
530          * @return Returns a reference to this object so that method calls can be chained together.
531          */

532         Builder ifModifiedSince(Instant ifModifiedSince);
533
534         /**
535          * <p>
536          * Return the object only if its entity tag (ETag) is different from the one specified, otherwise return a 304
537          * (not modified).
538          * </p>
539          * 
540          * @param ifNoneMatch
541          *        Return the object only if its entity tag (ETag) is different from the one specified, otherwise return
542          *        a 304 (not modified).
543          * @return Returns a reference to this object so that method calls can be chained together.
544          */

545         Builder ifNoneMatch(String ifNoneMatch);
546
547         /**
548          * <p>
549          * Return the object only if it has not been modified since the specified time, otherwise return a 412
550          * (precondition failed).
551          * </p>
552          * 
553          * @param ifUnmodifiedSince
554          *        Return the object only if it has not been modified since the specified time, otherwise return a 412
555          *        (precondition failed).
556          * @return Returns a reference to this object so that method calls can be chained together.
557          */

558         Builder ifUnmodifiedSince(Instant ifUnmodifiedSince);
559
560         /**
561          * <p>
562          * The object key.
563          * </p>
564          * 
565          * @param key
566          *        The object key.
567          * @return Returns a reference to this object so that method calls can be chained together.
568          */

569         Builder key(String key);
570
571         /**
572          * <p>
573          * Downloads the specified range bytes of an object. For more information about the HTTP Range header, see <a
574          * href="">http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35</a>.
575          * </p>
576          * <note>
577          * <p>
578          * Amazon S3 doesn't support retrieving multiple ranges of data per <code>GET</code> request.
579          * </p>
580          * </note>
581          * 
582          * @param range
583          *        Downloads the specified range bytes of an object. For more information about the HTTP Range header,
584          *        see <a href="">http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35</a>.</p> <note>
585          *        <p>
586          *        Amazon S3 doesn't support retrieving multiple ranges of data per <code>GET</code> request.
587          *        </p>
588          * @return Returns a reference to this object so that method calls can be chained together.
589          */

590         Builder range(String range);
591
592         /**
593          * <p>
594          * VersionId used to reference a specific version of the object.
595          * </p>
596          * 
597          * @param versionId
598          *        VersionId used to reference a specific version of the object.
599          * @return Returns a reference to this object so that method calls can be chained together.
600          */

601         Builder versionId(String versionId);
602
603         /**
604          * <p>
605          * Specifies the algorithm to use to when encrypting the object (for example, AES256).
606          * </p>
607          * 
608          * @param sseCustomerAlgorithm
609          *        Specifies the algorithm to use to when encrypting the object (for example, AES256).
610          * @return Returns a reference to this object so that method calls can be chained together.
611          */

612         Builder sseCustomerAlgorithm(String sseCustomerAlgorithm);
613
614         /**
615          * <p>
616          * Specifies the customer-provided encryption key for Amazon S3 to use in encrypting data. This value is used to
617          * store the object and then it is discarded; Amazon S3 does not store the encryption key. The key must be
618          * appropriate for use with the algorithm specified in the
619          * <code>x-amz-server-side​-encryption​-customer-algorithm</code> header.
620          * </p>
621          * 
622          * @param sseCustomerKey
623          *        Specifies the customer-provided encryption key for Amazon S3 to use in encrypting data. This value is
624          *        used to store the object and then it is discarded; Amazon S3 does not store the encryption key. The
625          *        key must be appropriate for use with the algorithm specified in the
626          *        <code>x-amz-server-side​-encryption​-customer-algorithm</code> header.
627          * @return Returns a reference to this object so that method calls can be chained together.
628          */

629         Builder sseCustomerKey(String sseCustomerKey);
630
631         /**
632          * <p>
633          * Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. Amazon S3 uses this header for
634          * a message integrity check to ensure that the encryption key was transmitted without error.
635          * </p>
636          * 
637          * @param sseCustomerKeyMD5
638          *        Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. Amazon S3 uses this
639          *        header for a message integrity check to ensure that the encryption key was transmitted without error.
640          * @return Returns a reference to this object so that method calls can be chained together.
641          */

642         Builder sseCustomerKeyMD5(String sseCustomerKeyMD5);
643
644         /**
645          * Sets the value of the RequestPayer property for this object.
646          *
647          * @param requestPayer
648          *        The new value for the RequestPayer property for this object.
649          * @see RequestPayer
650          * @return Returns a reference to this object so that method calls can be chained together.
651          * @see RequestPayer
652          */

653         Builder requestPayer(String requestPayer);
654
655         /**
656          * Sets the value of the RequestPayer property for this object.
657          *
658          * @param requestPayer
659          *        The new value for the RequestPayer property for this object.
660          * @see RequestPayer
661          * @return Returns a reference to this object so that method calls can be chained together.
662          * @see RequestPayer
663          */

664         Builder requestPayer(RequestPayer requestPayer);
665
666         /**
667          * <p>
668          * Part number of the object being read. This is a positive integer between 1 and 10,000. Effectively performs a
669          * 'ranged' HEAD request for the part specified. Useful querying about the size of the part and the number of
670          * parts in this object.
671          * </p>
672          * 
673          * @param partNumber
674          *        Part number of the object being read. This is a positive integer between 1 and 10,000. Effectively
675          *        performs a 'ranged' HEAD request for the part specified. Useful querying about the size of the part
676          *        and the number of parts in this object.
677          * @return Returns a reference to this object so that method calls can be chained together.
678          */

679         Builder partNumber(Integer partNumber);
680
681         @Override
682         Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration);
683
684         @Override
685         Builder overrideConfiguration(Consumer<AwsRequestOverrideConfiguration.Builder> builderConsumer);
686     }
687
688     static final class BuilderImpl extends S3Request.BuilderImpl implements Builder {
689         private String bucket;
690
691         private String ifMatch;
692
693         private Instant ifModifiedSince;
694
695         private String ifNoneMatch;
696
697         private Instant ifUnmodifiedSince;
698
699         private String key;
700
701         private String range;
702
703         private String versionId;
704
705         private String sseCustomerAlgorithm;
706
707         private String sseCustomerKey;
708
709         private String sseCustomerKeyMD5;
710
711         private String requestPayer;
712
713         private Integer partNumber;
714
715         private BuilderImpl() {
716         }
717
718         private BuilderImpl(HeadObjectRequest model) {
719             super(model);
720             bucket(model.bucket);
721             ifMatch(model.ifMatch);
722             ifModifiedSince(model.ifModifiedSince);
723             ifNoneMatch(model.ifNoneMatch);
724             ifUnmodifiedSince(model.ifUnmodifiedSince);
725             key(model.key);
726             range(model.range);
727             versionId(model.versionId);
728             sseCustomerAlgorithm(model.sseCustomerAlgorithm);
729             sseCustomerKey(model.sseCustomerKey);
730             sseCustomerKeyMD5(model.sseCustomerKeyMD5);
731             requestPayer(model.requestPayer);
732             partNumber(model.partNumber);
733         }
734
735         public final String getBucket() {
736             return bucket;
737         }
738
739         @Override
740         public final Builder bucket(String bucket) {
741             this.bucket = bucket;
742             return this;
743         }
744
745         public final void setBucket(String bucket) {
746             this.bucket = bucket;
747         }
748
749         public final String getIfMatch() {
750             return ifMatch;
751         }
752
753         @Override
754         public final Builder ifMatch(String ifMatch) {
755             this.ifMatch = ifMatch;
756             return this;
757         }
758
759         public final void setIfMatch(String ifMatch) {
760             this.ifMatch = ifMatch;
761         }
762
763         public final Instant getIfModifiedSince() {
764             return ifModifiedSince;
765         }
766
767         @Override
768         public final Builder ifModifiedSince(Instant ifModifiedSince) {
769             this.ifModifiedSince = ifModifiedSince;
770             return this;
771         }
772
773         public final void setIfModifiedSince(Instant ifModifiedSince) {
774             this.ifModifiedSince = ifModifiedSince;
775         }
776
777         public final String getIfNoneMatch() {
778             return ifNoneMatch;
779         }
780
781         @Override
782         public final Builder ifNoneMatch(String ifNoneMatch) {
783             this.ifNoneMatch = ifNoneMatch;
784             return this;
785         }
786
787         public final void setIfNoneMatch(String ifNoneMatch) {
788             this.ifNoneMatch = ifNoneMatch;
789         }
790
791         public final Instant getIfUnmodifiedSince() {
792             return ifUnmodifiedSince;
793         }
794
795         @Override
796         public final Builder ifUnmodifiedSince(Instant ifUnmodifiedSince) {
797             this.ifUnmodifiedSince = ifUnmodifiedSince;
798             return this;
799         }
800
801         public final void setIfUnmodifiedSince(Instant ifUnmodifiedSince) {
802             this.ifUnmodifiedSince = ifUnmodifiedSince;
803         }
804
805         public final String getKey() {
806             return key;
807         }
808
809         @Override
810         public final Builder key(String key) {
811             this.key = key;
812             return this;
813         }
814
815         public final void setKey(String key) {
816             this.key = key;
817         }
818
819         public final String getRange() {
820             return range;
821         }
822
823         @Override
824         public final Builder range(String range) {
825             this.range = range;
826             return this;
827         }
828
829         public final void setRange(String range) {
830             this.range = range;
831         }
832
833         public final String getVersionId() {
834             return versionId;
835         }
836
837         @Override
838         public final Builder versionId(String versionId) {
839             this.versionId = versionId;
840             return this;
841         }
842
843         public final void setVersionId(String versionId) {
844             this.versionId = versionId;
845         }
846
847         public final String getSseCustomerAlgorithm() {
848             return sseCustomerAlgorithm;
849         }
850
851         @Override
852         public final Builder sseCustomerAlgorithm(String sseCustomerAlgorithm) {
853             this.sseCustomerAlgorithm = sseCustomerAlgorithm;
854             return this;
855         }
856
857         public final void setSseCustomerAlgorithm(String sseCustomerAlgorithm) {
858             this.sseCustomerAlgorithm = sseCustomerAlgorithm;
859         }
860
861         public final String getSseCustomerKey() {
862             return sseCustomerKey;
863         }
864
865         @Override
866         public final Builder sseCustomerKey(String sseCustomerKey) {
867             this.sseCustomerKey = sseCustomerKey;
868             return this;
869         }
870
871         public final void setSseCustomerKey(String sseCustomerKey) {
872             this.sseCustomerKey = sseCustomerKey;
873         }
874
875         public final String getSseCustomerKeyMD5() {
876             return sseCustomerKeyMD5;
877         }
878
879         @Override
880         public final Builder sseCustomerKeyMD5(String sseCustomerKeyMD5) {
881             this.sseCustomerKeyMD5 = sseCustomerKeyMD5;
882             return this;
883         }
884
885         public final void setSseCustomerKeyMD5(String sseCustomerKeyMD5) {
886             this.sseCustomerKeyMD5 = sseCustomerKeyMD5;
887         }
888
889         public final String getRequestPayer() {
890             return requestPayer;
891         }
892
893         @Override
894         public final Builder requestPayer(String requestPayer) {
895             this.requestPayer = requestPayer;
896             return this;
897         }
898
899         @Override
900         public final Builder requestPayer(RequestPayer requestPayer) {
901             this.requestPayer(requestPayer == null ? null : requestPayer.toString());
902             return this;
903         }
904
905         public final void setRequestPayer(String requestPayer) {
906             this.requestPayer = requestPayer;
907         }
908
909         public final Integer getPartNumber() {
910             return partNumber;
911         }
912
913         @Override
914         public final Builder partNumber(Integer partNumber) {
915             this.partNumber = partNumber;
916             return this;
917         }
918
919         public final void setPartNumber(Integer partNumber) {
920             this.partNumber = partNumber;
921         }
922
923         @Override
924         public Builder overrideConfiguration(AwsRequestOverrideConfiguration overrideConfiguration) {
925             super.overrideConfiguration(overrideConfiguration);
926             return this;
927         }
928
929         @Override
930         public Builder overrideConfiguration(Consumer<AwsRequestOverrideConfiguration.Builder> builderConsumer) {
931             super.overrideConfiguration(builderConsumer);
932             return this;
933         }
934
935         @Override
936         public HeadObjectRequest build() {
937             return new HeadObjectRequest(this);
938         }
939
940         @Override
941         public List<SdkField<?>> sdkFields() {
942             return SDK_FIELDS;
943         }
944     }
945 }
946