4040from  ._models  import  ( # pylint: disable=unused-import 
4141    ContainerProperties ,
4242    BlobProperties ,
43-     BlobPropertiesPaged ,
44-     BlobType ,
45-     BlobPrefix )
43+     BlobType )
44+ from  ._list_blobs_helper  import  BlobPrefix , BlobPropertiesPaged 
4645from  ._lease  import  BlobLeaseClient , get_access_conditions 
4746from  ._blob_client  import  BlobClient 
4847
@@ -783,6 +782,12 @@ def upload_blob(
783782            and act according to the condition specified by the `match_condition` parameter. 
784783        :keyword ~azure.core.MatchConditions match_condition: 
785784            The match condition to use upon the etag. 
785+         :keyword str if_tags_match_condition 
786+             Specify a SQL where clause on blob tags to operate only on blob with a matching value. 
787+             eg. "\" tagname\" ='my tag'" 
788+ 
789+             .. versionadded:: 12.4.0 
790+ 
786791        :keyword int timeout: 
787792            The timeout parameter is expressed in seconds. This method may make 
788793            multiple calls to the Azure service and the timeout will apply to 
@@ -893,6 +898,12 @@ def delete_blob(
893898            and act according to the condition specified by the `match_condition` parameter. 
894899        :keyword ~azure.core.MatchConditions match_condition: 
895900            The match condition to use upon the etag. 
901+         :keyword str if_tags_match_condition 
902+             Specify a SQL where clause on blob tags to operate only on blob with a matching value. 
903+             eg. "\" tagname\" ='my tag'" 
904+ 
905+             .. versionadded:: 12.4.0 
906+ 
896907        :keyword int timeout: 
897908            The timeout parameter is expressed in seconds. 
898909        :rtype: None 
@@ -952,6 +963,12 @@ def download_blob(self, blob, offset=None, length=None, **kwargs):
952963            and act according to the condition specified by the `match_condition` parameter. 
953964        :keyword ~azure.core.MatchConditions match_condition: 
954965            The match condition to use upon the etag. 
966+         :keyword str if_tags_match_condition 
967+             Specify a SQL where clause on blob tags to operate only on blob with a matching value. 
968+             eg. "\" tagname\" ='my tag'" 
969+ 
970+             .. versionadded:: 12.4.0 
971+ 
955972        :keyword ~azure.storage.blob.CustomerProvidedEncryptionKey cpk: 
956973            Encrypts the data on the service-side with the given key. 
957974            Use of customer-provided keys must be done over HTTPS. 
@@ -998,6 +1015,9 @@ def _generate_delete_blobs_subrequest_options(
9981015        if_none_match  =  None 
9991016        if  modified_access_conditions  is  not None :
10001017            if_none_match  =  modified_access_conditions .if_none_match 
1018+         if_tags  =  None 
1019+         if  modified_access_conditions  is  not None :
1020+             if_tags  =  modified_access_conditions .if_tags 
10011021
10021022        # Construct parameters 
10031023        timeout  =  kwargs .pop ('timeout' , None )
@@ -1027,6 +1047,8 @@ def _generate_delete_blobs_subrequest_options(
10271047        if  if_none_match  is  not None :
10281048            header_parameters ['If-None-Match' ] =  self ._client ._serialize .header (  # pylint: disable=protected-access 
10291049                "if_none_match" , if_none_match , 'str' )
1050+         if  if_tags  is  not None :
1051+             header_parameters ['x-ms-if-tags' ] =  self ._client ._serialize .header ("if_tags" , if_tags , 'str' )  # pylint: disable=protected-access 
10301052
10311053        return  query_parameters , header_parameters 
10321054
@@ -1039,6 +1061,7 @@ def _generate_delete_blobs_options(self,
10391061        delete_snapshots  =  kwargs .pop ('delete_snapshots' , None )
10401062        if_modified_since  =  kwargs .pop ('if_modified_since' , None )
10411063        if_unmodified_since  =  kwargs .pop ('if_unmodified_since' , None )
1064+         if_tags_match_condition  =  kwargs .pop ('if_tags_match_condition' , None )
10421065        kwargs .update ({'raise_on_any_failure' : raise_on_any_failure ,
10431066                       'sas' : self ._query_str .replace ('?' , '&' ),
10441067                       'timeout' : '&timeout='  +  str (timeout ) if  timeout  else  "" 
@@ -1057,18 +1080,21 @@ def _generate_delete_blobs_options(self,
10571080                    if_modified_since = if_modified_since  or  blob .get ('if_modified_since' ),
10581081                    if_unmodified_since = if_unmodified_since  or  blob .get ('if_unmodified_since' ),
10591082                    etag = blob .get ('etag' ),
1083+                     if_tags_match_condition = if_tags_match_condition  or  blob .get ('if_tags_match_condition' ),
10601084                    match_condition = blob .get ('match_condition' ) or  MatchConditions .IfNotModified  if  blob .get ('etag' )
10611085                    else  None ,
10621086                    timeout = blob .get ('timeout' ),
10631087                )
1064-                 query_parameters , header_parameters  =  self ._generate_delete_blobs_subrequest_options (** options )
10651088            except  AttributeError :
1066-                 query_parameters ,  header_parameters   =   self . _generate_delete_blobs_subrequest_options ( 
1089+                 options   =   BlobClient . _generic_delete_blob_options (   # pylint: disable=protected-access 
10671090                    delete_snapshots = delete_snapshots ,
10681091                    if_modified_since = if_modified_since ,
1069-                     if_unmodified_since = if_unmodified_since 
1092+                     if_unmodified_since = if_unmodified_since ,
1093+                     if_tags_match_condition = if_tags_match_condition 
10701094                )
10711095
1096+             query_parameters , header_parameters  =  self ._generate_delete_blobs_subrequest_options (** options )
1097+ 
10721098            req  =  HttpRequest (
10731099                "DELETE" ,
10741100                "/{}/{}{}" .format (quote (container_name ), quote (blob_name , safe = '/~' ), self ._query_str ),
@@ -1113,6 +1139,8 @@ def delete_blobs(self, *blobs, **kwargs):
11131139                    key: 'etag', value type: str 
11141140                match the etag or not: 
11151141                    key: 'match_condition', value type: MatchConditions 
1142+                 tags match condition: 
1143+                     key: 'if_tags_match_condition', value type: str 
11161144                lease: 
11171145                    key: 'lease_id', value type: Union[str, LeaseClient] 
11181146                timeout for subrequest: 
@@ -1135,6 +1163,12 @@ def delete_blobs(self, *blobs, **kwargs):
11351163            If a date is passed in without timezone info, it is assumed to be UTC. 
11361164            Specify this header to perform the operation only if 
11371165            the resource has not been modified since the specified date/time. 
1166+         :keyword str if_tags_match_condition 
1167+             Specify a SQL where clause on blob tags to operate only on blob with a matching value. 
1168+             eg. "\" tagname\" ='my tag'" 
1169+ 
1170+             .. versionadded:: 12.4.0 
1171+ 
11381172        :keyword bool raise_on_any_failure: 
11391173            This is a boolean param which defaults to True. When this is set, an exception 
11401174            is raised even if there is a single operation failure. 
@@ -1152,19 +1186,25 @@ def delete_blobs(self, *blobs, **kwargs):
11521186                :dedent: 8 
11531187                :caption: Deleting multiple blobs. 
11541188        """ 
1189+         if  len (blobs ) ==  0 :
1190+             return  iter (list ())
1191+ 
11551192        reqs , options  =  self ._generate_delete_blobs_options (* blobs , ** kwargs )
11561193
11571194        return  self ._batch_send (* reqs , ** options )
11581195
11591196    def  _generate_set_tiers_subrequest_options (
1160-         self , tier , rehydrate_priority = None , lease_access_conditions = None , ** kwargs 
1197+         self , tier , snapshot = None ,  version_id = None ,  rehydrate_priority = None , lease_access_conditions = None , ** kwargs 
11611198    ):
11621199        """This code is a copy from _generated. 
11631200
11641201        Once Autorest is able to provide request preparation this code should be removed. 
11651202        """ 
11661203        if  not  tier :
11671204            raise  ValueError ("A blob tier must be specified" )
1205+         if  snapshot  and  version_id :
1206+             raise  ValueError ("Snapshot and version_id cannot be set at the same time" )
1207+         if_tags  =  kwargs .pop ('if_tags' , None )
11681208
11691209        lease_id  =  None 
11701210        if  lease_access_conditions  is  not None :
@@ -1174,6 +1214,10 @@ def _generate_set_tiers_subrequest_options(
11741214        timeout  =  kwargs .pop ('timeout' , None )
11751215        # Construct parameters 
11761216        query_parameters  =  {}
1217+         if  snapshot  is  not None :
1218+             query_parameters ['snapshot' ] =  self ._client ._serialize .query ("snapshot" , snapshot , 'str' )  # pylint: disable=protected-access 
1219+         if  version_id  is  not None :
1220+             query_parameters ['versionid' ] =  self ._client ._serialize .query ("version_id" , version_id , 'str' )  # pylint: disable=protected-access 
11771221        if  timeout  is  not None :
11781222            query_parameters ['timeout' ] =  self ._client ._serialize .query ("timeout" , timeout , 'int' , minimum = 0 )  # pylint: disable=protected-access 
11791223        query_parameters ['comp' ] =  self ._client ._serialize .query ("comp" , comp , 'str' )  # pylint: disable=protected-access, specify-parameter-names-in-call 
@@ -1186,6 +1230,8 @@ def _generate_set_tiers_subrequest_options(
11861230                "rehydrate_priority" , rehydrate_priority , 'str' )
11871231        if  lease_id  is  not None :
11881232            header_parameters ['x-ms-lease-id' ] =  self ._client ._serialize .header ("lease_id" , lease_id , 'str' )  # pylint: disable=protected-access 
1233+         if  if_tags  is  not None :
1234+             header_parameters ['x-ms-if-tags' ] =  self ._client ._serialize .header ("if_tags" , if_tags , 'str' )  # pylint: disable=protected-access 
11891235
11901236        return  query_parameters , header_parameters 
11911237
@@ -1197,6 +1243,7 @@ def _generate_set_tiers_options(self,
11971243        timeout  =  kwargs .pop ('timeout' , None )
11981244        raise_on_any_failure  =  kwargs .pop ('raise_on_any_failure' , True )
11991245        rehydrate_priority  =  kwargs .pop ('rehydrate_priority' , None )
1246+         if_tags  =  kwargs .pop ('if_tags_match_condition' , None )
12001247        kwargs .update ({'raise_on_any_failure' : raise_on_any_failure ,
12011248                       'sas' : self ._query_str .replace ('?' , '&' ),
12021249                       'timeout' : '&timeout='  +  str (timeout ) if  timeout  else  "" 
@@ -1211,13 +1258,16 @@ def _generate_set_tiers_options(self,
12111258                tier  =  blob_tier  or  blob .get ('blob_tier' )
12121259                query_parameters , header_parameters  =  self ._generate_set_tiers_subrequest_options (
12131260                    tier = tier ,
1261+                     snapshot = blob .get ('snapshot' ),
1262+                     version_id = blob .get ('version_id' ),
12141263                    rehydrate_priority = rehydrate_priority  or  blob .get ('rehydrate_priority' ),
12151264                    lease_access_conditions = blob .get ('lease_id' ),
1265+                     if_tags = if_tags  or  blob .get ('if_tags_match_condition' ),
12161266                    timeout = timeout  or  blob .get ('timeout' )
12171267                )
12181268            except  AttributeError :
12191269                query_parameters , header_parameters  =  self ._generate_set_tiers_subrequest_options (
1220-                     blob_tier , rehydrate_priority = rehydrate_priority )
1270+                     blob_tier , rehydrate_priority = rehydrate_priority ,  if_tags = if_tags )
12211271
12221272            req  =  HttpRequest (
12231273                "PUT" ,
@@ -1270,12 +1320,24 @@ def set_standard_blob_tier_blobs(
12701320                    key: 'rehydrate_priority', value type: RehydratePriority 
12711321                lease: 
12721322                    key: 'lease_id', value type: Union[str, LeaseClient] 
1323+                 snapshot: 
1324+                     key: "snapshost", value type: str 
1325+                 version id: 
1326+                     key: "version_id", value type: str 
1327+                 tags match condition: 
1328+                     key: 'if_tags_match_condition', value type: str 
12731329                timeout for subrequest: 
12741330                    key: 'timeout', value type: int 
12751331
12761332        :type blobs: list[str], list[dict], or list[~azure.storage.blob.BlobProperties] 
12771333        :keyword ~azure.storage.blob.RehydratePriority rehydrate_priority: 
12781334            Indicates the priority with which to rehydrate an archived blob 
1335+         :keyword str if_tags_match_condition 
1336+             Specify a SQL where clause on blob tags to operate only on blob with a matching value. 
1337+             eg. "\" tagname\" ='my tag'" 
1338+ 
1339+             .. versionadded:: 12.4.0 
1340+ 
12791341        :keyword int timeout: 
12801342            The timeout parameter is expressed in seconds. 
12811343        :keyword bool raise_on_any_failure: 
0 commit comments