@@ -28,16 +28,16 @@ use crate::list::{PaginatedListOptions, PaginatedListResult};
2828use crate :: multipart:: PartId ;
2929use crate :: util:: { deserialize_rfc1123, GetRange } ;
3030use 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 ,
3333} ;
3434use async_trait:: async_trait;
3535use base64:: prelude:: { BASE64_STANDARD , BASE64_STANDARD_NO_PAD } ;
3636use base64:: Engine ;
3737use bytes:: { Buf , Bytes } ;
3838use chrono:: { DateTime , Utc } ;
3939use http:: {
40- header:: { HeaderMap , HeaderValue , CONTENT_LENGTH , CONTENT_TYPE , IF_MATCH , IF_NONE_MATCH } ,
40+ header:: { HeaderMap , HeaderValue , CONTENT_LENGTH , CONTENT_TYPE , IF_MATCH , IF_NONE_MATCH , IF_UNMODIFIED_SINCE } ,
4141 HeaderName , Method ,
4242} ;
4343use rand:: Rng as _;
@@ -655,6 +655,53 @@ impl AzureClient {
655655 Ok ( ( ) )
656656 }
657657
658+ /// Make an Azure Delete request with conditional options
659+ pub ( crate ) async fn delete_request_with_opts (
660+ & self ,
661+ path : & Path ,
662+ opts : DeleteOptions ,
663+ ) -> Result < ( ) > {
664+ let credential = self . get_credential ( ) . await ?;
665+ let url = self . config . path_url ( path) ;
666+
667+ let sensitive = credential
668+ . as_deref ( )
669+ . map ( |c| c. sensitive_request ( ) )
670+ . unwrap_or_default ( ) ;
671+
672+ let mut builder = self . client
673+ . delete ( url. as_str ( ) )
674+ . header ( & DELETE_SNAPSHOTS , "include" ) ;
675+
676+ // Add conditional headers if specified
677+ if let Some ( if_match) = & opts. if_match {
678+ builder = builder. header ( IF_MATCH , if_match) ;
679+ }
680+
681+ if let Some ( if_unmodified_since) = opts. if_unmodified_since {
682+ builder = builder. header ( IF_UNMODIFIED_SINCE , & if_unmodified_since. to_rfc2822 ( ) ) ;
683+ }
684+
685+ // Azure supports versioned deletes via x-ms-version-id header
686+ if let Some ( version) = & opts. version {
687+ builder = builder. header ( "x-ms-version-id" , version) ;
688+ }
689+
690+ builder
691+ . extensions ( opts. extensions )
692+ . with_azure_authorization ( & credential, & self . config . account )
693+ . retryable ( & self . config . retry_config )
694+ . sensitive ( sensitive)
695+ . send ( )
696+ . await
697+ . map_err ( |source| {
698+ let path = path. as_ref ( ) . into ( ) ;
699+ Error :: DeleteRequest { source, path }
700+ } ) ?;
701+
702+ Ok ( ( ) )
703+ }
704+
658705 fn build_bulk_delete_body (
659706 & self ,
660707 boundary : & str ,
0 commit comments