View Javadoc
1   // Copyright (c) Microsoft Corporation. All rights reserved.
2   // Licensed under the MIT License.
3   // Code generated by Microsoft (R) AutoRest Code Generator.
4   
5   package com.azure.storage.blob.models;
6   
7   import com.azure.core.implementation.DateTimeRfc1123;
8   import com.azure.core.implementation.util.ImplUtils;
9   import com.fasterxml.jackson.annotation.JsonProperty;
10  import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
11  import java.time.OffsetDateTime;
12  
13  /**
14   * Defines headers for Upload operation.
15   */
16  @JacksonXmlRootElement(localName = "BlockBlob-Upload-Headers")
17  public final class BlockBlobUploadHeaders {
18      /*
19       * The ETag contains a value that you can use to perform operations
20       * conditionally. If the request version is 2011-08-18 or newer, the ETag
21       * value will be in quotes.
22       */
23      @JsonProperty(value = "ETag")
24      private String eTag;
25  
26      /*
27       * Returns the date and time the container was last modified. Any operation
28       * that modifies the blob, including an update of the blob's metadata or
29       * properties, changes the last-modified time of the blob.
30       */
31      @JsonProperty(value = "Last-Modified")
32      private DateTimeRfc1123 lastModified;
33  
34      /*
35       * If the blob has an MD5 hash and this operation is to read the full blob,
36       * this response header is returned so that the client can check for
37       * message content integrity.
38       */
39      @JsonProperty(value = "Content-MD5")
40      private byte[] contentMD5;
41  
42      /*
43       * This header uniquely identifies the request that was made and can be
44       * used for troubleshooting the request.
45       */
46      @JsonProperty(value = "x-ms-request-id")
47      private String requestId;
48  
49      /*
50       * Indicates the version of the Blob service used to execute the request.
51       * This header is returned for requests made against version 2009-09-19 and
52       * above.
53       */
54      @JsonProperty(value = "x-ms-version")
55      private String version;
56  
57      /*
58       * UTC date/time value generated by the service that identifies a version
59       * of the blob. This header is returned for requests made against version
60       * 2018-11-09 and above.
61       */
62      @JsonProperty(value = "x-ms-version-id")
63      private String versionId;
64  
65      /*
66       * UTC date/time value generated by the service that indicates the time at
67       * which the response was initiated
68       */
69      @JsonProperty(value = "Date")
70      private DateTimeRfc1123 dateProperty;
71  
72      /*
73       * The value of this header is set to true if the contents of the request
74       * are successfully encrypted using the specified algorithm, and false
75       * otherwise.
76       */
77      @JsonProperty(value = "x-ms-request-server-encrypted")
78      private Boolean isServerEncrypted;
79  
80      /*
81       * The SHA-256 hash of the encryption key used to encrypt the blob. This
82       * header is only returned when the blob was encrypted with a
83       * customer-provided key.
84       */
85      @JsonProperty(value = "x-ms-encryption-key-sha256")
86      private String encryptionKeySha256;
87  
88      /*
89       * The errorCode property.
90       */
91      @JsonProperty(value = "x-ms-error-code")
92      private String errorCode;
93  
94      /**
95       * Get the eTag property: The ETag contains a value that you can use to
96       * perform operations conditionally. If the request version is 2011-08-18
97       * or newer, the ETag value will be in quotes.
98       *
99       * @return the eTag value.
100      */
101     public String eTag() {
102         return this.eTag;
103     }
104 
105     /**
106      * Set the eTag property: The ETag contains a value that you can use to
107      * perform operations conditionally. If the request version is 2011-08-18
108      * or newer, the ETag value will be in quotes.
109      *
110      * @param eTag the eTag value to set.
111      * @return the BlockBlobUploadHeaders object itself.
112      */
113     public BlockBlobUploadHeaders eTag(String eTag) {
114         this.eTag = eTag;
115         return this;
116     }
117 
118     /**
119      * Get the lastModified property: Returns the date and time the container
120      * was last modified. Any operation that modifies the blob, including an
121      * update of the blob's metadata or properties, changes the last-modified
122      * time of the blob.
123      *
124      * @return the lastModified value.
125      */
126     public OffsetDateTime lastModified() {
127         if (this.lastModified == null) {
128             return null;
129         }
130         return this.lastModified.dateTime();
131     }
132 
133     /**
134      * Set the lastModified property: Returns the date and time the container
135      * was last modified. Any operation that modifies the blob, including an
136      * update of the blob's metadata or properties, changes the last-modified
137      * time of the blob.
138      *
139      * @param lastModified the lastModified value to set.
140      * @return the BlockBlobUploadHeaders object itself.
141      */
142     public BlockBlobUploadHeaders lastModified(OffsetDateTime lastModified) {
143         if (lastModified == null) {
144             this.lastModified = null;
145         } else {
146             this.lastModified = new DateTimeRfc1123(lastModified);
147         }
148         return this;
149     }
150 
151     /**
152      * Get the contentMD5 property: If the blob has an MD5 hash and this
153      * operation is to read the full blob, this response header is returned so
154      * that the client can check for message content integrity.
155      *
156      * @return the contentMD5 value.
157      */
158     public byte[] contentMD5() {
159         return ImplUtils.clone(this.contentMD5);
160     }
161 
162     /**
163      * Set the contentMD5 property: If the blob has an MD5 hash and this
164      * operation is to read the full blob, this response header is returned so
165      * that the client can check for message content integrity.
166      *
167      * @param contentMD5 the contentMD5 value to set.
168      * @return the BlockBlobUploadHeaders object itself.
169      */
170     public BlockBlobUploadHeaders contentMD5(byte[] contentMD5) {
171         this.contentMD5 = ImplUtils.clone(contentMD5);
172         return this;
173     }
174 
175     /**
176      * Get the requestId property: This header uniquely identifies the request
177      * that was made and can be used for troubleshooting the request.
178      *
179      * @return the requestId value.
180      */
181     public String requestId() {
182         return this.requestId;
183     }
184 
185     /**
186      * Set the requestId property: This header uniquely identifies the request
187      * that was made and can be used for troubleshooting the request.
188      *
189      * @param requestId the requestId value to set.
190      * @return the BlockBlobUploadHeaders object itself.
191      */
192     public BlockBlobUploadHeaders requestId(String requestId) {
193         this.requestId = requestId;
194         return this;
195     }
196 
197     /**
198      * Get the version property: Indicates the version of the Blob service used
199      * to execute the request. This header is returned for requests made
200      * against version 2009-09-19 and above.
201      *
202      * @return the version value.
203      */
204     public String version() {
205         return this.version;
206     }
207 
208     /**
209      * Set the version property: Indicates the version of the Blob service used
210      * to execute the request. This header is returned for requests made
211      * against version 2009-09-19 and above.
212      *
213      * @param version the version value to set.
214      * @return the BlockBlobUploadHeaders object itself.
215      */
216     public BlockBlobUploadHeaders version(String version) {
217         this.version = version;
218         return this;
219     }
220 
221     /**
222      * Get the versionId property: UTC date/time value generated by the service
223      * that identifies a version of the blob. This header is returned for
224      * requests made against version 2018-11-09 and above.
225      *
226      * @return the versionId value.
227      */
228     public String versionId() {
229         return this.versionId;
230     }
231 
232     /**
233      * Set the versionId property: UTC date/time value generated by the service
234      * that identifies a version of the blob. This header is returned for
235      * requests made against version 2018-11-09 and above.
236      *
237      * @param versionId the versionId value to set.
238      * @return the BlockBlobUploadHeaders object itself.
239      */
240     public BlockBlobUploadHeaders versionId(String versionId) {
241         this.versionId = versionId;
242         return this;
243     }
244 
245     /**
246      * Get the dateProperty property: UTC date/time value generated by the
247      * service that indicates the time at which the response was initiated.
248      *
249      * @return the dateProperty value.
250      */
251     public OffsetDateTime dateProperty() {
252         if (this.dateProperty == null) {
253             return null;
254         }
255         return this.dateProperty.dateTime();
256     }
257 
258     /**
259      * Set the dateProperty property: UTC date/time value generated by the
260      * service that indicates the time at which the response was initiated.
261      *
262      * @param dateProperty the dateProperty value to set.
263      * @return the BlockBlobUploadHeaders object itself.
264      */
265     public BlockBlobUploadHeaders dateProperty(OffsetDateTime dateProperty) {
266         if (dateProperty == null) {
267             this.dateProperty = null;
268         } else {
269             this.dateProperty = new DateTimeRfc1123(dateProperty);
270         }
271         return this;
272     }
273 
274     /**
275      * Get the isServerEncrypted property: The value of this header is set to
276      * true if the contents of the request are successfully encrypted using the
277      * specified algorithm, and false otherwise.
278      *
279      * @return the isServerEncrypted value.
280      */
281     public Boolean isServerEncrypted() {
282         return this.isServerEncrypted;
283     }
284 
285     /**
286      * Set the isServerEncrypted property: The value of this header is set to
287      * true if the contents of the request are successfully encrypted using the
288      * specified algorithm, and false otherwise.
289      *
290      * @param isServerEncrypted the isServerEncrypted value to set.
291      * @return the BlockBlobUploadHeaders object itself.
292      */
293     public BlockBlobUploadHeaders isServerEncrypted(Boolean isServerEncrypted) {
294         this.isServerEncrypted = isServerEncrypted;
295         return this;
296     }
297 
298     /**
299      * Get the encryptionKeySha256 property: The SHA-256 hash of the encryption
300      * key used to encrypt the blob. This header is only returned when the blob
301      * was encrypted with a customer-provided key.
302      *
303      * @return the encryptionKeySha256 value.
304      */
305     public String encryptionKeySha256() {
306         return this.encryptionKeySha256;
307     }
308 
309     /**
310      * Set the encryptionKeySha256 property: The SHA-256 hash of the encryption
311      * key used to encrypt the blob. This header is only returned when the blob
312      * was encrypted with a customer-provided key.
313      *
314      * @param encryptionKeySha256 the encryptionKeySha256 value to set.
315      * @return the BlockBlobUploadHeaders object itself.
316      */
317     public BlockBlobUploadHeaders encryptionKeySha256(String encryptionKeySha256) {
318         this.encryptionKeySha256 = encryptionKeySha256;
319         return this;
320     }
321 
322     /**
323      * Get the errorCode property: The errorCode property.
324      *
325      * @return the errorCode value.
326      */
327     public String errorCode() {
328         return this.errorCode;
329     }
330 
331     /**
332      * Set the errorCode property: The errorCode property.
333      *
334      * @param errorCode the errorCode value to set.
335      * @return the BlockBlobUploadHeaders object itself.
336      */
337     public BlockBlobUploadHeaders errorCode(String errorCode) {
338         this.errorCode = errorCode;
339         return this;
340     }
341 }