File: //snap/google-cloud-cli/394/help/man/man1/gcloud_storage_restore.1
.TH "GCLOUD_STORAGE_RESTORE" 1
.SH "NAME"
.HP
gcloud storage restore \- restore one or more soft\-deleted objects
.SH "SYNOPSIS"
.HP
\f5gcloud storage restore\fR [\fIURLS\fR\ ...] [\fB\-\-all\-versions\fR,\ \fB\-a\fR] [\fB\-\-async\fR] [\fB\-\-[no\-]preserve\-acl\fR,\ \fB\-p\fR] [\fB\-\-read\-paths\-from\-stdin\fR,\ \fB\-I\fR] [\fB\-\-allow\-overwrite\fR\ \fB\-\-created\-after\-time\fR=\fICREATED_AFTER_TIME\fR\ \fB\-\-created\-before\-time\fR=\fICREATED_BEFORE_TIME\fR\ \fB\-\-deleted\-after\-time\fR=\fIDELETED_AFTER_TIME\fR\ \fB\-\-deleted\-before\-time\fR=\fIDELETED_BEFORE_TIME\fR] [\fB\-\-if\-generation\-match\fR=\fIGENERATION\fR\ \fB\-\-if\-metageneration\-match\fR=\fIMETAGENERATION\fR] [\fIGCLOUD_WIDE_FLAG\ ...\fR]
.SH "DESCRIPTION"
The restore command restores soft\-deleted resources:
.RS 2m
$ gcloud storage restore url...
.RE
.SH "EXAMPLES"
Restore soft\-deleted version of bucket with generations:
.RS 2m
$ gcloud storage restore gs://bucket#123
.RE
Restore several soft\-deleted buckets with generations:
.RS 2m
$ gcloud storage restore gs://bucket1#123 gs://bucket2#456
.RE
Restore latest soft\-deleted version of object in a bucket.
.RS 2m
$ gcloud storage restore gs://bucket/file1.txt
.RE
Restore a specific soft\-deleted version of object in a bucket by specifying the
generation.
.RS 2m
$ gcloud storage restore gs://bucket/file1.txt#123
.RE
Restore all soft\-deleted versions of object in a bucket.
.RS 2m
$ gcloud storage restore gs://bucket/file1.txt \-\-all\-versions
.RE
Restore several objects in a bucket (with or without generation):
.RS 2m
$ gcloud storage restore gs://bucket/file1.txt \e
gs://bucket/file2.txt#456
.RE
Restore the latest soft\-deleted version of all text objects in a bucket:
.RS 2m
$ gcloud storage restore gs://bucket/**.txt
.RE
Restore a list of objects read from stdin (with or without generation):
.RS 2m
$ cat list\-of\-files.txt | gcloud storage restore \e
\-\-read\-paths\-from\-stdin
.RE
Restore object with its original ACL policy:
.RS 2m
$ gcloud storage restore gs://bucket/file1.txt \-\-preserve\-acl
.RE
Restore all objects in a bucket asynchronously:
.RS 2m
$ gcloud storage restore gs://bucket/** \-\-async
.RE
Restore all text files in a bucket asynchronously:
.RS 2m
$ gcloud storage restore gs://bucket/**.txt \-\-async
.RE
Restore objects created within a specific time range:
.RS 2m
$ gcloud storage restore gs://bucket/** \-\-async \e
\-\-created\-after\-time="2023\-01\-01T00:00:00Z" \e
\-\-created\-before\-time="2023\-01\-31T23:59:59Z"
.RE
Restore objects soft\-deleted within a specific time range:
.RS 2m
$ gcloud storage restore gs://bucket/** \-\-async \e
\-\-deleted\-after\-time="2023\-01\-01T00:00:00Z" \e
\-\-deleted\-before\-time="2023\-01\-31T23:59:59Z"
.RE
Restore objects using a combination of creation and deletion time filters:
.RS 2m
$ gcloud storage restore gs://bucket/** \-\-async \-\-allow\-overwrite \e
\-\-created\-after\-time="2023\-01\-01T00:00:00Z" \e
\-\-deleted\-after\-time="2023\-01\-01T00:00:00Z"
.RE
This command filters the objects that were live at 2023\-01\-01T00:00:00Z and
then soft\-deleted afterwards. This combination of filters is especially helpful
if there is a period of erroneous overwrites. They allow you to go back to the
point just before the overwrites began. You will also need to set the
\f5\-\-allow\-overwrite\fR option to true.
.SH "POSITIONAL ARGUMENTS"
.RS 2m
.TP 2m
[\fIURLS\fR ...]
The url of objects to list.
.RE
.sp
.SH "FLAGS"
.RS 2m
.TP 2m
SYNCHRONOUS RESTORE OPTIONS
.RS 2m
.TP 2m
\fB\-\-all\-versions\fR, \fB\-a\fR
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.
.RE
.sp
.TP 2m
\fB\-\-async\fR
Initiates an asynchronous bulk restore operation on the specified bucket.
.TP 2m
\fB\-\-[no\-]preserve\-acl\fR, \fB\-p\fR
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 \fB\-\-preserve\-acl\fR to enable
and \fB\-\-no\-preserve\-acl\fR to disable.
.TP 2m
\fB\-\-read\-paths\-from\-stdin\fR, \fB\-I\fR
Read the list of URLs from stdin.
.TP 2m
BULK RESTORE OPTIONS
.RS 2m
.TP 2m
\fB\-\-allow\-overwrite\fR
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.
.TP 2m
\fB\-\-created\-after\-time\fR=\fICREATED_AFTER_TIME\fR
Restores only the objects that were created after this time.
.TP 2m
\fB\-\-created\-before\-time\fR=\fICREATED_BEFORE_TIME\fR
Restores only the objects that were created before this time.
.TP 2m
\fB\-\-deleted\-after\-time\fR=\fIDELETED_AFTER_TIME\fR
Restores only the objects that were soft\-deleted after this time.
.TP 2m
\fB\-\-deleted\-before\-time\fR=\fIDELETED_BEFORE_TIME\fR
Restores only the objects that were soft\-deleted before this time.
.RE
.RE
.sp
.SH "PRECONDITION FLAGS"
.RS 2m
.TP 2m
\fB\-\-if\-generation\-match\fR=\fIGENERATION\fR
Execute only if the generation matches the generation of the requested object.
.TP 2m
\fB\-\-if\-metageneration\-match\fR=\fIMETAGENERATION\fR
Execute only if the metageneration matches the metageneration of the requested
object.
.RE
.sp
.SH "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 \fB$ gcloud help\fR for details.
.SH "NOTES"
This variant is also available:
.RS 2m
$ gcloud alpha storage restore
.RE