@@ -28,16 +28,19 @@ use crate::list::{PaginatedListOptions, PaginatedListResult};
28
28
use crate :: multipart:: PartId ;
29
29
use crate :: util:: { deserialize_rfc1123, GetRange } ;
30
30
use crate :: {
31
- Attribute , Attributes , ClientOptions , GetOptions , ListResult , ObjectMeta , Path , PutMode ,
32
- PutMultipartOptions , PutOptions , PutPayload , PutResult , Result , RetryConfig , TagSet ,
31
+ Attribute , Attributes , ClientOptions , DeleteOptions , GetOptions , ListResult , ObjectMeta , Path ,
32
+ PutMode , PutMultipartOptions , PutOptions , PutPayload , PutResult , Result , RetryConfig , TagSet ,
33
33
} ;
34
34
use async_trait:: async_trait;
35
35
use base64:: prelude:: { BASE64_STANDARD , BASE64_STANDARD_NO_PAD } ;
36
36
use base64:: Engine ;
37
37
use bytes:: { Buf , Bytes } ;
38
38
use chrono:: { DateTime , Utc } ;
39
39
use http:: {
40
- header:: { HeaderMap , HeaderValue , CONTENT_LENGTH , CONTENT_TYPE , IF_MATCH , IF_NONE_MATCH } ,
40
+ header:: {
41
+ HeaderMap , HeaderValue , CONTENT_LENGTH , CONTENT_TYPE , IF_MATCH , IF_NONE_MATCH ,
42
+ IF_UNMODIFIED_SINCE ,
43
+ } ,
41
44
HeaderName , Method ,
42
45
} ;
43
46
use rand:: Rng as _;
@@ -655,6 +658,54 @@ impl AzureClient {
655
658
Ok ( ( ) )
656
659
}
657
660
661
+ /// Make an Azure Delete request with conditional options
662
+ pub ( crate ) async fn delete_request_with_opts (
663
+ & self ,
664
+ path : & Path ,
665
+ opts : DeleteOptions ,
666
+ ) -> Result < ( ) > {
667
+ let credential = self . get_credential ( ) . await ?;
668
+ let url = self . config . path_url ( path) ;
669
+
670
+ let sensitive = credential
671
+ . as_deref ( )
672
+ . map ( |c| c. sensitive_request ( ) )
673
+ . unwrap_or_default ( ) ;
674
+
675
+ let mut builder = self
676
+ . client
677
+ . delete ( url. as_str ( ) )
678
+ . header ( & DELETE_SNAPSHOTS , "include" ) ;
679
+
680
+ // Add conditional headers if specified
681
+ if let Some ( if_match) = & opts. if_match {
682
+ builder = builder. header ( IF_MATCH , if_match) ;
683
+ }
684
+
685
+ if let Some ( if_unmodified_since) = opts. if_unmodified_since {
686
+ builder = builder. header ( IF_UNMODIFIED_SINCE , & if_unmodified_since. to_rfc2822 ( ) ) ;
687
+ }
688
+
689
+ // Azure supports versioned deletes via x-ms-version-id header
690
+ if let Some ( version) = & opts. version {
691
+ builder = builder. header ( "x-ms-version-id" , version) ;
692
+ }
693
+
694
+ builder
695
+ . extensions ( opts. extensions )
696
+ . with_azure_authorization ( & credential, & self . config . account )
697
+ . retryable ( & self . config . retry_config )
698
+ . sensitive ( sensitive)
699
+ . send ( )
700
+ . await
701
+ . map_err ( |source| {
702
+ let path = path. as_ref ( ) . into ( ) ;
703
+ Error :: DeleteRequest { source, path }
704
+ } ) ?;
705
+
706
+ Ok ( ( ) )
707
+ }
708
+
658
709
fn build_bulk_delete_body (
659
710
& self ,
660
711
boundary : & str ,
0 commit comments