1
0
Fork 0
mirror of https://github.com/imjasonh/gcloud-help synced 2026-07-15 17:35:31 +00:00
gcloud-help/gcloud/storage/buckets/update

337 lines
14 KiB
Text
Raw Normal View History

2022-09-14 09:28:28 +00:00
NAME
gcloud storage buckets update - update bucket settings
SYNOPSIS
2024-01-18 10:21:20 +00:00
gcloud storage buckets update [URL ...] [--additional-headers=HEADER=VALUE]
[--clear-soft-delete] [--continue-on-error, -c]
[--[no-]default-event-based-hold]
2023-11-01 10:29:29 +00:00
[--default-storage-class=DEFAULT_STORAGE_CLASS]
2024-01-18 10:21:20 +00:00
[--lock-retention-period] [--read-paths-from-stdin, -I]
2023-01-19 00:56:33 +00:00
[--recovery-point-objective=SETTING, --rpo=SETTING]
2023-11-09 11:45:52 +00:00
[--[no-]requester-pays] [--soft-delete-duration=SOFT_DELETE_DURATION]
[--[no-]uniform-bucket-level-access] [--[no-]versioning]
2023-01-19 00:56:33 +00:00
[--acl-file=ACL_FILE --add-acl-grant=[ACL_GRANT,...]
--canned-acl=PREDEFINED_ACL, --predefined-acl=PREDEFINED_ACL,
-a PREDEFINED_ACL --remove-acl-grant=REMOVE_ACL_GRANT]
[--add-default-object-acl-grant=[DEFAULT_OBJECT_ACL_GRANT,...]
--default-object-acl-file=DEFAULT_OBJECT_ACL_FILE
--predefined-default-object-acl=PREDEFINED_DEFAULT_OBJECT_ACL
--remove-default-object-acl-grant=REMOVE_DEFAULT_OBJECT_ACL_GRANT]
[--clear-cors | --cors-file=CORS_FILE]
2022-09-14 09:28:28 +00:00
[--clear-default-encryption-key
| --default-encryption-key=DEFAULT_ENCRYPTION_KEY]
[--clear-labels | --labels-file=LABELS_FILE
| --remove-labels=[LABEL_KEYS,...]
--update-labels=[LABEL_KEYS_AND_VALUES,...]]
[--clear-lifecycle | --lifecycle-file=LIFECYCLE_FILE]
[--clear-log-bucket | --log-bucket=LOG_BUCKET]
[--clear-log-object-prefix | --log-object-prefix=LOG_OBJECT_PREFIX]
[--clear-pap, --clear-public-access-prevention
| --[no-]pap, --[no-]public-access-prevention]
2023-01-19 00:56:33 +00:00
[--clear-retention-period | --retention-period=RETENTION_PERIOD]
2022-09-14 09:28:28 +00:00
[--clear-web-error-page | --web-error-page=WEB_ERROR_PAGE]
[--clear-web-main-page-suffix
2023-10-05 11:50:16 +00:00
| --web-main-page-suffix=WEB_MAIN_PAGE_SUFFIX]
2023-11-01 10:29:29 +00:00
[--autoclass-terminal-storage-class=AUTOCLASS_TERMINAL_STORAGE_CLASS
--[no-]enable-autoclass] [GCLOUD_WIDE_FLAG ...]
2022-09-14 09:28:28 +00:00
DESCRIPTION
2023-04-06 10:23:36 +00:00
Update the settings for a bucket.
2022-09-14 09:28:28 +00:00
EXAMPLES
The following command updates the default storage class of a Cloud Storage
bucket named "my-bucket" to NEARLINE and sets requester pays to true:
$ gcloud storage buckets update gs://my-bucket \
--default-storage-class=NEARLINE --requester-pays
2023-01-19 00:56:33 +00:00
The following command updates the retention period of a Cloud Storage
bucket named "my-bucket" to one year and thirty-six minutes:
$ gcloud storage buckets update gs://my-bucket \
--retention-period=1y36m
The following command clears the retention period of a bucket:
$ gcloud storage buckets update gs://my-bucket \
--clear-retention-period
2022-09-14 09:28:28 +00:00
POSITIONAL ARGUMENTS
2024-01-18 10:21:20 +00:00
[URL ...]
Specifies the URLs of the buckets to update.
2022-09-14 09:28:28 +00:00
FLAGS
2023-01-19 00:56:33 +00:00
--additional-headers=HEADER=VALUE
Includes arbitrary headers in storage API calls. Accepts a comma
separated list of key=value pairs, e.g. header1=value1,header2=value2.
Overrides the default storage/additional_headers property value for
this command invocation.
2022-10-18 11:38:19 +00:00
2023-11-09 11:45:52 +00:00
--clear-soft-delete
Clears bucket soft delete settings. Does not affect objects already in
soft-deleted state.
2022-09-14 09:28:28 +00:00
--continue-on-error, -c
If any operations are unsuccessful, the command will exit with a
non-zero exit status after completing the remaining operations. This
flag takes effect only in sequential execution mode (i.e. processor and
thread count are set to 1). Parallelism is default.
2023-01-19 00:56:33 +00:00
--[no-]default-event-based-hold
Sets the default value for an event-based hold on the bucket. By
setting the default event-based hold on a bucket, newly-created objects
inherit that value as their event-based hold (it is not applied
retroactively). Use --default-event-based-hold to enable and
--no-default-event-based-hold to disable.
2023-11-01 10:29:29 +00:00
--default-storage-class=DEFAULT_STORAGE_CLASS
Sets the default storage class for the bucket.
2023-01-19 00:56:33 +00:00
--lock-retention-period
Locks an unlocked retention policy on the buckets. Caution: A locked
retention policy cannot be removed from a bucket or reduced in
duration. Once locked, deleting the bucket is the only way to "remove"
a retention policy.
2024-01-18 10:21:20 +00:00
--read-paths-from-stdin, -I
Read the list of URLs from stdin.
2023-01-19 00:56:33 +00:00
--recovery-point-objective=SETTING, --rpo=SETTING
Sets the recovery point objective
(https://cloud.google.com/architecture/dr-scenarios-planning-guide#basics_of_dr_planning)
of a bucket. This flag can only be used with multi-region and
dual-region buckets. DEFAULT option is valid for multi-region and
dual-regions buckets. ASYNC_TURBO option is only valid for dual-region
buckets. If unspecified when the bucket is created, it defaults to
DEFAULT for dual-region and multi-region buckets. For more information,
2023-06-15 10:31:27 +00:00
see replication in Cloud Storage
(https://cloud.google.com/storage/docs/availability-durability#cross-region-redundancy).
SETTING must be one of: ASYNC_TURBO, DEFAULT.
2022-09-14 09:28:28 +00:00
--[no-]requester-pays
Allows you to configure a Cloud Storage bucket so that the requester
pays all costs related to accessing the bucket and its objects. Use
--requester-pays to enable and --no-requester-pays to disable.
2023-11-09 11:45:52 +00:00
--soft-delete-duration=SOFT_DELETE_DURATION
Duration to retain soft-deleted objects. For example, "2w1d" is two
weeks and one day.
2023-01-19 00:56:33 +00:00
--[no-]uniform-bucket-level-access
Enables or disables uniform bucket-level access
(https://cloud.google.com/storage/docs/bucket-policy-only) for the
buckets. Use --uniform-bucket-level-access to enable and
--no-uniform-bucket-level-access to disable.
2022-09-14 09:28:28 +00:00
--[no-]versioning
Allows you to configure a Cloud Storage bucket to keep old versions of
objects. Use --versioning to enable and --no-versioning to disable.
2023-01-19 00:56:33 +00:00
--acl-file=ACL_FILE
Path to a local JSON or YAML formatted file containing a valid policy.
2023-09-07 10:42:28 +00:00
See the ObjectAccessControls resource
(https://cloud.google.com/storage/docs/json_api/v1/objectAccessControls)
for a representation of JSON formatted files. The output of gcloud
storage [buckets|objects] describe --format="multi(acl:format=json)" is
a valid file and can be edited for more fine-grained control.
2023-01-19 00:56:33 +00:00
--add-acl-grant=[ACL_GRANT,...]
Key-value pairs mirroring the JSON accepted by your cloud provider. For
2023-09-07 10:42:28 +00:00
example, for Cloud
2023-01-19 00:56:33 +00:00
Storage,--add-acl-grant=entity=user-tim@gmail.com,role=OWNER
--canned-acl=PREDEFINED_ACL, --predefined-acl=PREDEFINED_ACL, -a PREDEFINED_ACL
Applies predefined, or "canned," ACLs to a resource. See docs for a
list of predefined ACL constants:
https://cloud.google.com/storage/docs/access-control/lists#predefined-acl
--remove-acl-grant=REMOVE_ACL_GRANT
Key-value pairs mirroring the JSON accepted by your cloud provider. For
2023-09-07 10:42:28 +00:00
example, for Cloud Storage, --remove-acl-grant=ENTITY, where ENTITY has
a valid ACL entity format, such as user-tim@gmail.com, group-admins,
allUsers, etc.
2023-01-19 00:56:33 +00:00
--add-default-object-acl-grant=[DEFAULT_OBJECT_ACL_GRANT,...]
Adds default object ACL grant. See --add-acl-grant help text for more
details.
--default-object-acl-file=DEFAULT_OBJECT_ACL_FILE
Sets the default object ACL from file for the bucket.
--predefined-default-object-acl=PREDEFINED_DEFAULT_OBJECT_ACL
Apply a predefined set of default object access controls tobuckets
--remove-default-object-acl-grant=REMOVE_DEFAULT_OBJECT_ACL_GRANT
Removes default object ACL grant. See --remove-acl-grant help text for
more details.
2022-09-14 09:28:28 +00:00
At most one of these can be specified:
--clear-cors
Clears the bucket's CORS settings.
--cors-file=CORS_FILE
Sets the Cross-Origin Resource Sharing (CORS) configuration on a
bucket. An example CORS JSON document looks like the following:
[
{
"origin": ["http://origin1.example.com"],
"responseHeader": ["Content-Type"],
"method": ["GET"],
"maxAgeSeconds": 3600
}
]
2023-04-06 10:23:36 +00:00
For more information about supported endpoints for CORS, see Cloud
Storage CORS support
2022-09-14 09:28:28 +00:00
(https://cloud.google.com/storage/docs/cross-origin#server-side-support).
At most one of these can be specified:
--clear-default-encryption-key
Clears the bucket's default encryption key.
--default-encryption-key=DEFAULT_ENCRYPTION_KEY
Set the default KMS key for the bucket.
At most one of these can be specified:
--clear-labels
Clear all labels associated with a bucket.
--labels-file=LABELS_FILE
Sets the label configuration for the bucket. An example label JSON
document looks like the following:
{
"your_label_key": "your_label_value",
"your_other_label_key": "your_other_label_value"
}
--remove-labels=[LABEL_KEYS,...]
Remove labels by their key names.
--update-labels=[LABEL_KEYS_AND_VALUES,...]
Add or update labels. Example:
--update-labels=key1=value1,key2=value2
At most one of these can be specified:
--clear-lifecycle
Removes all lifecycle configuration for the bucket.
--lifecycle-file=LIFECYCLE_FILE
Sets the lifecycle management configuration on a bucket. For example,
The following lifecycle management configuration JSON document
specifies that all objects in this bucket that are more than 365 days
old are deleted automatically:
{
"rule":
[
{
"action": {"type": "Delete"},
"condition": {"age": 365}
}
]
}
At most one of these can be specified:
--clear-log-bucket
2023-08-09 11:23:49 +00:00
Disables usage and storage logging for the bucket specified in the
overall update command.
2022-09-14 09:28:28 +00:00
--log-bucket=LOG_BUCKET
2023-08-09 11:23:49 +00:00
Enables usage and storage logging for the bucket specified in the
overall update command, outputting log files to the bucket specified
in this flag. Cloud Storage does not validate the existence of the
bucket receiving logs. In addition to enabling logging on your
bucket, you also need to grant cloud-storage-analytics@google.com
write access to the log bucket.
2022-09-14 09:28:28 +00:00
At most one of these can be specified:
--clear-log-object-prefix
2023-08-09 11:23:49 +00:00
Clears the prefix used to determine the naming of log objects in the
logging bucket.
2022-09-14 09:28:28 +00:00
--log-object-prefix=LOG_OBJECT_PREFIX
2023-08-09 11:23:49 +00:00
Specifies a prefix for the names of logs generated in the log bucket.
The default prefix is the bucket name. If logging is not enabled,
this flag has no effect.
2022-09-14 09:28:28 +00:00
At most one of these can be specified:
--clear-pap, --clear-public-access-prevention
Unsets the public access prevention setting on a bucket.
--[no-]pap, --[no-]public-access-prevention
2023-04-06 10:23:36 +00:00
If True, sets public access prevention
(https://cloud.google.com/storage/docs/public-access-prevention) to
"enforced". If False, sets public access prevention to "inherited".
Use --public-access-prevention to enable and
2022-09-14 09:28:28 +00:00
--no-public-access-prevention to disable.
2023-01-19 00:56:33 +00:00
At most one of these can be specified:
--clear-retention-period
Clears the object retention period for a bucket.
--retention-period=RETENTION_PERIOD
Minimum retention period
(https://cloud.google.com/storage/docs/bucket-lock#retention-periods)
for objects stored in the bucket, for example
2025-04-30 11:00:00 +00:00
--retention-period=P1Y1M1DT5S. Objects added to the bucket cannot be
2023-01-19 00:56:33 +00:00
deleted until they've been stored for the specified length of time.
Default is no retention period. Only available for Cloud Storage
using the JSON API.
2022-09-14 09:28:28 +00:00
At most one of these can be specified:
--clear-web-error-page
Clear website error page if bucket is hosting website.
--web-error-page=WEB_ERROR_PAGE
Cloud Storage allows you to configure a bucket to behave like a
static website. A subsequent GET bucket request through a custom
domain for a non-existent object serves the specified error page
instead of the standard Cloud Storage error.
At most one of these can be specified:
--clear-web-main-page-suffix
Clear website main page suffix if bucket is hosting website.
--web-main-page-suffix=WEB_MAIN_PAGE_SUFFIX
Cloud Storage allows you to configure a bucket to behave like a
static website. A subsequent GET bucket request through a custom
domain serves the specified "main" page instead of performing the
usual bucket listing.
2023-10-05 11:50:16 +00:00
AUTOCLASS FLAGS
2023-11-01 10:29:29 +00:00
--autoclass-terminal-storage-class=AUTOCLASS_TERMINAL_STORAGE_CLASS
The storage class that objects in the bucket eventually transition to
if they are not read for a certain length of time. Only valid if
Autoclass is enabled.
2023-10-05 11:50:16 +00:00
--[no-]enable-autoclass
The Autoclass feature automatically selects the best storage class for
objects based on access patterns. Use --enable-autoclass to enable and
--no-enable-autoclass to disable.
2022-09-14 09:28:28 +00:00
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 buckets update