azure_storage_blob/generated/models/header_traits.rs
1// Copyright (c) Microsoft Corporation. All rights reserved.
2//
3// Licensed under the MIT License. See License.txt in the project root for license information.
4// Code generated by Microsoft (R) Rust Code Generator. DO NOT EDIT.
5
6use super::{
7 AccountKind, AppendBlobClientAppendBlockFromUrlResult, AppendBlobClientAppendBlockResult,
8 AppendBlobClientCreateResult, AppendBlobClientSealResult, ArchiveStatus,
9 BlobClientAbortCopyFromUrlResult, BlobClientAcquireLeaseResult, BlobClientBreakLeaseResult,
10 BlobClientChangeLeaseResult, BlobClientCopyFromUrlResult, BlobClientCreateSnapshotResult,
11 BlobClientDeleteImmutabilityPolicyResult, BlobClientDownloadResult,
12 BlobClientGetAccountInfoResult, BlobClientGetPropertiesResult, BlobClientReleaseLeaseResult,
13 BlobClientRenewLeaseResult, BlobClientSetExpiryResult, BlobClientSetImmutabilityPolicyResult,
14 BlobClientSetLegalHoldResult, BlobClientStartCopyFromUrlResult, BlobClientUndeleteResult,
15 BlobContainerClientAcquireLeaseResult, BlobContainerClientBreakLeaseResult,
16 BlobContainerClientChangeLeaseResult, BlobContainerClientGetAccountInfoResult,
17 BlobContainerClientGetPropertiesResult, BlobContainerClientReleaseLeaseResult,
18 BlobContainerClientRenameResult, BlobContainerClientRenewLeaseResult,
19 BlobContainerClientRestoreResult, BlobContainerClientSetAccessPolicyResult,
20 BlobImmutabilityPolicyMode, BlobServiceClientGetAccountInfoResult, BlobTags, BlobType,
21 BlockBlobClientCommitBlockListResult, BlockBlobClientQueryResult,
22 BlockBlobClientStageBlockFromUrlResult, BlockBlobClientStageBlockResult,
23 BlockBlobClientUploadBlobFromUrlResult, BlockBlobClientUploadResult, BlockList, CopyStatus,
24 LeaseDuration, LeaseState, LeaseStatus, ListBlobsFlatSegmentResponse,
25 ListBlobsHierarchySegmentResponse, PageBlobClientClearPagesResult,
26 PageBlobClientCopyIncrementalResult, PageBlobClientCreateResult, PageBlobClientResizeResult,
27 PageBlobClientSetSequenceNumberResult, PageBlobClientUploadPagesFromUrlResult,
28 PageBlobClientUploadPagesResult, PageList, PublicAccessType, RehydratePriority,
29 SignedIdentifier, SkuName, StorageServiceStats, UserDelegationKey,
30};
31use azure_core::{
32 base64::decode,
33 http::{
34 headers::{HeaderName, Headers},
35 NoFormat, Response, XmlFormat,
36 },
37 time::{parse_rfc7231, OffsetDateTime},
38 Result,
39};
40use std::collections::HashMap;
41
42const ACCEPT_RANGES: HeaderName = HeaderName::from_static("accept-ranges");
43const ACCESS_TIER: HeaderName = HeaderName::from_static("x-ms-access-tier");
44const ACCESS_TIER_CHANGE_TIME: HeaderName = HeaderName::from_static("x-ms-access-tier-change-time");
45const ACCESS_TIER_INFERRED: HeaderName = HeaderName::from_static("x-ms-access-tier-inferred");
46const ACCOUNT_KIND: HeaderName = HeaderName::from_static("x-ms-account-kind");
47const ARCHIVE_STATUS: HeaderName = HeaderName::from_static("x-ms-archive-status");
48const BLOB_APPEND_OFFSET: HeaderName = HeaderName::from_static("x-ms-blob-append-offset");
49const BLOB_COMMITTED_BLOCK_COUNT: HeaderName =
50 HeaderName::from_static("x-ms-blob-committed-block-count");
51const BLOB_CONTENT_LENGTH: HeaderName = HeaderName::from_static("x-ms-blob-content-length");
52const BLOB_CONTENT_MD5: HeaderName = HeaderName::from_static("x-ms-blob-content-md5");
53const BLOB_PUBLIC_ACCESS: HeaderName = HeaderName::from_static("x-ms-blob-public-access");
54const BLOB_SEALED: HeaderName = HeaderName::from_static("x-ms-blob-sealed");
55const BLOB_SEQUENCE_NUMBER: HeaderName = HeaderName::from_static("x-ms-blob-sequence-number");
56const BLOB_TYPE: HeaderName = HeaderName::from_static("x-ms-blob-type");
57const CACHE_CONTROL: HeaderName = HeaderName::from_static("cache-control");
58const CONTENT_CRC64: HeaderName = HeaderName::from_static("x-ms-content-crc64");
59const CONTENT_DISPOSITION: HeaderName = HeaderName::from_static("content-disposition");
60const CONTENT_ENCODING: HeaderName = HeaderName::from_static("content-encoding");
61const CONTENT_LANGUAGE: HeaderName = HeaderName::from_static("content-language");
62const CONTENT_LENGTH: HeaderName = HeaderName::from_static("content-length");
63const CONTENT_MD5: HeaderName = HeaderName::from_static("content-md5");
64const CONTENT_RANGE: HeaderName = HeaderName::from_static("content-range");
65const COPY_COMPLETION_TIME: HeaderName = HeaderName::from_static("x-ms-copy-completion-time");
66const COPY_DESTINATION_SNAPSHOT: HeaderName =
67 HeaderName::from_static("x-ms-copy-destination-snapshot");
68const COPY_ID: HeaderName = HeaderName::from_static("x-ms-copy-id");
69const COPY_PROGRESS: HeaderName = HeaderName::from_static("x-ms-copy-progress");
70const COPY_SOURCE: HeaderName = HeaderName::from_static("x-ms-copy-source");
71const COPY_STATUS: HeaderName = HeaderName::from_static("x-ms-copy-status");
72const COPY_STATUS_DESCRIPTION: HeaderName = HeaderName::from_static("x-ms-copy-status-description");
73const CREATION_TIME: HeaderName = HeaderName::from_static("x-ms-creation-time");
74const DATE: HeaderName = HeaderName::from_static("date");
75const DEFAULT_ENCRYPTION_SCOPE: HeaderName =
76 HeaderName::from_static("x-ms-default-encryption-scope");
77const DENY_ENCRYPTION_SCOPE_OVERRIDE: HeaderName =
78 HeaderName::from_static("x-ms-deny-encryption-scope-override");
79const ENCRYPTION_KEY_SHA256: HeaderName = HeaderName::from_static("x-ms-encryption-key-sha256");
80const ENCRYPTION_SCOPE: HeaderName = HeaderName::from_static("x-ms-encryption-scope");
81const ETAG: HeaderName = HeaderName::from_static("etag");
82const EXPIRY_TIME: HeaderName = HeaderName::from_static("x-ms-expiry-time");
83const HAS_IMMUTABILITY_POLICY: HeaderName = HeaderName::from_static("x-ms-has-immutability-policy");
84const HAS_LEGAL_HOLD: HeaderName = HeaderName::from_static("x-ms-has-legal-hold");
85const IMMUTABILITY_POLICY_MODE: HeaderName =
86 HeaderName::from_static("x-ms-immutability-policy-mode");
87const IMMUTABILITY_POLICY_UNTIL_DATE: HeaderName =
88 HeaderName::from_static("x-ms-immutability-policy-until-date");
89const IMMUTABLE_STORAGE_WITH_VERSIONING_ENABLED: HeaderName =
90 HeaderName::from_static("x-ms-immutable-storage-with-versioning-enabled");
91const INCREMENTAL_COPY: HeaderName = HeaderName::from_static("x-ms-incremental-copy");
92const IS_CURRENT_VERSION: HeaderName = HeaderName::from_static("x-ms-is-current-version");
93const IS_HNS_ENABLED: HeaderName = HeaderName::from_static("x-ms-is-hns-enabled");
94const LAST_ACCESS_TIME: HeaderName = HeaderName::from_static("x-ms-last-access-time");
95const LAST_MODIFIED: HeaderName = HeaderName::from_static("last-modified");
96const LEASE_DURATION: HeaderName = HeaderName::from_static("x-ms-lease-duration");
97const LEASE_ID: HeaderName = HeaderName::from_static("x-ms-lease-id");
98const LEASE_STATE: HeaderName = HeaderName::from_static("x-ms-lease-state");
99const LEASE_STATUS: HeaderName = HeaderName::from_static("x-ms-lease-status");
100const LEASE_TIME: HeaderName = HeaderName::from_static("x-ms-lease-time");
101const LEGAL_HOLD: HeaderName = HeaderName::from_static("x-ms-legal-hold");
102const META: &str = "x-ms-meta-";
103const OR: &str = "x-ms-or-";
104const OR_POLICY_ID: HeaderName = HeaderName::from_static("x-ms-or-policy-id");
105const REHYDRATE_PRIORITY: HeaderName = HeaderName::from_static("x-ms-rehydrate-priority");
106const REQUEST_SERVER_ENCRYPTED: HeaderName =
107 HeaderName::from_static("x-ms-request-server-encrypted");
108const SERVER_ENCRYPTED: HeaderName = HeaderName::from_static("x-ms-server-encrypted");
109const SKU_NAME: HeaderName = HeaderName::from_static("x-ms-sku-name");
110const SNAPSHOT: HeaderName = HeaderName::from_static("x-ms-snapshot");
111const TAG_COUNT: HeaderName = HeaderName::from_static("x-ms-tag-count");
112const VERSION_ID: HeaderName = HeaderName::from_static("x-ms-version-id");
113
114/// Provides access to typed response headers for `AppendBlobClient::append_block_from_url()`
115///
116/// # Examples
117///
118/// ```no_run
119/// use azure_core::{Result, http::{Response, NoFormat}};
120/// use azure_storage_blob::models::{AppendBlobClientAppendBlockFromUrlResult, AppendBlobClientAppendBlockFromUrlResultHeaders};
121/// async fn example() -> Result<()> {
122/// let response: Response<AppendBlobClientAppendBlockFromUrlResult, NoFormat> = unimplemented!();
123/// // Access response headers
124/// if let Some(content_md5) = response.content_md5()? {
125/// println!("Content-MD5: {:?}", content_md5);
126/// }
127/// if let Some(last_modified) = response.last_modified()? {
128/// println!("Last-Modified: {:?}", last_modified);
129/// }
130/// if let Some(etag) = response.etag()? {
131/// println!("etag: {:?}", etag);
132/// }
133/// Ok(())
134/// }
135/// ```
136pub trait AppendBlobClientAppendBlockFromUrlResultHeaders: private::Sealed {
137 fn content_md5(&self) -> Result<Option<Vec<u8>>>;
138 fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
139 fn etag(&self) -> Result<Option<String>>;
140 fn blob_append_offset(&self) -> Result<Option<String>>;
141 fn blob_committed_block_count(&self) -> Result<Option<i32>>;
142 fn content_crc64(&self) -> Result<Option<Vec<u8>>>;
143 fn encryption_key_sha256(&self) -> Result<Option<String>>;
144 fn encryption_scope(&self) -> Result<Option<String>>;
145 fn is_server_encrypted(&self) -> Result<Option<bool>>;
146}
147
148impl AppendBlobClientAppendBlockFromUrlResultHeaders
149 for Response<AppendBlobClientAppendBlockFromUrlResult, NoFormat>
150{
151 /// If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the
152 /// client can check for message content integrity.
153 fn content_md5(&self) -> Result<Option<Vec<u8>>> {
154 Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| decode(h.as_str()))
155 }
156
157 /// The date/time that the container was last modified.
158 fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
159 Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
160 parse_rfc7231(h.as_str())
161 })
162 }
163
164 /// The ETag contains a value that you can use to perform operations conditionally.
165 fn etag(&self) -> Result<Option<String>> {
166 Headers::get_optional_as(self.headers(), &ETAG)
167 }
168
169 /// This response header is returned only for append operations. It returns the offset at which the block was committed, in
170 /// bytes.
171 fn blob_append_offset(&self) -> Result<Option<String>> {
172 Headers::get_optional_as(self.headers(), &BLOB_APPEND_OFFSET)
173 }
174
175 /// The number of committed blocks present in the blob. This header is returned only for append blobs.
176 fn blob_committed_block_count(&self) -> Result<Option<i32>> {
177 Headers::get_optional_as(self.headers(), &BLOB_COMMITTED_BLOCK_COUNT)
178 }
179
180 /// This response header is returned so that the client can check for the integrity of the copied content.
181 fn content_crc64(&self) -> Result<Option<Vec<u8>>> {
182 Headers::get_optional_with(self.headers(), &CONTENT_CRC64, |h| decode(h.as_str()))
183 }
184
185 /// The SHA-256 hash of the encryption key used to encrypt the blob. This header is only returned when the blob was encrypted
186 /// with a customer-provided key.
187 fn encryption_key_sha256(&self) -> Result<Option<String>> {
188 Headers::get_optional_as(self.headers(), &ENCRYPTION_KEY_SHA256)
189 }
190
191 /// If the blob has a MD5 hash, and if request contains range header (Range or x-ms-range), this response header is returned
192 /// with the value of the whole blob's MD5 value. This value may or may not be equal to the value returned in Content-MD5
193 /// header, with the latter calculated from the requested range
194 fn encryption_scope(&self) -> Result<Option<String>> {
195 Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE)
196 }
197
198 /// The value of this header is set to true if the contents of the request are successfully encrypted using the specified
199 /// algorithm, and false otherwise.
200 fn is_server_encrypted(&self) -> Result<Option<bool>> {
201 Headers::get_optional_as(self.headers(), &REQUEST_SERVER_ENCRYPTED)
202 }
203}
204
205/// Provides access to typed response headers for `AppendBlobClient::append_block()`
206///
207/// # Examples
208///
209/// ```no_run
210/// use azure_core::{Result, http::{Response, NoFormat}};
211/// use azure_storage_blob::models::{AppendBlobClientAppendBlockResult, AppendBlobClientAppendBlockResultHeaders};
212/// async fn example() -> Result<()> {
213/// let response: Response<AppendBlobClientAppendBlockResult, NoFormat> = unimplemented!();
214/// // Access response headers
215/// if let Some(content_md5) = response.content_md5()? {
216/// println!("Content-MD5: {:?}", content_md5);
217/// }
218/// if let Some(last_modified) = response.last_modified()? {
219/// println!("Last-Modified: {:?}", last_modified);
220/// }
221/// if let Some(etag) = response.etag()? {
222/// println!("etag: {:?}", etag);
223/// }
224/// Ok(())
225/// }
226/// ```
227pub trait AppendBlobClientAppendBlockResultHeaders: private::Sealed {
228 fn content_md5(&self) -> Result<Option<Vec<u8>>>;
229 fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
230 fn etag(&self) -> Result<Option<String>>;
231 fn blob_append_offset(&self) -> Result<Option<String>>;
232 fn blob_committed_block_count(&self) -> Result<Option<i32>>;
233 fn content_crc64(&self) -> Result<Option<Vec<u8>>>;
234 fn encryption_key_sha256(&self) -> Result<Option<String>>;
235 fn encryption_scope(&self) -> Result<Option<String>>;
236 fn is_server_encrypted(&self) -> Result<Option<bool>>;
237}
238
239impl AppendBlobClientAppendBlockResultHeaders
240 for Response<AppendBlobClientAppendBlockResult, NoFormat>
241{
242 /// If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the
243 /// client can check for message content integrity.
244 fn content_md5(&self) -> Result<Option<Vec<u8>>> {
245 Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| decode(h.as_str()))
246 }
247
248 /// The date/time that the container was last modified.
249 fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
250 Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
251 parse_rfc7231(h.as_str())
252 })
253 }
254
255 /// The ETag contains a value that you can use to perform operations conditionally.
256 fn etag(&self) -> Result<Option<String>> {
257 Headers::get_optional_as(self.headers(), &ETAG)
258 }
259
260 /// This response header is returned only for append operations. It returns the offset at which the block was committed, in
261 /// bytes.
262 fn blob_append_offset(&self) -> Result<Option<String>> {
263 Headers::get_optional_as(self.headers(), &BLOB_APPEND_OFFSET)
264 }
265
266 /// The number of committed blocks present in the blob. This header is returned only for append blobs.
267 fn blob_committed_block_count(&self) -> Result<Option<i32>> {
268 Headers::get_optional_as(self.headers(), &BLOB_COMMITTED_BLOCK_COUNT)
269 }
270
271 /// This response header is returned so that the client can check for the integrity of the copied content.
272 fn content_crc64(&self) -> Result<Option<Vec<u8>>> {
273 Headers::get_optional_with(self.headers(), &CONTENT_CRC64, |h| decode(h.as_str()))
274 }
275
276 /// The SHA-256 hash of the encryption key used to encrypt the blob. This header is only returned when the blob was encrypted
277 /// with a customer-provided key.
278 fn encryption_key_sha256(&self) -> Result<Option<String>> {
279 Headers::get_optional_as(self.headers(), &ENCRYPTION_KEY_SHA256)
280 }
281
282 /// If the blob has a MD5 hash, and if request contains range header (Range or x-ms-range), this response header is returned
283 /// with the value of the whole blob's MD5 value. This value may or may not be equal to the value returned in Content-MD5
284 /// header, with the latter calculated from the requested range
285 fn encryption_scope(&self) -> Result<Option<String>> {
286 Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE)
287 }
288
289 /// The value of this header is set to true if the contents of the request are successfully encrypted using the specified
290 /// algorithm, and false otherwise.
291 fn is_server_encrypted(&self) -> Result<Option<bool>> {
292 Headers::get_optional_as(self.headers(), &REQUEST_SERVER_ENCRYPTED)
293 }
294}
295
296/// Provides access to typed response headers for `AppendBlobClient::create()`
297///
298/// # Examples
299///
300/// ```no_run
301/// use azure_core::{Result, http::{Response, NoFormat}};
302/// use azure_storage_blob::models::{AppendBlobClientCreateResult, AppendBlobClientCreateResultHeaders};
303/// async fn example() -> Result<()> {
304/// let response: Response<AppendBlobClientCreateResult, NoFormat> = unimplemented!();
305/// // Access response headers
306/// if let Some(content_md5) = response.content_md5()? {
307/// println!("Content-MD5: {:?}", content_md5);
308/// }
309/// if let Some(last_modified) = response.last_modified()? {
310/// println!("Last-Modified: {:?}", last_modified);
311/// }
312/// if let Some(etag) = response.etag()? {
313/// println!("etag: {:?}", etag);
314/// }
315/// Ok(())
316/// }
317/// ```
318pub trait AppendBlobClientCreateResultHeaders: private::Sealed {
319 fn content_md5(&self) -> Result<Option<Vec<u8>>>;
320 fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
321 fn etag(&self) -> Result<Option<String>>;
322 fn encryption_key_sha256(&self) -> Result<Option<String>>;
323 fn encryption_scope(&self) -> Result<Option<String>>;
324 fn is_server_encrypted(&self) -> Result<Option<bool>>;
325 fn version_id(&self) -> Result<Option<String>>;
326}
327
328impl AppendBlobClientCreateResultHeaders for Response<AppendBlobClientCreateResult, NoFormat> {
329 /// If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the
330 /// client can check for message content integrity.
331 fn content_md5(&self) -> Result<Option<Vec<u8>>> {
332 Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| decode(h.as_str()))
333 }
334
335 /// The date/time that the container was last modified.
336 fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
337 Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
338 parse_rfc7231(h.as_str())
339 })
340 }
341
342 /// The ETag contains a value that you can use to perform operations conditionally.
343 fn etag(&self) -> Result<Option<String>> {
344 Headers::get_optional_as(self.headers(), &ETAG)
345 }
346
347 /// The SHA-256 hash of the encryption key used to encrypt the blob. This header is only returned when the blob was encrypted
348 /// with a customer-provided key.
349 fn encryption_key_sha256(&self) -> Result<Option<String>> {
350 Headers::get_optional_as(self.headers(), &ENCRYPTION_KEY_SHA256)
351 }
352
353 /// If the blob has a MD5 hash, and if request contains range header (Range or x-ms-range), this response header is returned
354 /// with the value of the whole blob's MD5 value. This value may or may not be equal to the value returned in Content-MD5
355 /// header, with the latter calculated from the requested range
356 fn encryption_scope(&self) -> Result<Option<String>> {
357 Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE)
358 }
359
360 /// The value of this header is set to true if the contents of the request are successfully encrypted using the specified
361 /// algorithm, and false otherwise.
362 fn is_server_encrypted(&self) -> Result<Option<bool>> {
363 Headers::get_optional_as(self.headers(), &REQUEST_SERVER_ENCRYPTED)
364 }
365
366 /// A DateTime value returned by the service that uniquely identifies the blob. The value of this header indicates the blob
367 /// version, and may be used in subsequent requests to access this version of the blob.
368 fn version_id(&self) -> Result<Option<String>> {
369 Headers::get_optional_as(self.headers(), &VERSION_ID)
370 }
371}
372
373/// Provides access to typed response headers for `AppendBlobClient::seal()`
374///
375/// # Examples
376///
377/// ```no_run
378/// use azure_core::{Result, http::{Response, NoFormat}};
379/// use azure_storage_blob::models::{AppendBlobClientSealResult, AppendBlobClientSealResultHeaders};
380/// async fn example() -> Result<()> {
381/// let response: Response<AppendBlobClientSealResult, NoFormat> = unimplemented!();
382/// // Access response headers
383/// if let Some(last_modified) = response.last_modified()? {
384/// println!("Last-Modified: {:?}", last_modified);
385/// }
386/// if let Some(etag) = response.etag()? {
387/// println!("etag: {:?}", etag);
388/// }
389/// if let Some(is_sealed) = response.is_sealed()? {
390/// println!("x-ms-blob-sealed: {:?}", is_sealed);
391/// }
392/// Ok(())
393/// }
394/// ```
395pub trait AppendBlobClientSealResultHeaders: private::Sealed {
396 fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
397 fn etag(&self) -> Result<Option<String>>;
398 fn is_sealed(&self) -> Result<Option<bool>>;
399}
400
401impl AppendBlobClientSealResultHeaders for Response<AppendBlobClientSealResult, NoFormat> {
402 /// The date/time that the container was last modified.
403 fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
404 Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
405 parse_rfc7231(h.as_str())
406 })
407 }
408
409 /// The ETag contains a value that you can use to perform operations conditionally.
410 fn etag(&self) -> Result<Option<String>> {
411 Headers::get_optional_as(self.headers(), &ETAG)
412 }
413
414 /// If this blob has been sealed
415 fn is_sealed(&self) -> Result<Option<bool>> {
416 Headers::get_optional_as(self.headers(), &BLOB_SEALED)
417 }
418}
419
420/// Provides access to typed response headers for `BlobClient::abort_copy_from_url()`
421///
422/// # Examples
423///
424/// ```no_run
425/// use azure_core::{Result, http::{Response, NoFormat}};
426/// use azure_storage_blob::models::{BlobClientAbortCopyFromUrlResult, BlobClientAbortCopyFromUrlResultHeaders};
427/// async fn example() -> Result<()> {
428/// let response: Response<BlobClientAbortCopyFromUrlResult, NoFormat> = unimplemented!();
429/// // Access response headers
430/// if let Some(date) = response.date()? {
431/// println!("Date: {:?}", date);
432/// }
433/// Ok(())
434/// }
435/// ```
436pub trait BlobClientAbortCopyFromUrlResultHeaders: private::Sealed {
437 fn date(&self) -> Result<Option<OffsetDateTime>>;
438}
439
440impl BlobClientAbortCopyFromUrlResultHeaders
441 for Response<BlobClientAbortCopyFromUrlResult, NoFormat>
442{
443 /// UTC date/time value generated by the service that indicates the time at which the response was initiated
444 fn date(&self) -> Result<Option<OffsetDateTime>> {
445 Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str()))
446 }
447}
448
449/// Provides access to typed response headers for `BlobClient::acquire_lease()`
450///
451/// # Examples
452///
453/// ```no_run
454/// use azure_core::{Result, http::{Response, NoFormat}};
455/// use azure_storage_blob::models::{BlobClientAcquireLeaseResult, BlobClientAcquireLeaseResultHeaders};
456/// async fn example() -> Result<()> {
457/// let response: Response<BlobClientAcquireLeaseResult, NoFormat> = unimplemented!();
458/// // Access response headers
459/// if let Some(last_modified) = response.last_modified()? {
460/// println!("Last-Modified: {:?}", last_modified);
461/// }
462/// if let Some(etag) = response.etag()? {
463/// println!("etag: {:?}", etag);
464/// }
465/// if let Some(lease_id) = response.lease_id()? {
466/// println!("x-ms-lease-id: {:?}", lease_id);
467/// }
468/// Ok(())
469/// }
470/// ```
471pub trait BlobClientAcquireLeaseResultHeaders: private::Sealed {
472 fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
473 fn etag(&self) -> Result<Option<String>>;
474 fn lease_id(&self) -> Result<Option<String>>;
475}
476
477impl BlobClientAcquireLeaseResultHeaders for Response<BlobClientAcquireLeaseResult, NoFormat> {
478 /// The date/time that the container was last modified.
479 fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
480 Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
481 parse_rfc7231(h.as_str())
482 })
483 }
484
485 /// The ETag contains a value that you can use to perform operations conditionally.
486 fn etag(&self) -> Result<Option<String>> {
487 Headers::get_optional_as(self.headers(), &ETAG)
488 }
489
490 /// Uniquely identifies a blobs' lease
491 fn lease_id(&self) -> Result<Option<String>> {
492 Headers::get_optional_as(self.headers(), &LEASE_ID)
493 }
494}
495
496/// Provides access to typed response headers for `BlobClient::break_lease()`
497///
498/// # Examples
499///
500/// ```no_run
501/// use azure_core::{Result, http::{Response, NoFormat}};
502/// use azure_storage_blob::models::{BlobClientBreakLeaseResult, BlobClientBreakLeaseResultHeaders};
503/// async fn example() -> Result<()> {
504/// let response: Response<BlobClientBreakLeaseResult, NoFormat> = unimplemented!();
505/// // Access response headers
506/// if let Some(last_modified) = response.last_modified()? {
507/// println!("Last-Modified: {:?}", last_modified);
508/// }
509/// if let Some(etag) = response.etag()? {
510/// println!("etag: {:?}", etag);
511/// }
512/// if let Some(lease_time) = response.lease_time()? {
513/// println!("x-ms-lease-time: {:?}", lease_time);
514/// }
515/// Ok(())
516/// }
517/// ```
518pub trait BlobClientBreakLeaseResultHeaders: private::Sealed {
519 fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
520 fn etag(&self) -> Result<Option<String>>;
521 fn lease_time(&self) -> Result<Option<i32>>;
522}
523
524impl BlobClientBreakLeaseResultHeaders for Response<BlobClientBreakLeaseResult, NoFormat> {
525 /// The date/time that the container was last modified.
526 fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
527 Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
528 parse_rfc7231(h.as_str())
529 })
530 }
531
532 /// The ETag contains a value that you can use to perform operations conditionally.
533 fn etag(&self) -> Result<Option<String>> {
534 Headers::get_optional_as(self.headers(), &ETAG)
535 }
536
537 /// Approximate time remaining in the lease period, in seconds.
538 fn lease_time(&self) -> Result<Option<i32>> {
539 Headers::get_optional_as(self.headers(), &LEASE_TIME)
540 }
541}
542
543/// Provides access to typed response headers for `BlobClient::change_lease()`
544///
545/// # Examples
546///
547/// ```no_run
548/// use azure_core::{Result, http::{Response, NoFormat}};
549/// use azure_storage_blob::models::{BlobClientChangeLeaseResult, BlobClientChangeLeaseResultHeaders};
550/// async fn example() -> Result<()> {
551/// let response: Response<BlobClientChangeLeaseResult, NoFormat> = unimplemented!();
552/// // Access response headers
553/// if let Some(last_modified) = response.last_modified()? {
554/// println!("Last-Modified: {:?}", last_modified);
555/// }
556/// if let Some(etag) = response.etag()? {
557/// println!("etag: {:?}", etag);
558/// }
559/// if let Some(lease_id) = response.lease_id()? {
560/// println!("x-ms-lease-id: {:?}", lease_id);
561/// }
562/// Ok(())
563/// }
564/// ```
565pub trait BlobClientChangeLeaseResultHeaders: private::Sealed {
566 fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
567 fn etag(&self) -> Result<Option<String>>;
568 fn lease_id(&self) -> Result<Option<String>>;
569}
570
571impl BlobClientChangeLeaseResultHeaders for Response<BlobClientChangeLeaseResult, NoFormat> {
572 /// The date/time that the container was last modified.
573 fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
574 Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
575 parse_rfc7231(h.as_str())
576 })
577 }
578
579 /// The ETag contains a value that you can use to perform operations conditionally.
580 fn etag(&self) -> Result<Option<String>> {
581 Headers::get_optional_as(self.headers(), &ETAG)
582 }
583
584 /// Uniquely identifies a blobs' lease
585 fn lease_id(&self) -> Result<Option<String>> {
586 Headers::get_optional_as(self.headers(), &LEASE_ID)
587 }
588}
589
590/// Provides access to typed response headers for `BlobClient::copy_from_url()`
591///
592/// # Examples
593///
594/// ```no_run
595/// use azure_core::{Result, http::{Response, NoFormat}};
596/// use azure_storage_blob::models::{BlobClientCopyFromUrlResult, BlobClientCopyFromUrlResultHeaders};
597/// async fn example() -> Result<()> {
598/// let response: Response<BlobClientCopyFromUrlResult, NoFormat> = unimplemented!();
599/// // Access response headers
600/// if let Some(content_md5) = response.content_md5()? {
601/// println!("Content-MD5: {:?}", content_md5);
602/// }
603/// if let Some(date) = response.date()? {
604/// println!("Date: {:?}", date);
605/// }
606/// if let Some(last_modified) = response.last_modified()? {
607/// println!("Last-Modified: {:?}", last_modified);
608/// }
609/// Ok(())
610/// }
611/// ```
612pub trait BlobClientCopyFromUrlResultHeaders: private::Sealed {
613 fn content_md5(&self) -> Result<Option<Vec<u8>>>;
614 fn date(&self) -> Result<Option<OffsetDateTime>>;
615 fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
616 fn etag(&self) -> Result<Option<String>>;
617 fn content_crc64(&self) -> Result<Option<Vec<u8>>>;
618 fn copy_id(&self) -> Result<Option<String>>;
619 fn encryption_scope(&self) -> Result<Option<String>>;
620 fn version_id(&self) -> Result<Option<String>>;
621}
622
623impl BlobClientCopyFromUrlResultHeaders for Response<BlobClientCopyFromUrlResult, NoFormat> {
624 /// If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the
625 /// client can check for message content integrity.
626 fn content_md5(&self) -> Result<Option<Vec<u8>>> {
627 Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| decode(h.as_str()))
628 }
629
630 /// UTC date/time value generated by the service that indicates the time at which the response was initiated
631 fn date(&self) -> Result<Option<OffsetDateTime>> {
632 Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str()))
633 }
634
635 /// The date/time that the container was last modified.
636 fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
637 Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
638 parse_rfc7231(h.as_str())
639 })
640 }
641
642 /// The ETag contains a value that you can use to perform operations conditionally.
643 fn etag(&self) -> Result<Option<String>> {
644 Headers::get_optional_as(self.headers(), &ETAG)
645 }
646
647 /// This response header is returned so that the client can check for the integrity of the copied content.
648 fn content_crc64(&self) -> Result<Option<Vec<u8>>> {
649 Headers::get_optional_with(self.headers(), &CONTENT_CRC64, |h| decode(h.as_str()))
650 }
651
652 /// String identifier for this copy operation. Use with Get Blob Properties to check the status of this copy operation, or
653 /// pass to Abort Copy Blob to abort a pending copy.
654 fn copy_id(&self) -> Result<Option<String>> {
655 Headers::get_optional_as(self.headers(), ©_ID)
656 }
657
658 /// If the blob has a MD5 hash, and if request contains range header (Range or x-ms-range), this response header is returned
659 /// with the value of the whole blob's MD5 value. This value may or may not be equal to the value returned in Content-MD5
660 /// header, with the latter calculated from the requested range
661 fn encryption_scope(&self) -> Result<Option<String>> {
662 Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE)
663 }
664
665 /// A DateTime value returned by the service that uniquely identifies the blob. The value of this header indicates the blob
666 /// version, and may be used in subsequent requests to access this version of the blob.
667 fn version_id(&self) -> Result<Option<String>> {
668 Headers::get_optional_as(self.headers(), &VERSION_ID)
669 }
670}
671
672/// Provides access to typed response headers for `BlobClient::create_snapshot()`
673///
674/// # Examples
675///
676/// ```no_run
677/// use azure_core::{Result, http::{Response, NoFormat}};
678/// use azure_storage_blob::models::{BlobClientCreateSnapshotResult, BlobClientCreateSnapshotResultHeaders};
679/// async fn example() -> Result<()> {
680/// let response: Response<BlobClientCreateSnapshotResult, NoFormat> = unimplemented!();
681/// // Access response headers
682/// if let Some(date) = response.date()? {
683/// println!("Date: {:?}", date);
684/// }
685/// if let Some(last_modified) = response.last_modified()? {
686/// println!("Last-Modified: {:?}", last_modified);
687/// }
688/// if let Some(etag) = response.etag()? {
689/// println!("etag: {:?}", etag);
690/// }
691/// Ok(())
692/// }
693/// ```
694pub trait BlobClientCreateSnapshotResultHeaders: private::Sealed {
695 fn date(&self) -> Result<Option<OffsetDateTime>>;
696 fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
697 fn etag(&self) -> Result<Option<String>>;
698 fn is_server_encrypted(&self) -> Result<Option<bool>>;
699 fn snapshot(&self) -> Result<Option<String>>;
700 fn version_id(&self) -> Result<Option<String>>;
701}
702
703impl BlobClientCreateSnapshotResultHeaders for Response<BlobClientCreateSnapshotResult, NoFormat> {
704 /// UTC date/time value generated by the service that indicates the time at which the response was initiated
705 fn date(&self) -> Result<Option<OffsetDateTime>> {
706 Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str()))
707 }
708
709 /// The date/time that the container was last modified.
710 fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
711 Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
712 parse_rfc7231(h.as_str())
713 })
714 }
715
716 /// The ETag contains a value that you can use to perform operations conditionally.
717 fn etag(&self) -> Result<Option<String>> {
718 Headers::get_optional_as(self.headers(), &ETAG)
719 }
720
721 /// The value of this header is set to true if the contents of the request are successfully encrypted using the specified
722 /// algorithm, and false otherwise.
723 fn is_server_encrypted(&self) -> Result<Option<bool>> {
724 Headers::get_optional_as(self.headers(), &REQUEST_SERVER_ENCRYPTED)
725 }
726
727 /// Uniquely identifies the snapshot and indicates the snapshot version. It may be used in subsequent requests to access the
728 /// snapshot.
729 fn snapshot(&self) -> Result<Option<String>> {
730 Headers::get_optional_as(self.headers(), &SNAPSHOT)
731 }
732
733 /// A DateTime value returned by the service that uniquely identifies the blob. The value of this header indicates the blob
734 /// version, and may be used in subsequent requests to access this version of the blob.
735 fn version_id(&self) -> Result<Option<String>> {
736 Headers::get_optional_as(self.headers(), &VERSION_ID)
737 }
738}
739
740/// Provides access to typed response headers for `BlobClient::delete_immutability_policy()`
741///
742/// # Examples
743///
744/// ```no_run
745/// use azure_core::{Result, http::{Response, NoFormat}};
746/// use azure_storage_blob::models::{BlobClientDeleteImmutabilityPolicyResult, BlobClientDeleteImmutabilityPolicyResultHeaders};
747/// async fn example() -> Result<()> {
748/// let response: Response<BlobClientDeleteImmutabilityPolicyResult, NoFormat> = unimplemented!();
749/// // Access response headers
750/// if let Some(date) = response.date()? {
751/// println!("Date: {:?}", date);
752/// }
753/// Ok(())
754/// }
755/// ```
756pub trait BlobClientDeleteImmutabilityPolicyResultHeaders: private::Sealed {
757 fn date(&self) -> Result<Option<OffsetDateTime>>;
758}
759
760impl BlobClientDeleteImmutabilityPolicyResultHeaders
761 for Response<BlobClientDeleteImmutabilityPolicyResult, NoFormat>
762{
763 /// UTC date/time value generated by the service that indicates the time at which the response was initiated
764 fn date(&self) -> Result<Option<OffsetDateTime>> {
765 Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str()))
766 }
767}
768
769/// Provides access to typed response headers for `BlobClient::download()`
770///
771/// # Examples
772///
773/// ```no_run
774/// use azure_core::{Result, http::{Response, NoFormat}};
775/// use azure_storage_blob::models::{BlobClientDownloadResult, BlobClientDownloadResultHeaders};
776/// async fn example() -> Result<()> {
777/// let response: Response<BlobClientDownloadResult, NoFormat> = unimplemented!();
778/// // Access response headers
779/// if let Some(cache_control) = response.cache_control()? {
780/// println!("Cache-Control: {:?}", cache_control);
781/// }
782/// if let Some(content_disposition) = response.content_disposition()? {
783/// println!("Content-Disposition: {:?}", content_disposition);
784/// }
785/// if let Some(content_encoding) = response.content_encoding()? {
786/// println!("Content-Encoding: {:?}", content_encoding);
787/// }
788/// Ok(())
789/// }
790/// ```
791pub trait BlobClientDownloadResultHeaders: private::Sealed {
792 fn cache_control(&self) -> Result<Option<String>>;
793 fn content_disposition(&self) -> Result<Option<String>>;
794 fn content_encoding(&self) -> Result<Option<String>>;
795 fn content_language(&self) -> Result<Option<String>>;
796 fn content_length(&self) -> Result<Option<u64>>;
797 fn content_md5(&self) -> Result<Option<Vec<u8>>>;
798 fn content_range(&self) -> Result<Option<String>>;
799 fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
800 fn etag(&self) -> Result<Option<String>>;
801 fn blob_committed_block_count(&self) -> Result<Option<i32>>;
802 fn blob_content_md5(&self) -> Result<Option<Vec<u8>>>;
803 fn is_sealed(&self) -> Result<Option<bool>>;
804 fn blob_sequence_number(&self) -> Result<Option<i64>>;
805 fn blob_type(&self) -> Result<Option<BlobType>>;
806 fn content_crc64(&self) -> Result<Option<Vec<u8>>>;
807 fn copy_completion_time(&self) -> Result<Option<OffsetDateTime>>;
808 fn copy_id(&self) -> Result<Option<String>>;
809 fn copy_progress(&self) -> Result<Option<String>>;
810 fn copy_source(&self) -> Result<Option<String>>;
811 fn copy_status(&self) -> Result<Option<CopyStatus>>;
812 fn copy_status_description(&self) -> Result<Option<String>>;
813 fn creation_time(&self) -> Result<Option<OffsetDateTime>>;
814 fn encryption_key_sha256(&self) -> Result<Option<String>>;
815 fn encryption_scope(&self) -> Result<Option<String>>;
816 fn immutability_policy_mode(&self) -> Result<Option<BlobImmutabilityPolicyMode>>;
817 fn immutability_policy_expires_on(&self) -> Result<Option<OffsetDateTime>>;
818 fn is_current_version(&self) -> Result<Option<bool>>;
819 fn last_accessed(&self) -> Result<Option<OffsetDateTime>>;
820 fn duration(&self) -> Result<Option<LeaseDuration>>;
821 fn lease_state(&self) -> Result<Option<LeaseState>>;
822 fn lease_status(&self) -> Result<Option<LeaseStatus>>;
823 fn legal_hold(&self) -> Result<Option<bool>>;
824 fn metadata(&self) -> Result<HashMap<String, String>>;
825 fn object_replication_rules(&self) -> Result<HashMap<String, String>>;
826 fn object_replication_policy_id(&self) -> Result<Option<String>>;
827 fn is_server_encrypted(&self) -> Result<Option<bool>>;
828 fn tag_count(&self) -> Result<Option<i64>>;
829 fn version_id(&self) -> Result<Option<String>>;
830}
831
832impl BlobClientDownloadResultHeaders for Response<BlobClientDownloadResult, NoFormat> {
833 /// This header is returned if it was previously specified for the blob.
834 fn cache_control(&self) -> Result<Option<String>> {
835 Headers::get_optional_as(self.headers(), &CACHE_CONTROL)
836 }
837
838 /// This header returns the value that was specified for the 'x-ms-blob-content-disposition' header. The Content-Disposition
839 /// response header field conveys additional information about how to process the response payload, and also can be used to
840 /// attach additional metadata. For example, if set to attachment, it indicates that the user-agent should not display the
841 /// response, but instead show a Save As dialog with a filename other than the blob name specified.
842 fn content_disposition(&self) -> Result<Option<String>> {
843 Headers::get_optional_as(self.headers(), &CONTENT_DISPOSITION)
844 }
845
846 /// This header returns the value that was specified for the Content-Encoding request header
847 fn content_encoding(&self) -> Result<Option<String>> {
848 Headers::get_optional_as(self.headers(), &CONTENT_ENCODING)
849 }
850
851 /// This header returns the value that was specified for the Content-Language request header.
852 fn content_language(&self) -> Result<Option<String>> {
853 Headers::get_optional_as(self.headers(), &CONTENT_LANGUAGE)
854 }
855
856 /// The number of bytes present in the response body.
857 fn content_length(&self) -> Result<Option<u64>> {
858 Headers::get_optional_as(self.headers(), &CONTENT_LENGTH)
859 }
860
861 /// If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the
862 /// client can check for message content integrity.
863 fn content_md5(&self) -> Result<Option<Vec<u8>>> {
864 Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| decode(h.as_str()))
865 }
866
867 /// Indicates the range of bytes returned in the event that the client requested a subset of the blob by setting the 'Range'
868 /// request header.
869 fn content_range(&self) -> Result<Option<String>> {
870 Headers::get_optional_as(self.headers(), &CONTENT_RANGE)
871 }
872
873 /// The date/time that the container was last modified.
874 fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
875 Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
876 parse_rfc7231(h.as_str())
877 })
878 }
879
880 /// The ETag contains a value that you can use to perform operations conditionally.
881 fn etag(&self) -> Result<Option<String>> {
882 Headers::get_optional_as(self.headers(), &ETAG)
883 }
884
885 /// The number of committed blocks present in the blob. This header is returned only for append blobs.
886 fn blob_committed_block_count(&self) -> Result<Option<i32>> {
887 Headers::get_optional_as(self.headers(), &BLOB_COMMITTED_BLOCK_COUNT)
888 }
889
890 /// If the blob has a MD5 hash, and if request contains range header (Range or x-ms-range), this response header is returned
891 /// with the value of the whole blob's MD5 value. This value may or may not be equal to the value returned in Content-MD5
892 /// header, with the latter calculated from the requested range
893 fn blob_content_md5(&self) -> Result<Option<Vec<u8>>> {
894 Headers::get_optional_with(self.headers(), &BLOB_CONTENT_MD5, |h| decode(h.as_str()))
895 }
896
897 /// If this blob has been sealed
898 fn is_sealed(&self) -> Result<Option<bool>> {
899 Headers::get_optional_as(self.headers(), &BLOB_SEALED)
900 }
901
902 /// The current sequence number for a page blob. This header is not returned for block blobs or append blobs.
903 fn blob_sequence_number(&self) -> Result<Option<i64>> {
904 Headers::get_optional_as(self.headers(), &BLOB_SEQUENCE_NUMBER)
905 }
906
907 /// The type of the blob.
908 fn blob_type(&self) -> Result<Option<BlobType>> {
909 Headers::get_optional_as(self.headers(), &BLOB_TYPE)
910 }
911
912 /// This response header is returned so that the client can check for the integrity of the copied content.
913 fn content_crc64(&self) -> Result<Option<Vec<u8>>> {
914 Headers::get_optional_with(self.headers(), &CONTENT_CRC64, |h| decode(h.as_str()))
915 }
916
917 /// Conclusion time of the last attempted Copy Blob operation where this blob was the destination blob. This value can specify
918 /// the time of a completed, aborted, or failed copy attempt. This header does not appear if a copy is pending, if this blob
919 /// has never been the destination in a Copy Blob operation, or if this blob has been modified after a concluded Copy Blob
920 /// operation using Set Blob Properties, Put Blob, or Put Block List.
921 fn copy_completion_time(&self) -> Result<Option<OffsetDateTime>> {
922 Headers::get_optional_with(self.headers(), ©_COMPLETION_TIME, |h| {
923 parse_rfc7231(h.as_str())
924 })
925 }
926
927 /// String identifier for this copy operation. Use with Get Blob Properties to check the status of this copy operation, or
928 /// pass to Abort Copy Blob to abort a pending copy.
929 fn copy_id(&self) -> Result<Option<String>> {
930 Headers::get_optional_as(self.headers(), ©_ID)
931 }
932
933 /// Contains the number of bytes copied and the total bytes in the source in the last attempted Copy Blob operation where
934 /// this blob was the destination blob. Can show between 0 and Content-Length bytes copied. This header does not appear if
935 /// this blob has never been the destination in a Copy Blob operation, or if this blob has been modified after a concluded
936 /// Copy Blob operation using Set Blob Properties, Put Blob, or Put Block List
937 fn copy_progress(&self) -> Result<Option<String>> {
938 Headers::get_optional_as(self.headers(), ©_PROGRESS)
939 }
940
941 /// URL up to 2 KB in length that specifies the source blob or file used in the last attempted Copy Blob operation where this
942 /// blob was the destination blob. This header does not appear if this blob has never been the destination in a Copy Blob
943 /// operation, or if this blob has been modified after a concluded Copy Blob operation using Set Blob Properties, Put Blob,
944 /// or Put Block List.
945 fn copy_source(&self) -> Result<Option<String>> {
946 Headers::get_optional_as(self.headers(), ©_SOURCE)
947 }
948
949 /// State of the copy operation identified by x-ms-copy-id.
950 fn copy_status(&self) -> Result<Option<CopyStatus>> {
951 Headers::get_optional_as(self.headers(), ©_STATUS)
952 }
953
954 /// Only appears when x-ms-copy-status is failed or pending. Describes the cause of the last fatal or non-fatal copy operation
955 /// failure. This header does not appear if this blob has never been the destination in a Copy Blob operation, or if this
956 /// blob has been modified after a concluded Copy Blob operation using Set Blob Properties, Put Blob, or Put Block List
957 fn copy_status_description(&self) -> Result<Option<String>> {
958 Headers::get_optional_as(self.headers(), ©_STATUS_DESCRIPTION)
959 }
960
961 /// Returns the date and time the blob was created.
962 fn creation_time(&self) -> Result<Option<OffsetDateTime>> {
963 Headers::get_optional_with(self.headers(), &CREATION_TIME, |h| {
964 parse_rfc7231(h.as_str())
965 })
966 }
967
968 /// The SHA-256 hash of the encryption key used to encrypt the blob. This header is only returned when the blob was encrypted
969 /// with a customer-provided key.
970 fn encryption_key_sha256(&self) -> Result<Option<String>> {
971 Headers::get_optional_as(self.headers(), &ENCRYPTION_KEY_SHA256)
972 }
973
974 /// If the blob has a MD5 hash, and if request contains range header (Range or x-ms-range), this response header is returned
975 /// with the value of the whole blob's MD5 value. This value may or may not be equal to the value returned in Content-MD5
976 /// header, with the latter calculated from the requested range
977 fn encryption_scope(&self) -> Result<Option<String>> {
978 Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE)
979 }
980
981 /// Indicates the immutability policy mode of the blob.
982 fn immutability_policy_mode(&self) -> Result<Option<BlobImmutabilityPolicyMode>> {
983 Headers::get_optional_as(self.headers(), &IMMUTABILITY_POLICY_MODE)
984 }
985
986 /// UTC date/time value generated by the service that indicates the time at which the blob immutability policy will expire.
987 fn immutability_policy_expires_on(&self) -> Result<Option<OffsetDateTime>> {
988 Headers::get_optional_with(self.headers(), &IMMUTABILITY_POLICY_UNTIL_DATE, |h| {
989 parse_rfc7231(h.as_str())
990 })
991 }
992
993 /// The value of this header indicates whether version of this blob is a current version, see also x-ms-version-id header.
994 fn is_current_version(&self) -> Result<Option<bool>> {
995 Headers::get_optional_as(self.headers(), &IS_CURRENT_VERSION)
996 }
997
998 /// UTC date/time value generated by the service that indicates the time at which the blob was last read or written to
999 fn last_accessed(&self) -> Result<Option<OffsetDateTime>> {
1000 Headers::get_optional_with(self.headers(), &LAST_ACCESS_TIME, |h| {
1001 parse_rfc7231(h.as_str())
1002 })
1003 }
1004
1005 /// Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never expires. A non-infinite lease
1006 /// can be between 15 and 60 seconds. A lease duration cannot be changed using renew or change.
1007 fn duration(&self) -> Result<Option<LeaseDuration>> {
1008 Headers::get_optional_as(self.headers(), &LEASE_DURATION)
1009 }
1010
1011 /// Lease state of the blob.
1012 fn lease_state(&self) -> Result<Option<LeaseState>> {
1013 Headers::get_optional_as(self.headers(), &LEASE_STATE)
1014 }
1015
1016 /// The lease status of the blob.
1017 fn lease_status(&self) -> Result<Option<LeaseStatus>> {
1018 Headers::get_optional_as(self.headers(), &LEASE_STATUS)
1019 }
1020
1021 /// Specifies the legal hold status to set on the blob.
1022 fn legal_hold(&self) -> Result<Option<bool>> {
1023 Headers::get_optional_as(self.headers(), &LEGAL_HOLD)
1024 }
1025
1026 /// The metadata headers.
1027 fn metadata(&self) -> Result<HashMap<String, String>> {
1028 let mut values = HashMap::new();
1029 for h in self.headers().iter() {
1030 let name = h.0.as_str();
1031 if name.len() > META.len() && name.starts_with(META) {
1032 values.insert(name[META.len()..].to_owned(), h.1.as_str().to_owned());
1033 }
1034 }
1035 Ok(values)
1036 }
1037
1038 /// Optional. Only valid when Object Replication is enabled for the storage container and on the source blob of the replication.
1039 /// When retrieving this header, it will return the header with the policy id and rule id (e.g. x-ms-or-policyid_ruleid),
1040 /// and the value will be the status of the replication (e.g. complete, failed).
1041 fn object_replication_rules(&self) -> Result<HashMap<String, String>> {
1042 let mut values = HashMap::new();
1043 for h in self.headers().iter() {
1044 let name = h.0.as_str();
1045 if name.len() > OR.len() && name.starts_with(OR) {
1046 values.insert(name[OR.len()..].to_owned(), h.1.as_str().to_owned());
1047 }
1048 }
1049 Ok(values)
1050 }
1051
1052 /// Optional. Only valid when Object Replication is enabled for the storage container and on the destination blob of the replication.
1053 fn object_replication_policy_id(&self) -> Result<Option<String>> {
1054 Headers::get_optional_as(self.headers(), &OR_POLICY_ID)
1055 }
1056
1057 /// The value of this header is set to true if the contents of the request are successfully encrypted using the specified
1058 /// algorithm, and false otherwise.
1059 fn is_server_encrypted(&self) -> Result<Option<bool>> {
1060 Headers::get_optional_as(self.headers(), &SERVER_ENCRYPTED)
1061 }
1062
1063 /// The number of tags associated with the blob
1064 fn tag_count(&self) -> Result<Option<i64>> {
1065 Headers::get_optional_as(self.headers(), &TAG_COUNT)
1066 }
1067
1068 /// A DateTime value returned by the service that uniquely identifies the blob. The value of this header indicates the blob
1069 /// version, and may be used in subsequent requests to access this version of the blob.
1070 fn version_id(&self) -> Result<Option<String>> {
1071 Headers::get_optional_as(self.headers(), &VERSION_ID)
1072 }
1073}
1074
1075/// Provides access to typed response headers for `BlobClient::get_account_info()`
1076///
1077/// # Examples
1078///
1079/// ```no_run
1080/// use azure_core::{Result, http::{Response, NoFormat}};
1081/// use azure_storage_blob::models::{BlobClientGetAccountInfoResult, BlobClientGetAccountInfoResultHeaders};
1082/// async fn example() -> Result<()> {
1083/// let response: Response<BlobClientGetAccountInfoResult, NoFormat> = unimplemented!();
1084/// // Access response headers
1085/// if let Some(account_kind) = response.account_kind()? {
1086/// println!("x-ms-account-kind: {:?}", account_kind);
1087/// }
1088/// if let Some(is_hierarchical_namespace_enabled) = response.is_hierarchical_namespace_enabled()? {
1089/// println!("x-ms-is-hns-enabled: {:?}", is_hierarchical_namespace_enabled);
1090/// }
1091/// if let Some(sku_name) = response.sku_name()? {
1092/// println!("x-ms-sku-name: {:?}", sku_name);
1093/// }
1094/// Ok(())
1095/// }
1096/// ```
1097pub trait BlobClientGetAccountInfoResultHeaders: private::Sealed {
1098 fn account_kind(&self) -> Result<Option<AccountKind>>;
1099 fn is_hierarchical_namespace_enabled(&self) -> Result<Option<bool>>;
1100 fn sku_name(&self) -> Result<Option<SkuName>>;
1101}
1102
1103impl BlobClientGetAccountInfoResultHeaders for Response<BlobClientGetAccountInfoResult, NoFormat> {
1104 /// Identifies the account kind
1105 fn account_kind(&self) -> Result<Option<AccountKind>> {
1106 Headers::get_optional_as(self.headers(), &ACCOUNT_KIND)
1107 }
1108
1109 /// Version 2019-07-07 and newer. Indicates if the account has a hierarchical namespace enabled.
1110 fn is_hierarchical_namespace_enabled(&self) -> Result<Option<bool>> {
1111 Headers::get_optional_as(self.headers(), &IS_HNS_ENABLED)
1112 }
1113
1114 /// Identifies the sku name of the account
1115 fn sku_name(&self) -> Result<Option<SkuName>> {
1116 Headers::get_optional_as(self.headers(), &SKU_NAME)
1117 }
1118}
1119
1120/// Provides access to typed response headers for `BlobClient::get_properties()`
1121///
1122/// # Examples
1123///
1124/// ```no_run
1125/// use azure_core::{Result, http::{Response, NoFormat}};
1126/// use azure_storage_blob::models::{BlobClientGetPropertiesResult, BlobClientGetPropertiesResultHeaders};
1127/// async fn example() -> Result<()> {
1128/// let response: Response<BlobClientGetPropertiesResult, NoFormat> = unimplemented!();
1129/// // Access response headers
1130/// if let Some(cache_control) = response.cache_control()? {
1131/// println!("Cache-Control: {:?}", cache_control);
1132/// }
1133/// if let Some(content_disposition) = response.content_disposition()? {
1134/// println!("Content-Disposition: {:?}", content_disposition);
1135/// }
1136/// if let Some(content_encoding) = response.content_encoding()? {
1137/// println!("Content-Encoding: {:?}", content_encoding);
1138/// }
1139/// Ok(())
1140/// }
1141/// ```
1142pub trait BlobClientGetPropertiesResultHeaders: private::Sealed {
1143 fn cache_control(&self) -> Result<Option<String>>;
1144 fn content_disposition(&self) -> Result<Option<String>>;
1145 fn content_encoding(&self) -> Result<Option<String>>;
1146 fn content_language(&self) -> Result<Option<String>>;
1147 fn content_length(&self) -> Result<Option<u64>>;
1148 fn content_md5(&self) -> Result<Option<Vec<u8>>>;
1149 fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
1150 fn etag(&self) -> Result<Option<String>>;
1151 fn access_tier(&self) -> Result<Option<String>>;
1152 fn access_tier_change_time(&self) -> Result<Option<OffsetDateTime>>;
1153 fn access_tier_inferred(&self) -> Result<Option<bool>>;
1154 fn archive_status(&self) -> Result<Option<ArchiveStatus>>;
1155 fn blob_committed_block_count(&self) -> Result<Option<i32>>;
1156 fn is_sealed(&self) -> Result<Option<bool>>;
1157 fn blob_sequence_number(&self) -> Result<Option<i64>>;
1158 fn blob_type(&self) -> Result<Option<BlobType>>;
1159 fn copy_completion_time(&self) -> Result<Option<OffsetDateTime>>;
1160 fn destination_snapshot(&self) -> Result<Option<String>>;
1161 fn copy_id(&self) -> Result<Option<String>>;
1162 fn copy_progress(&self) -> Result<Option<String>>;
1163 fn copy_source(&self) -> Result<Option<String>>;
1164 fn copy_status(&self) -> Result<Option<CopyStatus>>;
1165 fn copy_status_description(&self) -> Result<Option<String>>;
1166 fn creation_time(&self) -> Result<Option<OffsetDateTime>>;
1167 fn encryption_key_sha256(&self) -> Result<Option<String>>;
1168 fn encryption_scope(&self) -> Result<Option<String>>;
1169 fn expires_on(&self) -> Result<Option<OffsetDateTime>>;
1170 fn immutability_policy_mode(&self) -> Result<Option<BlobImmutabilityPolicyMode>>;
1171 fn immutability_policy_expires_on(&self) -> Result<Option<OffsetDateTime>>;
1172 fn is_incremental_copy(&self) -> Result<Option<bool>>;
1173 fn is_current_version(&self) -> Result<Option<bool>>;
1174 fn last_accessed(&self) -> Result<Option<OffsetDateTime>>;
1175 fn duration(&self) -> Result<Option<LeaseDuration>>;
1176 fn lease_state(&self) -> Result<Option<LeaseState>>;
1177 fn lease_status(&self) -> Result<Option<LeaseStatus>>;
1178 fn legal_hold(&self) -> Result<Option<bool>>;
1179 fn metadata(&self) -> Result<HashMap<String, String>>;
1180 fn object_replication_rules(&self) -> Result<HashMap<String, String>>;
1181 fn object_replication_policy_id(&self) -> Result<Option<String>>;
1182 fn rehydrate_priority(&self) -> Result<Option<RehydratePriority>>;
1183 fn is_server_encrypted(&self) -> Result<Option<bool>>;
1184 fn tag_count(&self) -> Result<Option<i64>>;
1185 fn version_id(&self) -> Result<Option<String>>;
1186}
1187
1188impl BlobClientGetPropertiesResultHeaders for Response<BlobClientGetPropertiesResult, NoFormat> {
1189 /// This header is returned if it was previously specified for the blob.
1190 fn cache_control(&self) -> Result<Option<String>> {
1191 Headers::get_optional_as(self.headers(), &CACHE_CONTROL)
1192 }
1193
1194 /// This header returns the value that was specified for the 'x-ms-blob-content-disposition' header. The Content-Disposition
1195 /// response header field conveys additional information about how to process the response payload, and also can be used to
1196 /// attach additional metadata. For example, if set to attachment, it indicates that the user-agent should not display the
1197 /// response, but instead show a Save As dialog with a filename other than the blob name specified.
1198 fn content_disposition(&self) -> Result<Option<String>> {
1199 Headers::get_optional_as(self.headers(), &CONTENT_DISPOSITION)
1200 }
1201
1202 /// This header returns the value that was specified for the Content-Encoding request header
1203 fn content_encoding(&self) -> Result<Option<String>> {
1204 Headers::get_optional_as(self.headers(), &CONTENT_ENCODING)
1205 }
1206
1207 /// This header returns the value that was specified for the Content-Language request header.
1208 fn content_language(&self) -> Result<Option<String>> {
1209 Headers::get_optional_as(self.headers(), &CONTENT_LANGUAGE)
1210 }
1211
1212 /// The number of bytes present in the response body.
1213 fn content_length(&self) -> Result<Option<u64>> {
1214 Headers::get_optional_as(self.headers(), &CONTENT_LENGTH)
1215 }
1216
1217 /// If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the
1218 /// client can check for message content integrity.
1219 fn content_md5(&self) -> Result<Option<Vec<u8>>> {
1220 Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| decode(h.as_str()))
1221 }
1222
1223 /// The date/time that the container was last modified.
1224 fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
1225 Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
1226 parse_rfc7231(h.as_str())
1227 })
1228 }
1229
1230 /// The ETag contains a value that you can use to perform operations conditionally.
1231 fn etag(&self) -> Result<Option<String>> {
1232 Headers::get_optional_as(self.headers(), &ETAG)
1233 }
1234
1235 /// The tier of page blob on a premium storage account or tier of block blob on blob storage LRS accounts. For a list of allowed
1236 /// premium page blob tiers, see <https://learn.microsoft.com/azure/virtual-machines/disks-types#premium-ssd>. For blob storage
1237 /// LRS accounts, valid values are Hot/Cool/Archive.
1238 fn access_tier(&self) -> Result<Option<String>> {
1239 Headers::get_optional_as(self.headers(), &ACCESS_TIER)
1240 }
1241
1242 /// The time the tier was changed on the object. This is only returned if the tier on the block blob was ever set.
1243 fn access_tier_change_time(&self) -> Result<Option<OffsetDateTime>> {
1244 Headers::get_optional_with(self.headers(), &ACCESS_TIER_CHANGE_TIME, |h| {
1245 parse_rfc7231(h.as_str())
1246 })
1247 }
1248
1249 /// For page blobs on a premium storage account only. If the access tier is not explicitly set on the blob, the tier is inferred
1250 /// based on its content length and this header will be returned with true value.
1251 fn access_tier_inferred(&self) -> Result<Option<bool>> {
1252 Headers::get_optional_as(self.headers(), &ACCESS_TIER_INFERRED)
1253 }
1254
1255 /// For blob storage LRS accounts, valid values are rehydrate-pending-to-hot/rehydrate-pending-to-cool. If the blob is being
1256 /// rehydrated and is not complete then this header is returned indicating that rehydrate is pending and also tells the destination
1257 /// tier.
1258 fn archive_status(&self) -> Result<Option<ArchiveStatus>> {
1259 Headers::get_optional_as(self.headers(), &ARCHIVE_STATUS)
1260 }
1261
1262 /// The number of committed blocks present in the blob. This header is returned only for append blobs.
1263 fn blob_committed_block_count(&self) -> Result<Option<i32>> {
1264 Headers::get_optional_as(self.headers(), &BLOB_COMMITTED_BLOCK_COUNT)
1265 }
1266
1267 /// If this blob has been sealed
1268 fn is_sealed(&self) -> Result<Option<bool>> {
1269 Headers::get_optional_as(self.headers(), &BLOB_SEALED)
1270 }
1271
1272 /// The current sequence number for a page blob. This header is not returned for block blobs or append blobs.
1273 fn blob_sequence_number(&self) -> Result<Option<i64>> {
1274 Headers::get_optional_as(self.headers(), &BLOB_SEQUENCE_NUMBER)
1275 }
1276
1277 /// The type of the blob.
1278 fn blob_type(&self) -> Result<Option<BlobType>> {
1279 Headers::get_optional_as(self.headers(), &BLOB_TYPE)
1280 }
1281
1282 /// Conclusion time of the last attempted Copy Blob operation where this blob was the destination blob. This value can specify
1283 /// the time of a completed, aborted, or failed copy attempt. This header does not appear if a copy is pending, if this blob
1284 /// has never been the destination in a Copy Blob operation, or if this blob has been modified after a concluded Copy Blob
1285 /// operation using Set Blob Properties, Put Blob, or Put Block List.
1286 fn copy_completion_time(&self) -> Result<Option<OffsetDateTime>> {
1287 Headers::get_optional_with(self.headers(), ©_COMPLETION_TIME, |h| {
1288 parse_rfc7231(h.as_str())
1289 })
1290 }
1291
1292 /// Included if the blob is incremental copy blob or incremental copy snapshot, if x-ms-copy-status is success. Snapshot time
1293 /// of the last successful incremental copy snapshot for this blob.
1294 fn destination_snapshot(&self) -> Result<Option<String>> {
1295 Headers::get_optional_as(self.headers(), ©_DESTINATION_SNAPSHOT)
1296 }
1297
1298 /// String identifier for this copy operation. Use with Get Blob Properties to check the status of this copy operation, or
1299 /// pass to Abort Copy Blob to abort a pending copy.
1300 fn copy_id(&self) -> Result<Option<String>> {
1301 Headers::get_optional_as(self.headers(), ©_ID)
1302 }
1303
1304 /// Contains the number of bytes copied and the total bytes in the source in the last attempted Copy Blob operation where
1305 /// this blob was the destination blob. Can show between 0 and Content-Length bytes copied. This header does not appear if
1306 /// this blob has never been the destination in a Copy Blob operation, or if this blob has been modified after a concluded
1307 /// Copy Blob operation using Set Blob Properties, Put Blob, or Put Block List
1308 fn copy_progress(&self) -> Result<Option<String>> {
1309 Headers::get_optional_as(self.headers(), ©_PROGRESS)
1310 }
1311
1312 /// URL up to 2 KB in length that specifies the source blob or file used in the last attempted Copy Blob operation where this
1313 /// blob was the destination blob. This header does not appear if this blob has never been the destination in a Copy Blob
1314 /// operation, or if this blob has been modified after a concluded Copy Blob operation using Set Blob Properties, Put Blob,
1315 /// or Put Block List.
1316 fn copy_source(&self) -> Result<Option<String>> {
1317 Headers::get_optional_as(self.headers(), ©_SOURCE)
1318 }
1319
1320 /// State of the copy operation identified by x-ms-copy-id.
1321 fn copy_status(&self) -> Result<Option<CopyStatus>> {
1322 Headers::get_optional_as(self.headers(), ©_STATUS)
1323 }
1324
1325 /// Only appears when x-ms-copy-status is failed or pending. Describes the cause of the last fatal or non-fatal copy operation
1326 /// failure. This header does not appear if this blob has never been the destination in a Copy Blob operation, or if this
1327 /// blob has been modified after a concluded Copy Blob operation using Set Blob Properties, Put Blob, or Put Block List
1328 fn copy_status_description(&self) -> Result<Option<String>> {
1329 Headers::get_optional_as(self.headers(), ©_STATUS_DESCRIPTION)
1330 }
1331
1332 /// Returns the date and time the blob was created.
1333 fn creation_time(&self) -> Result<Option<OffsetDateTime>> {
1334 Headers::get_optional_with(self.headers(), &CREATION_TIME, |h| {
1335 parse_rfc7231(h.as_str())
1336 })
1337 }
1338
1339 /// The SHA-256 hash of the encryption key used to encrypt the blob. This header is only returned when the blob was encrypted
1340 /// with a customer-provided key.
1341 fn encryption_key_sha256(&self) -> Result<Option<String>> {
1342 Headers::get_optional_as(self.headers(), &ENCRYPTION_KEY_SHA256)
1343 }
1344
1345 /// If the blob has a MD5 hash, and if request contains range header (Range or x-ms-range), this response header is returned
1346 /// with the value of the whole blob's MD5 value. This value may or may not be equal to the value returned in Content-MD5
1347 /// header, with the latter calculated from the requested range
1348 fn encryption_scope(&self) -> Result<Option<String>> {
1349 Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE)
1350 }
1351
1352 /// The time this blob will expire.
1353 fn expires_on(&self) -> Result<Option<OffsetDateTime>> {
1354 Headers::get_optional_with(self.headers(), &EXPIRY_TIME, |h| parse_rfc7231(h.as_str()))
1355 }
1356
1357 /// Indicates the immutability policy mode of the blob.
1358 fn immutability_policy_mode(&self) -> Result<Option<BlobImmutabilityPolicyMode>> {
1359 Headers::get_optional_as(self.headers(), &IMMUTABILITY_POLICY_MODE)
1360 }
1361
1362 /// UTC date/time value generated by the service that indicates the time at which the blob immutability policy will expire.
1363 fn immutability_policy_expires_on(&self) -> Result<Option<OffsetDateTime>> {
1364 Headers::get_optional_with(self.headers(), &IMMUTABILITY_POLICY_UNTIL_DATE, |h| {
1365 parse_rfc7231(h.as_str())
1366 })
1367 }
1368
1369 /// Included if the blob is incremental copy blob.
1370 fn is_incremental_copy(&self) -> Result<Option<bool>> {
1371 Headers::get_optional_as(self.headers(), &INCREMENTAL_COPY)
1372 }
1373
1374 /// The value of this header indicates whether version of this blob is a current version, see also x-ms-version-id header.
1375 fn is_current_version(&self) -> Result<Option<bool>> {
1376 Headers::get_optional_as(self.headers(), &IS_CURRENT_VERSION)
1377 }
1378
1379 /// UTC date/time value generated by the service that indicates the time at which the blob was last read or written to
1380 fn last_accessed(&self) -> Result<Option<OffsetDateTime>> {
1381 Headers::get_optional_with(self.headers(), &LAST_ACCESS_TIME, |h| {
1382 parse_rfc7231(h.as_str())
1383 })
1384 }
1385
1386 /// Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never expires. A non-infinite lease
1387 /// can be between 15 and 60 seconds. A lease duration cannot be changed using renew or change.
1388 fn duration(&self) -> Result<Option<LeaseDuration>> {
1389 Headers::get_optional_as(self.headers(), &LEASE_DURATION)
1390 }
1391
1392 /// Lease state of the blob.
1393 fn lease_state(&self) -> Result<Option<LeaseState>> {
1394 Headers::get_optional_as(self.headers(), &LEASE_STATE)
1395 }
1396
1397 /// The lease status of the blob.
1398 fn lease_status(&self) -> Result<Option<LeaseStatus>> {
1399 Headers::get_optional_as(self.headers(), &LEASE_STATUS)
1400 }
1401
1402 /// Specifies the legal hold status to set on the blob.
1403 fn legal_hold(&self) -> Result<Option<bool>> {
1404 Headers::get_optional_as(self.headers(), &LEGAL_HOLD)
1405 }
1406
1407 /// The metadata headers.
1408 fn metadata(&self) -> Result<HashMap<String, String>> {
1409 let mut values = HashMap::new();
1410 for h in self.headers().iter() {
1411 let name = h.0.as_str();
1412 if name.len() > META.len() && name.starts_with(META) {
1413 values.insert(name[META.len()..].to_owned(), h.1.as_str().to_owned());
1414 }
1415 }
1416 Ok(values)
1417 }
1418
1419 /// Optional. Only valid when Object Replication is enabled for the storage container and on the source blob of the replication.
1420 /// When retrieving this header, it will return the header with the policy id and rule id (e.g. x-ms-or-policyid_ruleid),
1421 /// and the value will be the status of the replication (e.g. complete, failed).
1422 fn object_replication_rules(&self) -> Result<HashMap<String, String>> {
1423 let mut values = HashMap::new();
1424 for h in self.headers().iter() {
1425 let name = h.0.as_str();
1426 if name.len() > OR.len() && name.starts_with(OR) {
1427 values.insert(name[OR.len()..].to_owned(), h.1.as_str().to_owned());
1428 }
1429 }
1430 Ok(values)
1431 }
1432
1433 /// Optional. Only valid when Object Replication is enabled for the storage container and on the destination blob of the replication.
1434 fn object_replication_policy_id(&self) -> Result<Option<String>> {
1435 Headers::get_optional_as(self.headers(), &OR_POLICY_ID)
1436 }
1437
1438 /// If an object is in rehydrate pending state then this header is returned with priority of rehydrate. Valid values are High
1439 /// and Standard.
1440 fn rehydrate_priority(&self) -> Result<Option<RehydratePriority>> {
1441 Headers::get_optional_as(self.headers(), &REHYDRATE_PRIORITY)
1442 }
1443
1444 /// The value of this header is set to true if the contents of the request are successfully encrypted using the specified
1445 /// algorithm, and false otherwise.
1446 fn is_server_encrypted(&self) -> Result<Option<bool>> {
1447 Headers::get_optional_as(self.headers(), &SERVER_ENCRYPTED)
1448 }
1449
1450 /// The number of tags associated with the blob
1451 fn tag_count(&self) -> Result<Option<i64>> {
1452 Headers::get_optional_as(self.headers(), &TAG_COUNT)
1453 }
1454
1455 /// A DateTime value returned by the service that uniquely identifies the blob. The value of this header indicates the blob
1456 /// version, and may be used in subsequent requests to access this version of the blob.
1457 fn version_id(&self) -> Result<Option<String>> {
1458 Headers::get_optional_as(self.headers(), &VERSION_ID)
1459 }
1460}
1461
1462/// Provides access to typed response headers for `BlobClient::release_lease()`
1463///
1464/// # Examples
1465///
1466/// ```no_run
1467/// use azure_core::{Result, http::{Response, NoFormat}};
1468/// use azure_storage_blob::models::{BlobClientReleaseLeaseResult, BlobClientReleaseLeaseResultHeaders};
1469/// async fn example() -> Result<()> {
1470/// let response: Response<BlobClientReleaseLeaseResult, NoFormat> = unimplemented!();
1471/// // Access response headers
1472/// if let Some(last_modified) = response.last_modified()? {
1473/// println!("Last-Modified: {:?}", last_modified);
1474/// }
1475/// if let Some(etag) = response.etag()? {
1476/// println!("etag: {:?}", etag);
1477/// }
1478/// Ok(())
1479/// }
1480/// ```
1481pub trait BlobClientReleaseLeaseResultHeaders: private::Sealed {
1482 fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
1483 fn etag(&self) -> Result<Option<String>>;
1484}
1485
1486impl BlobClientReleaseLeaseResultHeaders for Response<BlobClientReleaseLeaseResult, NoFormat> {
1487 /// The date/time that the container was last modified.
1488 fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
1489 Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
1490 parse_rfc7231(h.as_str())
1491 })
1492 }
1493
1494 /// The ETag contains a value that you can use to perform operations conditionally.
1495 fn etag(&self) -> Result<Option<String>> {
1496 Headers::get_optional_as(self.headers(), &ETAG)
1497 }
1498}
1499
1500/// Provides access to typed response headers for `BlobClient::renew_lease()`
1501///
1502/// # Examples
1503///
1504/// ```no_run
1505/// use azure_core::{Result, http::{Response, NoFormat}};
1506/// use azure_storage_blob::models::{BlobClientRenewLeaseResult, BlobClientRenewLeaseResultHeaders};
1507/// async fn example() -> Result<()> {
1508/// let response: Response<BlobClientRenewLeaseResult, NoFormat> = unimplemented!();
1509/// // Access response headers
1510/// if let Some(last_modified) = response.last_modified()? {
1511/// println!("Last-Modified: {:?}", last_modified);
1512/// }
1513/// if let Some(etag) = response.etag()? {
1514/// println!("etag: {:?}", etag);
1515/// }
1516/// if let Some(lease_id) = response.lease_id()? {
1517/// println!("x-ms-lease-id: {:?}", lease_id);
1518/// }
1519/// Ok(())
1520/// }
1521/// ```
1522pub trait BlobClientRenewLeaseResultHeaders: private::Sealed {
1523 fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
1524 fn etag(&self) -> Result<Option<String>>;
1525 fn lease_id(&self) -> Result<Option<String>>;
1526}
1527
1528impl BlobClientRenewLeaseResultHeaders for Response<BlobClientRenewLeaseResult, NoFormat> {
1529 /// The date/time that the container was last modified.
1530 fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
1531 Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
1532 parse_rfc7231(h.as_str())
1533 })
1534 }
1535
1536 /// The ETag contains a value that you can use to perform operations conditionally.
1537 fn etag(&self) -> Result<Option<String>> {
1538 Headers::get_optional_as(self.headers(), &ETAG)
1539 }
1540
1541 /// Uniquely identifies a blobs' lease
1542 fn lease_id(&self) -> Result<Option<String>> {
1543 Headers::get_optional_as(self.headers(), &LEASE_ID)
1544 }
1545}
1546
1547/// Provides access to typed response headers for `BlobClient::set_expiry()`
1548///
1549/// # Examples
1550///
1551/// ```no_run
1552/// use azure_core::{Result, http::{Response, NoFormat}};
1553/// use azure_storage_blob::models::{BlobClientSetExpiryResult, BlobClientSetExpiryResultHeaders};
1554/// async fn example() -> Result<()> {
1555/// let response: Response<BlobClientSetExpiryResult, NoFormat> = unimplemented!();
1556/// // Access response headers
1557/// if let Some(date) = response.date()? {
1558/// println!("Date: {:?}", date);
1559/// }
1560/// if let Some(last_modified) = response.last_modified()? {
1561/// println!("Last-Modified: {:?}", last_modified);
1562/// }
1563/// if let Some(etag) = response.etag()? {
1564/// println!("etag: {:?}", etag);
1565/// }
1566/// Ok(())
1567/// }
1568/// ```
1569pub trait BlobClientSetExpiryResultHeaders: private::Sealed {
1570 fn date(&self) -> Result<Option<OffsetDateTime>>;
1571 fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
1572 fn etag(&self) -> Result<Option<String>>;
1573}
1574
1575impl BlobClientSetExpiryResultHeaders for Response<BlobClientSetExpiryResult, NoFormat> {
1576 /// UTC date/time value generated by the service that indicates the time at which the response was initiated
1577 fn date(&self) -> Result<Option<OffsetDateTime>> {
1578 Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str()))
1579 }
1580
1581 /// The date/time that the container was last modified.
1582 fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
1583 Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
1584 parse_rfc7231(h.as_str())
1585 })
1586 }
1587
1588 /// The ETag contains a value that you can use to perform operations conditionally.
1589 fn etag(&self) -> Result<Option<String>> {
1590 Headers::get_optional_as(self.headers(), &ETAG)
1591 }
1592}
1593
1594/// Provides access to typed response headers for `BlobClient::set_immutability_policy()`
1595///
1596/// # Examples
1597///
1598/// ```no_run
1599/// use azure_core::{Result, http::{Response, NoFormat}};
1600/// use azure_storage_blob::models::{BlobClientSetImmutabilityPolicyResult, BlobClientSetImmutabilityPolicyResultHeaders};
1601/// async fn example() -> Result<()> {
1602/// let response: Response<BlobClientSetImmutabilityPolicyResult, NoFormat> = unimplemented!();
1603/// // Access response headers
1604/// if let Some(date) = response.date()? {
1605/// println!("Date: {:?}", date);
1606/// }
1607/// if let Some(immutability_policy_mode) = response.immutability_policy_mode()? {
1608/// println!("x-ms-immutability-policy-mode: {:?}", immutability_policy_mode);
1609/// }
1610/// if let Some(immutability_policy_expires_on) = response.immutability_policy_expires_on()? {
1611/// println!("x-ms-immutability-policy-until-date: {:?}", immutability_policy_expires_on);
1612/// }
1613/// Ok(())
1614/// }
1615/// ```
1616pub trait BlobClientSetImmutabilityPolicyResultHeaders: private::Sealed {
1617 fn date(&self) -> Result<Option<OffsetDateTime>>;
1618 fn immutability_policy_mode(&self) -> Result<Option<BlobImmutabilityPolicyMode>>;
1619 fn immutability_policy_expires_on(&self) -> Result<Option<OffsetDateTime>>;
1620}
1621
1622impl BlobClientSetImmutabilityPolicyResultHeaders
1623 for Response<BlobClientSetImmutabilityPolicyResult, NoFormat>
1624{
1625 /// UTC date/time value generated by the service that indicates the time at which the response was initiated
1626 fn date(&self) -> Result<Option<OffsetDateTime>> {
1627 Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str()))
1628 }
1629
1630 /// Indicates the immutability policy mode of the blob.
1631 fn immutability_policy_mode(&self) -> Result<Option<BlobImmutabilityPolicyMode>> {
1632 Headers::get_optional_as(self.headers(), &IMMUTABILITY_POLICY_MODE)
1633 }
1634
1635 /// UTC date/time value generated by the service that indicates the time at which the blob immutability policy will expire.
1636 fn immutability_policy_expires_on(&self) -> Result<Option<OffsetDateTime>> {
1637 Headers::get_optional_with(self.headers(), &IMMUTABILITY_POLICY_UNTIL_DATE, |h| {
1638 parse_rfc7231(h.as_str())
1639 })
1640 }
1641}
1642
1643/// Provides access to typed response headers for `BlobClient::set_legal_hold()`
1644///
1645/// # Examples
1646///
1647/// ```no_run
1648/// use azure_core::{Result, http::{Response, NoFormat}};
1649/// use azure_storage_blob::models::{BlobClientSetLegalHoldResult, BlobClientSetLegalHoldResultHeaders};
1650/// async fn example() -> Result<()> {
1651/// let response: Response<BlobClientSetLegalHoldResult, NoFormat> = unimplemented!();
1652/// // Access response headers
1653/// if let Some(date) = response.date()? {
1654/// println!("Date: {:?}", date);
1655/// }
1656/// if let Some(legal_hold) = response.legal_hold()? {
1657/// println!("x-ms-legal-hold: {:?}", legal_hold);
1658/// }
1659/// Ok(())
1660/// }
1661/// ```
1662pub trait BlobClientSetLegalHoldResultHeaders: private::Sealed {
1663 fn date(&self) -> Result<Option<OffsetDateTime>>;
1664 fn legal_hold(&self) -> Result<Option<bool>>;
1665}
1666
1667impl BlobClientSetLegalHoldResultHeaders for Response<BlobClientSetLegalHoldResult, NoFormat> {
1668 /// UTC date/time value generated by the service that indicates the time at which the response was initiated
1669 fn date(&self) -> Result<Option<OffsetDateTime>> {
1670 Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str()))
1671 }
1672
1673 /// Specifies the legal hold status to set on the blob.
1674 fn legal_hold(&self) -> Result<Option<bool>> {
1675 Headers::get_optional_as(self.headers(), &LEGAL_HOLD)
1676 }
1677}
1678
1679/// Provides access to typed response headers for `BlobClient::start_copy_from_url()`
1680///
1681/// # Examples
1682///
1683/// ```no_run
1684/// use azure_core::{Result, http::{Response, NoFormat}};
1685/// use azure_storage_blob::models::{BlobClientStartCopyFromUrlResult, BlobClientStartCopyFromUrlResultHeaders};
1686/// async fn example() -> Result<()> {
1687/// let response: Response<BlobClientStartCopyFromUrlResult, NoFormat> = unimplemented!();
1688/// // Access response headers
1689/// if let Some(date) = response.date()? {
1690/// println!("Date: {:?}", date);
1691/// }
1692/// if let Some(last_modified) = response.last_modified()? {
1693/// println!("Last-Modified: {:?}", last_modified);
1694/// }
1695/// if let Some(etag) = response.etag()? {
1696/// println!("etag: {:?}", etag);
1697/// }
1698/// Ok(())
1699/// }
1700/// ```
1701pub trait BlobClientStartCopyFromUrlResultHeaders: private::Sealed {
1702 fn date(&self) -> Result<Option<OffsetDateTime>>;
1703 fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
1704 fn etag(&self) -> Result<Option<String>>;
1705 fn copy_id(&self) -> Result<Option<String>>;
1706 fn copy_status(&self) -> Result<Option<CopyStatus>>;
1707 fn version_id(&self) -> Result<Option<String>>;
1708}
1709
1710impl BlobClientStartCopyFromUrlResultHeaders
1711 for Response<BlobClientStartCopyFromUrlResult, NoFormat>
1712{
1713 /// UTC date/time value generated by the service that indicates the time at which the response was initiated
1714 fn date(&self) -> Result<Option<OffsetDateTime>> {
1715 Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str()))
1716 }
1717
1718 /// The date/time that the container was last modified.
1719 fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
1720 Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
1721 parse_rfc7231(h.as_str())
1722 })
1723 }
1724
1725 /// The ETag contains a value that you can use to perform operations conditionally.
1726 fn etag(&self) -> Result<Option<String>> {
1727 Headers::get_optional_as(self.headers(), &ETAG)
1728 }
1729
1730 /// String identifier for this copy operation. Use with Get Blob Properties to check the status of this copy operation, or
1731 /// pass to Abort Copy Blob to abort a pending copy.
1732 fn copy_id(&self) -> Result<Option<String>> {
1733 Headers::get_optional_as(self.headers(), ©_ID)
1734 }
1735
1736 /// State of the copy operation identified by x-ms-copy-id.
1737 fn copy_status(&self) -> Result<Option<CopyStatus>> {
1738 Headers::get_optional_as(self.headers(), ©_STATUS)
1739 }
1740
1741 /// A DateTime value returned by the service that uniquely identifies the blob. The value of this header indicates the blob
1742 /// version, and may be used in subsequent requests to access this version of the blob.
1743 fn version_id(&self) -> Result<Option<String>> {
1744 Headers::get_optional_as(self.headers(), &VERSION_ID)
1745 }
1746}
1747
1748/// Provides access to typed response headers for `BlobClient::undelete()`
1749///
1750/// # Examples
1751///
1752/// ```no_run
1753/// use azure_core::{Result, http::{Response, NoFormat}};
1754/// use azure_storage_blob::models::{BlobClientUndeleteResult, BlobClientUndeleteResultHeaders};
1755/// async fn example() -> Result<()> {
1756/// let response: Response<BlobClientUndeleteResult, NoFormat> = unimplemented!();
1757/// // Access response headers
1758/// if let Some(date) = response.date()? {
1759/// println!("Date: {:?}", date);
1760/// }
1761/// Ok(())
1762/// }
1763/// ```
1764pub trait BlobClientUndeleteResultHeaders: private::Sealed {
1765 fn date(&self) -> Result<Option<OffsetDateTime>>;
1766}
1767
1768impl BlobClientUndeleteResultHeaders for Response<BlobClientUndeleteResult, NoFormat> {
1769 /// UTC date/time value generated by the service that indicates the time at which the response was initiated
1770 fn date(&self) -> Result<Option<OffsetDateTime>> {
1771 Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str()))
1772 }
1773}
1774
1775/// Provides access to typed response headers for `BlobContainerClient::acquire_lease()`
1776///
1777/// # Examples
1778///
1779/// ```no_run
1780/// use azure_core::{Result, http::{Response, NoFormat}};
1781/// use azure_storage_blob::models::{BlobContainerClientAcquireLeaseResult, BlobContainerClientAcquireLeaseResultHeaders};
1782/// async fn example() -> Result<()> {
1783/// let response: Response<BlobContainerClientAcquireLeaseResult, NoFormat> = unimplemented!();
1784/// // Access response headers
1785/// if let Some(last_modified) = response.last_modified()? {
1786/// println!("Last-Modified: {:?}", last_modified);
1787/// }
1788/// if let Some(etag) = response.etag()? {
1789/// println!("etag: {:?}", etag);
1790/// }
1791/// if let Some(lease_id) = response.lease_id()? {
1792/// println!("x-ms-lease-id: {:?}", lease_id);
1793/// }
1794/// Ok(())
1795/// }
1796/// ```
1797pub trait BlobContainerClientAcquireLeaseResultHeaders: private::Sealed {
1798 fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
1799 fn etag(&self) -> Result<Option<String>>;
1800 fn lease_id(&self) -> Result<Option<String>>;
1801}
1802
1803impl BlobContainerClientAcquireLeaseResultHeaders
1804 for Response<BlobContainerClientAcquireLeaseResult, NoFormat>
1805{
1806 /// The date/time that the container was last modified.
1807 fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
1808 Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
1809 parse_rfc7231(h.as_str())
1810 })
1811 }
1812
1813 /// The ETag contains a value that you can use to perform operations conditionally.
1814 fn etag(&self) -> Result<Option<String>> {
1815 Headers::get_optional_as(self.headers(), &ETAG)
1816 }
1817
1818 /// Uniquely identifies a blobs' lease
1819 fn lease_id(&self) -> Result<Option<String>> {
1820 Headers::get_optional_as(self.headers(), &LEASE_ID)
1821 }
1822}
1823
1824/// Provides access to typed response headers for `BlobContainerClient::break_lease()`
1825///
1826/// # Examples
1827///
1828/// ```no_run
1829/// use azure_core::{Result, http::{Response, NoFormat}};
1830/// use azure_storage_blob::models::{BlobContainerClientBreakLeaseResult, BlobContainerClientBreakLeaseResultHeaders};
1831/// async fn example() -> Result<()> {
1832/// let response: Response<BlobContainerClientBreakLeaseResult, NoFormat> = unimplemented!();
1833/// // Access response headers
1834/// if let Some(last_modified) = response.last_modified()? {
1835/// println!("Last-Modified: {:?}", last_modified);
1836/// }
1837/// if let Some(etag) = response.etag()? {
1838/// println!("etag: {:?}", etag);
1839/// }
1840/// if let Some(lease_time) = response.lease_time()? {
1841/// println!("x-ms-lease-time: {:?}", lease_time);
1842/// }
1843/// Ok(())
1844/// }
1845/// ```
1846pub trait BlobContainerClientBreakLeaseResultHeaders: private::Sealed {
1847 fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
1848 fn etag(&self) -> Result<Option<String>>;
1849 fn lease_time(&self) -> Result<Option<i32>>;
1850}
1851
1852impl BlobContainerClientBreakLeaseResultHeaders
1853 for Response<BlobContainerClientBreakLeaseResult, NoFormat>
1854{
1855 /// The date/time that the container was last modified.
1856 fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
1857 Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
1858 parse_rfc7231(h.as_str())
1859 })
1860 }
1861
1862 /// The ETag contains a value that you can use to perform operations conditionally.
1863 fn etag(&self) -> Result<Option<String>> {
1864 Headers::get_optional_as(self.headers(), &ETAG)
1865 }
1866
1867 /// Approximate time remaining in the lease period, in seconds.
1868 fn lease_time(&self) -> Result<Option<i32>> {
1869 Headers::get_optional_as(self.headers(), &LEASE_TIME)
1870 }
1871}
1872
1873/// Provides access to typed response headers for `BlobContainerClient::change_lease()`
1874///
1875/// # Examples
1876///
1877/// ```no_run
1878/// use azure_core::{Result, http::{Response, NoFormat}};
1879/// use azure_storage_blob::models::{BlobContainerClientChangeLeaseResult, BlobContainerClientChangeLeaseResultHeaders};
1880/// async fn example() -> Result<()> {
1881/// let response: Response<BlobContainerClientChangeLeaseResult, NoFormat> = unimplemented!();
1882/// // Access response headers
1883/// if let Some(last_modified) = response.last_modified()? {
1884/// println!("Last-Modified: {:?}", last_modified);
1885/// }
1886/// if let Some(etag) = response.etag()? {
1887/// println!("etag: {:?}", etag);
1888/// }
1889/// if let Some(lease_id) = response.lease_id()? {
1890/// println!("x-ms-lease-id: {:?}", lease_id);
1891/// }
1892/// Ok(())
1893/// }
1894/// ```
1895pub trait BlobContainerClientChangeLeaseResultHeaders: private::Sealed {
1896 fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
1897 fn etag(&self) -> Result<Option<String>>;
1898 fn lease_id(&self) -> Result<Option<String>>;
1899}
1900
1901impl BlobContainerClientChangeLeaseResultHeaders
1902 for Response<BlobContainerClientChangeLeaseResult, NoFormat>
1903{
1904 /// The date/time that the container was last modified.
1905 fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
1906 Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
1907 parse_rfc7231(h.as_str())
1908 })
1909 }
1910
1911 /// The ETag contains a value that you can use to perform operations conditionally.
1912 fn etag(&self) -> Result<Option<String>> {
1913 Headers::get_optional_as(self.headers(), &ETAG)
1914 }
1915
1916 /// Uniquely identifies a blobs' lease
1917 fn lease_id(&self) -> Result<Option<String>> {
1918 Headers::get_optional_as(self.headers(), &LEASE_ID)
1919 }
1920}
1921
1922/// Provides access to typed response headers for `BlobContainerClient::get_account_info()`
1923///
1924/// # Examples
1925///
1926/// ```no_run
1927/// use azure_core::{Result, http::{Response, NoFormat}};
1928/// use azure_storage_blob::models::{BlobContainerClientGetAccountInfoResult, BlobContainerClientGetAccountInfoResultHeaders};
1929/// async fn example() -> Result<()> {
1930/// let response: Response<BlobContainerClientGetAccountInfoResult, NoFormat> = unimplemented!();
1931/// // Access response headers
1932/// if let Some(account_kind) = response.account_kind()? {
1933/// println!("x-ms-account-kind: {:?}", account_kind);
1934/// }
1935/// if let Some(is_hierarchical_namespace_enabled) = response.is_hierarchical_namespace_enabled()? {
1936/// println!("x-ms-is-hns-enabled: {:?}", is_hierarchical_namespace_enabled);
1937/// }
1938/// if let Some(sku_name) = response.sku_name()? {
1939/// println!("x-ms-sku-name: {:?}", sku_name);
1940/// }
1941/// Ok(())
1942/// }
1943/// ```
1944pub trait BlobContainerClientGetAccountInfoResultHeaders: private::Sealed {
1945 fn account_kind(&self) -> Result<Option<AccountKind>>;
1946 fn is_hierarchical_namespace_enabled(&self) -> Result<Option<bool>>;
1947 fn sku_name(&self) -> Result<Option<SkuName>>;
1948}
1949
1950impl BlobContainerClientGetAccountInfoResultHeaders
1951 for Response<BlobContainerClientGetAccountInfoResult, NoFormat>
1952{
1953 /// Identifies the account kind
1954 fn account_kind(&self) -> Result<Option<AccountKind>> {
1955 Headers::get_optional_as(self.headers(), &ACCOUNT_KIND)
1956 }
1957
1958 /// Version 2019-07-07 and newer. Indicates if the account has a hierarchical namespace enabled.
1959 fn is_hierarchical_namespace_enabled(&self) -> Result<Option<bool>> {
1960 Headers::get_optional_as(self.headers(), &IS_HNS_ENABLED)
1961 }
1962
1963 /// Identifies the sku name of the account
1964 fn sku_name(&self) -> Result<Option<SkuName>> {
1965 Headers::get_optional_as(self.headers(), &SKU_NAME)
1966 }
1967}
1968
1969/// Provides access to typed response headers for `BlobContainerClient::get_properties()`
1970///
1971/// # Examples
1972///
1973/// ```no_run
1974/// use azure_core::{Result, http::{Response, NoFormat}};
1975/// use azure_storage_blob::models::{BlobContainerClientGetPropertiesResult, BlobContainerClientGetPropertiesResultHeaders};
1976/// async fn example() -> Result<()> {
1977/// let response: Response<BlobContainerClientGetPropertiesResult, NoFormat> = unimplemented!();
1978/// // Access response headers
1979/// if let Some(last_modified) = response.last_modified()? {
1980/// println!("Last-Modified: {:?}", last_modified);
1981/// }
1982/// if let Some(etag) = response.etag()? {
1983/// println!("etag: {:?}", etag);
1984/// }
1985/// if let Some(access) = response.access()? {
1986/// println!("x-ms-blob-public-access: {:?}", access);
1987/// }
1988/// Ok(())
1989/// }
1990/// ```
1991pub trait BlobContainerClientGetPropertiesResultHeaders: private::Sealed {
1992 fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
1993 fn etag(&self) -> Result<Option<String>>;
1994 fn access(&self) -> Result<Option<PublicAccessType>>;
1995 fn default_encryption_scope(&self) -> Result<Option<String>>;
1996 fn prevent_encryption_scope_override(&self) -> Result<Option<bool>>;
1997 fn has_immutability_policy(&self) -> Result<Option<bool>>;
1998 fn has_legal_hold(&self) -> Result<Option<bool>>;
1999 fn is_immutable_storage_with_versioning_enabled(&self) -> Result<Option<bool>>;
2000 fn duration(&self) -> Result<Option<LeaseDuration>>;
2001 fn lease_state(&self) -> Result<Option<LeaseState>>;
2002 fn lease_status(&self) -> Result<Option<LeaseStatus>>;
2003 fn metadata(&self) -> Result<HashMap<String, String>>;
2004}
2005
2006impl BlobContainerClientGetPropertiesResultHeaders
2007 for Response<BlobContainerClientGetPropertiesResult, NoFormat>
2008{
2009 /// The date/time that the container was last modified.
2010 fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
2011 Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
2012 parse_rfc7231(h.as_str())
2013 })
2014 }
2015
2016 /// The ETag contains a value that you can use to perform operations conditionally.
2017 fn etag(&self) -> Result<Option<String>> {
2018 Headers::get_optional_as(self.headers(), &ETAG)
2019 }
2020
2021 /// The public access setting for the container.
2022 fn access(&self) -> Result<Option<PublicAccessType>> {
2023 Headers::get_optional_as(self.headers(), &BLOB_PUBLIC_ACCESS)
2024 }
2025
2026 /// The default encryption scope for the container.
2027 fn default_encryption_scope(&self) -> Result<Option<String>> {
2028 Headers::get_optional_as(self.headers(), &DEFAULT_ENCRYPTION_SCOPE)
2029 }
2030
2031 /// If a blob has a lease and the lease is of infinite duration then the value of this header is set to true, otherwise it
2032 /// is set to false.
2033 fn prevent_encryption_scope_override(&self) -> Result<Option<bool>> {
2034 Headers::get_optional_as(self.headers(), &DENY_ENCRYPTION_SCOPE_OVERRIDE)
2035 }
2036
2037 /// Indicates whether the container has an immutability policy set on it.
2038 fn has_immutability_policy(&self) -> Result<Option<bool>> {
2039 Headers::get_optional_as(self.headers(), &HAS_IMMUTABILITY_POLICY)
2040 }
2041
2042 /// Indicates whether the container has a legal hold.
2043 fn has_legal_hold(&self) -> Result<Option<bool>> {
2044 Headers::get_optional_as(self.headers(), &HAS_LEGAL_HOLD)
2045 }
2046
2047 /// Indicates whether version level worm is enabled on a container
2048 fn is_immutable_storage_with_versioning_enabled(&self) -> Result<Option<bool>> {
2049 Headers::get_optional_as(self.headers(), &IMMUTABLE_STORAGE_WITH_VERSIONING_ENABLED)
2050 }
2051
2052 /// Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never expires. A non-infinite lease
2053 /// can be between 15 and 60 seconds. A lease duration cannot be changed using renew or change.
2054 fn duration(&self) -> Result<Option<LeaseDuration>> {
2055 Headers::get_optional_as(self.headers(), &LEASE_DURATION)
2056 }
2057
2058 /// Lease state of the blob.
2059 fn lease_state(&self) -> Result<Option<LeaseState>> {
2060 Headers::get_optional_as(self.headers(), &LEASE_STATE)
2061 }
2062
2063 /// The lease status of the blob.
2064 fn lease_status(&self) -> Result<Option<LeaseStatus>> {
2065 Headers::get_optional_as(self.headers(), &LEASE_STATUS)
2066 }
2067
2068 /// The metadata headers.
2069 fn metadata(&self) -> Result<HashMap<String, String>> {
2070 let mut values = HashMap::new();
2071 for h in self.headers().iter() {
2072 let name = h.0.as_str();
2073 if name.len() > META.len() && name.starts_with(META) {
2074 values.insert(name[META.len()..].to_owned(), h.1.as_str().to_owned());
2075 }
2076 }
2077 Ok(values)
2078 }
2079}
2080
2081/// Provides access to typed response headers for `BlobContainerClient::release_lease()`
2082///
2083/// # Examples
2084///
2085/// ```no_run
2086/// use azure_core::{Result, http::{Response, NoFormat}};
2087/// use azure_storage_blob::models::{BlobContainerClientReleaseLeaseResult, BlobContainerClientReleaseLeaseResultHeaders};
2088/// async fn example() -> Result<()> {
2089/// let response: Response<BlobContainerClientReleaseLeaseResult, NoFormat> = unimplemented!();
2090/// // Access response headers
2091/// if let Some(last_modified) = response.last_modified()? {
2092/// println!("Last-Modified: {:?}", last_modified);
2093/// }
2094/// if let Some(etag) = response.etag()? {
2095/// println!("etag: {:?}", etag);
2096/// }
2097/// Ok(())
2098/// }
2099/// ```
2100pub trait BlobContainerClientReleaseLeaseResultHeaders: private::Sealed {
2101 fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
2102 fn etag(&self) -> Result<Option<String>>;
2103}
2104
2105impl BlobContainerClientReleaseLeaseResultHeaders
2106 for Response<BlobContainerClientReleaseLeaseResult, NoFormat>
2107{
2108 /// The date/time that the container was last modified.
2109 fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
2110 Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
2111 parse_rfc7231(h.as_str())
2112 })
2113 }
2114
2115 /// The ETag contains a value that you can use to perform operations conditionally.
2116 fn etag(&self) -> Result<Option<String>> {
2117 Headers::get_optional_as(self.headers(), &ETAG)
2118 }
2119}
2120
2121/// Provides access to typed response headers for `BlobContainerClient::rename()`
2122///
2123/// # Examples
2124///
2125/// ```no_run
2126/// use azure_core::{Result, http::{Response, NoFormat}};
2127/// use azure_storage_blob::models::{BlobContainerClientRenameResult, BlobContainerClientRenameResultHeaders};
2128/// async fn example() -> Result<()> {
2129/// let response: Response<BlobContainerClientRenameResult, NoFormat> = unimplemented!();
2130/// // Access response headers
2131/// if let Some(date) = response.date()? {
2132/// println!("Date: {:?}", date);
2133/// }
2134/// Ok(())
2135/// }
2136/// ```
2137pub trait BlobContainerClientRenameResultHeaders: private::Sealed {
2138 fn date(&self) -> Result<Option<OffsetDateTime>>;
2139}
2140
2141impl BlobContainerClientRenameResultHeaders
2142 for Response<BlobContainerClientRenameResult, NoFormat>
2143{
2144 /// UTC date/time value generated by the service that indicates the time at which the response was initiated
2145 fn date(&self) -> Result<Option<OffsetDateTime>> {
2146 Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str()))
2147 }
2148}
2149
2150/// Provides access to typed response headers for `BlobContainerClient::renew_lease()`
2151///
2152/// # Examples
2153///
2154/// ```no_run
2155/// use azure_core::{Result, http::{Response, NoFormat}};
2156/// use azure_storage_blob::models::{BlobContainerClientRenewLeaseResult, BlobContainerClientRenewLeaseResultHeaders};
2157/// async fn example() -> Result<()> {
2158/// let response: Response<BlobContainerClientRenewLeaseResult, NoFormat> = unimplemented!();
2159/// // Access response headers
2160/// if let Some(last_modified) = response.last_modified()? {
2161/// println!("Last-Modified: {:?}", last_modified);
2162/// }
2163/// if let Some(etag) = response.etag()? {
2164/// println!("etag: {:?}", etag);
2165/// }
2166/// if let Some(lease_id) = response.lease_id()? {
2167/// println!("x-ms-lease-id: {:?}", lease_id);
2168/// }
2169/// Ok(())
2170/// }
2171/// ```
2172pub trait BlobContainerClientRenewLeaseResultHeaders: private::Sealed {
2173 fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
2174 fn etag(&self) -> Result<Option<String>>;
2175 fn lease_id(&self) -> Result<Option<String>>;
2176}
2177
2178impl BlobContainerClientRenewLeaseResultHeaders
2179 for Response<BlobContainerClientRenewLeaseResult, NoFormat>
2180{
2181 /// The date/time that the container was last modified.
2182 fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
2183 Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
2184 parse_rfc7231(h.as_str())
2185 })
2186 }
2187
2188 /// The ETag contains a value that you can use to perform operations conditionally.
2189 fn etag(&self) -> Result<Option<String>> {
2190 Headers::get_optional_as(self.headers(), &ETAG)
2191 }
2192
2193 /// Uniquely identifies a blobs' lease
2194 fn lease_id(&self) -> Result<Option<String>> {
2195 Headers::get_optional_as(self.headers(), &LEASE_ID)
2196 }
2197}
2198
2199/// Provides access to typed response headers for `BlobContainerClient::restore()`
2200///
2201/// # Examples
2202///
2203/// ```no_run
2204/// use azure_core::{Result, http::{Response, NoFormat}};
2205/// use azure_storage_blob::models::{BlobContainerClientRestoreResult, BlobContainerClientRestoreResultHeaders};
2206/// async fn example() -> Result<()> {
2207/// let response: Response<BlobContainerClientRestoreResult, NoFormat> = unimplemented!();
2208/// // Access response headers
2209/// if let Some(date) = response.date()? {
2210/// println!("Date: {:?}", date);
2211/// }
2212/// Ok(())
2213/// }
2214/// ```
2215pub trait BlobContainerClientRestoreResultHeaders: private::Sealed {
2216 fn date(&self) -> Result<Option<OffsetDateTime>>;
2217}
2218
2219impl BlobContainerClientRestoreResultHeaders
2220 for Response<BlobContainerClientRestoreResult, NoFormat>
2221{
2222 /// UTC date/time value generated by the service that indicates the time at which the response was initiated
2223 fn date(&self) -> Result<Option<OffsetDateTime>> {
2224 Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str()))
2225 }
2226}
2227
2228/// Provides access to typed response headers for `BlobContainerClient::set_access_policy()`
2229///
2230/// # Examples
2231///
2232/// ```no_run
2233/// use azure_core::{Result, http::{Response, NoFormat}};
2234/// use azure_storage_blob::models::{BlobContainerClientSetAccessPolicyResult, BlobContainerClientSetAccessPolicyResultHeaders};
2235/// async fn example() -> Result<()> {
2236/// let response: Response<BlobContainerClientSetAccessPolicyResult, NoFormat> = unimplemented!();
2237/// // Access response headers
2238/// if let Some(date) = response.date()? {
2239/// println!("Date: {:?}", date);
2240/// }
2241/// if let Some(last_modified) = response.last_modified()? {
2242/// println!("Last-Modified: {:?}", last_modified);
2243/// }
2244/// if let Some(etag) = response.etag()? {
2245/// println!("etag: {:?}", etag);
2246/// }
2247/// Ok(())
2248/// }
2249/// ```
2250pub trait BlobContainerClientSetAccessPolicyResultHeaders: private::Sealed {
2251 fn date(&self) -> Result<Option<OffsetDateTime>>;
2252 fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
2253 fn etag(&self) -> Result<Option<String>>;
2254}
2255
2256impl BlobContainerClientSetAccessPolicyResultHeaders
2257 for Response<BlobContainerClientSetAccessPolicyResult, NoFormat>
2258{
2259 /// UTC date/time value generated by the service that indicates the time at which the response was initiated
2260 fn date(&self) -> Result<Option<OffsetDateTime>> {
2261 Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str()))
2262 }
2263
2264 /// The date/time that the container was last modified.
2265 fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
2266 Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
2267 parse_rfc7231(h.as_str())
2268 })
2269 }
2270
2271 /// The ETag contains a value that you can use to perform operations conditionally.
2272 fn etag(&self) -> Result<Option<String>> {
2273 Headers::get_optional_as(self.headers(), &ETAG)
2274 }
2275}
2276
2277/// Provides access to typed response headers for `BlobServiceClient::get_account_info()`
2278///
2279/// # Examples
2280///
2281/// ```no_run
2282/// use azure_core::{Result, http::{Response, NoFormat}};
2283/// use azure_storage_blob::models::{BlobServiceClientGetAccountInfoResult, BlobServiceClientGetAccountInfoResultHeaders};
2284/// async fn example() -> Result<()> {
2285/// let response: Response<BlobServiceClientGetAccountInfoResult, NoFormat> = unimplemented!();
2286/// // Access response headers
2287/// if let Some(account_kind) = response.account_kind()? {
2288/// println!("x-ms-account-kind: {:?}", account_kind);
2289/// }
2290/// if let Some(is_hierarchical_namespace_enabled) = response.is_hierarchical_namespace_enabled()? {
2291/// println!("x-ms-is-hns-enabled: {:?}", is_hierarchical_namespace_enabled);
2292/// }
2293/// if let Some(sku_name) = response.sku_name()? {
2294/// println!("x-ms-sku-name: {:?}", sku_name);
2295/// }
2296/// Ok(())
2297/// }
2298/// ```
2299pub trait BlobServiceClientGetAccountInfoResultHeaders: private::Sealed {
2300 fn account_kind(&self) -> Result<Option<AccountKind>>;
2301 fn is_hierarchical_namespace_enabled(&self) -> Result<Option<bool>>;
2302 fn sku_name(&self) -> Result<Option<SkuName>>;
2303}
2304
2305impl BlobServiceClientGetAccountInfoResultHeaders
2306 for Response<BlobServiceClientGetAccountInfoResult, NoFormat>
2307{
2308 /// Identifies the account kind
2309 fn account_kind(&self) -> Result<Option<AccountKind>> {
2310 Headers::get_optional_as(self.headers(), &ACCOUNT_KIND)
2311 }
2312
2313 /// Version 2019-07-07 and newer. Indicates if the account has a hierarchical namespace enabled.
2314 fn is_hierarchical_namespace_enabled(&self) -> Result<Option<bool>> {
2315 Headers::get_optional_as(self.headers(), &IS_HNS_ENABLED)
2316 }
2317
2318 /// Identifies the sku name of the account
2319 fn sku_name(&self) -> Result<Option<SkuName>> {
2320 Headers::get_optional_as(self.headers(), &SKU_NAME)
2321 }
2322}
2323
2324/// Provides access to typed response headers for `BlobClient::get_tags()`
2325///
2326/// # Examples
2327///
2328/// ```no_run
2329/// use azure_core::{Result, http::{Response, XmlFormat}};
2330/// use azure_storage_blob::models::{BlobTags, BlobTagsHeaders};
2331/// async fn example() -> Result<()> {
2332/// let response: Response<BlobTags, XmlFormat> = unimplemented!();
2333/// // Access response headers
2334/// if let Some(date) = response.date()? {
2335/// println!("Date: {:?}", date);
2336/// }
2337/// Ok(())
2338/// }
2339/// ```
2340pub trait BlobTagsHeaders: private::Sealed {
2341 fn date(&self) -> Result<Option<OffsetDateTime>>;
2342}
2343
2344impl BlobTagsHeaders for Response<BlobTags, XmlFormat> {
2345 /// UTC date/time value generated by the service that indicates the time at which the response was initiated
2346 fn date(&self) -> Result<Option<OffsetDateTime>> {
2347 Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str()))
2348 }
2349}
2350
2351/// Provides access to typed response headers for `BlockBlobClient::commit_block_list()`
2352///
2353/// # Examples
2354///
2355/// ```no_run
2356/// use azure_core::{Result, http::{Response, NoFormat}};
2357/// use azure_storage_blob::models::{BlockBlobClientCommitBlockListResult, BlockBlobClientCommitBlockListResultHeaders};
2358/// async fn example() -> Result<()> {
2359/// let response: Response<BlockBlobClientCommitBlockListResult, NoFormat> = unimplemented!();
2360/// // Access response headers
2361/// if let Some(content_md5) = response.content_md5()? {
2362/// println!("Content-MD5: {:?}", content_md5);
2363/// }
2364/// if let Some(last_modified) = response.last_modified()? {
2365/// println!("Last-Modified: {:?}", last_modified);
2366/// }
2367/// if let Some(etag) = response.etag()? {
2368/// println!("etag: {:?}", etag);
2369/// }
2370/// Ok(())
2371/// }
2372/// ```
2373pub trait BlockBlobClientCommitBlockListResultHeaders: private::Sealed {
2374 fn content_md5(&self) -> Result<Option<Vec<u8>>>;
2375 fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
2376 fn etag(&self) -> Result<Option<String>>;
2377 fn content_crc64(&self) -> Result<Option<Vec<u8>>>;
2378 fn encryption_key_sha256(&self) -> Result<Option<String>>;
2379 fn encryption_scope(&self) -> Result<Option<String>>;
2380 fn is_server_encrypted(&self) -> Result<Option<bool>>;
2381 fn version_id(&self) -> Result<Option<String>>;
2382}
2383
2384impl BlockBlobClientCommitBlockListResultHeaders
2385 for Response<BlockBlobClientCommitBlockListResult, NoFormat>
2386{
2387 /// If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the
2388 /// client can check for message content integrity.
2389 fn content_md5(&self) -> Result<Option<Vec<u8>>> {
2390 Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| decode(h.as_str()))
2391 }
2392
2393 /// The date/time that the container was last modified.
2394 fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
2395 Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
2396 parse_rfc7231(h.as_str())
2397 })
2398 }
2399
2400 /// The ETag contains a value that you can use to perform operations conditionally.
2401 fn etag(&self) -> Result<Option<String>> {
2402 Headers::get_optional_as(self.headers(), &ETAG)
2403 }
2404
2405 /// This response header is returned so that the client can check for the integrity of the copied content.
2406 fn content_crc64(&self) -> Result<Option<Vec<u8>>> {
2407 Headers::get_optional_with(self.headers(), &CONTENT_CRC64, |h| decode(h.as_str()))
2408 }
2409
2410 /// The SHA-256 hash of the encryption key used to encrypt the blob. This header is only returned when the blob was encrypted
2411 /// with a customer-provided key.
2412 fn encryption_key_sha256(&self) -> Result<Option<String>> {
2413 Headers::get_optional_as(self.headers(), &ENCRYPTION_KEY_SHA256)
2414 }
2415
2416 /// If the blob has a MD5 hash, and if request contains range header (Range or x-ms-range), this response header is returned
2417 /// with the value of the whole blob's MD5 value. This value may or may not be equal to the value returned in Content-MD5
2418 /// header, with the latter calculated from the requested range
2419 fn encryption_scope(&self) -> Result<Option<String>> {
2420 Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE)
2421 }
2422
2423 /// The value of this header is set to true if the contents of the request are successfully encrypted using the specified
2424 /// algorithm, and false otherwise.
2425 fn is_server_encrypted(&self) -> Result<Option<bool>> {
2426 Headers::get_optional_as(self.headers(), &REQUEST_SERVER_ENCRYPTED)
2427 }
2428
2429 /// A DateTime value returned by the service that uniquely identifies the blob. The value of this header indicates the blob
2430 /// version, and may be used in subsequent requests to access this version of the blob.
2431 fn version_id(&self) -> Result<Option<String>> {
2432 Headers::get_optional_as(self.headers(), &VERSION_ID)
2433 }
2434}
2435
2436/// Provides access to typed response headers for `BlockBlobClient::query()`
2437///
2438/// # Examples
2439///
2440/// ```no_run
2441/// use azure_core::{Result, http::{Response, NoFormat}};
2442/// use azure_storage_blob::models::{BlockBlobClientQueryResult, BlockBlobClientQueryResultHeaders};
2443/// async fn example() -> Result<()> {
2444/// let response: Response<BlockBlobClientQueryResult, NoFormat> = unimplemented!();
2445/// // Access response headers
2446/// if let Some(accept_ranges) = response.accept_ranges()? {
2447/// println!("Accept-Ranges: {:?}", accept_ranges);
2448/// }
2449/// if let Some(cache_control) = response.cache_control()? {
2450/// println!("Cache-Control: {:?}", cache_control);
2451/// }
2452/// if let Some(content_disposition) = response.content_disposition()? {
2453/// println!("Content-Disposition: {:?}", content_disposition);
2454/// }
2455/// Ok(())
2456/// }
2457/// ```
2458pub trait BlockBlobClientQueryResultHeaders: private::Sealed {
2459 fn accept_ranges(&self) -> Result<Option<String>>;
2460 fn cache_control(&self) -> Result<Option<String>>;
2461 fn content_disposition(&self) -> Result<Option<String>>;
2462 fn content_encoding(&self) -> Result<Option<String>>;
2463 fn content_language(&self) -> Result<Option<String>>;
2464 fn content_length(&self) -> Result<Option<u64>>;
2465 fn content_md5(&self) -> Result<Option<Vec<u8>>>;
2466 fn content_range(&self) -> Result<Option<String>>;
2467 fn date(&self) -> Result<Option<OffsetDateTime>>;
2468 fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
2469 fn etag(&self) -> Result<Option<String>>;
2470 fn blob_committed_block_count(&self) -> Result<Option<i32>>;
2471 fn blob_content_md5(&self) -> Result<Option<Vec<u8>>>;
2472 fn blob_sequence_number(&self) -> Result<Option<i64>>;
2473 fn blob_type(&self) -> Result<Option<BlobType>>;
2474 fn content_crc64(&self) -> Result<Option<Vec<u8>>>;
2475 fn copy_completion_time(&self) -> Result<Option<OffsetDateTime>>;
2476 fn copy_id(&self) -> Result<Option<String>>;
2477 fn copy_progress(&self) -> Result<Option<String>>;
2478 fn copy_source(&self) -> Result<Option<String>>;
2479 fn copy_status(&self) -> Result<Option<CopyStatus>>;
2480 fn copy_status_description(&self) -> Result<Option<String>>;
2481 fn encryption_key_sha256(&self) -> Result<Option<String>>;
2482 fn encryption_scope(&self) -> Result<Option<String>>;
2483 fn duration(&self) -> Result<Option<LeaseDuration>>;
2484 fn lease_state(&self) -> Result<Option<LeaseState>>;
2485 fn lease_status(&self) -> Result<Option<LeaseStatus>>;
2486 fn metadata(&self) -> Result<HashMap<String, String>>;
2487 fn is_server_encrypted(&self) -> Result<Option<bool>>;
2488}
2489
2490impl BlockBlobClientQueryResultHeaders for Response<BlockBlobClientQueryResult, NoFormat> {
2491 /// Indicates that the service supports requests for partial blob content.
2492 fn accept_ranges(&self) -> Result<Option<String>> {
2493 Headers::get_optional_as(self.headers(), &ACCEPT_RANGES)
2494 }
2495
2496 /// This header is returned if it was previously specified for the blob.
2497 fn cache_control(&self) -> Result<Option<String>> {
2498 Headers::get_optional_as(self.headers(), &CACHE_CONTROL)
2499 }
2500
2501 /// This header returns the value that was specified for the 'x-ms-blob-content-disposition' header. The Content-Disposition
2502 /// response header field conveys additional information about how to process the response payload, and also can be used to
2503 /// attach additional metadata. For example, if set to attachment, it indicates that the user-agent should not display the
2504 /// response, but instead show a Save As dialog with a filename other than the blob name specified.
2505 fn content_disposition(&self) -> Result<Option<String>> {
2506 Headers::get_optional_as(self.headers(), &CONTENT_DISPOSITION)
2507 }
2508
2509 /// This header returns the value that was specified for the Content-Encoding request header
2510 fn content_encoding(&self) -> Result<Option<String>> {
2511 Headers::get_optional_as(self.headers(), &CONTENT_ENCODING)
2512 }
2513
2514 /// This header returns the value that was specified for the Content-Language request header.
2515 fn content_language(&self) -> Result<Option<String>> {
2516 Headers::get_optional_as(self.headers(), &CONTENT_LANGUAGE)
2517 }
2518
2519 /// The number of bytes present in the response body.
2520 fn content_length(&self) -> Result<Option<u64>> {
2521 Headers::get_optional_as(self.headers(), &CONTENT_LENGTH)
2522 }
2523
2524 /// If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the
2525 /// client can check for message content integrity.
2526 fn content_md5(&self) -> Result<Option<Vec<u8>>> {
2527 Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| decode(h.as_str()))
2528 }
2529
2530 /// Indicates the range of bytes returned in the event that the client requested a subset of the blob by setting the 'Range'
2531 /// request header.
2532 fn content_range(&self) -> Result<Option<String>> {
2533 Headers::get_optional_as(self.headers(), &CONTENT_RANGE)
2534 }
2535
2536 /// UTC date/time value generated by the service that indicates the time at which the response was initiated
2537 fn date(&self) -> Result<Option<OffsetDateTime>> {
2538 Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str()))
2539 }
2540
2541 /// The date/time that the container was last modified.
2542 fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
2543 Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
2544 parse_rfc7231(h.as_str())
2545 })
2546 }
2547
2548 /// The ETag contains a value that you can use to perform operations conditionally.
2549 fn etag(&self) -> Result<Option<String>> {
2550 Headers::get_optional_as(self.headers(), &ETAG)
2551 }
2552
2553 /// The number of committed blocks present in the blob. This header is returned only for append blobs.
2554 fn blob_committed_block_count(&self) -> Result<Option<i32>> {
2555 Headers::get_optional_as(self.headers(), &BLOB_COMMITTED_BLOCK_COUNT)
2556 }
2557
2558 /// If the blob has a MD5 hash, and if request contains range header (Range or x-ms-range), this response header is returned
2559 /// with the value of the whole blob's MD5 value. This value may or may not be equal to the value returned in Content-MD5
2560 /// header, with the latter calculated from the requested range
2561 fn blob_content_md5(&self) -> Result<Option<Vec<u8>>> {
2562 Headers::get_optional_with(self.headers(), &BLOB_CONTENT_MD5, |h| decode(h.as_str()))
2563 }
2564
2565 /// The current sequence number for a page blob. This header is not returned for block blobs or append blobs.
2566 fn blob_sequence_number(&self) -> Result<Option<i64>> {
2567 Headers::get_optional_as(self.headers(), &BLOB_SEQUENCE_NUMBER)
2568 }
2569
2570 /// The type of the blob.
2571 fn blob_type(&self) -> Result<Option<BlobType>> {
2572 Headers::get_optional_as(self.headers(), &BLOB_TYPE)
2573 }
2574
2575 /// This response header is returned so that the client can check for the integrity of the copied content.
2576 fn content_crc64(&self) -> Result<Option<Vec<u8>>> {
2577 Headers::get_optional_with(self.headers(), &CONTENT_CRC64, |h| decode(h.as_str()))
2578 }
2579
2580 /// Conclusion time of the last attempted Copy Blob operation where this blob was the destination blob. This value can specify
2581 /// the time of a completed, aborted, or failed copy attempt. This header does not appear if a copy is pending, if this blob
2582 /// has never been the destination in a Copy Blob operation, or if this blob has been modified after a concluded Copy Blob
2583 /// operation using Set Blob Properties, Put Blob, or Put Block List.
2584 fn copy_completion_time(&self) -> Result<Option<OffsetDateTime>> {
2585 Headers::get_optional_with(self.headers(), ©_COMPLETION_TIME, |h| {
2586 parse_rfc7231(h.as_str())
2587 })
2588 }
2589
2590 /// String identifier for this copy operation. Use with Get Blob Properties to check the status of this copy operation, or
2591 /// pass to Abort Copy Blob to abort a pending copy.
2592 fn copy_id(&self) -> Result<Option<String>> {
2593 Headers::get_optional_as(self.headers(), ©_ID)
2594 }
2595
2596 /// Contains the number of bytes copied and the total bytes in the source in the last attempted Copy Blob operation where
2597 /// this blob was the destination blob. Can show between 0 and Content-Length bytes copied. This header does not appear if
2598 /// this blob has never been the destination in a Copy Blob operation, or if this blob has been modified after a concluded
2599 /// Copy Blob operation using Set Blob Properties, Put Blob, or Put Block List
2600 fn copy_progress(&self) -> Result<Option<String>> {
2601 Headers::get_optional_as(self.headers(), ©_PROGRESS)
2602 }
2603
2604 /// URL up to 2 KB in length that specifies the source blob or file used in the last attempted Copy Blob operation where this
2605 /// blob was the destination blob. This header does not appear if this blob has never been the destination in a Copy Blob
2606 /// operation, or if this blob has been modified after a concluded Copy Blob operation using Set Blob Properties, Put Blob,
2607 /// or Put Block List.
2608 fn copy_source(&self) -> Result<Option<String>> {
2609 Headers::get_optional_as(self.headers(), ©_SOURCE)
2610 }
2611
2612 /// State of the copy operation identified by x-ms-copy-id.
2613 fn copy_status(&self) -> Result<Option<CopyStatus>> {
2614 Headers::get_optional_as(self.headers(), ©_STATUS)
2615 }
2616
2617 /// Only appears when x-ms-copy-status is failed or pending. Describes the cause of the last fatal or non-fatal copy operation
2618 /// failure. This header does not appear if this blob has never been the destination in a Copy Blob operation, or if this
2619 /// blob has been modified after a concluded Copy Blob operation using Set Blob Properties, Put Blob, or Put Block List
2620 fn copy_status_description(&self) -> Result<Option<String>> {
2621 Headers::get_optional_as(self.headers(), ©_STATUS_DESCRIPTION)
2622 }
2623
2624 /// The SHA-256 hash of the encryption key used to encrypt the blob. This header is only returned when the blob was encrypted
2625 /// with a customer-provided key.
2626 fn encryption_key_sha256(&self) -> Result<Option<String>> {
2627 Headers::get_optional_as(self.headers(), &ENCRYPTION_KEY_SHA256)
2628 }
2629
2630 /// If the blob has a MD5 hash, and if request contains range header (Range or x-ms-range), this response header is returned
2631 /// with the value of the whole blob's MD5 value. This value may or may not be equal to the value returned in Content-MD5
2632 /// header, with the latter calculated from the requested range
2633 fn encryption_scope(&self) -> Result<Option<String>> {
2634 Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE)
2635 }
2636
2637 /// Specifies the duration of the lease, in seconds, or negative one (-1) for a lease that never expires. A non-infinite lease
2638 /// can be between 15 and 60 seconds. A lease duration cannot be changed using renew or change.
2639 fn duration(&self) -> Result<Option<LeaseDuration>> {
2640 Headers::get_optional_as(self.headers(), &LEASE_DURATION)
2641 }
2642
2643 /// Lease state of the blob.
2644 fn lease_state(&self) -> Result<Option<LeaseState>> {
2645 Headers::get_optional_as(self.headers(), &LEASE_STATE)
2646 }
2647
2648 /// The lease status of the blob.
2649 fn lease_status(&self) -> Result<Option<LeaseStatus>> {
2650 Headers::get_optional_as(self.headers(), &LEASE_STATUS)
2651 }
2652
2653 /// The metadata headers.
2654 fn metadata(&self) -> Result<HashMap<String, String>> {
2655 let mut values = HashMap::new();
2656 for h in self.headers().iter() {
2657 let name = h.0.as_str();
2658 if name.len() > META.len() && name.starts_with(META) {
2659 values.insert(name[META.len()..].to_owned(), h.1.as_str().to_owned());
2660 }
2661 }
2662 Ok(values)
2663 }
2664
2665 /// The value of this header is set to true if the contents of the request are successfully encrypted using the specified
2666 /// algorithm, and false otherwise.
2667 fn is_server_encrypted(&self) -> Result<Option<bool>> {
2668 Headers::get_optional_as(self.headers(), &SERVER_ENCRYPTED)
2669 }
2670}
2671
2672/// Provides access to typed response headers for `BlockBlobClient::stage_block_from_url()`
2673///
2674/// # Examples
2675///
2676/// ```no_run
2677/// use azure_core::{Result, http::{Response, NoFormat}};
2678/// use azure_storage_blob::models::{BlockBlobClientStageBlockFromUrlResult, BlockBlobClientStageBlockFromUrlResultHeaders};
2679/// async fn example() -> Result<()> {
2680/// let response: Response<BlockBlobClientStageBlockFromUrlResult, NoFormat> = unimplemented!();
2681/// // Access response headers
2682/// if let Some(content_md5) = response.content_md5()? {
2683/// println!("Content-MD5: {:?}", content_md5);
2684/// }
2685/// if let Some(date) = response.date()? {
2686/// println!("Date: {:?}", date);
2687/// }
2688/// if let Some(content_crc64) = response.content_crc64()? {
2689/// println!("x-ms-content-crc64: {:?}", content_crc64);
2690/// }
2691/// Ok(())
2692/// }
2693/// ```
2694pub trait BlockBlobClientStageBlockFromUrlResultHeaders: private::Sealed {
2695 fn content_md5(&self) -> Result<Option<Vec<u8>>>;
2696 fn date(&self) -> Result<Option<OffsetDateTime>>;
2697 fn content_crc64(&self) -> Result<Option<Vec<u8>>>;
2698 fn encryption_key_sha256(&self) -> Result<Option<String>>;
2699 fn encryption_scope(&self) -> Result<Option<String>>;
2700 fn is_server_encrypted(&self) -> Result<Option<bool>>;
2701}
2702
2703impl BlockBlobClientStageBlockFromUrlResultHeaders
2704 for Response<BlockBlobClientStageBlockFromUrlResult, NoFormat>
2705{
2706 /// If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the
2707 /// client can check for message content integrity.
2708 fn content_md5(&self) -> Result<Option<Vec<u8>>> {
2709 Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| decode(h.as_str()))
2710 }
2711
2712 /// UTC date/time value generated by the service that indicates the time at which the response was initiated
2713 fn date(&self) -> Result<Option<OffsetDateTime>> {
2714 Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str()))
2715 }
2716
2717 /// This response header is returned so that the client can check for the integrity of the copied content.
2718 fn content_crc64(&self) -> Result<Option<Vec<u8>>> {
2719 Headers::get_optional_with(self.headers(), &CONTENT_CRC64, |h| decode(h.as_str()))
2720 }
2721
2722 /// The SHA-256 hash of the encryption key used to encrypt the blob. This header is only returned when the blob was encrypted
2723 /// with a customer-provided key.
2724 fn encryption_key_sha256(&self) -> Result<Option<String>> {
2725 Headers::get_optional_as(self.headers(), &ENCRYPTION_KEY_SHA256)
2726 }
2727
2728 /// If the blob has a MD5 hash, and if request contains range header (Range or x-ms-range), this response header is returned
2729 /// with the value of the whole blob's MD5 value. This value may or may not be equal to the value returned in Content-MD5
2730 /// header, with the latter calculated from the requested range
2731 fn encryption_scope(&self) -> Result<Option<String>> {
2732 Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE)
2733 }
2734
2735 /// The value of this header is set to true if the contents of the request are successfully encrypted using the specified
2736 /// algorithm, and false otherwise.
2737 fn is_server_encrypted(&self) -> Result<Option<bool>> {
2738 Headers::get_optional_as(self.headers(), &REQUEST_SERVER_ENCRYPTED)
2739 }
2740}
2741
2742/// Provides access to typed response headers for `BlockBlobClient::stage_block()`
2743///
2744/// # Examples
2745///
2746/// ```no_run
2747/// use azure_core::{Result, http::{Response, NoFormat}};
2748/// use azure_storage_blob::models::{BlockBlobClientStageBlockResult, BlockBlobClientStageBlockResultHeaders};
2749/// async fn example() -> Result<()> {
2750/// let response: Response<BlockBlobClientStageBlockResult, NoFormat> = unimplemented!();
2751/// // Access response headers
2752/// if let Some(content_md5) = response.content_md5()? {
2753/// println!("Content-MD5: {:?}", content_md5);
2754/// }
2755/// if let Some(content_crc64) = response.content_crc64()? {
2756/// println!("x-ms-content-crc64: {:?}", content_crc64);
2757/// }
2758/// if let Some(encryption_key_sha256) = response.encryption_key_sha256()? {
2759/// println!("x-ms-encryption-key-sha256: {:?}", encryption_key_sha256);
2760/// }
2761/// Ok(())
2762/// }
2763/// ```
2764pub trait BlockBlobClientStageBlockResultHeaders: private::Sealed {
2765 fn content_md5(&self) -> Result<Option<Vec<u8>>>;
2766 fn content_crc64(&self) -> Result<Option<Vec<u8>>>;
2767 fn encryption_key_sha256(&self) -> Result<Option<String>>;
2768 fn encryption_scope(&self) -> Result<Option<String>>;
2769 fn is_server_encrypted(&self) -> Result<Option<bool>>;
2770}
2771
2772impl BlockBlobClientStageBlockResultHeaders
2773 for Response<BlockBlobClientStageBlockResult, NoFormat>
2774{
2775 /// If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the
2776 /// client can check for message content integrity.
2777 fn content_md5(&self) -> Result<Option<Vec<u8>>> {
2778 Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| decode(h.as_str()))
2779 }
2780
2781 /// This response header is returned so that the client can check for the integrity of the copied content.
2782 fn content_crc64(&self) -> Result<Option<Vec<u8>>> {
2783 Headers::get_optional_with(self.headers(), &CONTENT_CRC64, |h| decode(h.as_str()))
2784 }
2785
2786 /// The SHA-256 hash of the encryption key used to encrypt the blob. This header is only returned when the blob was encrypted
2787 /// with a customer-provided key.
2788 fn encryption_key_sha256(&self) -> Result<Option<String>> {
2789 Headers::get_optional_as(self.headers(), &ENCRYPTION_KEY_SHA256)
2790 }
2791
2792 /// If the blob has a MD5 hash, and if request contains range header (Range or x-ms-range), this response header is returned
2793 /// with the value of the whole blob's MD5 value. This value may or may not be equal to the value returned in Content-MD5
2794 /// header, with the latter calculated from the requested range
2795 fn encryption_scope(&self) -> Result<Option<String>> {
2796 Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE)
2797 }
2798
2799 /// The value of this header is set to true if the contents of the request are successfully encrypted using the specified
2800 /// algorithm, and false otherwise.
2801 fn is_server_encrypted(&self) -> Result<Option<bool>> {
2802 Headers::get_optional_as(self.headers(), &REQUEST_SERVER_ENCRYPTED)
2803 }
2804}
2805
2806/// Provides access to typed response headers for `BlockBlobClient::upload_blob_from_url()`
2807///
2808/// # Examples
2809///
2810/// ```no_run
2811/// use azure_core::{Result, http::{Response, NoFormat}};
2812/// use azure_storage_blob::models::{BlockBlobClientUploadBlobFromUrlResult, BlockBlobClientUploadBlobFromUrlResultHeaders};
2813/// async fn example() -> Result<()> {
2814/// let response: Response<BlockBlobClientUploadBlobFromUrlResult, NoFormat> = unimplemented!();
2815/// // Access response headers
2816/// if let Some(content_md5) = response.content_md5()? {
2817/// println!("Content-MD5: {:?}", content_md5);
2818/// }
2819/// if let Some(last_modified) = response.last_modified()? {
2820/// println!("Last-Modified: {:?}", last_modified);
2821/// }
2822/// if let Some(etag) = response.etag()? {
2823/// println!("etag: {:?}", etag);
2824/// }
2825/// Ok(())
2826/// }
2827/// ```
2828pub trait BlockBlobClientUploadBlobFromUrlResultHeaders: private::Sealed {
2829 fn content_md5(&self) -> Result<Option<Vec<u8>>>;
2830 fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
2831 fn etag(&self) -> Result<Option<String>>;
2832 fn encryption_key_sha256(&self) -> Result<Option<String>>;
2833 fn encryption_scope(&self) -> Result<Option<String>>;
2834 fn is_server_encrypted(&self) -> Result<Option<bool>>;
2835 fn version_id(&self) -> Result<Option<String>>;
2836}
2837
2838impl BlockBlobClientUploadBlobFromUrlResultHeaders
2839 for Response<BlockBlobClientUploadBlobFromUrlResult, NoFormat>
2840{
2841 /// If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the
2842 /// client can check for message content integrity.
2843 fn content_md5(&self) -> Result<Option<Vec<u8>>> {
2844 Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| decode(h.as_str()))
2845 }
2846
2847 /// The date/time that the container was last modified.
2848 fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
2849 Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
2850 parse_rfc7231(h.as_str())
2851 })
2852 }
2853
2854 /// The ETag contains a value that you can use to perform operations conditionally.
2855 fn etag(&self) -> Result<Option<String>> {
2856 Headers::get_optional_as(self.headers(), &ETAG)
2857 }
2858
2859 /// The SHA-256 hash of the encryption key used to encrypt the blob. This header is only returned when the blob was encrypted
2860 /// with a customer-provided key.
2861 fn encryption_key_sha256(&self) -> Result<Option<String>> {
2862 Headers::get_optional_as(self.headers(), &ENCRYPTION_KEY_SHA256)
2863 }
2864
2865 /// If the blob has a MD5 hash, and if request contains range header (Range or x-ms-range), this response header is returned
2866 /// with the value of the whole blob's MD5 value. This value may or may not be equal to the value returned in Content-MD5
2867 /// header, with the latter calculated from the requested range
2868 fn encryption_scope(&self) -> Result<Option<String>> {
2869 Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE)
2870 }
2871
2872 /// The value of this header is set to true if the contents of the request are successfully encrypted using the specified
2873 /// algorithm, and false otherwise.
2874 fn is_server_encrypted(&self) -> Result<Option<bool>> {
2875 Headers::get_optional_as(self.headers(), &REQUEST_SERVER_ENCRYPTED)
2876 }
2877
2878 /// A DateTime value returned by the service that uniquely identifies the blob. The value of this header indicates the blob
2879 /// version, and may be used in subsequent requests to access this version of the blob.
2880 fn version_id(&self) -> Result<Option<String>> {
2881 Headers::get_optional_as(self.headers(), &VERSION_ID)
2882 }
2883}
2884
2885/// Provides access to typed response headers for `BlockBlobClient::upload()`
2886///
2887/// # Examples
2888///
2889/// ```no_run
2890/// use azure_core::{Result, http::{Response, NoFormat}};
2891/// use azure_storage_blob::models::{BlockBlobClientUploadResult, BlockBlobClientUploadResultHeaders};
2892/// async fn example() -> Result<()> {
2893/// let response: Response<BlockBlobClientUploadResult, NoFormat> = unimplemented!();
2894/// // Access response headers
2895/// if let Some(content_md5) = response.content_md5()? {
2896/// println!("Content-MD5: {:?}", content_md5);
2897/// }
2898/// if let Some(last_modified) = response.last_modified()? {
2899/// println!("Last-Modified: {:?}", last_modified);
2900/// }
2901/// if let Some(etag) = response.etag()? {
2902/// println!("etag: {:?}", etag);
2903/// }
2904/// Ok(())
2905/// }
2906/// ```
2907pub trait BlockBlobClientUploadResultHeaders: private::Sealed {
2908 fn content_md5(&self) -> Result<Option<Vec<u8>>>;
2909 fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
2910 fn etag(&self) -> Result<Option<String>>;
2911 fn encryption_key_sha256(&self) -> Result<Option<String>>;
2912 fn encryption_scope(&self) -> Result<Option<String>>;
2913 fn is_server_encrypted(&self) -> Result<Option<bool>>;
2914 fn version_id(&self) -> Result<Option<String>>;
2915}
2916
2917impl BlockBlobClientUploadResultHeaders for Response<BlockBlobClientUploadResult, NoFormat> {
2918 /// If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the
2919 /// client can check for message content integrity.
2920 fn content_md5(&self) -> Result<Option<Vec<u8>>> {
2921 Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| decode(h.as_str()))
2922 }
2923
2924 /// The date/time that the container was last modified.
2925 fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
2926 Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
2927 parse_rfc7231(h.as_str())
2928 })
2929 }
2930
2931 /// The ETag contains a value that you can use to perform operations conditionally.
2932 fn etag(&self) -> Result<Option<String>> {
2933 Headers::get_optional_as(self.headers(), &ETAG)
2934 }
2935
2936 /// The SHA-256 hash of the encryption key used to encrypt the blob. This header is only returned when the blob was encrypted
2937 /// with a customer-provided key.
2938 fn encryption_key_sha256(&self) -> Result<Option<String>> {
2939 Headers::get_optional_as(self.headers(), &ENCRYPTION_KEY_SHA256)
2940 }
2941
2942 /// If the blob has a MD5 hash, and if request contains range header (Range or x-ms-range), this response header is returned
2943 /// with the value of the whole blob's MD5 value. This value may or may not be equal to the value returned in Content-MD5
2944 /// header, with the latter calculated from the requested range
2945 fn encryption_scope(&self) -> Result<Option<String>> {
2946 Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE)
2947 }
2948
2949 /// The value of this header is set to true if the contents of the request are successfully encrypted using the specified
2950 /// algorithm, and false otherwise.
2951 fn is_server_encrypted(&self) -> Result<Option<bool>> {
2952 Headers::get_optional_as(self.headers(), &REQUEST_SERVER_ENCRYPTED)
2953 }
2954
2955 /// A DateTime value returned by the service that uniquely identifies the blob. The value of this header indicates the blob
2956 /// version, and may be used in subsequent requests to access this version of the blob.
2957 fn version_id(&self) -> Result<Option<String>> {
2958 Headers::get_optional_as(self.headers(), &VERSION_ID)
2959 }
2960}
2961
2962/// Provides access to typed response headers for `BlockBlobClient::get_block_list()`
2963///
2964/// # Examples
2965///
2966/// ```no_run
2967/// use azure_core::{Result, http::{Response, XmlFormat}};
2968/// use azure_storage_blob::models::{BlockList, BlockListHeaders};
2969/// async fn example() -> Result<()> {
2970/// let response: Response<BlockList, XmlFormat> = unimplemented!();
2971/// // Access response headers
2972/// if let Some(last_modified) = response.last_modified()? {
2973/// println!("Last-Modified: {:?}", last_modified);
2974/// }
2975/// if let Some(etag) = response.etag()? {
2976/// println!("etag: {:?}", etag);
2977/// }
2978/// if let Some(blob_content_length) = response.blob_content_length()? {
2979/// println!("x-ms-blob-content-length: {:?}", blob_content_length);
2980/// }
2981/// Ok(())
2982/// }
2983/// ```
2984pub trait BlockListHeaders: private::Sealed {
2985 fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
2986 fn etag(&self) -> Result<Option<String>>;
2987 fn blob_content_length(&self) -> Result<Option<i64>>;
2988}
2989
2990impl BlockListHeaders for Response<BlockList, XmlFormat> {
2991 /// The date/time that the container was last modified.
2992 fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
2993 Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
2994 parse_rfc7231(h.as_str())
2995 })
2996 }
2997
2998 /// The ETag contains a value that you can use to perform operations conditionally.
2999 fn etag(&self) -> Result<Option<String>> {
3000 Headers::get_optional_as(self.headers(), &ETAG)
3001 }
3002
3003 /// The size of the blob in bytes.
3004 fn blob_content_length(&self) -> Result<Option<i64>> {
3005 Headers::get_optional_as(self.headers(), &BLOB_CONTENT_LENGTH)
3006 }
3007}
3008
3009/// Provides access to typed response headers for `BlobContainerClient::list_blob_flat_segment()`
3010///
3011/// # Examples
3012///
3013/// ```no_run
3014/// use azure_core::{Result, http::{Response, XmlFormat}};
3015/// use azure_storage_blob::models::{ListBlobsFlatSegmentResponse, ListBlobsFlatSegmentResponseHeaders};
3016/// async fn example() -> Result<()> {
3017/// let response: Response<ListBlobsFlatSegmentResponse, XmlFormat> = unimplemented!();
3018/// // Access response headers
3019/// if let Some(date) = response.date()? {
3020/// println!("Date: {:?}", date);
3021/// }
3022/// Ok(())
3023/// }
3024/// ```
3025pub trait ListBlobsFlatSegmentResponseHeaders: private::Sealed {
3026 fn date(&self) -> Result<Option<OffsetDateTime>>;
3027}
3028
3029impl ListBlobsFlatSegmentResponseHeaders for Response<ListBlobsFlatSegmentResponse, XmlFormat> {
3030 /// UTC date/time value generated by the service that indicates the time at which the response was initiated
3031 fn date(&self) -> Result<Option<OffsetDateTime>> {
3032 Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str()))
3033 }
3034}
3035
3036/// Provides access to typed response headers for `BlobContainerClient::list_blob_hierarchy_segment()`
3037///
3038/// # Examples
3039///
3040/// ```no_run
3041/// use azure_core::{Result, http::{Response, XmlFormat}};
3042/// use azure_storage_blob::models::{ListBlobsHierarchySegmentResponse, ListBlobsHierarchySegmentResponseHeaders};
3043/// async fn example() -> Result<()> {
3044/// let response: Response<ListBlobsHierarchySegmentResponse, XmlFormat> = unimplemented!();
3045/// // Access response headers
3046/// if let Some(date) = response.date()? {
3047/// println!("Date: {:?}", date);
3048/// }
3049/// Ok(())
3050/// }
3051/// ```
3052pub trait ListBlobsHierarchySegmentResponseHeaders: private::Sealed {
3053 fn date(&self) -> Result<Option<OffsetDateTime>>;
3054}
3055
3056impl ListBlobsHierarchySegmentResponseHeaders
3057 for Response<ListBlobsHierarchySegmentResponse, XmlFormat>
3058{
3059 /// UTC date/time value generated by the service that indicates the time at which the response was initiated
3060 fn date(&self) -> Result<Option<OffsetDateTime>> {
3061 Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str()))
3062 }
3063}
3064
3065/// Provides access to typed response headers for `PageBlobClient::clear_pages()`
3066///
3067/// # Examples
3068///
3069/// ```no_run
3070/// use azure_core::{Result, http::{Response, NoFormat}};
3071/// use azure_storage_blob::models::{PageBlobClientClearPagesResult, PageBlobClientClearPagesResultHeaders};
3072/// async fn example() -> Result<()> {
3073/// let response: Response<PageBlobClientClearPagesResult, NoFormat> = unimplemented!();
3074/// // Access response headers
3075/// if let Some(content_md5) = response.content_md5()? {
3076/// println!("Content-MD5: {:?}", content_md5);
3077/// }
3078/// if let Some(last_modified) = response.last_modified()? {
3079/// println!("Last-Modified: {:?}", last_modified);
3080/// }
3081/// if let Some(etag) = response.etag()? {
3082/// println!("etag: {:?}", etag);
3083/// }
3084/// Ok(())
3085/// }
3086/// ```
3087pub trait PageBlobClientClearPagesResultHeaders: private::Sealed {
3088 fn content_md5(&self) -> Result<Option<Vec<u8>>>;
3089 fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
3090 fn etag(&self) -> Result<Option<String>>;
3091 fn blob_sequence_number(&self) -> Result<Option<i64>>;
3092 fn content_crc64(&self) -> Result<Option<Vec<u8>>>;
3093}
3094
3095impl PageBlobClientClearPagesResultHeaders for Response<PageBlobClientClearPagesResult, NoFormat> {
3096 /// If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the
3097 /// client can check for message content integrity.
3098 fn content_md5(&self) -> Result<Option<Vec<u8>>> {
3099 Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| decode(h.as_str()))
3100 }
3101
3102 /// The date/time that the container was last modified.
3103 fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
3104 Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
3105 parse_rfc7231(h.as_str())
3106 })
3107 }
3108
3109 /// The ETag contains a value that you can use to perform operations conditionally.
3110 fn etag(&self) -> Result<Option<String>> {
3111 Headers::get_optional_as(self.headers(), &ETAG)
3112 }
3113
3114 /// The current sequence number for a page blob. This header is not returned for block blobs or append blobs.
3115 fn blob_sequence_number(&self) -> Result<Option<i64>> {
3116 Headers::get_optional_as(self.headers(), &BLOB_SEQUENCE_NUMBER)
3117 }
3118
3119 /// This response header is returned so that the client can check for the integrity of the copied content.
3120 fn content_crc64(&self) -> Result<Option<Vec<u8>>> {
3121 Headers::get_optional_with(self.headers(), &CONTENT_CRC64, |h| decode(h.as_str()))
3122 }
3123}
3124
3125/// Provides access to typed response headers for `PageBlobClient::copy_incremental()`
3126///
3127/// # Examples
3128///
3129/// ```no_run
3130/// use azure_core::{Result, http::{Response, NoFormat}};
3131/// use azure_storage_blob::models::{PageBlobClientCopyIncrementalResult, PageBlobClientCopyIncrementalResultHeaders};
3132/// async fn example() -> Result<()> {
3133/// let response: Response<PageBlobClientCopyIncrementalResult, NoFormat> = unimplemented!();
3134/// // Access response headers
3135/// if let Some(date) = response.date()? {
3136/// println!("Date: {:?}", date);
3137/// }
3138/// if let Some(last_modified) = response.last_modified()? {
3139/// println!("Last-Modified: {:?}", last_modified);
3140/// }
3141/// if let Some(etag) = response.etag()? {
3142/// println!("etag: {:?}", etag);
3143/// }
3144/// Ok(())
3145/// }
3146/// ```
3147pub trait PageBlobClientCopyIncrementalResultHeaders: private::Sealed {
3148 fn date(&self) -> Result<Option<OffsetDateTime>>;
3149 fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
3150 fn etag(&self) -> Result<Option<String>>;
3151 fn copy_id(&self) -> Result<Option<String>>;
3152 fn copy_status(&self) -> Result<Option<CopyStatus>>;
3153}
3154
3155impl PageBlobClientCopyIncrementalResultHeaders
3156 for Response<PageBlobClientCopyIncrementalResult, NoFormat>
3157{
3158 /// UTC date/time value generated by the service that indicates the time at which the response was initiated
3159 fn date(&self) -> Result<Option<OffsetDateTime>> {
3160 Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str()))
3161 }
3162
3163 /// The date/time that the container was last modified.
3164 fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
3165 Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
3166 parse_rfc7231(h.as_str())
3167 })
3168 }
3169
3170 /// The ETag contains a value that you can use to perform operations conditionally.
3171 fn etag(&self) -> Result<Option<String>> {
3172 Headers::get_optional_as(self.headers(), &ETAG)
3173 }
3174
3175 /// String identifier for this copy operation. Use with Get Blob Properties to check the status of this copy operation, or
3176 /// pass to Abort Copy Blob to abort a pending copy.
3177 fn copy_id(&self) -> Result<Option<String>> {
3178 Headers::get_optional_as(self.headers(), ©_ID)
3179 }
3180
3181 /// State of the copy operation identified by x-ms-copy-id.
3182 fn copy_status(&self) -> Result<Option<CopyStatus>> {
3183 Headers::get_optional_as(self.headers(), ©_STATUS)
3184 }
3185}
3186
3187/// Provides access to typed response headers for `PageBlobClient::create()`
3188///
3189/// # Examples
3190///
3191/// ```no_run
3192/// use azure_core::{Result, http::{Response, NoFormat}};
3193/// use azure_storage_blob::models::{PageBlobClientCreateResult, PageBlobClientCreateResultHeaders};
3194/// async fn example() -> Result<()> {
3195/// let response: Response<PageBlobClientCreateResult, NoFormat> = unimplemented!();
3196/// // Access response headers
3197/// if let Some(content_md5) = response.content_md5()? {
3198/// println!("Content-MD5: {:?}", content_md5);
3199/// }
3200/// if let Some(last_modified) = response.last_modified()? {
3201/// println!("Last-Modified: {:?}", last_modified);
3202/// }
3203/// if let Some(etag) = response.etag()? {
3204/// println!("etag: {:?}", etag);
3205/// }
3206/// Ok(())
3207/// }
3208/// ```
3209pub trait PageBlobClientCreateResultHeaders: private::Sealed {
3210 fn content_md5(&self) -> Result<Option<Vec<u8>>>;
3211 fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
3212 fn etag(&self) -> Result<Option<String>>;
3213 fn encryption_key_sha256(&self) -> Result<Option<String>>;
3214 fn encryption_scope(&self) -> Result<Option<String>>;
3215 fn is_server_encrypted(&self) -> Result<Option<bool>>;
3216 fn version_id(&self) -> Result<Option<String>>;
3217}
3218
3219impl PageBlobClientCreateResultHeaders for Response<PageBlobClientCreateResult, NoFormat> {
3220 /// If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the
3221 /// client can check for message content integrity.
3222 fn content_md5(&self) -> Result<Option<Vec<u8>>> {
3223 Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| decode(h.as_str()))
3224 }
3225
3226 /// The date/time that the container was last modified.
3227 fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
3228 Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
3229 parse_rfc7231(h.as_str())
3230 })
3231 }
3232
3233 /// The ETag contains a value that you can use to perform operations conditionally.
3234 fn etag(&self) -> Result<Option<String>> {
3235 Headers::get_optional_as(self.headers(), &ETAG)
3236 }
3237
3238 /// The SHA-256 hash of the encryption key used to encrypt the blob. This header is only returned when the blob was encrypted
3239 /// with a customer-provided key.
3240 fn encryption_key_sha256(&self) -> Result<Option<String>> {
3241 Headers::get_optional_as(self.headers(), &ENCRYPTION_KEY_SHA256)
3242 }
3243
3244 /// If the blob has a MD5 hash, and if request contains range header (Range or x-ms-range), this response header is returned
3245 /// with the value of the whole blob's MD5 value. This value may or may not be equal to the value returned in Content-MD5
3246 /// header, with the latter calculated from the requested range
3247 fn encryption_scope(&self) -> Result<Option<String>> {
3248 Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE)
3249 }
3250
3251 /// The value of this header is set to true if the contents of the request are successfully encrypted using the specified
3252 /// algorithm, and false otherwise.
3253 fn is_server_encrypted(&self) -> Result<Option<bool>> {
3254 Headers::get_optional_as(self.headers(), &REQUEST_SERVER_ENCRYPTED)
3255 }
3256
3257 /// A DateTime value returned by the service that uniquely identifies the blob. The value of this header indicates the blob
3258 /// version, and may be used in subsequent requests to access this version of the blob.
3259 fn version_id(&self) -> Result<Option<String>> {
3260 Headers::get_optional_as(self.headers(), &VERSION_ID)
3261 }
3262}
3263
3264/// Provides access to typed response headers for `PageBlobClient::resize()`
3265///
3266/// # Examples
3267///
3268/// ```no_run
3269/// use azure_core::{Result, http::{Response, NoFormat}};
3270/// use azure_storage_blob::models::{PageBlobClientResizeResult, PageBlobClientResizeResultHeaders};
3271/// async fn example() -> Result<()> {
3272/// let response: Response<PageBlobClientResizeResult, NoFormat> = unimplemented!();
3273/// // Access response headers
3274/// if let Some(last_modified) = response.last_modified()? {
3275/// println!("Last-Modified: {:?}", last_modified);
3276/// }
3277/// if let Some(etag) = response.etag()? {
3278/// println!("etag: {:?}", etag);
3279/// }
3280/// if let Some(blob_sequence_number) = response.blob_sequence_number()? {
3281/// println!("x-ms-blob-sequence-number: {:?}", blob_sequence_number);
3282/// }
3283/// Ok(())
3284/// }
3285/// ```
3286pub trait PageBlobClientResizeResultHeaders: private::Sealed {
3287 fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
3288 fn etag(&self) -> Result<Option<String>>;
3289 fn blob_sequence_number(&self) -> Result<Option<i64>>;
3290}
3291
3292impl PageBlobClientResizeResultHeaders for Response<PageBlobClientResizeResult, NoFormat> {
3293 /// The date/time that the container was last modified.
3294 fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
3295 Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
3296 parse_rfc7231(h.as_str())
3297 })
3298 }
3299
3300 /// The ETag contains a value that you can use to perform operations conditionally.
3301 fn etag(&self) -> Result<Option<String>> {
3302 Headers::get_optional_as(self.headers(), &ETAG)
3303 }
3304
3305 /// The current sequence number for a page blob. This header is not returned for block blobs or append blobs.
3306 fn blob_sequence_number(&self) -> Result<Option<i64>> {
3307 Headers::get_optional_as(self.headers(), &BLOB_SEQUENCE_NUMBER)
3308 }
3309}
3310
3311/// Provides access to typed response headers for `PageBlobClient::set_sequence_number()`
3312///
3313/// # Examples
3314///
3315/// ```no_run
3316/// use azure_core::{Result, http::{Response, NoFormat}};
3317/// use azure_storage_blob::models::{PageBlobClientSetSequenceNumberResult, PageBlobClientSetSequenceNumberResultHeaders};
3318/// async fn example() -> Result<()> {
3319/// let response: Response<PageBlobClientSetSequenceNumberResult, NoFormat> = unimplemented!();
3320/// // Access response headers
3321/// if let Some(last_modified) = response.last_modified()? {
3322/// println!("Last-Modified: {:?}", last_modified);
3323/// }
3324/// if let Some(etag) = response.etag()? {
3325/// println!("etag: {:?}", etag);
3326/// }
3327/// if let Some(blob_sequence_number) = response.blob_sequence_number()? {
3328/// println!("x-ms-blob-sequence-number: {:?}", blob_sequence_number);
3329/// }
3330/// Ok(())
3331/// }
3332/// ```
3333pub trait PageBlobClientSetSequenceNumberResultHeaders: private::Sealed {
3334 fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
3335 fn etag(&self) -> Result<Option<String>>;
3336 fn blob_sequence_number(&self) -> Result<Option<i64>>;
3337}
3338
3339impl PageBlobClientSetSequenceNumberResultHeaders
3340 for Response<PageBlobClientSetSequenceNumberResult, NoFormat>
3341{
3342 /// The date/time that the container was last modified.
3343 fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
3344 Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
3345 parse_rfc7231(h.as_str())
3346 })
3347 }
3348
3349 /// The ETag contains a value that you can use to perform operations conditionally.
3350 fn etag(&self) -> Result<Option<String>> {
3351 Headers::get_optional_as(self.headers(), &ETAG)
3352 }
3353
3354 /// The current sequence number for a page blob. This header is not returned for block blobs or append blobs.
3355 fn blob_sequence_number(&self) -> Result<Option<i64>> {
3356 Headers::get_optional_as(self.headers(), &BLOB_SEQUENCE_NUMBER)
3357 }
3358}
3359
3360/// Provides access to typed response headers for `PageBlobClient::upload_pages_from_url()`
3361///
3362/// # Examples
3363///
3364/// ```no_run
3365/// use azure_core::{Result, http::{Response, NoFormat}};
3366/// use azure_storage_blob::models::{PageBlobClientUploadPagesFromUrlResult, PageBlobClientUploadPagesFromUrlResultHeaders};
3367/// async fn example() -> Result<()> {
3368/// let response: Response<PageBlobClientUploadPagesFromUrlResult, NoFormat> = unimplemented!();
3369/// // Access response headers
3370/// if let Some(content_md5) = response.content_md5()? {
3371/// println!("Content-MD5: {:?}", content_md5);
3372/// }
3373/// if let Some(last_modified) = response.last_modified()? {
3374/// println!("Last-Modified: {:?}", last_modified);
3375/// }
3376/// if let Some(etag) = response.etag()? {
3377/// println!("etag: {:?}", etag);
3378/// }
3379/// Ok(())
3380/// }
3381/// ```
3382pub trait PageBlobClientUploadPagesFromUrlResultHeaders: private::Sealed {
3383 fn content_md5(&self) -> Result<Option<Vec<u8>>>;
3384 fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
3385 fn etag(&self) -> Result<Option<String>>;
3386 fn blob_sequence_number(&self) -> Result<Option<i64>>;
3387 fn content_crc64(&self) -> Result<Option<Vec<u8>>>;
3388 fn encryption_key_sha256(&self) -> Result<Option<String>>;
3389 fn encryption_scope(&self) -> Result<Option<String>>;
3390 fn is_server_encrypted(&self) -> Result<Option<bool>>;
3391}
3392
3393impl PageBlobClientUploadPagesFromUrlResultHeaders
3394 for Response<PageBlobClientUploadPagesFromUrlResult, NoFormat>
3395{
3396 /// If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the
3397 /// client can check for message content integrity.
3398 fn content_md5(&self) -> Result<Option<Vec<u8>>> {
3399 Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| decode(h.as_str()))
3400 }
3401
3402 /// The date/time that the container was last modified.
3403 fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
3404 Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
3405 parse_rfc7231(h.as_str())
3406 })
3407 }
3408
3409 /// The ETag contains a value that you can use to perform operations conditionally.
3410 fn etag(&self) -> Result<Option<String>> {
3411 Headers::get_optional_as(self.headers(), &ETAG)
3412 }
3413
3414 /// The current sequence number for a page blob. This header is not returned for block blobs or append blobs.
3415 fn blob_sequence_number(&self) -> Result<Option<i64>> {
3416 Headers::get_optional_as(self.headers(), &BLOB_SEQUENCE_NUMBER)
3417 }
3418
3419 /// This response header is returned so that the client can check for the integrity of the copied content.
3420 fn content_crc64(&self) -> Result<Option<Vec<u8>>> {
3421 Headers::get_optional_with(self.headers(), &CONTENT_CRC64, |h| decode(h.as_str()))
3422 }
3423
3424 /// The SHA-256 hash of the encryption key used to encrypt the blob. This header is only returned when the blob was encrypted
3425 /// with a customer-provided key.
3426 fn encryption_key_sha256(&self) -> Result<Option<String>> {
3427 Headers::get_optional_as(self.headers(), &ENCRYPTION_KEY_SHA256)
3428 }
3429
3430 /// If the blob has a MD5 hash, and if request contains range header (Range or x-ms-range), this response header is returned
3431 /// with the value of the whole blob's MD5 value. This value may or may not be equal to the value returned in Content-MD5
3432 /// header, with the latter calculated from the requested range
3433 fn encryption_scope(&self) -> Result<Option<String>> {
3434 Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE)
3435 }
3436
3437 /// The value of this header is set to true if the contents of the request are successfully encrypted using the specified
3438 /// algorithm, and false otherwise.
3439 fn is_server_encrypted(&self) -> Result<Option<bool>> {
3440 Headers::get_optional_as(self.headers(), &REQUEST_SERVER_ENCRYPTED)
3441 }
3442}
3443
3444/// Provides access to typed response headers for `PageBlobClient::upload_pages()`
3445///
3446/// # Examples
3447///
3448/// ```no_run
3449/// use azure_core::{Result, http::{Response, NoFormat}};
3450/// use azure_storage_blob::models::{PageBlobClientUploadPagesResult, PageBlobClientUploadPagesResultHeaders};
3451/// async fn example() -> Result<()> {
3452/// let response: Response<PageBlobClientUploadPagesResult, NoFormat> = unimplemented!();
3453/// // Access response headers
3454/// if let Some(content_md5) = response.content_md5()? {
3455/// println!("Content-MD5: {:?}", content_md5);
3456/// }
3457/// if let Some(last_modified) = response.last_modified()? {
3458/// println!("Last-Modified: {:?}", last_modified);
3459/// }
3460/// if let Some(etag) = response.etag()? {
3461/// println!("etag: {:?}", etag);
3462/// }
3463/// Ok(())
3464/// }
3465/// ```
3466pub trait PageBlobClientUploadPagesResultHeaders: private::Sealed {
3467 fn content_md5(&self) -> Result<Option<Vec<u8>>>;
3468 fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
3469 fn etag(&self) -> Result<Option<String>>;
3470 fn blob_sequence_number(&self) -> Result<Option<i64>>;
3471 fn content_crc64(&self) -> Result<Option<Vec<u8>>>;
3472 fn encryption_key_sha256(&self) -> Result<Option<String>>;
3473 fn encryption_scope(&self) -> Result<Option<String>>;
3474 fn is_server_encrypted(&self) -> Result<Option<bool>>;
3475}
3476
3477impl PageBlobClientUploadPagesResultHeaders
3478 for Response<PageBlobClientUploadPagesResult, NoFormat>
3479{
3480 /// If the blob has an MD5 hash and this operation is to read the full blob, this response header is returned so that the
3481 /// client can check for message content integrity.
3482 fn content_md5(&self) -> Result<Option<Vec<u8>>> {
3483 Headers::get_optional_with(self.headers(), &CONTENT_MD5, |h| decode(h.as_str()))
3484 }
3485
3486 /// The date/time that the container was last modified.
3487 fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
3488 Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
3489 parse_rfc7231(h.as_str())
3490 })
3491 }
3492
3493 /// The ETag contains a value that you can use to perform operations conditionally.
3494 fn etag(&self) -> Result<Option<String>> {
3495 Headers::get_optional_as(self.headers(), &ETAG)
3496 }
3497
3498 /// The current sequence number for a page blob. This header is not returned for block blobs or append blobs.
3499 fn blob_sequence_number(&self) -> Result<Option<i64>> {
3500 Headers::get_optional_as(self.headers(), &BLOB_SEQUENCE_NUMBER)
3501 }
3502
3503 /// This response header is returned so that the client can check for the integrity of the copied content.
3504 fn content_crc64(&self) -> Result<Option<Vec<u8>>> {
3505 Headers::get_optional_with(self.headers(), &CONTENT_CRC64, |h| decode(h.as_str()))
3506 }
3507
3508 /// The SHA-256 hash of the encryption key used to encrypt the blob. This header is only returned when the blob was encrypted
3509 /// with a customer-provided key.
3510 fn encryption_key_sha256(&self) -> Result<Option<String>> {
3511 Headers::get_optional_as(self.headers(), &ENCRYPTION_KEY_SHA256)
3512 }
3513
3514 /// If the blob has a MD5 hash, and if request contains range header (Range or x-ms-range), this response header is returned
3515 /// with the value of the whole blob's MD5 value. This value may or may not be equal to the value returned in Content-MD5
3516 /// header, with the latter calculated from the requested range
3517 fn encryption_scope(&self) -> Result<Option<String>> {
3518 Headers::get_optional_as(self.headers(), &ENCRYPTION_SCOPE)
3519 }
3520
3521 /// The value of this header is set to true if the contents of the request are successfully encrypted using the specified
3522 /// algorithm, and false otherwise.
3523 fn is_server_encrypted(&self) -> Result<Option<bool>> {
3524 Headers::get_optional_as(self.headers(), &REQUEST_SERVER_ENCRYPTED)
3525 }
3526}
3527
3528/// Provides access to typed response headers for the following methods:
3529/// * `PageBlobClient::get_page_ranges()`
3530/// * `PageBlobClient::get_page_ranges_diff()`
3531pub trait PageListHeaders: private::Sealed {
3532 fn date(&self) -> Result<Option<OffsetDateTime>>;
3533 fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
3534 fn etag(&self) -> Result<Option<String>>;
3535 fn blob_content_length(&self) -> Result<Option<i64>>;
3536}
3537
3538impl PageListHeaders for Response<PageList, XmlFormat> {
3539 /// UTC date/time value generated by the service that indicates the time at which the response was initiated
3540 fn date(&self) -> Result<Option<OffsetDateTime>> {
3541 Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str()))
3542 }
3543
3544 /// The date/time that the container was last modified.
3545 fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
3546 Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
3547 parse_rfc7231(h.as_str())
3548 })
3549 }
3550
3551 /// The ETag contains a value that you can use to perform operations conditionally.
3552 fn etag(&self) -> Result<Option<String>> {
3553 Headers::get_optional_as(self.headers(), &ETAG)
3554 }
3555
3556 /// The size of the blob in bytes.
3557 fn blob_content_length(&self) -> Result<Option<i64>> {
3558 Headers::get_optional_as(self.headers(), &BLOB_CONTENT_LENGTH)
3559 }
3560}
3561
3562/// Provides access to typed response headers for `BlobServiceClient::get_statistics()`
3563///
3564/// # Examples
3565///
3566/// ```no_run
3567/// use azure_core::{Result, http::{Response, XmlFormat}};
3568/// use azure_storage_blob::models::{StorageServiceStats, StorageServiceStatsHeaders};
3569/// async fn example() -> Result<()> {
3570/// let response: Response<StorageServiceStats, XmlFormat> = unimplemented!();
3571/// // Access response headers
3572/// if let Some(date) = response.date()? {
3573/// println!("Date: {:?}", date);
3574/// }
3575/// Ok(())
3576/// }
3577/// ```
3578pub trait StorageServiceStatsHeaders: private::Sealed {
3579 fn date(&self) -> Result<Option<OffsetDateTime>>;
3580}
3581
3582impl StorageServiceStatsHeaders for Response<StorageServiceStats, XmlFormat> {
3583 /// UTC date/time value generated by the service that indicates the time at which the response was initiated
3584 fn date(&self) -> Result<Option<OffsetDateTime>> {
3585 Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str()))
3586 }
3587}
3588
3589/// Provides access to typed response headers for `BlobServiceClient::get_user_delegation_key()`
3590///
3591/// # Examples
3592///
3593/// ```no_run
3594/// use azure_core::{Result, http::{Response, XmlFormat}};
3595/// use azure_storage_blob::models::{UserDelegationKey, UserDelegationKeyHeaders};
3596/// async fn example() -> Result<()> {
3597/// let response: Response<UserDelegationKey, XmlFormat> = unimplemented!();
3598/// // Access response headers
3599/// if let Some(date) = response.date()? {
3600/// println!("Date: {:?}", date);
3601/// }
3602/// Ok(())
3603/// }
3604/// ```
3605pub trait UserDelegationKeyHeaders: private::Sealed {
3606 fn date(&self) -> Result<Option<OffsetDateTime>>;
3607}
3608
3609impl UserDelegationKeyHeaders for Response<UserDelegationKey, XmlFormat> {
3610 /// UTC date/time value generated by the service that indicates the time at which the response was initiated
3611 fn date(&self) -> Result<Option<OffsetDateTime>> {
3612 Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str()))
3613 }
3614}
3615
3616/// Provides access to typed response headers for `BlobContainerClient::get_access_policy()`
3617///
3618/// # Examples
3619///
3620/// ```no_run
3621/// use azure_core::{Result, http::{Response, XmlFormat}};
3622/// use azure_storage_blob::models::{SignedIdentifier, VecSignedIdentifierHeaders};
3623/// async fn example() -> Result<()> {
3624/// let response: Response<Vec<SignedIdentifier>, XmlFormat> = unimplemented!();
3625/// // Access response headers
3626/// if let Some(date) = response.date()? {
3627/// println!("Date: {:?}", date);
3628/// }
3629/// if let Some(last_modified) = response.last_modified()? {
3630/// println!("Last-Modified: {:?}", last_modified);
3631/// }
3632/// if let Some(etag) = response.etag()? {
3633/// println!("etag: {:?}", etag);
3634/// }
3635/// Ok(())
3636/// }
3637/// ```
3638pub trait VecSignedIdentifierHeaders: private::Sealed {
3639 fn date(&self) -> Result<Option<OffsetDateTime>>;
3640 fn last_modified(&self) -> Result<Option<OffsetDateTime>>;
3641 fn etag(&self) -> Result<Option<String>>;
3642 fn access(&self) -> Result<Option<PublicAccessType>>;
3643}
3644
3645impl VecSignedIdentifierHeaders for Response<Vec<SignedIdentifier>, XmlFormat> {
3646 /// UTC date/time value generated by the service that indicates the time at which the response was initiated
3647 fn date(&self) -> Result<Option<OffsetDateTime>> {
3648 Headers::get_optional_with(self.headers(), &DATE, |h| parse_rfc7231(h.as_str()))
3649 }
3650
3651 /// The date/time that the container was last modified.
3652 fn last_modified(&self) -> Result<Option<OffsetDateTime>> {
3653 Headers::get_optional_with(self.headers(), &LAST_MODIFIED, |h| {
3654 parse_rfc7231(h.as_str())
3655 })
3656 }
3657
3658 /// The ETag contains a value that you can use to perform operations conditionally.
3659 fn etag(&self) -> Result<Option<String>> {
3660 Headers::get_optional_as(self.headers(), &ETAG)
3661 }
3662
3663 /// The public access setting for the container.
3664 fn access(&self) -> Result<Option<PublicAccessType>> {
3665 Headers::get_optional_as(self.headers(), &BLOB_PUBLIC_ACCESS)
3666 }
3667}
3668
3669mod private {
3670 use super::{
3671 AppendBlobClientAppendBlockFromUrlResult, AppendBlobClientAppendBlockResult,
3672 AppendBlobClientCreateResult, AppendBlobClientSealResult, BlobClientAbortCopyFromUrlResult,
3673 BlobClientAcquireLeaseResult, BlobClientBreakLeaseResult, BlobClientChangeLeaseResult,
3674 BlobClientCopyFromUrlResult, BlobClientCreateSnapshotResult,
3675 BlobClientDeleteImmutabilityPolicyResult, BlobClientDownloadResult,
3676 BlobClientGetAccountInfoResult, BlobClientGetPropertiesResult,
3677 BlobClientReleaseLeaseResult, BlobClientRenewLeaseResult, BlobClientSetExpiryResult,
3678 BlobClientSetImmutabilityPolicyResult, BlobClientSetLegalHoldResult,
3679 BlobClientStartCopyFromUrlResult, BlobClientUndeleteResult,
3680 BlobContainerClientAcquireLeaseResult, BlobContainerClientBreakLeaseResult,
3681 BlobContainerClientChangeLeaseResult, BlobContainerClientGetAccountInfoResult,
3682 BlobContainerClientGetPropertiesResult, BlobContainerClientReleaseLeaseResult,
3683 BlobContainerClientRenameResult, BlobContainerClientRenewLeaseResult,
3684 BlobContainerClientRestoreResult, BlobContainerClientSetAccessPolicyResult,
3685 BlobServiceClientGetAccountInfoResult, BlobTags, BlockBlobClientCommitBlockListResult,
3686 BlockBlobClientQueryResult, BlockBlobClientStageBlockFromUrlResult,
3687 BlockBlobClientStageBlockResult, BlockBlobClientUploadBlobFromUrlResult,
3688 BlockBlobClientUploadResult, BlockList, ListBlobsFlatSegmentResponse,
3689 ListBlobsHierarchySegmentResponse, PageBlobClientClearPagesResult,
3690 PageBlobClientCopyIncrementalResult, PageBlobClientCreateResult,
3691 PageBlobClientResizeResult, PageBlobClientSetSequenceNumberResult,
3692 PageBlobClientUploadPagesFromUrlResult, PageBlobClientUploadPagesResult, PageList,
3693 SignedIdentifier, StorageServiceStats, UserDelegationKey,
3694 };
3695 use azure_core::http::{NoFormat, Response, XmlFormat};
3696
3697 pub trait Sealed {}
3698
3699 impl Sealed for Response<AppendBlobClientAppendBlockFromUrlResult, NoFormat> {}
3700 impl Sealed for Response<AppendBlobClientAppendBlockResult, NoFormat> {}
3701 impl Sealed for Response<AppendBlobClientCreateResult, NoFormat> {}
3702 impl Sealed for Response<AppendBlobClientSealResult, NoFormat> {}
3703 impl Sealed for Response<BlobClientAbortCopyFromUrlResult, NoFormat> {}
3704 impl Sealed for Response<BlobClientAcquireLeaseResult, NoFormat> {}
3705 impl Sealed for Response<BlobClientBreakLeaseResult, NoFormat> {}
3706 impl Sealed for Response<BlobClientChangeLeaseResult, NoFormat> {}
3707 impl Sealed for Response<BlobClientCopyFromUrlResult, NoFormat> {}
3708 impl Sealed for Response<BlobClientCreateSnapshotResult, NoFormat> {}
3709 impl Sealed for Response<BlobClientDeleteImmutabilityPolicyResult, NoFormat> {}
3710 impl Sealed for Response<BlobClientDownloadResult, NoFormat> {}
3711 impl Sealed for Response<BlobClientGetAccountInfoResult, NoFormat> {}
3712 impl Sealed for Response<BlobClientGetPropertiesResult, NoFormat> {}
3713 impl Sealed for Response<BlobClientReleaseLeaseResult, NoFormat> {}
3714 impl Sealed for Response<BlobClientRenewLeaseResult, NoFormat> {}
3715 impl Sealed for Response<BlobClientSetExpiryResult, NoFormat> {}
3716 impl Sealed for Response<BlobClientSetImmutabilityPolicyResult, NoFormat> {}
3717 impl Sealed for Response<BlobClientSetLegalHoldResult, NoFormat> {}
3718 impl Sealed for Response<BlobClientStartCopyFromUrlResult, NoFormat> {}
3719 impl Sealed for Response<BlobClientUndeleteResult, NoFormat> {}
3720 impl Sealed for Response<BlobContainerClientAcquireLeaseResult, NoFormat> {}
3721 impl Sealed for Response<BlobContainerClientBreakLeaseResult, NoFormat> {}
3722 impl Sealed for Response<BlobContainerClientChangeLeaseResult, NoFormat> {}
3723 impl Sealed for Response<BlobContainerClientGetAccountInfoResult, NoFormat> {}
3724 impl Sealed for Response<BlobContainerClientGetPropertiesResult, NoFormat> {}
3725 impl Sealed for Response<BlobContainerClientReleaseLeaseResult, NoFormat> {}
3726 impl Sealed for Response<BlobContainerClientRenameResult, NoFormat> {}
3727 impl Sealed for Response<BlobContainerClientRenewLeaseResult, NoFormat> {}
3728 impl Sealed for Response<BlobContainerClientRestoreResult, NoFormat> {}
3729 impl Sealed for Response<BlobContainerClientSetAccessPolicyResult, NoFormat> {}
3730 impl Sealed for Response<BlobServiceClientGetAccountInfoResult, NoFormat> {}
3731 impl Sealed for Response<BlobTags, XmlFormat> {}
3732 impl Sealed for Response<BlockBlobClientCommitBlockListResult, NoFormat> {}
3733 impl Sealed for Response<BlockBlobClientQueryResult, NoFormat> {}
3734 impl Sealed for Response<BlockBlobClientStageBlockFromUrlResult, NoFormat> {}
3735 impl Sealed for Response<BlockBlobClientStageBlockResult, NoFormat> {}
3736 impl Sealed for Response<BlockBlobClientUploadBlobFromUrlResult, NoFormat> {}
3737 impl Sealed for Response<BlockBlobClientUploadResult, NoFormat> {}
3738 impl Sealed for Response<BlockList, XmlFormat> {}
3739 impl Sealed for Response<ListBlobsFlatSegmentResponse, XmlFormat> {}
3740 impl Sealed for Response<ListBlobsHierarchySegmentResponse, XmlFormat> {}
3741 impl Sealed for Response<PageBlobClientClearPagesResult, NoFormat> {}
3742 impl Sealed for Response<PageBlobClientCopyIncrementalResult, NoFormat> {}
3743 impl Sealed for Response<PageBlobClientCreateResult, NoFormat> {}
3744 impl Sealed for Response<PageBlobClientResizeResult, NoFormat> {}
3745 impl Sealed for Response<PageBlobClientSetSequenceNumberResult, NoFormat> {}
3746 impl Sealed for Response<PageBlobClientUploadPagesFromUrlResult, NoFormat> {}
3747 impl Sealed for Response<PageBlobClientUploadPagesResult, NoFormat> {}
3748 impl Sealed for Response<PageList, XmlFormat> {}
3749 impl Sealed for Response<StorageServiceStats, XmlFormat> {}
3750 impl Sealed for Response<UserDelegationKey, XmlFormat> {}
3751 impl Sealed for Response<Vec<SignedIdentifier>, XmlFormat> {}
3752}