gcloud alpha storage restore

NAME
gcloud alpha storage restore - restore one or more soft-deleted objects
SYNOPSIS
gcloud alpha 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
(ALPHA) The restore command restores soft-deleted resources:
gcloud alpha storage restore url…
EXAMPLES
Restore soft-deleted version of bucket with generations:
gcloud alpha storage restore gs://bucket#123

Restore several soft-deleted buckets with generations:

gcloud alpha storage restore gs://bucket1#123 gs://bucket2#456

Restore latest soft-deleted version of object in a bucket.

gcloud alpha storage restore gs://bucket/file1.txt

Restore a specific soft-deleted version of object in a bucket by specifying the generation.

gcloud alpha storage restore gs://bucket/file1.txt#123

Restore all soft-deleted versions of object in a bucket.

gcloud alpha storage restore gs://bucket/file1.txt --all-versions

Restore several objects in a bucket (with or without generation):

gcloud alpha 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 alpha storage restore gs://bucket/**.txt

Restore a list of objects read from stdin (with or without generation):

cat list-of-files.txt | gcloud alpha storage restore --read-paths-from-stdin

Restore object with its original ACL policy:

gcloud alpha storage restore gs://bucket/file1.txt --preserve-acl

Restore all objects in a bucket asynchronously:

gcloud alpha storage restore gs://bucket/** --async

Restore all text files in a bucket asynchronously:

gcloud alpha 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.
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 command is currently in alpha and might change without notice. If this command fails with API permission errors despite specifying the correct project, you might be trying to access an API with an invitation-only early access allowlist. This variant is also available:
gcloud storage restore