@@ -360,7 +360,6 @@ def _require_client(self, client):
360
360
client = self .client
361
361
return client
362
362
363
- @create_trace_span (name = "Storage.ACL.reload" )
364
363
def reload (self , client = None , timeout = _DEFAULT_TIMEOUT , retry = DEFAULT_RETRY ):
365
364
"""Reload the ACL data from Cloud Storage.
366
365
@@ -379,25 +378,26 @@ def reload(self, client=None, timeout=_DEFAULT_TIMEOUT, retry=DEFAULT_RETRY):
379
378
:param retry:
380
379
(Optional) How to retry the RPC. See: :ref:`configuring_retries`
381
380
"""
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 = {}
385
385
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
388
388
389
- self .entities .clear ()
389
+ self .entities .clear ()
390
390
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
398
398
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 ))
401
401
402
402
def _save (
403
403
self ,
@@ -486,7 +486,6 @@ def _save(
486
486
487
487
self .loaded = True
488
488
489
- @create_trace_span (name = "Storage.ACL.save" )
490
489
def save (
491
490
self ,
492
491
acl = None ,
@@ -536,26 +535,26 @@ def save(
536
535
:param retry:
537
536
(Optional) How to retry the RPC. See: :ref:`configuring_retries`
538
537
"""
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
+ )
544
557
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" )
559
558
def save_predefined (
560
559
self ,
561
560
predefined ,
@@ -608,20 +607,20 @@ def save_predefined(
608
607
:param retry:
609
608
(Optional) How to retry the RPC. See: :ref:`configuring_retries`
610
609
"""
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
+ )
623
623
624
- @create_trace_span (name = "Storage.ACL.clear" )
625
624
def clear (
626
625
self ,
627
626
client = None ,
@@ -671,16 +670,17 @@ def clear(
671
670
:param retry:
672
671
(Optional) How to retry the RPC. See: :ref:`configuring_retries`
673
672
"""
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
+ )
684
684
685
685
686
686
class BucketACL (ACL ):
0 commit comments