azure_storage_blobs/blob/operations/
delete_blob.rs1use crate::prelude::*;
2use azure_core::{headers::*, prelude::*, RequestId};
3use time::OffsetDateTime;
4
5operation! {
6 DeleteBlob,
7 client: BlobClient,
8 ?if_modified_since: IfModifiedSinceCondition,
9 ?if_match: IfMatchCondition,
10 ?if_tags: IfTags,
11 ?delete_snapshots_method: DeleteSnapshotsMethod,
12 ?lease_id: LeaseId
13}
14
15impl DeleteBlobBuilder {
16 pub fn into_future(mut self) -> DeleteBlob {
17 Box::pin(async move {
18 let url = self.client.url()?;
19
20 let mut headers = Headers::new();
21 headers.add(self.lease_id);
22 headers.add(
23 self.delete_snapshots_method
24 .unwrap_or(DeleteSnapshotsMethod::Include),
25 );
26 headers.add(self.if_modified_since);
27 headers.add(self.if_match);
28 headers.add(self.if_tags);
29
30 let mut request =
31 BlobClient::finalize_request(url, azure_core::Method::Delete, headers, None)?;
32
33 let response = self.client.send(&mut self.context, &mut request).await?;
34 DeleteBlobResponse::from_headers(response.headers())
35 })
36 }
37}
38
39azure_storage::response_from_headers!(DeleteBlobResponse ,
40 delete_type_permanent_from_headers => delete_type_permanent: bool,
41 request_id_from_headers => request_id: RequestId,
42 date_from_headers => date: OffsetDateTime
43);