@@ -474,7 +474,9 @@ def reload(self, client=None, timeout=_DEFAULT_TIMEOUT, retry=DEFAULT_RETRY):
474474 for entry in found .get ("items" , ()):
475475 self .add_entity (self .entity_from_dict (entry ))
476476
477- def _save (self , acl , predefined , client , timeout = _DEFAULT_TIMEOUT ):
477+ def _save (
478+ self , acl , predefined , client , timeout = _DEFAULT_TIMEOUT , retry = DEFAULT_RETRY ,
479+ ):
478480 """Helper for :meth:`save` and :meth:`save_predefined`.
479481
480482 :type acl: :class:`google.cloud.storage.acl.ACL`, or a compatible list.
@@ -495,8 +497,19 @@ def _save(self, acl, predefined, client, timeout=_DEFAULT_TIMEOUT):
495497
496498 Can also be passed as a tuple (connect_timeout, read_timeout).
497499 See :meth:`requests.Session.request` documentation for details.
500+
501+ :type retry: :class:`~google.api_core.retry.Retry`
502+ :param retry: (Optional) How to retry the RPC.
503+
504+ A None value will disable retries.
505+
506+ A google.api_core.retry.Retry value will enable retries,
507+ and the object will define retriable response codes and errors
508+ and configure backoff and timeout options.
498509 """
510+ client = self ._require_client (client )
499511 query_params = {"projection" : "full" }
512+
500513 if predefined is not None :
501514 acl = []
502515 query_params [self ._PREDEFINED_QUERY_PARAM ] = predefined
@@ -505,21 +518,25 @@ def _save(self, acl, predefined, client, timeout=_DEFAULT_TIMEOUT):
505518 query_params ["userProject" ] = self .user_project
506519
507520 path = self .save_path
508- client = self ._require_client (client )
509521
510- result = client ._connection .api_request (
511- method = "PATCH" ,
512- path = path ,
513- data = {self ._URL_PATH_ELEM : list (acl )},
522+ result = client ._patch_resource (
523+ path ,
524+ {self ._URL_PATH_ELEM : list (acl )},
514525 query_params = query_params ,
515526 timeout = timeout ,
527+ retry = retry ,
516528 )
529+
517530 self .entities .clear ()
531+
518532 for entry in result .get (self ._URL_PATH_ELEM , ()):
519533 self .add_entity (self .entity_from_dict (entry ))
534+
520535 self .loaded = True
521536
522- def save (self , acl = None , client = None , timeout = _DEFAULT_TIMEOUT ):
537+ def save (
538+ self , acl = None , client = None , timeout = _DEFAULT_TIMEOUT , retry = DEFAULT_RETRY
539+ ):
523540 """Save this ACL for the current bucket.
524541
525542 If :attr:`user_project` is set, bills the API request to that project.
@@ -538,6 +555,15 @@ def save(self, acl=None, client=None, timeout=_DEFAULT_TIMEOUT):
538555
539556 Can also be passed as a tuple (connect_timeout, read_timeout).
540557 See :meth:`requests.Session.request` documentation for details.
558+
559+ :type retry: :class:`~google.api_core.retry.Retry`
560+ :param retry: (Optional) How to retry the RPC.
561+
562+ A None value will disable retries.
563+
564+ A google.api_core.retry.Retry value will enable retries,
565+ and the object will define retriable response codes and errors
566+ and configure backoff and timeout options.
541567 """
542568 if acl is None :
543569 acl = self
@@ -546,9 +572,11 @@ def save(self, acl=None, client=None, timeout=_DEFAULT_TIMEOUT):
546572 save_to_backend = True
547573
548574 if save_to_backend :
549- self ._save (acl , None , client , timeout = timeout )
575+ self ._save (acl , None , client , timeout = timeout , retry = retry )
550576
551- def save_predefined (self , predefined , client = None , timeout = _DEFAULT_TIMEOUT ):
577+ def save_predefined (
578+ self , predefined , client = None , timeout = _DEFAULT_TIMEOUT , retry = DEFAULT_RETRY ,
579+ ):
552580 """Save this ACL for the current bucket using a predefined ACL.
553581
554582 If :attr:`user_project` is set, bills the API request to that project.
@@ -570,11 +598,20 @@ def save_predefined(self, predefined, client=None, timeout=_DEFAULT_TIMEOUT):
570598
571599 Can also be passed as a tuple (connect_timeout, read_timeout).
572600 See :meth:`requests.Session.request` documentation for details.
601+
602+ :type retry: :class:`~google.api_core.retry.Retry`
603+ :param retry: (Optional) How to retry the RPC.
604+
605+ A None value will disable retries.
606+
607+ A google.api_core.retry.Retry value will enable retries,
608+ and the object will define retriable response codes and errors
609+ and configure backoff and timeout options.
573610 """
574611 predefined = self .validate_predefined (predefined )
575- self ._save (None , predefined , client , timeout = timeout )
612+ self ._save (None , predefined , client , timeout = timeout , retry = retry )
576613
577- def clear (self , client = None , timeout = _DEFAULT_TIMEOUT ):
614+ def clear (self , client = None , timeout = _DEFAULT_TIMEOUT , retry = DEFAULT_RETRY ):
578615 """Remove all ACL entries.
579616
580617 If :attr:`user_project` is set, bills the API request to that project.
@@ -594,8 +631,17 @@ def clear(self, client=None, timeout=_DEFAULT_TIMEOUT):
594631
595632 Can also be passed as a tuple (connect_timeout, read_timeout).
596633 See :meth:`requests.Session.request` documentation for details.
634+
635+ :type retry: :class:`~google.api_core.retry.Retry`
636+ :param retry: (Optional) How to retry the RPC.
637+
638+ A None value will disable retries.
639+
640+ A google.api_core.retry.Retry value will enable retries,
641+ and the object will define retriable response codes and errors
642+ and configure backoff and timeout options.
597643 """
598- self .save ([], client = client , timeout = timeout )
644+ self .save ([], client = client , timeout = timeout , retry = retry )
599645
600646
601647class BucketACL (ACL ):
0 commit comments