@@ -360,7 +360,6 @@ def _require_client(self, client):
360360 client = self .client
361361 return client
362362
363- @create_trace_span (name = "Storage.ACL.reload" )
364363 def reload (self , client = None , timeout = _DEFAULT_TIMEOUT , retry = DEFAULT_RETRY ):
365364 """Reload the ACL data from Cloud Storage.
366365
@@ -379,25 +378,26 @@ def reload(self, client=None, timeout=_DEFAULT_TIMEOUT, retry=DEFAULT_RETRY):
379378 :param retry:
380379 (Optional) How to retry the RPC. See: :ref:`configuring_retries`
381380 """
382- path = self .reload_path
383- client = self ._require_client (client )
384- query_params = {}
381+ with create_trace_span (name = "Storage.ACL.reload" ):
382+ path = self .reload_path
383+ client = self ._require_client (client )
384+ query_params = {}
385385
386- if self .user_project is not None :
387- query_params ["userProject" ] = self .user_project
386+ if self .user_project is not None :
387+ query_params ["userProject" ] = self .user_project
388388
389- self .entities .clear ()
389+ self .entities .clear ()
390390
391- found = client ._get_resource (
392- path ,
393- query_params = query_params ,
394- timeout = timeout ,
395- retry = retry ,
396- )
397- self .loaded = True
391+ found = client ._get_resource (
392+ path ,
393+ query_params = query_params ,
394+ timeout = timeout ,
395+ retry = retry ,
396+ )
397+ self .loaded = True
398398
399- for entry in found .get ("items" , ()):
400- self .add_entity (self .entity_from_dict (entry ))
399+ for entry in found .get ("items" , ()):
400+ self .add_entity (self .entity_from_dict (entry ))
401401
402402 def _save (
403403 self ,
@@ -486,7 +486,6 @@ def _save(
486486
487487 self .loaded = True
488488
489- @create_trace_span (name = "Storage.ACL.save" )
490489 def save (
491490 self ,
492491 acl = None ,
@@ -536,26 +535,26 @@ def save(
536535 :param retry:
537536 (Optional) How to retry the RPC. See: :ref:`configuring_retries`
538537 """
539- if acl is None :
540- acl = self
541- save_to_backend = acl .loaded
542- else :
543- save_to_backend = True
538+ with create_trace_span (name = "Storage.ACL.save" ):
539+ if acl is None :
540+ acl = self
541+ save_to_backend = acl .loaded
542+ else :
543+ save_to_backend = True
544+
545+ if save_to_backend :
546+ self ._save (
547+ acl ,
548+ None ,
549+ client ,
550+ if_generation_match = if_generation_match ,
551+ if_generation_not_match = if_generation_not_match ,
552+ if_metageneration_match = if_metageneration_match ,
553+ if_metageneration_not_match = if_metageneration_not_match ,
554+ timeout = timeout ,
555+ retry = retry ,
556+ )
544557
545- if save_to_backend :
546- self ._save (
547- acl ,
548- None ,
549- client ,
550- if_generation_match = if_generation_match ,
551- if_generation_not_match = if_generation_not_match ,
552- if_metageneration_match = if_metageneration_match ,
553- if_metageneration_not_match = if_metageneration_not_match ,
554- timeout = timeout ,
555- retry = retry ,
556- )
557-
558- @create_trace_span (name = "Storage.ACL.savePredefined" )
559558 def save_predefined (
560559 self ,
561560 predefined ,
@@ -608,20 +607,20 @@ def save_predefined(
608607 :param retry:
609608 (Optional) How to retry the RPC. See: :ref:`configuring_retries`
610609 """
611- predefined = self .validate_predefined (predefined )
612- self ._save (
613- None ,
614- predefined ,
615- client ,
616- if_generation_match = if_generation_match ,
617- if_generation_not_match = if_generation_not_match ,
618- if_metageneration_match = if_metageneration_match ,
619- if_metageneration_not_match = if_metageneration_not_match ,
620- timeout = timeout ,
621- retry = retry ,
622- )
610+ with create_trace_span (name = "Storage.ACL.savePredefined" ):
611+ predefined = self .validate_predefined (predefined )
612+ self ._save (
613+ None ,
614+ predefined ,
615+ client ,
616+ if_generation_match = if_generation_match ,
617+ if_generation_not_match = if_generation_not_match ,
618+ if_metageneration_match = if_metageneration_match ,
619+ if_metageneration_not_match = if_metageneration_not_match ,
620+ timeout = timeout ,
621+ retry = retry ,
622+ )
623623
624- @create_trace_span (name = "Storage.ACL.clear" )
625624 def clear (
626625 self ,
627626 client = None ,
@@ -671,16 +670,17 @@ def clear(
671670 :param retry:
672671 (Optional) How to retry the RPC. See: :ref:`configuring_retries`
673672 """
674- self .save (
675- [],
676- client = client ,
677- if_generation_match = if_generation_match ,
678- if_generation_not_match = if_generation_not_match ,
679- if_metageneration_match = if_metageneration_match ,
680- if_metageneration_not_match = if_metageneration_not_match ,
681- timeout = timeout ,
682- retry = retry ,
683- )
673+ with create_trace_span (name = "Storage.ACL.clear" ):
674+ self .save (
675+ [],
676+ client = client ,
677+ if_generation_match = if_generation_match ,
678+ if_generation_not_match = if_generation_not_match ,
679+ if_metageneration_match = if_metageneration_match ,
680+ if_metageneration_not_match = if_metageneration_not_match ,
681+ timeout = timeout ,
682+ retry = retry ,
683+ )
684684
685685
686686class BucketACL (ACL ):
0 commit comments