Skip to main content

azure_storage_blob/generated/models/
header_traits.rs

1// Copyright (c) Microsoft Corporation. All rights reserved.
2// Licensed under the MIT License.
3//
4// Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT.
5
6use super::{
7    AccountKind, AppendBlobClientAppendBlockFromUrlResult, AppendBlobClientAppendBlockResult,
8    AppendBlobClientCreateResult, AppendBlobClientSealResult, ArchiveStatus,
9    BlobClientAcquireLeaseResult, BlobClientBreakLeaseResult, BlobClientChangeLeaseResult,
10    BlobClientCreateSnapshotResult, BlobClientDownloadInternalResult,
11    BlobClientGetAccountInfoResult, BlobClientGetPropertiesResult, BlobClientReleaseLeaseResult,
12    BlobClientRenewLeaseResult, BlobClientStartCopyFromUrlResult,
13    BlobContainerClientAcquireLeaseResult, BlobContainerClientBreakLeaseResult,
14    BlobContainerClientChangeLeaseResult, BlobContainerClientGetAccountInfoResult,
15    BlobContainerClientGetPropertiesResult, BlobContainerClientReleaseLeaseResult,
16    BlobContainerClientRenewLeaseResult, BlobServiceClientGetAccountInfoResult, BlobType,
17    BlockBlobClientCommitBlockListResult, BlockBlobClientStageBlockFromUrlResult,
18    BlockBlobClientStageBlockResult, BlockBlobClientUploadBlobFromUrlResult,
19    BlockBlobClientUploadInternalResult, BlockList, CopyStatus, ImmutabilityPolicyMode,
20    LeaseDuration, LeaseState, LeaseStatus, PageBlobClientClearPagesResult,
21    PageBlobClientCreateResult, PageBlobClientResizeResult, PageBlobClientSetSequenceNumberResult,
22    PageBlobClientUploadPagesFromUrlResult, PageBlobClientUploadPagesResult, PageList,
23    PublicAccessType, RehydratePriority, SignedIdentifiers, SkuName,
24};
25use azure_core::{
26    base64,
27    http::{
28        headers::{HeaderName, Headers},
29        AsyncResponse, Etag, NoFormat, Response, XmlFormat,
30    },
31    time::{parse_rfc7231, OffsetDateTime},
32    Result,
33};
34use std::collections::HashMap;
35
36const ACCESS_TIER: HeaderName = HeaderName::from_static("x-ms-access-tier");
37const ACCESS_TIER_CHANGE_TIME: HeaderName = HeaderName::from_static("x-ms-access-tier-change-time");
38const ACCESS_TIER_INFERRED: HeaderName = HeaderName::from_static("x-ms-access-tier-inferred");
39const ACCOUNT_KIND: HeaderName = HeaderName::from_static("x-ms-account-kind");
40const ARCHIVE_STATUS: HeaderName = HeaderName::from_static("x-ms-archive-status");
41const BLOB_APPEND_OFFSET: HeaderName = HeaderName::from_static("x-ms-blob-append-offset");
42const BLOB_COMMITTED_BLOCK_COUNT: HeaderName =
43    HeaderName::from_static("x-ms-blob-committed-block-count");
44const BLOB_CONTENT_LENGTH: HeaderName = HeaderName::from_static("x-ms-blob-content-length");
45const BLOB_CONTENT_MD5: HeaderName = HeaderName::from_static("x-ms-blob-content-md5");
46const BLOB_PUBLIC_ACCESS: HeaderName = HeaderName::from_static("x-ms-blob-public-access");
47const BLOB_SEALED: HeaderName = HeaderName::from_static("x-ms-blob-sealed");
48const BLOB_SEQUENCE_NUMBER: HeaderName = HeaderName::from_static("x-ms-blob-sequence-number");
49const BLOB_TYPE: HeaderName = HeaderName::from_static("x-ms-blob-type");
50const CACHE_CONTROL: HeaderName = HeaderName::from_static("cache-control");
51const CONTENT_CRC64: HeaderName = HeaderName::from_static("x-ms-content-crc64");
52const CONTENT_DISPOSITION: HeaderName = HeaderName::from_static("content-disposition");
53const CONTENT_ENCODING: HeaderName = HeaderName::from_static("content-encoding");
54const CONTENT_LANGUAGE: HeaderName = HeaderName::from_static("content-language");
55const CONTENT_LENGTH: HeaderName = HeaderName::from_static("content-length");
56const CONTENT_MD5: HeaderName = HeaderName::from_static("content-md5");
57const CONTENT_RANGE: HeaderName = HeaderName::from_static("content-range");
58const CONTENT_TYPE: HeaderName = HeaderName::from_static("content-type");
59const COPY_COMPLETION_TIME: HeaderName = HeaderName::from_static("x-ms-copy-completion-time");
60const COPY_DESTINATION_SNAPSHOT: HeaderName =
61    HeaderName::from_static("x-ms-copy-destination-snapshot");
62const COPY_ID: HeaderName = HeaderName::from_static("x-ms-copy-id");
63const COPY_PROGRESS: HeaderName = HeaderName::from_static("x-ms-copy-progress");
64const COPY_SOURCE: HeaderName = HeaderName::from_static("x-ms-copy-source");
65const COPY_STATUS: HeaderName = HeaderName::from_static("x-ms-copy-status");
66const COPY_STATUS_DESCRIPTION: HeaderName = HeaderName::from_static("x-ms-copy-status-description");
67const CREATION_TIME: HeaderName = HeaderName::from_static("x-ms-creation-time");
68const DEFAULT_ENCRYPTION_SCOPE: HeaderName =
69    HeaderName::from_static("x-ms-default-encryption-scope");
70const DENY_ENCRYPTION_SCOPE_OVERRIDE: HeaderName =
71    HeaderName::from_static("x-ms-deny-encryption-scope-override");
72const ENCRYPTION_KEY_SHA256: HeaderName = HeaderName::from_static("x-ms-encryption-key-sha256");
73const ENCRYPTION_SCOPE: HeaderName = HeaderName::from_static("x-ms-encryption-scope");
74const ETAG: HeaderName = HeaderName::from_static("etag");
75const EXPIRY_TIME: HeaderName = HeaderName::from_static("x-ms-expiry-time");
76const HAS_IMMUTABILITY_POLICY: HeaderName = HeaderName::from_static("x-ms-has-immutability-policy");
77const HAS_LEGAL_HOLD: HeaderName = HeaderName::from_static("x-ms-has-legal-hold");
78const IMMUTABILITY_POLICY_MODE: HeaderName =
79    HeaderName::from_static("x-ms-immutability-policy-mode");
80const IMMUTABILITY_POLICY_UNTIL_DATE: HeaderName =
81    HeaderName::from_static("x-ms-immutability-policy-until-date");
82const IMMUTABLE_STORAGE_WITH_VERSIONING_ENABLED: HeaderName =
83    HeaderName::from_static("x-ms-immutable-storage-with-versioning-enabled");
84const INCREMENTAL_COPY: HeaderName = HeaderName::from_static("x-ms-incremental-copy");
85const IS_CURRENT_VERSION: HeaderName = HeaderName::from_static("x-ms-is-current-version");
86const IS_HNS_ENABLED: HeaderName = HeaderName::from_static("x-ms-is-hns-enabled");
87const LAST_ACCESS_TIME: HeaderName = HeaderName::from_static("x-ms-last-access-time");
88const LAST_MODIFIED: HeaderName = HeaderName::from_static("last-modified");
89const LEASE_DURATION: HeaderName = HeaderName::from_static("x-ms-lease-duration");
90const LEASE_ID: HeaderName = HeaderName::from_static("x-ms-lease-id");
91const LEASE_STATE: HeaderName = HeaderName::from_static("x-ms-lease-state");
92const LEASE_STATUS: HeaderName = HeaderName::from_static("x-ms-lease-status");
93const LEASE_TIME: HeaderName = HeaderName::from_static("x-ms-lease-time");
94const LEGAL_HOLD: HeaderName = HeaderName::from_static("x-ms-legal-hold");
95const META: &str = "x-ms-meta-";
96const OR: &str = "x-ms-or-";
97const OR_POLICY_ID: HeaderName = HeaderName::from_static("x-ms-or-policy-id");
98const REHYDRATE_PRIORITY: HeaderName = HeaderName::from_static("x-ms-rehydrate-priority");
99const REQUEST_SERVER_ENCRYPTED: HeaderName =
100    HeaderName::from_static("x-ms-request-server-encrypted");
101const SERVER_ENCRYPTED: HeaderName = HeaderName::from_static("x-ms-server-encrypted");
102const SKU_NAME: HeaderName = HeaderName::from_static("x-ms-sku-name");
103const SNAPSHOT: HeaderName = HeaderName::from_static("x-ms-snapshot");
104const TAG_COUNT: HeaderName = HeaderName::from_static("x-ms-tag-count");
105const VERSION_ID: HeaderName = HeaderName::from_static("x-ms-version-id");
106
107/// Provides access to typed response headers for `AppendBlobClient::append_block_from_url()`
108///
109/// # Examples
110///
111/// ```no_run
112/// use azure_core::{Result, http::{Response, NoFormat}};
113/// use azure_storage_blob::models::{AppendBlobClientAppendBlockFromUrlResult, AppendBlobClientAppendBlockFromUrlResultHeaders};
114/// async fn example() -> Result<()> {
115///     let response: Response<AppendBlobClientAppendBlockFromUrlResult, NoFormat> = unimplemented!();
116///     // Access response headers
117///     if let Some(content_md5) = response.content_md5()? {
118///         println!("content-md5: {:?}", content_md5);
119///     }
120///     if let Some(etag) = response.etag()? {
121///         println!("etag: {:?}", etag);
122///     }
123///     if let Some(last_modified) = response.last_modified()? {
124///         println!("last-modified: {:?}", last_modified);
125///     }
126///     Ok(())
127/// }
128/// ```
129pub trait AppendBlobClientAppendBlockFromUrlResultHeaders: private::Sealed {
130    fn content_md5(&self) -> Result<Option<Vec<u8>>>;
131    fn etag(&self) -> Result<Option<Etag>>;
132    fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
133    fn blob_append_offset(&self) -> Result<Option<String>>;
134    fn blob_committed_block_count(&self) -> Result<Option<i32>>;
135    fn content_crc64(&self) -> Result<Option<Vec<u8>>>;
136    fn encryption_key_sha256(&self) -> Result<Option<String>>;
137    fn encryption_scope(&self) -> Result<Option<String>>;
138    fn is_server_encrypted(&self) -> Result<Option<bool>>;
139}
140
141impl AppendBlobClientAppendBlockFromUrlResultHeaders
142    for Response<AppendBlobClientAppendBlockFromUrlResult, NoFormat>
143{
144    /// The blob content MD5 hash. Only returned if the full blob is read.
145    fn content_md5(&self) -> Result<Option<Vec<u8>>> {
146        Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| base64::decode(h.as_str()))
147    }
148
149    /// An opaque identifier for the current state of the resource.
150    fn etag(&self) -> Result<Option<Etag>> {
151        Headers::get_optional_as(self.headers(), &ETAG)
152    }
153
154    /// The date-time that the resource was last modified.
155    fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
156        Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
157            parse_rfc7231(h.as_str())
158        })
159    }
160
161    /// The offset at which the block was committed, in bytes.
162    fn blob_append_offset(&self) -> Result<Option<String>> {
163        Headers::get_optional_as(self.headers(), &BLOB_APPEND_OFFSET)
164    }
165
166    /// The number of committed blocks present in the blob.
167    fn blob_committed_block_count(&self) -> Result<Option<i32>> {
168        Headers::get_optional_as(self.headers(), &BLOB_COMMITTED_BLOCK_COUNT)
169    }
170
171    /// The CRC64 hash of the content.
172    fn content_crc64(&self) -> Result<Option<Vec<u8>>> {
173        Headers::get_optional_with(self.headers(), &CONTENT_CRC64, |h| {
174            base64::decode(h.as_str())
175        })
176    }
177
178    /// The SHA-256 hash of the provided encryption key.
179    fn encryption_key_sha256(&self) -> Result<Option<String>> {
180        Headers::get_optional_as(self.headers(), &ENCRYPTION_KEY_SHA256)
181    }
182
183    /// Specifies the encryption scope used to encrypt the data.
184    fn encryption_scope(&self) -> Result<Option<String>> {
185        Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE)
186    }
187
188    /// Indicates whether the contents of the request are successfully encrypted.
189    fn is_server_encrypted(&self) -> Result<Option<bool>> {
190        Headers::get_optional_as(self.headers(), &REQUEST_SERVER_ENCRYPTED)
191    }
192}
193
194/// Provides access to typed response headers for `AppendBlobClient::append_block()`
195///
196/// # Examples
197///
198/// ```no_run
199/// use azure_core::{Result, http::{Response, NoFormat}};
200/// use azure_storage_blob::models::{AppendBlobClientAppendBlockResult, AppendBlobClientAppendBlockResultHeaders};
201/// async fn example() -> Result<()> {
202///     let response: Response<AppendBlobClientAppendBlockResult, NoFormat> = unimplemented!();
203///     // Access response headers
204///     if let Some(content_md5) = response.content_md5()? {
205///         println!("content-md5: {:?}", content_md5);
206///     }
207///     if let Some(etag) = response.etag()? {
208///         println!("etag: {:?}", etag);
209///     }
210///     if let Some(last_modified) = response.last_modified()? {
211///         println!("last-modified: {:?}", last_modified);
212///     }
213///     Ok(())
214/// }
215/// ```
216pub trait AppendBlobClientAppendBlockResultHeaders: private::Sealed {
217    fn content_md5(&self) -> Result<Option<Vec<u8>>>;
218    fn etag(&self) -> Result<Option<Etag>>;
219    fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
220    fn blob_append_offset(&self) -> Result<Option<String>>;
221    fn blob_committed_block_count(&self) -> Result<Option<i32>>;
222    fn content_crc64(&self) -> Result<Option<Vec<u8>>>;
223    fn encryption_key_sha256(&self) -> Result<Option<String>>;
224    fn encryption_scope(&self) -> Result<Option<String>>;
225    fn is_server_encrypted(&self) -> Result<Option<bool>>;
226}
227
228impl AppendBlobClientAppendBlockResultHeaders
229    for Response<AppendBlobClientAppendBlockResult, NoFormat>
230{
231    /// The blob content MD5 hash. Only returned if the full blob is read.
232    fn content_md5(&self) -> Result<Option<Vec<u8>>> {
233        Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| base64::decode(h.as_str()))
234    }
235
236    /// An opaque identifier for the current state of the resource.
237    fn etag(&self) -> Result<Option<Etag>> {
238        Headers::get_optional_as(self.headers(), &ETAG)
239    }
240
241    /// The date-time that the resource was last modified.
242    fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
243        Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
244            parse_rfc7231(h.as_str())
245        })
246    }
247
248    /// The offset at which the block was committed, in bytes.
249    fn blob_append_offset(&self) -> Result<Option<String>> {
250        Headers::get_optional_as(self.headers(), &BLOB_APPEND_OFFSET)
251    }
252
253    /// The number of committed blocks present in the blob.
254    fn blob_committed_block_count(&self) -> Result<Option<i32>> {
255        Headers::get_optional_as(self.headers(), &BLOB_COMMITTED_BLOCK_COUNT)
256    }
257
258    /// The CRC64 hash of the content.
259    fn content_crc64(&self) -> Result<Option<Vec<u8>>> {
260        Headers::get_optional_with(self.headers(), &CONTENT_CRC64, |h| {
261            base64::decode(h.as_str())
262        })
263    }
264
265    /// The SHA-256 hash of the provided encryption key.
266    fn encryption_key_sha256(&self) -> Result<Option<String>> {
267        Headers::get_optional_as(self.headers(), &ENCRYPTION_KEY_SHA256)
268    }
269
270    /// Specifies the encryption scope used to encrypt the data.
271    fn encryption_scope(&self) -> Result<Option<String>> {
272        Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE)
273    }
274
275    /// Indicates whether the contents of the request are successfully encrypted.
276    fn is_server_encrypted(&self) -> Result<Option<bool>> {
277        Headers::get_optional_as(self.headers(), &REQUEST_SERVER_ENCRYPTED)
278    }
279}
280
281/// Provides access to typed response headers for `AppendBlobClient::create()`
282///
283/// # Examples
284///
285/// ```no_run
286/// use azure_core::{Result, http::{Response, NoFormat}};
287/// use azure_storage_blob::models::{AppendBlobClientCreateResult, AppendBlobClientCreateResultHeaders};
288/// async fn example() -> Result<()> {
289///     let response: Response<AppendBlobClientCreateResult, NoFormat> = unimplemented!();
290///     // Access response headers
291///     if let Some(content_md5) = response.content_md5()? {
292///         println!("content-md5: {:?}", content_md5);
293///     }
294///     if let Some(etag) = response.etag()? {
295///         println!("etag: {:?}", etag);
296///     }
297///     if let Some(last_modified) = response.last_modified()? {
298///         println!("last-modified: {:?}", last_modified);
299///     }
300///     Ok(())
301/// }
302/// ```
303pub trait AppendBlobClientCreateResultHeaders: private::Sealed {
304    fn content_md5(&self) -> Result<Option<Vec<u8>>>;
305    fn etag(&self) -> Result<Option<Etag>>;
306    fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
307    fn encryption_key_sha256(&self) -> Result<Option<String>>;
308    fn encryption_scope(&self) -> Result<Option<String>>;
309    fn is_server_encrypted(&self) -> Result<Option<bool>>;
310    fn version_id(&self) -> Result<Option<String>>;
311}
312
313impl AppendBlobClientCreateResultHeaders for Response<AppendBlobClientCreateResult, NoFormat> {
314    /// The blob content MD5 hash. Only returned if the full blob is read.
315    fn content_md5(&self) -> Result<Option<Vec<u8>>> {
316        Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| base64::decode(h.as_str()))
317    }
318
319    /// An opaque identifier for the current state of the resource.
320    fn etag(&self) -> Result<Option<Etag>> {
321        Headers::get_optional_as(self.headers(), &ETAG)
322    }
323
324    /// The date-time that the resource was last modified.
325    fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
326        Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
327            parse_rfc7231(h.as_str())
328        })
329    }
330
331    /// The SHA-256 hash of the provided encryption key.
332    fn encryption_key_sha256(&self) -> Result<Option<String>> {
333        Headers::get_optional_as(self.headers(), &ENCRYPTION_KEY_SHA256)
334    }
335
336    /// Specifies the encryption scope used to encrypt the data.
337    fn encryption_scope(&self) -> Result<Option<String>> {
338        Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE)
339    }
340
341    /// Indicates whether the contents of the request are successfully encrypted.
342    fn is_server_encrypted(&self) -> Result<Option<bool>> {
343        Headers::get_optional_as(self.headers(), &REQUEST_SERVER_ENCRYPTED)
344    }
345
346    /// The version ID of the blob.
347    fn version_id(&self) -> Result<Option<String>> {
348        Headers::get_optional_as(self.headers(), &VERSION_ID)
349    }
350}
351
352/// Provides access to typed response headers for `AppendBlobClient::seal()`
353///
354/// # Examples
355///
356/// ```no_run
357/// use azure_core::{Result, http::{Response, NoFormat}};
358/// use azure_storage_blob::models::{AppendBlobClientSealResult, AppendBlobClientSealResultHeaders};
359/// async fn example() -> Result<()> {
360///     let response: Response<AppendBlobClientSealResult, NoFormat> = unimplemented!();
361///     // Access response headers
362///     if let Some(etag) = response.etag()? {
363///         println!("etag: {:?}", etag);
364///     }
365///     if let Some(last_modified) = response.last_modified()? {
366///         println!("last-modified: {:?}", last_modified);
367///     }
368///     if let Some(is_sealed) = response.is_sealed()? {
369///         println!("x-ms-blob-sealed: {:?}", is_sealed);
370///     }
371///     Ok(())
372/// }
373/// ```
374pub trait AppendBlobClientSealResultHeaders: private::Sealed {
375    fn etag(&self) -> Result<Option<Etag>>;
376    fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
377    fn is_sealed(&self) -> Result<Option<bool>>;
378}
379
380impl AppendBlobClientSealResultHeaders for Response<AppendBlobClientSealResult, NoFormat> {
381    /// An opaque identifier for the current state of the resource.
382    fn etag(&self) -> Result<Option<Etag>> {
383        Headers::get_optional_as(self.headers(), &ETAG)
384    }
385
386    /// The date-time that the resource was last modified.
387    fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
388        Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
389            parse_rfc7231(h.as_str())
390        })
391    }
392
393    /// Whether the blob is sealed.
394    fn is_sealed(&self) -> Result<Option<bool>> {
395        Headers::get_optional_as(self.headers(), &BLOB_SEALED)
396    }
397}
398
399/// Provides access to typed response headers for `BlobClient::acquire_lease()`
400///
401/// # Examples
402///
403/// ```no_run
404/// use azure_core::{Result, http::{Response, NoFormat}};
405/// use azure_storage_blob::models::{BlobClientAcquireLeaseResult, BlobClientAcquireLeaseResultHeaders};
406/// async fn example() -> Result<()> {
407///     let response: Response<BlobClientAcquireLeaseResult, NoFormat> = unimplemented!();
408///     // Access response headers
409///     if let Some(etag) = response.etag()? {
410///         println!("etag: {:?}", etag);
411///     }
412///     if let Some(last_modified) = response.last_modified()? {
413///         println!("last-modified: {:?}", last_modified);
414///     }
415///     if let Some(lease_id) = response.lease_id()? {
416///         println!("x-ms-lease-id: {:?}", lease_id);
417///     }
418///     Ok(())
419/// }
420/// ```
421pub trait BlobClientAcquireLeaseResultHeaders: private::Sealed {
422    fn etag(&self) -> Result<Option<Etag>>;
423    fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
424    fn lease_id(&self) -> Result<Option<String>>;
425}
426
427impl BlobClientAcquireLeaseResultHeaders for Response<BlobClientAcquireLeaseResult, NoFormat> {
428    /// An opaque identifier for the current state of the resource.
429    fn etag(&self) -> Result<Option<Etag>> {
430        Headers::get_optional_as(self.headers(), &ETAG)
431    }
432
433    /// The date-time that the resource was last modified.
434    fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
435        Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
436            parse_rfc7231(h.as_str())
437        })
438    }
439
440    /// Uniquely identifies a blob's lease.
441    fn lease_id(&self) -> Result<Option<String>> {
442        Headers::get_optional_as(self.headers(), &LEASE_ID)
443    }
444}
445
446/// Provides access to typed response headers for `BlobClient::break_lease()`
447///
448/// # Examples
449///
450/// ```no_run
451/// use azure_core::{Result, http::{Response, NoFormat}};
452/// use azure_storage_blob::models::{BlobClientBreakLeaseResult, BlobClientBreakLeaseResultHeaders};
453/// async fn example() -> Result<()> {
454///     let response: Response<BlobClientBreakLeaseResult, NoFormat> = unimplemented!();
455///     // Access response headers
456///     if let Some(etag) = response.etag()? {
457///         println!("etag: {:?}", etag);
458///     }
459///     if let Some(last_modified) = response.last_modified()? {
460///         println!("last-modified: {:?}", last_modified);
461///     }
462///     if let Some(lease_time) = response.lease_time()? {
463///         println!("x-ms-lease-time: {:?}", lease_time);
464///     }
465///     Ok(())
466/// }
467/// ```
468pub trait BlobClientBreakLeaseResultHeaders: private::Sealed {
469    fn etag(&self) -> Result<Option<Etag>>;
470    fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
471    fn lease_time(&self) -> Result<Option<i32>>;
472}
473
474impl BlobClientBreakLeaseResultHeaders for Response<BlobClientBreakLeaseResult, NoFormat> {
475    /// An opaque identifier for the current state of the resource.
476    fn etag(&self) -> Result<Option<Etag>> {
477        Headers::get_optional_as(self.headers(), &ETAG)
478    }
479
480    /// The date-time that the resource was last modified.
481    fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
482        Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
483            parse_rfc7231(h.as_str())
484        })
485    }
486
487    /// Approximate time remaining in the lease period, in seconds.
488    fn lease_time(&self) -> Result<Option<i32>> {
489        Headers::get_optional_as(self.headers(), &LEASE_TIME)
490    }
491}
492
493/// Provides access to typed response headers for `BlobClient::change_lease()`
494///
495/// # Examples
496///
497/// ```no_run
498/// use azure_core::{Result, http::{Response, NoFormat}};
499/// use azure_storage_blob::models::{BlobClientChangeLeaseResult, BlobClientChangeLeaseResultHeaders};
500/// async fn example() -> Result<()> {
501///     let response: Response<BlobClientChangeLeaseResult, NoFormat> = unimplemented!();
502///     // Access response headers
503///     if let Some(etag) = response.etag()? {
504///         println!("etag: {:?}", etag);
505///     }
506///     if let Some(last_modified) = response.last_modified()? {
507///         println!("last-modified: {:?}", last_modified);
508///     }
509///     if let Some(lease_id) = response.lease_id()? {
510///         println!("x-ms-lease-id: {:?}", lease_id);
511///     }
512///     Ok(())
513/// }
514/// ```
515pub trait BlobClientChangeLeaseResultHeaders: private::Sealed {
516    fn etag(&self) -> Result<Option<Etag>>;
517    fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
518    fn lease_id(&self) -> Result<Option<String>>;
519}
520
521impl BlobClientChangeLeaseResultHeaders for Response<BlobClientChangeLeaseResult, NoFormat> {
522    /// An opaque identifier for the current state of the resource.
523    fn etag(&self) -> Result<Option<Etag>> {
524        Headers::get_optional_as(self.headers(), &ETAG)
525    }
526
527    /// The date-time that the resource was last modified.
528    fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
529        Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
530            parse_rfc7231(h.as_str())
531        })
532    }
533
534    /// Uniquely identifies a blob's lease.
535    fn lease_id(&self) -> Result<Option<String>> {
536        Headers::get_optional_as(self.headers(), &LEASE_ID)
537    }
538}
539
540/// Provides access to typed response headers for `BlobClient::create_snapshot()`
541///
542/// # Examples
543///
544/// ```no_run
545/// use azure_core::{Result, http::{Response, NoFormat}};
546/// use azure_storage_blob::models::{BlobClientCreateSnapshotResult, BlobClientCreateSnapshotResultHeaders};
547/// async fn example() -> Result<()> {
548///     let response: Response<BlobClientCreateSnapshotResult, NoFormat> = unimplemented!();
549///     // Access response headers
550///     if let Some(etag) = response.etag()? {
551///         println!("etag: {:?}", etag);
552///     }
553///     if let Some(last_modified) = response.last_modified()? {
554///         println!("last-modified: {:?}", last_modified);
555///     }
556///     if let Some(is_server_encrypted) = response.is_server_encrypted()? {
557///         println!("x-ms-request-server-encrypted: {:?}", is_server_encrypted);
558///     }
559///     Ok(())
560/// }
561/// ```
562pub trait BlobClientCreateSnapshotResultHeaders: private::Sealed {
563    fn etag(&self) -> Result<Option<Etag>>;
564    fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
565    fn is_server_encrypted(&self) -> Result<Option<bool>>;
566    fn snapshot(&self) -> Result<Option<String>>;
567    fn version_id(&self) -> Result<Option<String>>;
568}
569
570impl BlobClientCreateSnapshotResultHeaders for Response<BlobClientCreateSnapshotResult, NoFormat> {
571    /// An opaque identifier for the current state of the resource.
572    fn etag(&self) -> Result<Option<Etag>> {
573        Headers::get_optional_as(self.headers(), &ETAG)
574    }
575
576    /// The date-time that the resource was last modified.
577    fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
578        Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
579            parse_rfc7231(h.as_str())
580        })
581    }
582
583    /// Indicates whether the contents of the request are successfully encrypted.
584    fn is_server_encrypted(&self) -> Result<Option<bool>> {
585        Headers::get_optional_as(self.headers(), &REQUEST_SERVER_ENCRYPTED)
586    }
587
588    /// Uniquely identifies the snapshot and indicates the snapshot version.
589    fn snapshot(&self) -> Result<Option<String>> {
590        Headers::get_optional_as(self.headers(), &SNAPSHOT)
591    }
592
593    /// The version ID of the blob.
594    fn version_id(&self) -> Result<Option<String>> {
595        Headers::get_optional_as(self.headers(), &VERSION_ID)
596    }
597}
598
599/// Provides access to typed response headers for `BlobClient::download_internal()`
600///
601/// # Examples
602///
603/// ```ignore
604/// use azure_core::{Result, http::AsyncResponse};
605/// use azure_storage_blob::models::{BlobClientDownloadInternalResult, BlobClientDownloadInternalResultHeaders};
606/// async fn example() -> Result<()> {
607///     let response: AsyncResponse<BlobClientDownloadInternalResult> = unimplemented!();
608///     // Access response headers
609///     if let Some(cache_control) = response.cache_control()? {
610///         println!("cache-control: {:?}", cache_control);
611///     }
612///     if let Some(content_disposition) = response.content_disposition()? {
613///         println!("content-disposition: {:?}", content_disposition);
614///     }
615///     if let Some(content_encoding) = response.content_encoding()? {
616///         println!("content-encoding: {:?}", content_encoding);
617///     }
618///     Ok(())
619/// }
620/// ```
621pub(crate) trait BlobClientDownloadInternalResultHeaders: private::Sealed {
622    fn cache_control(&self) -> Result<Option<String>>;
623    fn content_disposition(&self) -> Result<Option<String>>;
624    fn content_encoding(&self) -> Result<Option<String>>;
625    fn content_language(&self) -> Result<Option<String>>;
626    fn content_length(&self) -> Result<Option<u64>>;
627    fn content_md5(&self) -> Result<Option<Vec<u8>>>;
628    fn content_range(&self) -> Result<Option<String>>;
629    fn etag(&self) -> Result<Option<Etag>>;
630    fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
631    fn blob_committed_block_count(&self) -> Result<Option<i32>>;
632    fn blob_content_md5(&self) -> Result<Option<Vec<u8>>>;
633    fn is_sealed(&self) -> Result<Option<bool>>;
634    fn blob_sequence_number(&self) -> Result<Option<i64>>;
635    fn blob_type(&self) -> Result<Option<BlobType>>;
636    fn content_crc64(&self) -> Result<Option<Vec<u8>>>;
637    fn copy_completion_time(&self) -> Result<Option<OffsetDateTime>>;
638    fn copy_id(&self) -> Result<Option<String>>;
639    fn copy_progress(&self) -> Result<Option<String>>;
640    fn copy_source(&self) -> Result<Option<String>>;
641    fn copy_status(&self) -> Result<Option<CopyStatus>>;
642    fn copy_status_description(&self) -> Result<Option<String>>;
643    fn creation_time(&self) -> Result<Option<OffsetDateTime>>;
644    fn encryption_key_sha256(&self) -> Result<Option<String>>;
645    fn encryption_scope(&self) -> Result<Option<String>>;
646    fn immutability_policy_mode(&self) -> Result<Option<ImmutabilityPolicyMode>>;
647    fn immutability_policy_expires_on(&self) -> Result<Option<OffsetDateTime>>;
648    fn is_current_version(&self) -> Result<Option<bool>>;
649    fn last_accessed(&self) -> Result<Option<OffsetDateTime>>;
650    fn duration(&self) -> Result<Option<LeaseDuration>>;
651    fn lease_state(&self) -> Result<Option<LeaseState>>;
652    fn lease_status(&self) -> Result<Option<LeaseStatus>>;
653    fn legal_hold(&self) -> Result<Option<bool>>;
654    fn metadata(&self) -> Result<HashMap<String, String>>;
655    fn object_replication_rules(&self) -> Result<HashMap<String, String>>;
656    fn object_replication_policy_id(&self) -> Result<Option<String>>;
657    fn is_server_encrypted(&self) -> Result<Option<bool>>;
658    fn tag_count(&self) -> Result<Option<i64>>;
659    fn version_id(&self) -> Result<Option<String>>;
660}
661
662impl BlobClientDownloadInternalResultHeaders for AsyncResponse<BlobClientDownloadInternalResult> {
663    /// The Cache-Control of the blob.
664    fn cache_control(&self) -> Result<Option<String>> {
665        Headers::get_optional_as(self.headers(), &CACHE_CONTROL)
666    }
667
668    /// The Content-Disposition of the blob.
669    fn content_disposition(&self) -> Result<Option<String>> {
670        Headers::get_optional_as(self.headers(), &CONTENT_DISPOSITION)
671    }
672
673    /// The Content-Encoding of the blob.
674    fn content_encoding(&self) -> Result<Option<String>> {
675        Headers::get_optional_as(self.headers(), &CONTENT_ENCODING)
676    }
677
678    /// The Content-Language of the blob.
679    fn content_language(&self) -> Result<Option<String>> {
680        Headers::get_optional_as(self.headers(), &CONTENT_LANGUAGE)
681    }
682
683    /// The number of bytes present in the response body.
684    fn content_length(&self) -> Result<Option<u64>> {
685        Headers::get_optional_as(self.headers(), &CONTENT_LENGTH)
686    }
687
688    /// The blob content MD5 hash. Only returned if the full blob is read.
689    fn content_md5(&self) -> Result<Option<Vec<u8>>> {
690        Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| base64::decode(h.as_str()))
691    }
692
693    /// Indicates the range of bytes returned in this response.
694    fn content_range(&self) -> Result<Option<String>> {
695        Headers::get_optional_as(self.headers(), &CONTENT_RANGE)
696    }
697
698    /// An opaque identifier for the current state of the resource.
699    fn etag(&self) -> Result<Option<Etag>> {
700        Headers::get_optional_as(self.headers(), &ETAG)
701    }
702
703    /// The date-time that the resource was last modified.
704    fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
705        Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
706            parse_rfc7231(h.as_str())
707        })
708    }
709
710    /// The number of committed blocks present in the blob.
711    fn blob_committed_block_count(&self) -> Result<Option<i32>> {
712        Headers::get_optional_as(self.headers(), &BLOB_COMMITTED_BLOCK_COUNT)
713    }
714
715    /// MD5 hash of the full blob content only returned for ranged reads. This is the hash of the complete blob, not just the
716    /// requested range.
717    fn blob_content_md5(&self) -> Result<Option<Vec<u8>>> {
718        Headers::get_optional_with(self.headers(), &BLOB_CONTENT_MD5, |h| {
719            base64::decode(h.as_str())
720        })
721    }
722
723    /// Whether the blob is sealed.
724    fn is_sealed(&self) -> Result<Option<bool>> {
725        Headers::get_optional_as(self.headers(), &BLOB_SEALED)
726    }
727
728    /// The current sequence number for a page blob.
729    fn blob_sequence_number(&self) -> Result<Option<i64>> {
730        Headers::get_optional_as(self.headers(), &BLOB_SEQUENCE_NUMBER)
731    }
732
733    /// The type of the blob.
734    fn blob_type(&self) -> Result<Option<BlobType>> {
735        Headers::get_optional_as(self.headers(), &BLOB_TYPE)
736    }
737
738    /// The CRC64 hash of the content.
739    fn content_crc64(&self) -> Result<Option<Vec<u8>>> {
740        Headers::get_optional_with(self.headers(), &CONTENT_CRC64, |h| {
741            base64::decode(h.as_str())
742        })
743    }
744
745    /// If this blob was the destination of a copy, specifies the completion time of the last attempted copy operation.
746    fn copy_completion_time(&self) -> Result<Option<OffsetDateTime>> {
747        Headers::get_optional_with(self.headers(), &COPY_COMPLETION_TIME, |h| {
748            parse_rfc7231(h.as_str())
749        })
750    }
751
752    /// Identifier for this copy operation.
753    fn copy_id(&self) -> Result<Option<String>> {
754        Headers::get_optional_as(self.headers(), &COPY_ID)
755    }
756
757    /// If this blob was the destination of a copy, specifies the number of bytes copied and the total bytes in the source.
758    fn copy_progress(&self) -> Result<Option<String>> {
759        Headers::get_optional_as(self.headers(), &COPY_PROGRESS)
760    }
761
762    /// If this blob was the destination of a copy, specifies the source URL.
763    fn copy_source(&self) -> Result<Option<String>> {
764        Headers::get_optional_as(self.headers(), &COPY_SOURCE)
765    }
766
767    /// Status of the copy operation.
768    fn copy_status(&self) -> Result<Option<CopyStatus>> {
769        Headers::get_optional_as(self.headers(), &COPY_STATUS)
770    }
771
772    /// If this blob was the destination of a copy, specifies the cause of the copy operation failure.
773    fn copy_status_description(&self) -> Result<Option<String>> {
774        Headers::get_optional_as(self.headers(), &COPY_STATUS_DESCRIPTION)
775    }
776
777    /// The date-time the blob was created.
778    fn creation_time(&self) -> Result<Option<OffsetDateTime>> {
779        Headers::get_optional_with(self.headers(), &CREATION_TIME, |h| {
780            parse_rfc7231(h.as_str())
781        })
782    }
783
784    /// The SHA-256 hash of the provided encryption key.
785    fn encryption_key_sha256(&self) -> Result<Option<String>> {
786        Headers::get_optional_as(self.headers(), &ENCRYPTION_KEY_SHA256)
787    }
788
789    /// Specifies the encryption scope used to encrypt the data.
790    fn encryption_scope(&self) -> Result<Option<String>> {
791        Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE)
792    }
793
794    /// Indicates the immutability policy mode of the blob.
795    fn immutability_policy_mode(&self) -> Result<Option<ImmutabilityPolicyMode>> {
796        Headers::get_optional_as(self.headers(), &IMMUTABILITY_POLICY_MODE)
797    }
798
799    /// The date-time that indicates the time at which the blob immutability policy will expire.
800    fn immutability_policy_expires_on(&self) -> Result<Option<OffsetDateTime>> {
801        Headers::get_optional_with(self.headers(), &IMMUTABILITY_POLICY_UNTIL_DATE, |h| {
802            parse_rfc7231(h.as_str())
803        })
804    }
805
806    /// Indicates whether this is the current version of the blob.
807    fn is_current_version(&self) -> Result<Option<bool>> {
808        Headers::get_optional_as(self.headers(), &IS_CURRENT_VERSION)
809    }
810
811    /// The date-time value that indicates the time at which the blob was last read or written.
812    fn last_accessed(&self) -> Result<Option<OffsetDateTime>> {
813        Headers::get_optional_with(self.headers(), &LAST_ACCESS_TIME, |h| {
814            parse_rfc7231(h.as_str())
815        })
816    }
817
818    /// Specifies the duration of the lease.
819    fn duration(&self) -> Result<Option<LeaseDuration>> {
820        Headers::get_optional_as(self.headers(), &LEASE_DURATION)
821    }
822
823    /// The lease state of the blob.
824    fn lease_state(&self) -> Result<Option<LeaseState>> {
825        Headers::get_optional_as(self.headers(), &LEASE_STATE)
826    }
827
828    /// The lease status of the blob.
829    fn lease_status(&self) -> Result<Option<LeaseStatus>> {
830        Headers::get_optional_as(self.headers(), &LEASE_STATUS)
831    }
832
833    /// Indicates whether the blob has a legal hold.
834    fn legal_hold(&self) -> Result<Option<bool>> {
835        Headers::get_optional_as(self.headers(), &LEGAL_HOLD)
836    }
837
838    /// The metadata headers.
839    fn metadata(&self) -> Result<HashMap<String, String>> {
840        let mut values = HashMap::new();
841        for h in self.headers().iter() {
842            let name = h.0.as_str();
843            if name.len() > META.len() && name.starts_with(META) {
844                values.insert(name[META.len()..].to_owned(), h.1.as_str().to_owned());
845            }
846        }
847        Ok(values)
848    }
849
850    /// The object replication status headers.
851    fn object_replication_rules(&self) -> Result<HashMap<String, String>> {
852        let mut values = HashMap::new();
853        for h in self.headers().iter() {
854            let name = h.0.as_str();
855            if name.len() > OR.len() && name.starts_with(OR) {
856                values.insert(name[OR.len()..].to_owned(), h.1.as_str().to_owned());
857            }
858        }
859        Ok(values)
860    }
861
862    /// The object replication policy ID.
863    fn object_replication_policy_id(&self) -> Result<Option<String>> {
864        Headers::get_optional_as(self.headers(), &OR_POLICY_ID)
865    }
866
867    /// Indicates whether the contents of the request are successfully encrypted.
868    fn is_server_encrypted(&self) -> Result<Option<bool>> {
869        Headers::get_optional_as(self.headers(), &SERVER_ENCRYPTED)
870    }
871
872    /// The number of tags associated with the blob.
873    fn tag_count(&self) -> Result<Option<i64>> {
874        Headers::get_optional_as(self.headers(), &TAG_COUNT)
875    }
876
877    /// The version ID of the blob.
878    fn version_id(&self) -> Result<Option<String>> {
879        Headers::get_optional_as(self.headers(), &VERSION_ID)
880    }
881}
882
883/// Provides access to typed response headers for `BlobClient::get_account_info()`
884///
885/// # Examples
886///
887/// ```no_run
888/// use azure_core::{Result, http::{Response, NoFormat}};
889/// use azure_storage_blob::models::{BlobClientGetAccountInfoResult, BlobClientGetAccountInfoResultHeaders};
890/// async fn example() -> Result<()> {
891///     let response: Response<BlobClientGetAccountInfoResult, NoFormat> = unimplemented!();
892///     // Access response headers
893///     if let Some(account_kind) = response.account_kind()? {
894///         println!("x-ms-account-kind: {:?}", account_kind);
895///     }
896///     if let Some(is_hierarchical_namespace_enabled) = response.is_hierarchical_namespace_enabled()? {
897///         println!("x-ms-is-hns-enabled: {:?}", is_hierarchical_namespace_enabled);
898///     }
899///     if let Some(sku_name) = response.sku_name()? {
900///         println!("x-ms-sku-name: {:?}", sku_name);
901///     }
902///     Ok(())
903/// }
904/// ```
905pub trait BlobClientGetAccountInfoResultHeaders: private::Sealed {
906    fn account_kind(&self) -> Result<Option<AccountKind>>;
907    fn is_hierarchical_namespace_enabled(&self) -> Result<Option<bool>>;
908    fn sku_name(&self) -> Result<Option<SkuName>>;
909}
910
911impl BlobClientGetAccountInfoResultHeaders for Response<BlobClientGetAccountInfoResult, NoFormat> {
912    /// The account kind.
913    fn account_kind(&self) -> Result<Option<AccountKind>> {
914        Headers::get_optional_as(self.headers(), &ACCOUNT_KIND)
915    }
916
917    /// Indicates if the account has a hierarchical namespace enabled.
918    fn is_hierarchical_namespace_enabled(&self) -> Result<Option<bool>> {
919        Headers::get_optional_as(self.headers(), &IS_HNS_ENABLED)
920    }
921
922    /// The SKU name of the account.
923    fn sku_name(&self) -> Result<Option<SkuName>> {
924        Headers::get_optional_as(self.headers(), &SKU_NAME)
925    }
926}
927
928/// Provides access to typed response headers for `BlobClient::get_properties()`
929///
930/// # Examples
931///
932/// ```no_run
933/// use azure_core::{Result, http::{Response, NoFormat}};
934/// use azure_storage_blob::models::{BlobClientGetPropertiesResult, BlobClientGetPropertiesResultHeaders};
935/// async fn example() -> Result<()> {
936///     let response: Response<BlobClientGetPropertiesResult, NoFormat> = unimplemented!();
937///     // Access response headers
938///     if let Some(cache_control) = response.cache_control()? {
939///         println!("cache-control: {:?}", cache_control);
940///     }
941///     if let Some(content_disposition) = response.content_disposition()? {
942///         println!("content-disposition: {:?}", content_disposition);
943///     }
944///     if let Some(content_encoding) = response.content_encoding()? {
945///         println!("content-encoding: {:?}", content_encoding);
946///     }
947///     Ok(())
948/// }
949/// ```
950pub trait BlobClientGetPropertiesResultHeaders: private::Sealed {
951    fn cache_control(&self) -> Result<Option<String>>;
952    fn content_disposition(&self) -> Result<Option<String>>;
953    fn content_encoding(&self) -> Result<Option<String>>;
954    fn content_language(&self) -> Result<Option<String>>;
955    fn content_length(&self) -> Result<Option<u64>>;
956    fn content_md5(&self) -> Result<Option<Vec<u8>>>;
957    fn content_type(&self) -> Result<Option<String>>;
958    fn etag(&self) -> Result<Option<Etag>>;
959    fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
960    fn access_tier(&self) -> Result<Option<String>>;
961    fn access_tier_change_time(&self) -> Result<Option<OffsetDateTime>>;
962    fn access_tier_inferred(&self) -> Result<Option<bool>>;
963    fn archive_status(&self) -> Result<Option<ArchiveStatus>>;
964    fn blob_committed_block_count(&self) -> Result<Option<i32>>;
965    fn is_sealed(&self) -> Result<Option<bool>>;
966    fn blob_sequence_number(&self) -> Result<Option<i64>>;
967    fn blob_type(&self) -> Result<Option<BlobType>>;
968    fn copy_completion_time(&self) -> Result<Option<OffsetDateTime>>;
969    fn destination_snapshot(&self) -> Result<Option<String>>;
970    fn copy_id(&self) -> Result<Option<String>>;
971    fn copy_progress(&self) -> Result<Option<String>>;
972    fn copy_source(&self) -> Result<Option<String>>;
973    fn copy_status(&self) -> Result<Option<CopyStatus>>;
974    fn copy_status_description(&self) -> Result<Option<String>>;
975    fn creation_time(&self) -> Result<Option<OffsetDateTime>>;
976    fn encryption_key_sha256(&self) -> Result<Option<String>>;
977    fn encryption_scope(&self) -> Result<Option<String>>;
978    fn expires_on(&self) -> Result<Option<OffsetDateTime>>;
979    fn immutability_policy_mode(&self) -> Result<Option<ImmutabilityPolicyMode>>;
980    fn immutability_policy_expires_on(&self) -> Result<Option<OffsetDateTime>>;
981    fn is_incremental_copy(&self) -> Result<Option<bool>>;
982    fn is_current_version(&self) -> Result<Option<bool>>;
983    fn last_accessed(&self) -> Result<Option<OffsetDateTime>>;
984    fn duration(&self) -> Result<Option<LeaseDuration>>;
985    fn lease_state(&self) -> Result<Option<LeaseState>>;
986    fn lease_status(&self) -> Result<Option<LeaseStatus>>;
987    fn legal_hold(&self) -> Result<Option<bool>>;
988    fn metadata(&self) -> Result<HashMap<String, String>>;
989    fn object_replication_rules(&self) -> Result<HashMap<String, String>>;
990    fn object_replication_policy_id(&self) -> Result<Option<String>>;
991    fn rehydrate_priority(&self) -> Result<Option<RehydratePriority>>;
992    fn is_server_encrypted(&self) -> Result<Option<bool>>;
993    fn tag_count(&self) -> Result<Option<i64>>;
994    fn version_id(&self) -> Result<Option<String>>;
995}
996
997impl BlobClientGetPropertiesResultHeaders for Response<BlobClientGetPropertiesResult, NoFormat> {
998    /// The Cache-Control of the blob.
999    fn cache_control(&self) -> Result<Option<String>> {
1000        Headers::get_optional_as(self.headers(), &CACHE_CONTROL)
1001    }
1002
1003    /// The Content-Disposition of the blob.
1004    fn content_disposition(&self) -> Result<Option<String>> {
1005        Headers::get_optional_as(self.headers(), &CONTENT_DISPOSITION)
1006    }
1007
1008    /// The Content-Encoding of the blob.
1009    fn content_encoding(&self) -> Result<Option<String>> {
1010        Headers::get_optional_as(self.headers(), &CONTENT_ENCODING)
1011    }
1012
1013    /// The Content-Language of the blob.
1014    fn content_language(&self) -> Result<Option<String>> {
1015        Headers::get_optional_as(self.headers(), &CONTENT_LANGUAGE)
1016    }
1017
1018    /// The number of bytes present in the response body.
1019    fn content_length(&self) -> Result<Option<u64>> {
1020        Headers::get_optional_as(self.headers(), &CONTENT_LENGTH)
1021    }
1022
1023    /// The blob content MD5 hash. Only returned if the full blob is read.
1024    fn content_md5(&self) -> Result<Option<Vec<u8>>> {
1025        Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| base64::decode(h.as_str()))
1026    }
1027
1028    /// Content-type.
1029    fn content_type(&self) -> Result<Option<String>> {
1030        Headers::get_optional_as(self.headers(), &CONTENT_TYPE)
1031    }
1032
1033    /// An opaque identifier for the current state of the resource.
1034    fn etag(&self) -> Result<Option<Etag>> {
1035        Headers::get_optional_as(self.headers(), &ETAG)
1036    }
1037
1038    /// The date-time that the resource was last modified.
1039    fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
1040        Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
1041            parse_rfc7231(h.as_str())
1042        })
1043    }
1044
1045    /// The access tier of the blob.
1046    fn access_tier(&self) -> Result<Option<String>> {
1047        Headers::get_optional_as(self.headers(), &ACCESS_TIER)
1048    }
1049
1050    /// The time the tier was changed on the blob. This is only returned if the tier on the blob was ever set.
1051    fn access_tier_change_time(&self) -> Result<Option<OffsetDateTime>> {
1052        Headers::get_optional_with(self.headers(), &ACCESS_TIER_CHANGE_TIME, |h| {
1053            parse_rfc7231(h.as_str())
1054        })
1055    }
1056
1057    /// Included if the access tier is inferred.
1058    fn access_tier_inferred(&self) -> Result<Option<bool>> {
1059        Headers::get_optional_as(self.headers(), &ACCESS_TIER_INFERRED)
1060    }
1061
1062    /// Included if the blob rehydrate operation is pending. Indicates the destination tier.
1063    fn archive_status(&self) -> Result<Option<ArchiveStatus>> {
1064        Headers::get_optional_as(self.headers(), &ARCHIVE_STATUS)
1065    }
1066
1067    /// The number of committed blocks present in the blob.
1068    fn blob_committed_block_count(&self) -> Result<Option<i32>> {
1069        Headers::get_optional_as(self.headers(), &BLOB_COMMITTED_BLOCK_COUNT)
1070    }
1071
1072    /// Whether the blob is sealed.
1073    fn is_sealed(&self) -> Result<Option<bool>> {
1074        Headers::get_optional_as(self.headers(), &BLOB_SEALED)
1075    }
1076
1077    /// The current sequence number for a page blob.
1078    fn blob_sequence_number(&self) -> Result<Option<i64>> {
1079        Headers::get_optional_as(self.headers(), &BLOB_SEQUENCE_NUMBER)
1080    }
1081
1082    /// The type of the blob.
1083    fn blob_type(&self) -> Result<Option<BlobType>> {
1084        Headers::get_optional_as(self.headers(), &BLOB_TYPE)
1085    }
1086
1087    /// If this blob was the destination of a copy, specifies the completion time of the last attempted copy operation.
1088    fn copy_completion_time(&self) -> Result<Option<OffsetDateTime>> {
1089        Headers::get_optional_with(self.headers(), &COPY_COMPLETION_TIME, |h| {
1090            parse_rfc7231(h.as_str())
1091        })
1092    }
1093
1094    /// Included if the blob is incremental copy blob or incremental copy snapshot, if x-ms-copy-status is success.
1095    fn destination_snapshot(&self) -> Result<Option<String>> {
1096        Headers::get_optional_as(self.headers(), &COPY_DESTINATION_SNAPSHOT)
1097    }
1098
1099    /// Identifier for this copy operation.
1100    fn copy_id(&self) -> Result<Option<String>> {
1101        Headers::get_optional_as(self.headers(), &COPY_ID)
1102    }
1103
1104    /// If this blob was the destination of a copy, specifies the number of bytes copied and the total bytes in the source.
1105    fn copy_progress(&self) -> Result<Option<String>> {
1106        Headers::get_optional_as(self.headers(), &COPY_PROGRESS)
1107    }
1108
1109    /// If this blob was the destination of a copy, specifies the source URL.
1110    fn copy_source(&self) -> Result<Option<String>> {
1111        Headers::get_optional_as(self.headers(), &COPY_SOURCE)
1112    }
1113
1114    /// Status of the copy operation.
1115    fn copy_status(&self) -> Result<Option<CopyStatus>> {
1116        Headers::get_optional_as(self.headers(), &COPY_STATUS)
1117    }
1118
1119    /// If this blob was the destination of a copy, specifies the cause of the copy operation failure.
1120    fn copy_status_description(&self) -> Result<Option<String>> {
1121        Headers::get_optional_as(self.headers(), &COPY_STATUS_DESCRIPTION)
1122    }
1123
1124    /// The date-time the blob was created.
1125    fn creation_time(&self) -> Result<Option<OffsetDateTime>> {
1126        Headers::get_optional_with(self.headers(), &CREATION_TIME, |h| {
1127            parse_rfc7231(h.as_str())
1128        })
1129    }
1130
1131    /// The SHA-256 hash of the provided encryption key.
1132    fn encryption_key_sha256(&self) -> Result<Option<String>> {
1133        Headers::get_optional_as(self.headers(), &ENCRYPTION_KEY_SHA256)
1134    }
1135
1136    /// Specifies the encryption scope used to encrypt the data.
1137    fn encryption_scope(&self) -> Result<Option<String>> {
1138        Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE)
1139    }
1140
1141    /// The date-time this blob will expire.
1142    fn expires_on(&self) -> Result<Option<OffsetDateTime>> {
1143        Headers::get_optional_with(self.headers(), &EXPIRY_TIME, |h| parse_rfc7231(h.as_str()))
1144    }
1145
1146    /// Indicates the immutability policy mode of the blob.
1147    fn immutability_policy_mode(&self) -> Result<Option<ImmutabilityPolicyMode>> {
1148        Headers::get_optional_as(self.headers(), &IMMUTABILITY_POLICY_MODE)
1149    }
1150
1151    /// The date-time that indicates the time at which the blob immutability policy will expire.
1152    fn immutability_policy_expires_on(&self) -> Result<Option<OffsetDateTime>> {
1153        Headers::get_optional_with(self.headers(), &IMMUTABILITY_POLICY_UNTIL_DATE, |h| {
1154            parse_rfc7231(h.as_str())
1155        })
1156    }
1157
1158    /// Included if the blob is incremental copy blob.
1159    fn is_incremental_copy(&self) -> Result<Option<bool>> {
1160        Headers::get_optional_as(self.headers(), &INCREMENTAL_COPY)
1161    }
1162
1163    /// Indicates whether this is the current version of the blob.
1164    fn is_current_version(&self) -> Result<Option<bool>> {
1165        Headers::get_optional_as(self.headers(), &IS_CURRENT_VERSION)
1166    }
1167
1168    /// The date-time value that indicates the time at which the blob was last read or written.
1169    fn last_accessed(&self) -> Result<Option<OffsetDateTime>> {
1170        Headers::get_optional_with(self.headers(), &LAST_ACCESS_TIME, |h| {
1171            parse_rfc7231(h.as_str())
1172        })
1173    }
1174
1175    /// Specifies the duration of the lease.
1176    fn duration(&self) -> Result<Option<LeaseDuration>> {
1177        Headers::get_optional_as(self.headers(), &LEASE_DURATION)
1178    }
1179
1180    /// The lease state of the blob.
1181    fn lease_state(&self) -> Result<Option<LeaseState>> {
1182        Headers::get_optional_as(self.headers(), &LEASE_STATE)
1183    }
1184
1185    /// The lease status of the blob.
1186    fn lease_status(&self) -> Result<Option<LeaseStatus>> {
1187        Headers::get_optional_as(self.headers(), &LEASE_STATUS)
1188    }
1189
1190    /// Indicates whether the blob has a legal hold.
1191    fn legal_hold(&self) -> Result<Option<bool>> {
1192        Headers::get_optional_as(self.headers(), &LEGAL_HOLD)
1193    }
1194
1195    /// The metadata headers.
1196    fn metadata(&self) -> Result<HashMap<String, String>> {
1197        let mut values = HashMap::new();
1198        for h in self.headers().iter() {
1199            let name = h.0.as_str();
1200            if name.len() > META.len() && name.starts_with(META) {
1201                values.insert(name[META.len()..].to_owned(), h.1.as_str().to_owned());
1202            }
1203        }
1204        Ok(values)
1205    }
1206
1207    /// The object replication status headers.
1208    fn object_replication_rules(&self) -> Result<HashMap<String, String>> {
1209        let mut values = HashMap::new();
1210        for h in self.headers().iter() {
1211            let name = h.0.as_str();
1212            if name.len() > OR.len() && name.starts_with(OR) {
1213                values.insert(name[OR.len()..].to_owned(), h.1.as_str().to_owned());
1214            }
1215        }
1216        Ok(values)
1217    }
1218
1219    /// The object replication policy ID.
1220    fn object_replication_policy_id(&self) -> Result<Option<String>> {
1221        Headers::get_optional_as(self.headers(), &OR_POLICY_ID)
1222    }
1223
1224    /// The priority of the rehydration operation.
1225    fn rehydrate_priority(&self) -> Result<Option<RehydratePriority>> {
1226        Headers::get_optional_as(self.headers(), &REHYDRATE_PRIORITY)
1227    }
1228
1229    /// Indicates whether the contents of the request are successfully encrypted.
1230    fn is_server_encrypted(&self) -> Result<Option<bool>> {
1231        Headers::get_optional_as(self.headers(), &SERVER_ENCRYPTED)
1232    }
1233
1234    /// The number of tags associated with the blob.
1235    fn tag_count(&self) -> Result<Option<i64>> {
1236        Headers::get_optional_as(self.headers(), &TAG_COUNT)
1237    }
1238
1239    /// The version ID of the blob.
1240    fn version_id(&self) -> Result<Option<String>> {
1241        Headers::get_optional_as(self.headers(), &VERSION_ID)
1242    }
1243}
1244
1245/// Provides access to typed response headers for `BlobClient::release_lease()`
1246///
1247/// # Examples
1248///
1249/// ```no_run
1250/// use azure_core::{Result, http::{Response, NoFormat}};
1251/// use azure_storage_blob::models::{BlobClientReleaseLeaseResult, BlobClientReleaseLeaseResultHeaders};
1252/// async fn example() -> Result<()> {
1253///     let response: Response<BlobClientReleaseLeaseResult, NoFormat> = unimplemented!();
1254///     // Access response headers
1255///     if let Some(etag) = response.etag()? {
1256///         println!("etag: {:?}", etag);
1257///     }
1258///     if let Some(last_modified) = response.last_modified()? {
1259///         println!("last-modified: {:?}", last_modified);
1260///     }
1261///     Ok(())
1262/// }
1263/// ```
1264pub trait BlobClientReleaseLeaseResultHeaders: private::Sealed {
1265    fn etag(&self) -> Result<Option<Etag>>;
1266    fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
1267}
1268
1269impl BlobClientReleaseLeaseResultHeaders for Response<BlobClientReleaseLeaseResult, NoFormat> {
1270    /// An opaque identifier for the current state of the resource.
1271    fn etag(&self) -> Result<Option<Etag>> {
1272        Headers::get_optional_as(self.headers(), &ETAG)
1273    }
1274
1275    /// The date-time that the resource was last modified.
1276    fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
1277        Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
1278            parse_rfc7231(h.as_str())
1279        })
1280    }
1281}
1282
1283/// Provides access to typed response headers for `BlobClient::renew_lease()`
1284///
1285/// # Examples
1286///
1287/// ```no_run
1288/// use azure_core::{Result, http::{Response, NoFormat}};
1289/// use azure_storage_blob::models::{BlobClientRenewLeaseResult, BlobClientRenewLeaseResultHeaders};
1290/// async fn example() -> Result<()> {
1291///     let response: Response<BlobClientRenewLeaseResult, NoFormat> = unimplemented!();
1292///     // Access response headers
1293///     if let Some(etag) = response.etag()? {
1294///         println!("etag: {:?}", etag);
1295///     }
1296///     if let Some(last_modified) = response.last_modified()? {
1297///         println!("last-modified: {:?}", last_modified);
1298///     }
1299///     if let Some(lease_id) = response.lease_id()? {
1300///         println!("x-ms-lease-id: {:?}", lease_id);
1301///     }
1302///     Ok(())
1303/// }
1304/// ```
1305pub trait BlobClientRenewLeaseResultHeaders: private::Sealed {
1306    fn etag(&self) -> Result<Option<Etag>>;
1307    fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
1308    fn lease_id(&self) -> Result<Option<String>>;
1309}
1310
1311impl BlobClientRenewLeaseResultHeaders for Response<BlobClientRenewLeaseResult, NoFormat> {
1312    /// An opaque identifier for the current state of the resource.
1313    fn etag(&self) -> Result<Option<Etag>> {
1314        Headers::get_optional_as(self.headers(), &ETAG)
1315    }
1316
1317    /// The date-time that the resource was last modified.
1318    fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
1319        Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
1320            parse_rfc7231(h.as_str())
1321        })
1322    }
1323
1324    /// Uniquely identifies a blob's lease.
1325    fn lease_id(&self) -> Result<Option<String>> {
1326        Headers::get_optional_as(self.headers(), &LEASE_ID)
1327    }
1328}
1329
1330/// Provides access to typed response headers for `BlobClient::start_copy_from_url()`
1331///
1332/// # Examples
1333///
1334/// ```no_run
1335/// use azure_core::{Result, http::{Response, NoFormat}};
1336/// use azure_storage_blob::models::{BlobClientStartCopyFromUrlResult, BlobClientStartCopyFromUrlResultHeaders};
1337/// async fn example() -> Result<()> {
1338///     let response: Response<BlobClientStartCopyFromUrlResult, NoFormat> = unimplemented!();
1339///     // Access response headers
1340///     if let Some(etag) = response.etag()? {
1341///         println!("etag: {:?}", etag);
1342///     }
1343///     if let Some(last_modified) = response.last_modified()? {
1344///         println!("last-modified: {:?}", last_modified);
1345///     }
1346///     if let Some(copy_id) = response.copy_id()? {
1347///         println!("x-ms-copy-id: {:?}", copy_id);
1348///     }
1349///     Ok(())
1350/// }
1351/// ```
1352pub trait BlobClientStartCopyFromUrlResultHeaders: private::Sealed {
1353    fn etag(&self) -> Result<Option<Etag>>;
1354    fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
1355    fn copy_id(&self) -> Result<Option<String>>;
1356    fn copy_status(&self) -> Result<Option<CopyStatus>>;
1357    fn version_id(&self) -> Result<Option<String>>;
1358}
1359
1360impl BlobClientStartCopyFromUrlResultHeaders
1361    for Response<BlobClientStartCopyFromUrlResult, NoFormat>
1362{
1363    /// An opaque identifier for the current state of the resource.
1364    fn etag(&self) -> Result<Option<Etag>> {
1365        Headers::get_optional_as(self.headers(), &ETAG)
1366    }
1367
1368    /// The date-time that the resource was last modified.
1369    fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
1370        Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
1371            parse_rfc7231(h.as_str())
1372        })
1373    }
1374
1375    /// Identifier for this copy operation.
1376    fn copy_id(&self) -> Result<Option<String>> {
1377        Headers::get_optional_as(self.headers(), &COPY_ID)
1378    }
1379
1380    /// Status of the copy operation.
1381    fn copy_status(&self) -> Result<Option<CopyStatus>> {
1382        Headers::get_optional_as(self.headers(), &COPY_STATUS)
1383    }
1384
1385    /// The version ID of the blob.
1386    fn version_id(&self) -> Result<Option<String>> {
1387        Headers::get_optional_as(self.headers(), &VERSION_ID)
1388    }
1389}
1390
1391/// Provides access to typed response headers for `BlobContainerClient::acquire_lease()`
1392///
1393/// # Examples
1394///
1395/// ```no_run
1396/// use azure_core::{Result, http::{Response, NoFormat}};
1397/// use azure_storage_blob::models::{BlobContainerClientAcquireLeaseResult, BlobContainerClientAcquireLeaseResultHeaders};
1398/// async fn example() -> Result<()> {
1399///     let response: Response<BlobContainerClientAcquireLeaseResult, NoFormat> = unimplemented!();
1400///     // Access response headers
1401///     if let Some(etag) = response.etag()? {
1402///         println!("etag: {:?}", etag);
1403///     }
1404///     if let Some(last_modified) = response.last_modified()? {
1405///         println!("last-modified: {:?}", last_modified);
1406///     }
1407///     if let Some(lease_id) = response.lease_id()? {
1408///         println!("x-ms-lease-id: {:?}", lease_id);
1409///     }
1410///     Ok(())
1411/// }
1412/// ```
1413pub trait BlobContainerClientAcquireLeaseResultHeaders: private::Sealed {
1414    fn etag(&self) -> Result<Option<Etag>>;
1415    fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
1416    fn lease_id(&self) -> Result<Option<String>>;
1417}
1418
1419impl BlobContainerClientAcquireLeaseResultHeaders
1420    for Response<BlobContainerClientAcquireLeaseResult, NoFormat>
1421{
1422    /// An opaque identifier for the current state of the resource.
1423    fn etag(&self) -> Result<Option<Etag>> {
1424        Headers::get_optional_as(self.headers(), &ETAG)
1425    }
1426
1427    /// The date-time that the resource was last modified.
1428    fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
1429        Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
1430            parse_rfc7231(h.as_str())
1431        })
1432    }
1433
1434    /// Uniquely identifies a blob's lease.
1435    fn lease_id(&self) -> Result<Option<String>> {
1436        Headers::get_optional_as(self.headers(), &LEASE_ID)
1437    }
1438}
1439
1440/// Provides access to typed response headers for `BlobContainerClient::break_lease()`
1441///
1442/// # Examples
1443///
1444/// ```no_run
1445/// use azure_core::{Result, http::{Response, NoFormat}};
1446/// use azure_storage_blob::models::{BlobContainerClientBreakLeaseResult, BlobContainerClientBreakLeaseResultHeaders};
1447/// async fn example() -> Result<()> {
1448///     let response: Response<BlobContainerClientBreakLeaseResult, NoFormat> = unimplemented!();
1449///     // Access response headers
1450///     if let Some(etag) = response.etag()? {
1451///         println!("etag: {:?}", etag);
1452///     }
1453///     if let Some(last_modified) = response.last_modified()? {
1454///         println!("last-modified: {:?}", last_modified);
1455///     }
1456///     if let Some(lease_time) = response.lease_time()? {
1457///         println!("x-ms-lease-time: {:?}", lease_time);
1458///     }
1459///     Ok(())
1460/// }
1461/// ```
1462pub trait BlobContainerClientBreakLeaseResultHeaders: private::Sealed {
1463    fn etag(&self) -> Result<Option<Etag>>;
1464    fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
1465    fn lease_time(&self) -> Result<Option<i32>>;
1466}
1467
1468impl BlobContainerClientBreakLeaseResultHeaders
1469    for Response<BlobContainerClientBreakLeaseResult, NoFormat>
1470{
1471    /// An opaque identifier for the current state of the resource.
1472    fn etag(&self) -> Result<Option<Etag>> {
1473        Headers::get_optional_as(self.headers(), &ETAG)
1474    }
1475
1476    /// The date-time that the resource was last modified.
1477    fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
1478        Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
1479            parse_rfc7231(h.as_str())
1480        })
1481    }
1482
1483    /// Approximate time remaining in the lease period, in seconds.
1484    fn lease_time(&self) -> Result<Option<i32>> {
1485        Headers::get_optional_as(self.headers(), &LEASE_TIME)
1486    }
1487}
1488
1489/// Provides access to typed response headers for `BlobContainerClient::change_lease()`
1490///
1491/// # Examples
1492///
1493/// ```no_run
1494/// use azure_core::{Result, http::{Response, NoFormat}};
1495/// use azure_storage_blob::models::{BlobContainerClientChangeLeaseResult, BlobContainerClientChangeLeaseResultHeaders};
1496/// async fn example() -> Result<()> {
1497///     let response: Response<BlobContainerClientChangeLeaseResult, NoFormat> = unimplemented!();
1498///     // Access response headers
1499///     if let Some(etag) = response.etag()? {
1500///         println!("etag: {:?}", etag);
1501///     }
1502///     if let Some(last_modified) = response.last_modified()? {
1503///         println!("last-modified: {:?}", last_modified);
1504///     }
1505///     if let Some(lease_id) = response.lease_id()? {
1506///         println!("x-ms-lease-id: {:?}", lease_id);
1507///     }
1508///     Ok(())
1509/// }
1510/// ```
1511pub trait BlobContainerClientChangeLeaseResultHeaders: private::Sealed {
1512    fn etag(&self) -> Result<Option<Etag>>;
1513    fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
1514    fn lease_id(&self) -> Result<Option<String>>;
1515}
1516
1517impl BlobContainerClientChangeLeaseResultHeaders
1518    for Response<BlobContainerClientChangeLeaseResult, NoFormat>
1519{
1520    /// An opaque identifier for the current state of the resource.
1521    fn etag(&self) -> Result<Option<Etag>> {
1522        Headers::get_optional_as(self.headers(), &ETAG)
1523    }
1524
1525    /// The date-time that the resource was last modified.
1526    fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
1527        Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
1528            parse_rfc7231(h.as_str())
1529        })
1530    }
1531
1532    /// Uniquely identifies a blob's lease.
1533    fn lease_id(&self) -> Result<Option<String>> {
1534        Headers::get_optional_as(self.headers(), &LEASE_ID)
1535    }
1536}
1537
1538/// Provides access to typed response headers for `BlobContainerClient::get_account_info()`
1539///
1540/// # Examples
1541///
1542/// ```no_run
1543/// use azure_core::{Result, http::{Response, NoFormat}};
1544/// use azure_storage_blob::models::{BlobContainerClientGetAccountInfoResult, BlobContainerClientGetAccountInfoResultHeaders};
1545/// async fn example() -> Result<()> {
1546///     let response: Response<BlobContainerClientGetAccountInfoResult, NoFormat> = unimplemented!();
1547///     // Access response headers
1548///     if let Some(account_kind) = response.account_kind()? {
1549///         println!("x-ms-account-kind: {:?}", account_kind);
1550///     }
1551///     if let Some(is_hierarchical_namespace_enabled) = response.is_hierarchical_namespace_enabled()? {
1552///         println!("x-ms-is-hns-enabled: {:?}", is_hierarchical_namespace_enabled);
1553///     }
1554///     if let Some(sku_name) = response.sku_name()? {
1555///         println!("x-ms-sku-name: {:?}", sku_name);
1556///     }
1557///     Ok(())
1558/// }
1559/// ```
1560pub trait BlobContainerClientGetAccountInfoResultHeaders: private::Sealed {
1561    fn account_kind(&self) -> Result<Option<AccountKind>>;
1562    fn is_hierarchical_namespace_enabled(&self) -> Result<Option<bool>>;
1563    fn sku_name(&self) -> Result<Option<SkuName>>;
1564}
1565
1566impl BlobContainerClientGetAccountInfoResultHeaders
1567    for Response<BlobContainerClientGetAccountInfoResult, NoFormat>
1568{
1569    /// The account kind.
1570    fn account_kind(&self) -> Result<Option<AccountKind>> {
1571        Headers::get_optional_as(self.headers(), &ACCOUNT_KIND)
1572    }
1573
1574    /// Indicates if the account has a hierarchical namespace enabled.
1575    fn is_hierarchical_namespace_enabled(&self) -> Result<Option<bool>> {
1576        Headers::get_optional_as(self.headers(), &IS_HNS_ENABLED)
1577    }
1578
1579    /// The SKU name of the account.
1580    fn sku_name(&self) -> Result<Option<SkuName>> {
1581        Headers::get_optional_as(self.headers(), &SKU_NAME)
1582    }
1583}
1584
1585/// Provides access to typed response headers for `BlobContainerClient::get_properties()`
1586///
1587/// # Examples
1588///
1589/// ```no_run
1590/// use azure_core::{Result, http::{Response, NoFormat}};
1591/// use azure_storage_blob::models::{BlobContainerClientGetPropertiesResult, BlobContainerClientGetPropertiesResultHeaders};
1592/// async fn example() -> Result<()> {
1593///     let response: Response<BlobContainerClientGetPropertiesResult, NoFormat> = unimplemented!();
1594///     // Access response headers
1595///     if let Some(etag) = response.etag()? {
1596///         println!("etag: {:?}", etag);
1597///     }
1598///     if let Some(last_modified) = response.last_modified()? {
1599///         println!("last-modified: {:?}", last_modified);
1600///     }
1601///     if let Some(access) = response.access()? {
1602///         println!("x-ms-blob-public-access: {:?}", access);
1603///     }
1604///     Ok(())
1605/// }
1606/// ```
1607pub trait BlobContainerClientGetPropertiesResultHeaders: private::Sealed {
1608    fn etag(&self) -> Result<Option<Etag>>;
1609    fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
1610    fn access(&self) -> Result<Option<PublicAccessType>>;
1611    fn default_encryption_scope(&self) -> Result<Option<String>>;
1612    fn prevent_encryption_scope_override(&self) -> Result<Option<bool>>;
1613    fn has_immutability_policy(&self) -> Result<Option<bool>>;
1614    fn has_legal_hold(&self) -> Result<Option<bool>>;
1615    fn is_immutable_storage_with_versioning_enabled(&self) -> Result<Option<bool>>;
1616    fn duration(&self) -> Result<Option<LeaseDuration>>;
1617    fn lease_state(&self) -> Result<Option<LeaseState>>;
1618    fn lease_status(&self) -> Result<Option<LeaseStatus>>;
1619    fn metadata(&self) -> Result<HashMap<String, String>>;
1620}
1621
1622impl BlobContainerClientGetPropertiesResultHeaders
1623    for Response<BlobContainerClientGetPropertiesResult, NoFormat>
1624{
1625    /// An opaque identifier for the current state of the resource.
1626    fn etag(&self) -> Result<Option<Etag>> {
1627        Headers::get_optional_as(self.headers(), &ETAG)
1628    }
1629
1630    /// The date-time that the resource was last modified.
1631    fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
1632        Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
1633            parse_rfc7231(h.as_str())
1634        })
1635    }
1636
1637    /// The public access setting for the container.
1638    fn access(&self) -> Result<Option<PublicAccessType>> {
1639        Headers::get_optional_as(self.headers(), &BLOB_PUBLIC_ACCESS)
1640    }
1641
1642    /// The default encryption scope for the container.
1643    fn default_encryption_scope(&self) -> Result<Option<String>> {
1644        Headers::get_optional_as(self.headers(), &DEFAULT_ENCRYPTION_SCOPE)
1645    }
1646
1647    /// Whether to prevent encryption scope override.
1648    fn prevent_encryption_scope_override(&self) -> Result<Option<bool>> {
1649        Headers::get_optional_as(self.headers(), &DENY_ENCRYPTION_SCOPE_OVERRIDE)
1650    }
1651
1652    /// Indicates whether the container has an immutability policy set on it.
1653    fn has_immutability_policy(&self) -> Result<Option<bool>> {
1654        Headers::get_optional_as(self.headers(), &HAS_IMMUTABILITY_POLICY)
1655    }
1656
1657    /// Indicates whether the container has a legal hold.
1658    fn has_legal_hold(&self) -> Result<Option<bool>> {
1659        Headers::get_optional_as(self.headers(), &HAS_LEGAL_HOLD)
1660    }
1661
1662    /// Indicates whether version level WORM (Write Once, Read Many) is enabled on a container.
1663    fn is_immutable_storage_with_versioning_enabled(&self) -> Result<Option<bool>> {
1664        Headers::get_optional_as(self.headers(), &IMMUTABLE_STORAGE_WITH_VERSIONING_ENABLED)
1665    }
1666
1667    /// Specifies the duration of the lease.
1668    fn duration(&self) -> Result<Option<LeaseDuration>> {
1669        Headers::get_optional_as(self.headers(), &LEASE_DURATION)
1670    }
1671
1672    /// The lease state of the blob.
1673    fn lease_state(&self) -> Result<Option<LeaseState>> {
1674        Headers::get_optional_as(self.headers(), &LEASE_STATE)
1675    }
1676
1677    /// The lease status of the blob.
1678    fn lease_status(&self) -> Result<Option<LeaseStatus>> {
1679        Headers::get_optional_as(self.headers(), &LEASE_STATUS)
1680    }
1681
1682    /// The metadata headers.
1683    fn metadata(&self) -> Result<HashMap<String, String>> {
1684        let mut values = HashMap::new();
1685        for h in self.headers().iter() {
1686            let name = h.0.as_str();
1687            if name.len() > META.len() && name.starts_with(META) {
1688                values.insert(name[META.len()..].to_owned(), h.1.as_str().to_owned());
1689            }
1690        }
1691        Ok(values)
1692    }
1693}
1694
1695/// Provides access to typed response headers for `BlobContainerClient::release_lease()`
1696///
1697/// # Examples
1698///
1699/// ```no_run
1700/// use azure_core::{Result, http::{Response, NoFormat}};
1701/// use azure_storage_blob::models::{BlobContainerClientReleaseLeaseResult, BlobContainerClientReleaseLeaseResultHeaders};
1702/// async fn example() -> Result<()> {
1703///     let response: Response<BlobContainerClientReleaseLeaseResult, NoFormat> = unimplemented!();
1704///     // Access response headers
1705///     if let Some(etag) = response.etag()? {
1706///         println!("etag: {:?}", etag);
1707///     }
1708///     if let Some(last_modified) = response.last_modified()? {
1709///         println!("last-modified: {:?}", last_modified);
1710///     }
1711///     Ok(())
1712/// }
1713/// ```
1714pub trait BlobContainerClientReleaseLeaseResultHeaders: private::Sealed {
1715    fn etag(&self) -> Result<Option<Etag>>;
1716    fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
1717}
1718
1719impl BlobContainerClientReleaseLeaseResultHeaders
1720    for Response<BlobContainerClientReleaseLeaseResult, NoFormat>
1721{
1722    /// An opaque identifier for the current state of the resource.
1723    fn etag(&self) -> Result<Option<Etag>> {
1724        Headers::get_optional_as(self.headers(), &ETAG)
1725    }
1726
1727    /// The date-time that the resource was last modified.
1728    fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
1729        Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
1730            parse_rfc7231(h.as_str())
1731        })
1732    }
1733}
1734
1735/// Provides access to typed response headers for `BlobContainerClient::renew_lease()`
1736///
1737/// # Examples
1738///
1739/// ```no_run
1740/// use azure_core::{Result, http::{Response, NoFormat}};
1741/// use azure_storage_blob::models::{BlobContainerClientRenewLeaseResult, BlobContainerClientRenewLeaseResultHeaders};
1742/// async fn example() -> Result<()> {
1743///     let response: Response<BlobContainerClientRenewLeaseResult, NoFormat> = unimplemented!();
1744///     // Access response headers
1745///     if let Some(etag) = response.etag()? {
1746///         println!("etag: {:?}", etag);
1747///     }
1748///     if let Some(last_modified) = response.last_modified()? {
1749///         println!("last-modified: {:?}", last_modified);
1750///     }
1751///     if let Some(lease_id) = response.lease_id()? {
1752///         println!("x-ms-lease-id: {:?}", lease_id);
1753///     }
1754///     Ok(())
1755/// }
1756/// ```
1757pub trait BlobContainerClientRenewLeaseResultHeaders: private::Sealed {
1758    fn etag(&self) -> Result<Option<Etag>>;
1759    fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
1760    fn lease_id(&self) -> Result<Option<String>>;
1761}
1762
1763impl BlobContainerClientRenewLeaseResultHeaders
1764    for Response<BlobContainerClientRenewLeaseResult, NoFormat>
1765{
1766    /// An opaque identifier for the current state of the resource.
1767    fn etag(&self) -> Result<Option<Etag>> {
1768        Headers::get_optional_as(self.headers(), &ETAG)
1769    }
1770
1771    /// The date-time that the resource was last modified.
1772    fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
1773        Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
1774            parse_rfc7231(h.as_str())
1775        })
1776    }
1777
1778    /// Uniquely identifies a blob's lease.
1779    fn lease_id(&self) -> Result<Option<String>> {
1780        Headers::get_optional_as(self.headers(), &LEASE_ID)
1781    }
1782}
1783
1784/// Provides access to typed response headers for `BlobServiceClient::get_account_info()`
1785///
1786/// # Examples
1787///
1788/// ```no_run
1789/// use azure_core::{Result, http::{Response, NoFormat}};
1790/// use azure_storage_blob::models::{BlobServiceClientGetAccountInfoResult, BlobServiceClientGetAccountInfoResultHeaders};
1791/// async fn example() -> Result<()> {
1792///     let response: Response<BlobServiceClientGetAccountInfoResult, NoFormat> = unimplemented!();
1793///     // Access response headers
1794///     if let Some(account_kind) = response.account_kind()? {
1795///         println!("x-ms-account-kind: {:?}", account_kind);
1796///     }
1797///     if let Some(is_hierarchical_namespace_enabled) = response.is_hierarchical_namespace_enabled()? {
1798///         println!("x-ms-is-hns-enabled: {:?}", is_hierarchical_namespace_enabled);
1799///     }
1800///     if let Some(sku_name) = response.sku_name()? {
1801///         println!("x-ms-sku-name: {:?}", sku_name);
1802///     }
1803///     Ok(())
1804/// }
1805/// ```
1806pub trait BlobServiceClientGetAccountInfoResultHeaders: private::Sealed {
1807    fn account_kind(&self) -> Result<Option<AccountKind>>;
1808    fn is_hierarchical_namespace_enabled(&self) -> Result<Option<bool>>;
1809    fn sku_name(&self) -> Result<Option<SkuName>>;
1810}
1811
1812impl BlobServiceClientGetAccountInfoResultHeaders
1813    for Response<BlobServiceClientGetAccountInfoResult, NoFormat>
1814{
1815    /// The account kind.
1816    fn account_kind(&self) -> Result<Option<AccountKind>> {
1817        Headers::get_optional_as(self.headers(), &ACCOUNT_KIND)
1818    }
1819
1820    /// Indicates if the account has hierarchical namespace enabled.
1821    fn is_hierarchical_namespace_enabled(&self) -> Result<Option<bool>> {
1822        Headers::get_optional_as(self.headers(), &IS_HNS_ENABLED)
1823    }
1824
1825    /// The SKU name of the account.
1826    fn sku_name(&self) -> Result<Option<SkuName>> {
1827        Headers::get_optional_as(self.headers(), &SKU_NAME)
1828    }
1829}
1830
1831/// Provides access to typed response headers for `BlockBlobClient::commit_block_list()`
1832///
1833/// # Examples
1834///
1835/// ```no_run
1836/// use azure_core::{Result, http::{Response, NoFormat}};
1837/// use azure_storage_blob::models::{BlockBlobClientCommitBlockListResult, BlockBlobClientCommitBlockListResultHeaders};
1838/// async fn example() -> Result<()> {
1839///     let response: Response<BlockBlobClientCommitBlockListResult, NoFormat> = unimplemented!();
1840///     // Access response headers
1841///     if let Some(content_md5) = response.content_md5()? {
1842///         println!("content-md5: {:?}", content_md5);
1843///     }
1844///     if let Some(etag) = response.etag()? {
1845///         println!("etag: {:?}", etag);
1846///     }
1847///     if let Some(last_modified) = response.last_modified()? {
1848///         println!("last-modified: {:?}", last_modified);
1849///     }
1850///     Ok(())
1851/// }
1852/// ```
1853pub trait BlockBlobClientCommitBlockListResultHeaders: private::Sealed {
1854    fn content_md5(&self) -> Result<Option<Vec<u8>>>;
1855    fn etag(&self) -> Result<Option<Etag>>;
1856    fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
1857    fn content_crc64(&self) -> Result<Option<Vec<u8>>>;
1858    fn encryption_key_sha256(&self) -> Result<Option<String>>;
1859    fn encryption_scope(&self) -> Result<Option<String>>;
1860    fn is_server_encrypted(&self) -> Result<Option<bool>>;
1861    fn version_id(&self) -> Result<Option<String>>;
1862}
1863
1864impl BlockBlobClientCommitBlockListResultHeaders
1865    for Response<BlockBlobClientCommitBlockListResult, NoFormat>
1866{
1867    /// The blob content MD5 hash. Only returned if the full blob is read.
1868    fn content_md5(&self) -> Result<Option<Vec<u8>>> {
1869        Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| base64::decode(h.as_str()))
1870    }
1871
1872    /// An opaque identifier for the current state of the resource.
1873    fn etag(&self) -> Result<Option<Etag>> {
1874        Headers::get_optional_as(self.headers(), &ETAG)
1875    }
1876
1877    /// The date-time that the resource was last modified.
1878    fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
1879        Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
1880            parse_rfc7231(h.as_str())
1881        })
1882    }
1883
1884    /// The CRC64 hash of the content.
1885    fn content_crc64(&self) -> Result<Option<Vec<u8>>> {
1886        Headers::get_optional_with(self.headers(), &CONTENT_CRC64, |h| {
1887            base64::decode(h.as_str())
1888        })
1889    }
1890
1891    /// The SHA-256 hash of the provided encryption key.
1892    fn encryption_key_sha256(&self) -> Result<Option<String>> {
1893        Headers::get_optional_as(self.headers(), &ENCRYPTION_KEY_SHA256)
1894    }
1895
1896    /// Specifies the encryption scope used to encrypt the data.
1897    fn encryption_scope(&self) -> Result<Option<String>> {
1898        Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE)
1899    }
1900
1901    /// Indicates whether the contents of the request are successfully encrypted.
1902    fn is_server_encrypted(&self) -> Result<Option<bool>> {
1903        Headers::get_optional_as(self.headers(), &REQUEST_SERVER_ENCRYPTED)
1904    }
1905
1906    /// The version ID of the blob.
1907    fn version_id(&self) -> Result<Option<String>> {
1908        Headers::get_optional_as(self.headers(), &VERSION_ID)
1909    }
1910}
1911
1912/// Provides access to typed response headers for `BlockBlobClient::stage_block_from_url()`
1913///
1914/// # Examples
1915///
1916/// ```no_run
1917/// use azure_core::{Result, http::{Response, NoFormat}};
1918/// use azure_storage_blob::models::{BlockBlobClientStageBlockFromUrlResult, BlockBlobClientStageBlockFromUrlResultHeaders};
1919/// async fn example() -> Result<()> {
1920///     let response: Response<BlockBlobClientStageBlockFromUrlResult, NoFormat> = unimplemented!();
1921///     // Access response headers
1922///     if let Some(content_md5) = response.content_md5()? {
1923///         println!("content-md5: {:?}", content_md5);
1924///     }
1925///     if let Some(content_crc64) = response.content_crc64()? {
1926///         println!("x-ms-content-crc64: {:?}", content_crc64);
1927///     }
1928///     if let Some(encryption_key_sha256) = response.encryption_key_sha256()? {
1929///         println!("x-ms-encryption-key-sha256: {:?}", encryption_key_sha256);
1930///     }
1931///     Ok(())
1932/// }
1933/// ```
1934pub trait BlockBlobClientStageBlockFromUrlResultHeaders: private::Sealed {
1935    fn content_md5(&self) -> Result<Option<Vec<u8>>>;
1936    fn content_crc64(&self) -> Result<Option<Vec<u8>>>;
1937    fn encryption_key_sha256(&self) -> Result<Option<String>>;
1938    fn encryption_scope(&self) -> Result<Option<String>>;
1939    fn is_server_encrypted(&self) -> Result<Option<bool>>;
1940}
1941
1942impl BlockBlobClientStageBlockFromUrlResultHeaders
1943    for Response<BlockBlobClientStageBlockFromUrlResult, NoFormat>
1944{
1945    /// The blob content MD5 hash. Only returned if the full blob is read.
1946    fn content_md5(&self) -> Result<Option<Vec<u8>>> {
1947        Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| base64::decode(h.as_str()))
1948    }
1949
1950    /// The CRC64 hash of the content.
1951    fn content_crc64(&self) -> Result<Option<Vec<u8>>> {
1952        Headers::get_optional_with(self.headers(), &CONTENT_CRC64, |h| {
1953            base64::decode(h.as_str())
1954        })
1955    }
1956
1957    /// The SHA-256 hash of the provided encryption key.
1958    fn encryption_key_sha256(&self) -> Result<Option<String>> {
1959        Headers::get_optional_as(self.headers(), &ENCRYPTION_KEY_SHA256)
1960    }
1961
1962    /// Specifies the encryption scope used to encrypt the data.
1963    fn encryption_scope(&self) -> Result<Option<String>> {
1964        Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE)
1965    }
1966
1967    /// Indicates whether the contents of the request are successfully encrypted.
1968    fn is_server_encrypted(&self) -> Result<Option<bool>> {
1969        Headers::get_optional_as(self.headers(), &REQUEST_SERVER_ENCRYPTED)
1970    }
1971}
1972
1973/// Provides access to typed response headers for `BlockBlobClient::stage_block()`
1974///
1975/// # Examples
1976///
1977/// ```no_run
1978/// use azure_core::{Result, http::{Response, NoFormat}};
1979/// use azure_storage_blob::models::{BlockBlobClientStageBlockResult, BlockBlobClientStageBlockResultHeaders};
1980/// async fn example() -> Result<()> {
1981///     let response: Response<BlockBlobClientStageBlockResult, NoFormat> = unimplemented!();
1982///     // Access response headers
1983///     if let Some(content_md5) = response.content_md5()? {
1984///         println!("content-md5: {:?}", content_md5);
1985///     }
1986///     if let Some(content_crc64) = response.content_crc64()? {
1987///         println!("x-ms-content-crc64: {:?}", content_crc64);
1988///     }
1989///     if let Some(encryption_key_sha256) = response.encryption_key_sha256()? {
1990///         println!("x-ms-encryption-key-sha256: {:?}", encryption_key_sha256);
1991///     }
1992///     Ok(())
1993/// }
1994/// ```
1995pub trait BlockBlobClientStageBlockResultHeaders: private::Sealed {
1996    fn content_md5(&self) -> Result<Option<Vec<u8>>>;
1997    fn content_crc64(&self) -> Result<Option<Vec<u8>>>;
1998    fn encryption_key_sha256(&self) -> Result<Option<String>>;
1999    fn encryption_scope(&self) -> Result<Option<String>>;
2000    fn is_server_encrypted(&self) -> Result<Option<bool>>;
2001}
2002
2003impl BlockBlobClientStageBlockResultHeaders
2004    for Response<BlockBlobClientStageBlockResult, NoFormat>
2005{
2006    /// The blob content MD5 hash. Only returned if the full blob is read.
2007    fn content_md5(&self) -> Result<Option<Vec<u8>>> {
2008        Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| base64::decode(h.as_str()))
2009    }
2010
2011    /// The CRC64 hash of the content.
2012    fn content_crc64(&self) -> Result<Option<Vec<u8>>> {
2013        Headers::get_optional_with(self.headers(), &CONTENT_CRC64, |h| {
2014            base64::decode(h.as_str())
2015        })
2016    }
2017
2018    /// The SHA-256 hash of the provided encryption key.
2019    fn encryption_key_sha256(&self) -> Result<Option<String>> {
2020        Headers::get_optional_as(self.headers(), &ENCRYPTION_KEY_SHA256)
2021    }
2022
2023    /// Specifies the encryption scope used to encrypt the data.
2024    fn encryption_scope(&self) -> Result<Option<String>> {
2025        Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE)
2026    }
2027
2028    /// Indicates whether the contents of the request are successfully encrypted.
2029    fn is_server_encrypted(&self) -> Result<Option<bool>> {
2030        Headers::get_optional_as(self.headers(), &REQUEST_SERVER_ENCRYPTED)
2031    }
2032}
2033
2034/// Provides access to typed response headers for `BlockBlobClient::upload_blob_from_url()`
2035///
2036/// # Examples
2037///
2038/// ```no_run
2039/// use azure_core::{Result, http::{Response, NoFormat}};
2040/// use azure_storage_blob::models::{BlockBlobClientUploadBlobFromUrlResult, BlockBlobClientUploadBlobFromUrlResultHeaders};
2041/// async fn example() -> Result<()> {
2042///     let response: Response<BlockBlobClientUploadBlobFromUrlResult, NoFormat> = unimplemented!();
2043///     // Access response headers
2044///     if let Some(content_md5) = response.content_md5()? {
2045///         println!("content-md5: {:?}", content_md5);
2046///     }
2047///     if let Some(etag) = response.etag()? {
2048///         println!("etag: {:?}", etag);
2049///     }
2050///     if let Some(last_modified) = response.last_modified()? {
2051///         println!("last-modified: {:?}", last_modified);
2052///     }
2053///     Ok(())
2054/// }
2055/// ```
2056pub trait BlockBlobClientUploadBlobFromUrlResultHeaders: private::Sealed {
2057    fn content_md5(&self) -> Result<Option<Vec<u8>>>;
2058    fn etag(&self) -> Result<Option<Etag>>;
2059    fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
2060    fn encryption_key_sha256(&self) -> Result<Option<String>>;
2061    fn encryption_scope(&self) -> Result<Option<String>>;
2062    fn is_server_encrypted(&self) -> Result<Option<bool>>;
2063    fn version_id(&self) -> Result<Option<String>>;
2064}
2065
2066impl BlockBlobClientUploadBlobFromUrlResultHeaders
2067    for Response<BlockBlobClientUploadBlobFromUrlResult, NoFormat>
2068{
2069    /// The blob content MD5 hash. Only returned if the full blob is read.
2070    fn content_md5(&self) -> Result<Option<Vec<u8>>> {
2071        Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| base64::decode(h.as_str()))
2072    }
2073
2074    /// An opaque identifier for the current state of the resource.
2075    fn etag(&self) -> Result<Option<Etag>> {
2076        Headers::get_optional_as(self.headers(), &ETAG)
2077    }
2078
2079    /// The date-time that the resource was last modified.
2080    fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
2081        Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
2082            parse_rfc7231(h.as_str())
2083        })
2084    }
2085
2086    /// The SHA-256 hash of the provided encryption key.
2087    fn encryption_key_sha256(&self) -> Result<Option<String>> {
2088        Headers::get_optional_as(self.headers(), &ENCRYPTION_KEY_SHA256)
2089    }
2090
2091    /// Specifies the encryption scope used to encrypt the data.
2092    fn encryption_scope(&self) -> Result<Option<String>> {
2093        Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE)
2094    }
2095
2096    /// Indicates whether the contents of the request are successfully encrypted.
2097    fn is_server_encrypted(&self) -> Result<Option<bool>> {
2098        Headers::get_optional_as(self.headers(), &REQUEST_SERVER_ENCRYPTED)
2099    }
2100
2101    /// The version ID of the blob.
2102    fn version_id(&self) -> Result<Option<String>> {
2103        Headers::get_optional_as(self.headers(), &VERSION_ID)
2104    }
2105}
2106
2107/// Provides access to typed response headers for `BlockBlobClient::upload_internal()`
2108///
2109/// # Examples
2110///
2111/// ```ignore
2112/// use azure_core::{Result, http::{Response, NoFormat}};
2113/// use azure_storage_blob::models::{BlockBlobClientUploadInternalResult, BlockBlobClientUploadInternalResultHeaders};
2114/// async fn example() -> Result<()> {
2115///     let response: Response<BlockBlobClientUploadInternalResult, NoFormat> = unimplemented!();
2116///     // Access response headers
2117///     if let Some(content_md5) = response.content_md5()? {
2118///         println!("content-md5: {:?}", content_md5);
2119///     }
2120///     if let Some(etag) = response.etag()? {
2121///         println!("etag: {:?}", etag);
2122///     }
2123///     if let Some(last_modified) = response.last_modified()? {
2124///         println!("last-modified: {:?}", last_modified);
2125///     }
2126///     Ok(())
2127/// }
2128/// ```
2129pub(crate) trait BlockBlobClientUploadInternalResultHeaders: private::Sealed {
2130    fn content_md5(&self) -> Result<Option<Vec<u8>>>;
2131    fn etag(&self) -> Result<Option<Etag>>;
2132    fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
2133    fn content_crc64(&self) -> Result<Option<Vec<u8>>>;
2134    fn encryption_key_sha256(&self) -> Result<Option<String>>;
2135    fn encryption_scope(&self) -> Result<Option<String>>;
2136    fn is_server_encrypted(&self) -> Result<Option<bool>>;
2137    fn version_id(&self) -> Result<Option<String>>;
2138}
2139
2140impl BlockBlobClientUploadInternalResultHeaders
2141    for Response<BlockBlobClientUploadInternalResult, NoFormat>
2142{
2143    /// The blob content MD5 hash. Only returned if the full blob is read.
2144    fn content_md5(&self) -> Result<Option<Vec<u8>>> {
2145        Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| base64::decode(h.as_str()))
2146    }
2147
2148    /// An opaque identifier for the current state of the resource.
2149    fn etag(&self) -> Result<Option<Etag>> {
2150        Headers::get_optional_as(self.headers(), &ETAG)
2151    }
2152
2153    /// The date-time that the resource was last modified.
2154    fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
2155        Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
2156            parse_rfc7231(h.as_str())
2157        })
2158    }
2159
2160    /// The CRC64 hash of the content.
2161    fn content_crc64(&self) -> Result<Option<Vec<u8>>> {
2162        Headers::get_optional_with(self.headers(), &CONTENT_CRC64, |h| {
2163            base64::decode(h.as_str())
2164        })
2165    }
2166
2167    /// The SHA-256 hash of the provided encryption key.
2168    fn encryption_key_sha256(&self) -> Result<Option<String>> {
2169        Headers::get_optional_as(self.headers(), &ENCRYPTION_KEY_SHA256)
2170    }
2171
2172    /// Specifies the encryption scope used to encrypt the data.
2173    fn encryption_scope(&self) -> Result<Option<String>> {
2174        Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE)
2175    }
2176
2177    /// Indicates whether the contents of the request are successfully encrypted.
2178    fn is_server_encrypted(&self) -> Result<Option<bool>> {
2179        Headers::get_optional_as(self.headers(), &REQUEST_SERVER_ENCRYPTED)
2180    }
2181
2182    /// The version ID of the blob.
2183    fn version_id(&self) -> Result<Option<String>> {
2184        Headers::get_optional_as(self.headers(), &VERSION_ID)
2185    }
2186}
2187
2188/// Provides access to typed response headers for `BlockBlobClient::get_block_list()`
2189///
2190/// # Examples
2191///
2192/// ```no_run
2193/// use azure_core::{Result, http::{Response, XmlFormat}};
2194/// use azure_storage_blob::models::{BlockList, BlockListHeaders};
2195/// async fn example() -> Result<()> {
2196///     let response: Response<BlockList, XmlFormat> = unimplemented!();
2197///     // Access response headers
2198///     if let Some(etag) = response.etag()? {
2199///         println!("etag: {:?}", etag);
2200///     }
2201///     if let Some(last_modified) = response.last_modified()? {
2202///         println!("last-modified: {:?}", last_modified);
2203///     }
2204///     if let Some(blob_content_length) = response.blob_content_length()? {
2205///         println!("x-ms-blob-content-length: {:?}", blob_content_length);
2206///     }
2207///     Ok(())
2208/// }
2209/// ```
2210pub trait BlockListHeaders: private::Sealed {
2211    fn etag(&self) -> Result<Option<Etag>>;
2212    fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
2213    fn blob_content_length(&self) -> Result<Option<i64>>;
2214}
2215
2216impl BlockListHeaders for Response<BlockList, XmlFormat> {
2217    /// An opaque identifier for the current state of the resource.
2218    fn etag(&self) -> Result<Option<Etag>> {
2219        Headers::get_optional_as(self.headers(), &ETAG)
2220    }
2221
2222    /// The date-time that the resource was last modified.
2223    fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
2224        Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
2225            parse_rfc7231(h.as_str())
2226        })
2227    }
2228
2229    /// The size of the blob in bytes.
2230    fn blob_content_length(&self) -> Result<Option<i64>> {
2231        Headers::get_optional_as(self.headers(), &BLOB_CONTENT_LENGTH)
2232    }
2233}
2234
2235/// Provides access to typed response headers for `PageBlobClient::clear_pages()`
2236///
2237/// # Examples
2238///
2239/// ```no_run
2240/// use azure_core::{Result, http::{Response, NoFormat}};
2241/// use azure_storage_blob::models::{PageBlobClientClearPagesResult, PageBlobClientClearPagesResultHeaders};
2242/// async fn example() -> Result<()> {
2243///     let response: Response<PageBlobClientClearPagesResult, NoFormat> = unimplemented!();
2244///     // Access response headers
2245///     if let Some(content_md5) = response.content_md5()? {
2246///         println!("content-md5: {:?}", content_md5);
2247///     }
2248///     if let Some(etag) = response.etag()? {
2249///         println!("etag: {:?}", etag);
2250///     }
2251///     if let Some(last_modified) = response.last_modified()? {
2252///         println!("last-modified: {:?}", last_modified);
2253///     }
2254///     Ok(())
2255/// }
2256/// ```
2257pub trait PageBlobClientClearPagesResultHeaders: private::Sealed {
2258    fn content_md5(&self) -> Result<Option<Vec<u8>>>;
2259    fn etag(&self) -> Result<Option<Etag>>;
2260    fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
2261    fn blob_sequence_number(&self) -> Result<Option<i64>>;
2262    fn content_crc64(&self) -> Result<Option<Vec<u8>>>;
2263}
2264
2265impl PageBlobClientClearPagesResultHeaders for Response<PageBlobClientClearPagesResult, NoFormat> {
2266    /// The blob content MD5 hash. Only returned if the full blob is read.
2267    fn content_md5(&self) -> Result<Option<Vec<u8>>> {
2268        Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| base64::decode(h.as_str()))
2269    }
2270
2271    /// An opaque identifier for the current state of the resource.
2272    fn etag(&self) -> Result<Option<Etag>> {
2273        Headers::get_optional_as(self.headers(), &ETAG)
2274    }
2275
2276    /// The date-time that the resource was last modified.
2277    fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
2278        Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
2279            parse_rfc7231(h.as_str())
2280        })
2281    }
2282
2283    /// The current sequence number for a page blob.
2284    fn blob_sequence_number(&self) -> Result<Option<i64>> {
2285        Headers::get_optional_as(self.headers(), &BLOB_SEQUENCE_NUMBER)
2286    }
2287
2288    /// The CRC64 hash of the content.
2289    fn content_crc64(&self) -> Result<Option<Vec<u8>>> {
2290        Headers::get_optional_with(self.headers(), &CONTENT_CRC64, |h| {
2291            base64::decode(h.as_str())
2292        })
2293    }
2294}
2295
2296/// Provides access to typed response headers for `PageBlobClient::create()`
2297///
2298/// # Examples
2299///
2300/// ```no_run
2301/// use azure_core::{Result, http::{Response, NoFormat}};
2302/// use azure_storage_blob::models::{PageBlobClientCreateResult, PageBlobClientCreateResultHeaders};
2303/// async fn example() -> Result<()> {
2304///     let response: Response<PageBlobClientCreateResult, NoFormat> = unimplemented!();
2305///     // Access response headers
2306///     if let Some(content_md5) = response.content_md5()? {
2307///         println!("content-md5: {:?}", content_md5);
2308///     }
2309///     if let Some(etag) = response.etag()? {
2310///         println!("etag: {:?}", etag);
2311///     }
2312///     if let Some(last_modified) = response.last_modified()? {
2313///         println!("last-modified: {:?}", last_modified);
2314///     }
2315///     Ok(())
2316/// }
2317/// ```
2318pub trait PageBlobClientCreateResultHeaders: private::Sealed {
2319    fn content_md5(&self) -> Result<Option<Vec<u8>>>;
2320    fn etag(&self) -> Result<Option<Etag>>;
2321    fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
2322    fn encryption_key_sha256(&self) -> Result<Option<String>>;
2323    fn encryption_scope(&self) -> Result<Option<String>>;
2324    fn is_server_encrypted(&self) -> Result<Option<bool>>;
2325    fn version_id(&self) -> Result<Option<String>>;
2326}
2327
2328impl PageBlobClientCreateResultHeaders for Response<PageBlobClientCreateResult, NoFormat> {
2329    /// The blob content MD5 hash. Only returned if the full blob is read.
2330    fn content_md5(&self) -> Result<Option<Vec<u8>>> {
2331        Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| base64::decode(h.as_str()))
2332    }
2333
2334    /// An opaque identifier for the current state of the resource.
2335    fn etag(&self) -> Result<Option<Etag>> {
2336        Headers::get_optional_as(self.headers(), &ETAG)
2337    }
2338
2339    /// The date-time that the resource was last modified.
2340    fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
2341        Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
2342            parse_rfc7231(h.as_str())
2343        })
2344    }
2345
2346    /// The SHA-256 hash of the provided encryption key.
2347    fn encryption_key_sha256(&self) -> Result<Option<String>> {
2348        Headers::get_optional_as(self.headers(), &ENCRYPTION_KEY_SHA256)
2349    }
2350
2351    /// Specifies the encryption scope used to encrypt the data.
2352    fn encryption_scope(&self) -> Result<Option<String>> {
2353        Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE)
2354    }
2355
2356    /// Indicates whether the contents of the request are successfully encrypted.
2357    fn is_server_encrypted(&self) -> Result<Option<bool>> {
2358        Headers::get_optional_as(self.headers(), &REQUEST_SERVER_ENCRYPTED)
2359    }
2360
2361    /// The version ID of the blob.
2362    fn version_id(&self) -> Result<Option<String>> {
2363        Headers::get_optional_as(self.headers(), &VERSION_ID)
2364    }
2365}
2366
2367/// Provides access to typed response headers for `PageBlobClient::resize()`
2368///
2369/// # Examples
2370///
2371/// ```no_run
2372/// use azure_core::{Result, http::{Response, NoFormat}};
2373/// use azure_storage_blob::models::{PageBlobClientResizeResult, PageBlobClientResizeResultHeaders};
2374/// async fn example() -> Result<()> {
2375///     let response: Response<PageBlobClientResizeResult, NoFormat> = unimplemented!();
2376///     // Access response headers
2377///     if let Some(etag) = response.etag()? {
2378///         println!("etag: {:?}", etag);
2379///     }
2380///     if let Some(last_modified) = response.last_modified()? {
2381///         println!("last-modified: {:?}", last_modified);
2382///     }
2383///     if let Some(blob_sequence_number) = response.blob_sequence_number()? {
2384///         println!("x-ms-blob-sequence-number: {:?}", blob_sequence_number);
2385///     }
2386///     Ok(())
2387/// }
2388/// ```
2389pub trait PageBlobClientResizeResultHeaders: private::Sealed {
2390    fn etag(&self) -> Result<Option<Etag>>;
2391    fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
2392    fn blob_sequence_number(&self) -> Result<Option<i64>>;
2393}
2394
2395impl PageBlobClientResizeResultHeaders for Response<PageBlobClientResizeResult, NoFormat> {
2396    /// An opaque identifier for the current state of the resource.
2397    fn etag(&self) -> Result<Option<Etag>> {
2398        Headers::get_optional_as(self.headers(), &ETAG)
2399    }
2400
2401    /// The date-time that the resource was last modified.
2402    fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
2403        Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
2404            parse_rfc7231(h.as_str())
2405        })
2406    }
2407
2408    /// The current sequence number for a page blob.
2409    fn blob_sequence_number(&self) -> Result<Option<i64>> {
2410        Headers::get_optional_as(self.headers(), &BLOB_SEQUENCE_NUMBER)
2411    }
2412}
2413
2414/// Provides access to typed response headers for `PageBlobClient::set_sequence_number()`
2415///
2416/// # Examples
2417///
2418/// ```no_run
2419/// use azure_core::{Result, http::{Response, NoFormat}};
2420/// use azure_storage_blob::models::{PageBlobClientSetSequenceNumberResult, PageBlobClientSetSequenceNumberResultHeaders};
2421/// async fn example() -> Result<()> {
2422///     let response: Response<PageBlobClientSetSequenceNumberResult, NoFormat> = unimplemented!();
2423///     // Access response headers
2424///     if let Some(etag) = response.etag()? {
2425///         println!("etag: {:?}", etag);
2426///     }
2427///     if let Some(last_modified) = response.last_modified()? {
2428///         println!("last-modified: {:?}", last_modified);
2429///     }
2430///     if let Some(blob_sequence_number) = response.blob_sequence_number()? {
2431///         println!("x-ms-blob-sequence-number: {:?}", blob_sequence_number);
2432///     }
2433///     Ok(())
2434/// }
2435/// ```
2436pub trait PageBlobClientSetSequenceNumberResultHeaders: private::Sealed {
2437    fn etag(&self) -> Result<Option<Etag>>;
2438    fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
2439    fn blob_sequence_number(&self) -> Result<Option<i64>>;
2440}
2441
2442impl PageBlobClientSetSequenceNumberResultHeaders
2443    for Response<PageBlobClientSetSequenceNumberResult, NoFormat>
2444{
2445    /// An opaque identifier for the current state of the resource.
2446    fn etag(&self) -> Result<Option<Etag>> {
2447        Headers::get_optional_as(self.headers(), &ETAG)
2448    }
2449
2450    /// The date-time that the resource was last modified.
2451    fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
2452        Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
2453            parse_rfc7231(h.as_str())
2454        })
2455    }
2456
2457    /// The current sequence number for a page blob.
2458    fn blob_sequence_number(&self) -> Result<Option<i64>> {
2459        Headers::get_optional_as(self.headers(), &BLOB_SEQUENCE_NUMBER)
2460    }
2461}
2462
2463/// Provides access to typed response headers for `PageBlobClient::upload_pages_from_url()`
2464///
2465/// # Examples
2466///
2467/// ```no_run
2468/// use azure_core::{Result, http::{Response, NoFormat}};
2469/// use azure_storage_blob::models::{PageBlobClientUploadPagesFromUrlResult, PageBlobClientUploadPagesFromUrlResultHeaders};
2470/// async fn example() -> Result<()> {
2471///     let response: Response<PageBlobClientUploadPagesFromUrlResult, NoFormat> = unimplemented!();
2472///     // Access response headers
2473///     if let Some(content_md5) = response.content_md5()? {
2474///         println!("content-md5: {:?}", content_md5);
2475///     }
2476///     if let Some(etag) = response.etag()? {
2477///         println!("etag: {:?}", etag);
2478///     }
2479///     if let Some(last_modified) = response.last_modified()? {
2480///         println!("last-modified: {:?}", last_modified);
2481///     }
2482///     Ok(())
2483/// }
2484/// ```
2485pub trait PageBlobClientUploadPagesFromUrlResultHeaders: private::Sealed {
2486    fn content_md5(&self) -> Result<Option<Vec<u8>>>;
2487    fn etag(&self) -> Result<Option<Etag>>;
2488    fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
2489    fn blob_sequence_number(&self) -> Result<Option<i64>>;
2490    fn content_crc64(&self) -> Result<Option<Vec<u8>>>;
2491    fn encryption_key_sha256(&self) -> Result<Option<String>>;
2492    fn encryption_scope(&self) -> Result<Option<String>>;
2493    fn is_server_encrypted(&self) -> Result<Option<bool>>;
2494}
2495
2496impl PageBlobClientUploadPagesFromUrlResultHeaders
2497    for Response<PageBlobClientUploadPagesFromUrlResult, NoFormat>
2498{
2499    /// The blob content MD5 hash. Only returned if the full blob is read.
2500    fn content_md5(&self) -> Result<Option<Vec<u8>>> {
2501        Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| base64::decode(h.as_str()))
2502    }
2503
2504    /// An opaque identifier for the current state of the resource.
2505    fn etag(&self) -> Result<Option<Etag>> {
2506        Headers::get_optional_as(self.headers(), &ETAG)
2507    }
2508
2509    /// The date-time that the resource was last modified.
2510    fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
2511        Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
2512            parse_rfc7231(h.as_str())
2513        })
2514    }
2515
2516    /// The current sequence number for a page blob.
2517    fn blob_sequence_number(&self) -> Result<Option<i64>> {
2518        Headers::get_optional_as(self.headers(), &BLOB_SEQUENCE_NUMBER)
2519    }
2520
2521    /// The CRC64 hash of the content.
2522    fn content_crc64(&self) -> Result<Option<Vec<u8>>> {
2523        Headers::get_optional_with(self.headers(), &CONTENT_CRC64, |h| {
2524            base64::decode(h.as_str())
2525        })
2526    }
2527
2528    /// The SHA-256 hash of the provided encryption key.
2529    fn encryption_key_sha256(&self) -> Result<Option<String>> {
2530        Headers::get_optional_as(self.headers(), &ENCRYPTION_KEY_SHA256)
2531    }
2532
2533    /// Specifies the encryption scope used to encrypt the data.
2534    fn encryption_scope(&self) -> Result<Option<String>> {
2535        Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE)
2536    }
2537
2538    /// Indicates whether the contents of the request are successfully encrypted.
2539    fn is_server_encrypted(&self) -> Result<Option<bool>> {
2540        Headers::get_optional_as(self.headers(), &REQUEST_SERVER_ENCRYPTED)
2541    }
2542}
2543
2544/// Provides access to typed response headers for `PageBlobClient::upload_pages()`
2545///
2546/// # Examples
2547///
2548/// ```no_run
2549/// use azure_core::{Result, http::{Response, NoFormat}};
2550/// use azure_storage_blob::models::{PageBlobClientUploadPagesResult, PageBlobClientUploadPagesResultHeaders};
2551/// async fn example() -> Result<()> {
2552///     let response: Response<PageBlobClientUploadPagesResult, NoFormat> = unimplemented!();
2553///     // Access response headers
2554///     if let Some(content_md5) = response.content_md5()? {
2555///         println!("content-md5: {:?}", content_md5);
2556///     }
2557///     if let Some(etag) = response.etag()? {
2558///         println!("etag: {:?}", etag);
2559///     }
2560///     if let Some(last_modified) = response.last_modified()? {
2561///         println!("last-modified: {:?}", last_modified);
2562///     }
2563///     Ok(())
2564/// }
2565/// ```
2566pub trait PageBlobClientUploadPagesResultHeaders: private::Sealed {
2567    fn content_md5(&self) -> Result<Option<Vec<u8>>>;
2568    fn etag(&self) -> Result<Option<Etag>>;
2569    fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
2570    fn blob_sequence_number(&self) -> Result<Option<i64>>;
2571    fn content_crc64(&self) -> Result<Option<Vec<u8>>>;
2572    fn encryption_key_sha256(&self) -> Result<Option<String>>;
2573    fn encryption_scope(&self) -> Result<Option<String>>;
2574    fn is_server_encrypted(&self) -> Result<Option<bool>>;
2575}
2576
2577impl PageBlobClientUploadPagesResultHeaders
2578    for Response<PageBlobClientUploadPagesResult, NoFormat>
2579{
2580    /// The blob content MD5 hash. Only returned if the full blob is read.
2581    fn content_md5(&self) -> Result<Option<Vec<u8>>> {
2582        Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| base64::decode(h.as_str()))
2583    }
2584
2585    /// An opaque identifier for the current state of the resource.
2586    fn etag(&self) -> Result<Option<Etag>> {
2587        Headers::get_optional_as(self.headers(), &ETAG)
2588    }
2589
2590    /// The date-time that the resource was last modified.
2591    fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
2592        Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
2593            parse_rfc7231(h.as_str())
2594        })
2595    }
2596
2597    /// The current sequence number for a page blob.
2598    fn blob_sequence_number(&self) -> Result<Option<i64>> {
2599        Headers::get_optional_as(self.headers(), &BLOB_SEQUENCE_NUMBER)
2600    }
2601
2602    /// The CRC64 hash of the content.
2603    fn content_crc64(&self) -> Result<Option<Vec<u8>>> {
2604        Headers::get_optional_with(self.headers(), &CONTENT_CRC64, |h| {
2605            base64::decode(h.as_str())
2606        })
2607    }
2608
2609    /// The SHA-256 hash of the provided encryption key.
2610    fn encryption_key_sha256(&self) -> Result<Option<String>> {
2611        Headers::get_optional_as(self.headers(), &ENCRYPTION_KEY_SHA256)
2612    }
2613
2614    /// Specifies the encryption scope used to encrypt the data.
2615    fn encryption_scope(&self) -> Result<Option<String>> {
2616        Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE)
2617    }
2618
2619    /// Indicates whether the contents of the request are successfully encrypted.
2620    fn is_server_encrypted(&self) -> Result<Option<bool>> {
2621        Headers::get_optional_as(self.headers(), &REQUEST_SERVER_ENCRYPTED)
2622    }
2623}
2624
2625/// Provides access to typed response headers for `PageBlobClient::list_page_ranges()`
2626///
2627/// # Examples
2628///
2629/// ```no_run
2630/// use azure_core::{Result, http::{Response, XmlFormat}};
2631/// use azure_storage_blob::models::{PageList, PageListHeaders};
2632/// async fn example() -> Result<()> {
2633///     let response: Response<PageList, XmlFormat> = unimplemented!();
2634///     // Access response headers
2635///     if let Some(etag) = response.etag()? {
2636///         println!("etag: {:?}", etag);
2637///     }
2638///     if let Some(last_modified) = response.last_modified()? {
2639///         println!("last-modified: {:?}", last_modified);
2640///     }
2641///     if let Some(blob_content_length) = response.blob_content_length()? {
2642///         println!("x-ms-blob-content-length: {:?}", blob_content_length);
2643///     }
2644///     Ok(())
2645/// }
2646/// ```
2647pub trait PageListHeaders: private::Sealed {
2648    fn etag(&self) -> Result<Option<Etag>>;
2649    fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
2650    fn blob_content_length(&self) -> Result<Option<i64>>;
2651}
2652
2653impl PageListHeaders for Response<PageList, XmlFormat> {
2654    /// An opaque identifier for the current state of the resource.
2655    fn etag(&self) -> Result<Option<Etag>> {
2656        Headers::get_optional_as(self.headers(), &ETAG)
2657    }
2658
2659    /// The date-time that the resource was last modified.
2660    fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
2661        Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
2662            parse_rfc7231(h.as_str())
2663        })
2664    }
2665
2666    /// The size of the blob in bytes.
2667    fn blob_content_length(&self) -> Result<Option<i64>> {
2668        Headers::get_optional_as(self.headers(), &BLOB_CONTENT_LENGTH)
2669    }
2670}
2671
2672/// Provides access to typed response headers for `BlobContainerClient::get_access_policy()`
2673///
2674/// # Examples
2675///
2676/// ```no_run
2677/// use azure_core::{Result, http::{Response, XmlFormat}};
2678/// use azure_storage_blob::models::{SignedIdentifiers, SignedIdentifiersHeaders};
2679/// async fn example() -> Result<()> {
2680///     let response: Response<SignedIdentifiers, XmlFormat> = unimplemented!();
2681///     // Access response headers
2682///     if let Some(etag) = response.etag()? {
2683///         println!("etag: {:?}", etag);
2684///     }
2685///     if let Some(last_modified) = response.last_modified()? {
2686///         println!("last-modified: {:?}", last_modified);
2687///     }
2688///     if let Some(access) = response.access()? {
2689///         println!("x-ms-blob-public-access: {:?}", access);
2690///     }
2691///     Ok(())
2692/// }
2693/// ```
2694pub trait SignedIdentifiersHeaders: private::Sealed {
2695    fn etag(&self) -> Result<Option<Etag>>;
2696    fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
2697    fn access(&self) -> Result<Option<PublicAccessType>>;
2698}
2699
2700impl SignedIdentifiersHeaders for Response<SignedIdentifiers, XmlFormat> {
2701    /// An opaque identifier for the current state of the resource.
2702    fn etag(&self) -> Result<Option<Etag>> {
2703        Headers::get_optional_as(self.headers(), &ETAG)
2704    }
2705
2706    /// The date-time that the resource was last modified.
2707    fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
2708        Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
2709            parse_rfc7231(h.as_str())
2710        })
2711    }
2712
2713    /// The public access setting for the container.
2714    fn access(&self) -> Result<Option<PublicAccessType>> {
2715        Headers::get_optional_as(self.headers(), &BLOB_PUBLIC_ACCESS)
2716    }
2717}
2718
2719mod private {
2720    use super::{
2721        AppendBlobClientAppendBlockFromUrlResult, AppendBlobClientAppendBlockResult,
2722        AppendBlobClientCreateResult, AppendBlobClientSealResult, BlobClientAcquireLeaseResult,
2723        BlobClientBreakLeaseResult, BlobClientChangeLeaseResult, BlobClientCreateSnapshotResult,
2724        BlobClientDownloadInternalResult, BlobClientGetAccountInfoResult,
2725        BlobClientGetPropertiesResult, BlobClientReleaseLeaseResult, BlobClientRenewLeaseResult,
2726        BlobClientStartCopyFromUrlResult, BlobContainerClientAcquireLeaseResult,
2727        BlobContainerClientBreakLeaseResult, BlobContainerClientChangeLeaseResult,
2728        BlobContainerClientGetAccountInfoResult, BlobContainerClientGetPropertiesResult,
2729        BlobContainerClientReleaseLeaseResult, BlobContainerClientRenewLeaseResult,
2730        BlobServiceClientGetAccountInfoResult, BlockBlobClientCommitBlockListResult,
2731        BlockBlobClientStageBlockFromUrlResult, BlockBlobClientStageBlockResult,
2732        BlockBlobClientUploadBlobFromUrlResult, BlockBlobClientUploadInternalResult, BlockList,
2733        PageBlobClientClearPagesResult, PageBlobClientCreateResult, PageBlobClientResizeResult,
2734        PageBlobClientSetSequenceNumberResult, PageBlobClientUploadPagesFromUrlResult,
2735        PageBlobClientUploadPagesResult, PageList, SignedIdentifiers,
2736    };
2737    use azure_core::http::{AsyncResponse, NoFormat, Response, XmlFormat};
2738
2739    pub trait Sealed {}
2740
2741    impl Sealed for AsyncResponse<BlobClientDownloadInternalResult> {}
2742    impl Sealed for Response<AppendBlobClientAppendBlockFromUrlResult, NoFormat> {}
2743    impl Sealed for Response<AppendBlobClientAppendBlockResult, NoFormat> {}
2744    impl Sealed for Response<AppendBlobClientCreateResult, NoFormat> {}
2745    impl Sealed for Response<AppendBlobClientSealResult, NoFormat> {}
2746    impl Sealed for Response<BlobClientAcquireLeaseResult, NoFormat> {}
2747    impl Sealed for Response<BlobClientBreakLeaseResult, NoFormat> {}
2748    impl Sealed for Response<BlobClientChangeLeaseResult, NoFormat> {}
2749    impl Sealed for Response<BlobClientCreateSnapshotResult, NoFormat> {}
2750    impl Sealed for Response<BlobClientGetAccountInfoResult, NoFormat> {}
2751    impl Sealed for Response<BlobClientGetPropertiesResult, NoFormat> {}
2752    impl Sealed for Response<BlobClientReleaseLeaseResult, NoFormat> {}
2753    impl Sealed for Response<BlobClientRenewLeaseResult, NoFormat> {}
2754    impl Sealed for Response<BlobClientStartCopyFromUrlResult, NoFormat> {}
2755    impl Sealed for Response<BlobContainerClientAcquireLeaseResult, NoFormat> {}
2756    impl Sealed for Response<BlobContainerClientBreakLeaseResult, NoFormat> {}
2757    impl Sealed for Response<BlobContainerClientChangeLeaseResult, NoFormat> {}
2758    impl Sealed for Response<BlobContainerClientGetAccountInfoResult, NoFormat> {}
2759    impl Sealed for Response<BlobContainerClientGetPropertiesResult, NoFormat> {}
2760    impl Sealed for Response<BlobContainerClientReleaseLeaseResult, NoFormat> {}
2761    impl Sealed for Response<BlobContainerClientRenewLeaseResult, NoFormat> {}
2762    impl Sealed for Response<BlobServiceClientGetAccountInfoResult, NoFormat> {}
2763    impl Sealed for Response<BlockBlobClientCommitBlockListResult, NoFormat> {}
2764    impl Sealed for Response<BlockBlobClientStageBlockFromUrlResult, NoFormat> {}
2765    impl Sealed for Response<BlockBlobClientStageBlockResult, NoFormat> {}
2766    impl Sealed for Response<BlockBlobClientUploadBlobFromUrlResult, NoFormat> {}
2767    impl Sealed for Response<BlockBlobClientUploadInternalResult, NoFormat> {}
2768    impl Sealed for Response<BlockList, XmlFormat> {}
2769    impl Sealed for Response<PageBlobClientClearPagesResult, NoFormat> {}
2770    impl Sealed for Response<PageBlobClientCreateResult, NoFormat> {}
2771    impl Sealed for Response<PageBlobClientResizeResult, NoFormat> {}
2772    impl Sealed for Response<PageBlobClientSetSequenceNumberResult, NoFormat> {}
2773    impl Sealed for Response<PageBlobClientUploadPagesFromUrlResult, NoFormat> {}
2774    impl Sealed for Response<PageBlobClientUploadPagesResult, NoFormat> {}
2775    impl Sealed for Response<PageList, XmlFormat> {}
2776    impl Sealed for Response<SignedIdentifiers, XmlFormat> {}
2777}