You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 31, 2026. It is now read-only.
* feat: add support for soft delete
* add restore, get object, list_objects, unit tests
* integration test
* update restore_blob
* SoftDeletePolicy data class
* update docstrings; address comments
:returns: Iterator of all :class:`~google.cloud.storage.blob.Blob`
1383
1400
in this bucket matching the arguments.
@@ -1398,6 +1415,7 @@ def list_blobs(
1398
1415
timeout=timeout,
1399
1416
retry=retry,
1400
1417
match_glob=match_glob,
1418
+
soft_deleted=soft_deleted,
1401
1419
)
1402
1420
1403
1421
deflist_notifications(
@@ -2060,6 +2078,110 @@ def rename_blob(
2060
2078
)
2061
2079
returnnew_blob
2062
2080
2081
+
defrestore_blob(
2082
+
self,
2083
+
blob_name,
2084
+
client=None,
2085
+
generation=None,
2086
+
copy_source_acl=None,
2087
+
projection=None,
2088
+
if_generation_match=None,
2089
+
if_generation_not_match=None,
2090
+
if_metageneration_match=None,
2091
+
if_metageneration_not_match=None,
2092
+
timeout=_DEFAULT_TIMEOUT,
2093
+
retry=DEFAULT_RETRY_IF_GENERATION_SPECIFIED,
2094
+
):
2095
+
"""Restores a soft-deleted object.
2096
+
2097
+
If :attr:`user_project` is set on the bucket, bills the API request to that project.
2098
+
2099
+
See [API reference docs](https://cloud.google.com/storage/docs/json_api/v1/objects/restore)
2100
+
2101
+
:type blob_name: str
2102
+
:param blob_name: The name of the blob to be restored.
:param client: (Optional) The client to use. If not passed, falls back
2106
+
to the ``client`` stored on the current bucket.
2107
+
2108
+
:type generation: long
2109
+
:param generation: (Optional) If present, selects a specific revision of this object.
2110
+
2111
+
:type copy_source_acl: bool
2112
+
:param copy_source_acl: (Optional) If true, copy the soft-deleted object's access controls.
2113
+
2114
+
:type projection: str
2115
+
:param projection: (Optional) Specifies the set of properties to return.
2116
+
If used, must be 'full' or 'noAcl'.
2117
+
2118
+
:type if_generation_match: long
2119
+
:param if_generation_match:
2120
+
(Optional) See :ref:`using-if-generation-match`
2121
+
2122
+
:type if_generation_not_match: long
2123
+
:param if_generation_not_match:
2124
+
(Optional) See :ref:`using-if-generation-not-match`
2125
+
2126
+
:type if_metageneration_match: long
2127
+
:param if_metageneration_match:
2128
+
(Optional) See :ref:`using-if-metageneration-match`
2129
+
2130
+
:type if_metageneration_not_match: long
2131
+
:param if_metageneration_not_match:
2132
+
(Optional) See :ref:`using-if-metageneration-not-match`
2133
+
2134
+
:type timeout: float or tuple
2135
+
:param timeout:
2136
+
(Optional) The amount of time, in seconds, to wait
2137
+
for the server response. See: :ref:`configuring_timeouts`
2138
+
2139
+
:type retry: google.api_core.retry.Retry or google.cloud.storage.retry.ConditionalRetryPolicy
2140
+
:param retry:
2141
+
(Optional) How to retry the RPC.
2142
+
The default value is ``DEFAULT_RETRY_IF_GENERATION_SPECIFIED``, which
2143
+
only restore operations with ``if_generation_match`` or ``generation`` set
2144
+
will be retried.
2145
+
2146
+
Users can configure non-default retry behavior. A ``None`` value will
2147
+
disable retries. A ``DEFAULT_RETRY`` value will enable retries
2148
+
even if restore operations are not guaranteed to be idempotent.
2149
+
See [Configuring Retries](https://cloud.google.com/python/docs/reference/storage/latest/retry_timeout).
0 commit comments