Skip to content

Commit 910e34c

Browse files
feat: make retry parameter public and added in other methods (#331)
* feat: make retry parameter public and added in other methods * feat: change in doc string * feat: changes in docstring * feat: remove retry for acl
1 parent 41849b1 commit 910e34c

File tree

11 files changed

+866
-67
lines changed

11 files changed

+866
-67
lines changed

google/cloud/storage/_helpers.py

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ def reload(
145145
if_generation_not_match=None,
146146
if_metageneration_match=None,
147147
if_metageneration_not_match=None,
148+
retry=DEFAULT_RETRY,
148149
):
149150
"""Reload properties from Cloud Storage.
150151
@@ -187,6 +188,20 @@ def reload(
187188
:type if_metageneration_not_match: long
188189
:param if_metageneration_not_match: (Optional) Make the operation conditional on whether the
189190
blob's current metageneration does not match the given value.
191+
192+
:type retry: google.api_core.retry.Retry or google.cloud.storage.retry.ConditionalRetryPolicy
193+
:param retry: (Optional) How to retry the RPC. A None value will disable retries.
194+
A google.api_core.retry.Retry value will enable retries, and the object will
195+
define retriable response codes and errors and configure backoff and timeout options.
196+
197+
A google.cloud.storage.retry.ConditionalRetryPolicy value wraps a Retry object and
198+
activates it only if certain conditions are met. This class exists to provide safe defaults
199+
for RPC calls that are not technically safe to retry normally (due to potential data
200+
duplication or other side-effects) but become safe to retry if a condition such as
201+
if_metageneration_match is set.
202+
203+
See the retry.py source code and docstrings in this package (google.cloud.storage.retry) for
204+
information on retry types and how to configure them.
190205
"""
191206
client = self._require_client(client)
192207
query_params = self._query_params
@@ -207,7 +222,7 @@ def reload(
207222
headers=self._encryption_headers(),
208223
_target_object=self,
209224
timeout=timeout,
210-
retry=DEFAULT_RETRY,
225+
retry=retry,
211226
)
212227
self._set_properties(api_response)
213228

@@ -247,6 +262,7 @@ def patch(
247262
if_generation_not_match=None,
248263
if_metageneration_match=None,
249264
if_metageneration_not_match=None,
265+
retry=DEFAULT_RETRY_IF_METAGENERATION_SPECIFIED,
250266
):
251267
"""Sends all changed properties in a PATCH request.
252268
@@ -286,6 +302,20 @@ def patch(
286302
:type if_metageneration_not_match: long
287303
:param if_metageneration_not_match: (Optional) Make the operation conditional on whether the
288304
blob's current metageneration does not match the given value.
305+
306+
:type retry: google.api_core.retry.Retry or google.cloud.storage.retry.ConditionalRetryPolicy
307+
:param retry: (Optional) How to retry the RPC. A None value will disable retries.
308+
A google.api_core.retry.Retry value will enable retries, and the object will
309+
define retriable response codes and errors and configure backoff and timeout options.
310+
311+
A google.cloud.storage.retry.ConditionalRetryPolicy value wraps a Retry object and
312+
activates it only if certain conditions are met. This class exists to provide safe defaults
313+
for RPC calls that are not technically safe to retry normally (due to potential data
314+
duplication or other side-effects) but become safe to retry if a condition such as
315+
if_metageneration_match is set.
316+
317+
See the retry.py source code and docstrings in this package (google.cloud.storage.retry) for
318+
information on retry types and how to configure them.
289319
"""
290320
client = self._require_client(client)
291321
query_params = self._query_params
@@ -309,7 +339,7 @@ def patch(
309339
query_params=query_params,
310340
_target_object=self,
311341
timeout=timeout,
312-
retry=DEFAULT_RETRY_IF_METAGENERATION_SPECIFIED,
342+
retry=retry,
313343
)
314344
self._set_properties(api_response)
315345

@@ -321,6 +351,7 @@ def update(
321351
if_generation_not_match=None,
322352
if_metageneration_match=None,
323353
if_metageneration_not_match=None,
354+
retry=DEFAULT_RETRY_IF_METAGENERATION_SPECIFIED,
324355
):
325356
"""Sends all properties in a PUT request.
326357
@@ -360,6 +391,20 @@ def update(
360391
:type if_metageneration_not_match: long
361392
:param if_metageneration_not_match: (Optional) Make the operation conditional on whether the
362393
blob's current metageneration does not match the given value.
394+
395+
:type retry: google.api_core.retry.Retry or google.cloud.storage.retry.ConditionalRetryPolicy
396+
:param retry: (Optional) How to retry the RPC. A None value will disable retries.
397+
A google.api_core.retry.Retry value will enable retries, and the object will
398+
define retriable response codes and errors and configure backoff and timeout options.
399+
400+
A google.cloud.storage.retry.ConditionalRetryPolicy value wraps a Retry object and
401+
activates it only if certain conditions are met. This class exists to provide safe defaults
402+
for RPC calls that are not technically safe to retry normally (due to potential data
403+
duplication or other side-effects) but become safe to retry if a condition such as
404+
if_metageneration_match is set.
405+
406+
See the retry.py source code and docstrings in this package (google.cloud.storage.retry) for
407+
information on retry types and how to configure them.
363408
"""
364409
client = self._require_client(client)
365410

@@ -380,7 +425,7 @@ def update(
380425
query_params=query_params,
381426
_target_object=self,
382427
timeout=timeout,
383-
retry=DEFAULT_RETRY_IF_METAGENERATION_SPECIFIED,
428+
retry=retry,
384429
)
385430
self._set_properties(api_response)
386431

google/cloud/storage/acl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ def reload(self, client=None, timeout=_DEFAULT_TIMEOUT):
456456
self.entities.clear()
457457

458458
found = client._connection.api_request(
459-
method="GET", path=path, query_params=query_params, timeout=timeout
459+
method="GET", path=path, query_params=query_params, timeout=timeout,
460460
)
461461
self.loaded = True
462462
for entry in found.get("items", ()):

0 commit comments

Comments
 (0)