@@ -28,16 +28,19 @@ 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:: {
41+ HeaderMap , HeaderValue , CONTENT_LENGTH , CONTENT_TYPE , IF_MATCH , IF_NONE_MATCH ,
42+ IF_UNMODIFIED_SINCE ,
43+ } ,
4144 HeaderName , Method ,
4245} ;
4346use rand:: Rng as _;
@@ -655,6 +658,54 @@ impl AzureClient {
655658 Ok ( ( ) )
656659 }
657660
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+
658709 fn build_bulk_delete_body (
659710 & self ,
660711 boundary : & str ,
0 commit comments