- NAME
-
- gcloud storage restore - restore one or more soft-deleted objects
- SYNOPSIS
-
-
gcloud storage restore
[URLS
…] [--all-versions
,-a
] [--async
] [--[no-]preserve-acl
,-p
] [--read-paths-from-stdin
,-I
] [--allow-overwrite
--deleted-after-time
=DELETED_AFTER_TIME
--deleted-before-time
=DELETED_BEFORE_TIME
] [--if-generation-match
=GENERATION
--if-metageneration-match
=METAGENERATION
] [GCLOUD_WIDE_FLAG …
]
-
- DESCRIPTION
-
The restore command restores soft-deleted resources:
gcloud storage restore url…
- EXAMPLES
-
Restore soft-deleted version of bucket with generations:
gcloud storage restore gs://bucket#123
Restore several soft-deleted buckets with generations:
gcloud storage restore gs://bucket1#123 gs://bucket2#456
Restore latest soft-deleted version of object in a bucket.
gcloud storage restore gs://bucket/file1.txt
Restore a specific soft-deleted version of object in a bucket by specifying the generation.
gcloud storage restore gs://bucket/file1.txt#123
Restore all soft-deleted versions of object in a bucket.
gcloud storage restore gs://bucket/file1.txt --all-versions
Restore several objects in a bucket (with or without generation):
gcloud storage restore gs://bucket/file1.txt gs://bucket/file2.txt#456
Restore the latest soft-deleted version of all text objects in a bucket:
gcloud storage restore gs://bucket/**.txt
Restore a list of objects read from stdin (with or without generation):
cat list-of-files.txt | gcloud storage restore --read-paths-from-stdin
Restore object with its original ACL policy:
gcloud storage restore gs://bucket/file1.txt --preserve-acl
Restore all objects in a bucket asynchronously:
gcloud storage restore gs://bucket/** --async
Restore all text files in a bucket asynchronously:
gcloud storage restore gs://bucket/**.txt --async
- POSITIONAL ARGUMENTS
-
- [
URLS
…] - The url of objects to list.
- [
- FLAGS
-
-
SYNCHRONOUS RESTORE OPTIONS
--all-versions
,-a
-
Restores all versions of soft-deleted objects.
This flag is only useful for buckets with [object versioning] (https://cloud.google.com/storage/docs/object-versioning) enabled. In this case, the latest soft-deleted version will become live and the previous generations will become noncurrent.
If versioning is disabled, the latest soft-deleted version will become live and previous generations will be soft-deleted again.
This flag disables parallelism to preserve version order.
--async
- Initiates an asynchronous bulk restore operation on the specified bucket.
--[no-]preserve-acl
,-p
-
Preserves ACLs when copying in the cloud. This option is Cloud Storage-only, and
you need OWNER access to all copied objects. If all objects in the destination
bucket should have the same ACL, you can also set a default object ACL on that
bucket instead of using this flag. Preserving ACLs is the default behavior for
updating existing objects. Use
--preserve-acl
to enable and--no-preserve-acl
to disable. --read-paths-from-stdin
,-I
- Read the list of URLs from stdin.
-
BULK RESTORE OPTIONS
--allow-overwrite
- If included, live objects will be overwritten. If versioning is enabled, this will result in a noncurrent object. If versioning is not enabled, this will result in a soft-deleted object.
--deleted-after-time
=DELETED_AFTER_TIME
- Restores only the objects that were soft-deleted after this time.
--deleted-before-time
=DELETED_BEFORE_TIME
- Restores only the objects that were soft-deleted before this time.
-
SYNCHRONOUS RESTORE OPTIONS
- PRECONDITION FLAGS
-
--if-generation-match
=GENERATION
- Execute only if the generation matches the generation of the requested object.
--if-metageneration-match
=METAGENERATION
- Execute only if the metageneration matches the metageneration of the requested object.
- GCLOUD WIDE FLAGS
-
These flags are available to all commands:
--access-token-file
,--account
,--billing-project
,--configuration
,--flags-file
,--flatten
,--format
,--help
,--impersonate-service-account
,--log-http
,--project
,--quiet
,--trace-token
,--user-output-enabled
,--verbosity
.Run
$ gcloud help
for details. - NOTES
-
This variant is also available:
gcloud alpha storage restore
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-24 UTC.