名称
gdcloud storage buckets create - 创建新的存储分区。
摘要
gdcloud storage buckets create [ BUCKET_NAME ...]
--bucket-file=BUCKET_FILE |
--location=LOCATION
--location-type=LOCATION_TYPE
( [--description=DESCRIPTION]
[--storage-class=STORAGE_CLASS]
[--project=PROJECT_ID]
[--api-version=VERSION]
[--labels=key1=value1,key2=value2 | --labels-file=LABELS_FILE]
[--annotations=value1,key2=value2 | --annotations-file=ANNOTATIONS_FILE]
[--finalizers=value1,value2]
[--enable-locking-policy]
[--retention-days=RETENTION_DAYS]
[--enable-cors-policy=bool]
[--cors-file=CORS_FILE] )
[--enable-life-cycle-policy=bool]
[--life-cycle-rules-file=LIFE_CYCLE_RULES_FILE] )
[--format=FORMAT]
[--log-http] [flags]
说明
创建用于存储对象的存储分区。
示例
The following command creates a zonal bucket named "my-bucket" in the default project:
gdcloud storage buckets create my-bucket --location=zone1 --location-type=SingleZone
The following command creates two zonal buckets, one named "my-bucket" and a second bucket named "my-other-bucket":
gdcloud storage buckets create my-bucket my-other-bucket --location=zone1 --location-type=SingleZone
The following command creates a zonal bucket with the Standard storage class in a project with ID my-project-id:
gdcloud storage buckets create my-bucket --storage-class=Standard --project=my-project-id --location=zone1 --location-type=SingleZone
The following command creates a zonal bucket from a file containing YAML configuration for the bucket. Flags other than --bucket-file are ignored when creating a bucket:
gdcloud storage buckets create --bucket-file=BUCKET_FILE --location=zone1 --location-type=SingleZone
The following command creates two dual-zone buckets, one named "my-dual-zone-bucket" and a second bucket named "my-other-dual-zone-bucket":
gdcloud storage buckets create my-dual-zone-bucket my-other-dual-zone-bucket --location=zone1,zone2 --location-type=AsyncDualZone
The following command creates a dual-zone bucket from a file containing YAML configuration for the bucket. Flags other than --bucket-file are ignored when creating a bucket:
gdcloud storage buckets create --bucket-file=BUCKET_FILE --location=zone1,zone2 --location-type=AsyncDualZone
必需标志
--location string Comma-separated list of zones where the storage buckets are available.
--location-type string Bucket location configuration type. Available options are: [AsyncDualZone, SyncDualZone, SingleZone].
可选标志
--annotations stringToString Comma-separated list of key-value pairs for annotations. (default [])
--annotations-file string Path to a file containing YAML configuration for annotations.
--api-version string API version for the bucket (default is the newest API version).
--bucket-file string Path to a file containing YAML configuration for a bucket custom resource.
If set, the gdcloud CLI creates the bucket from the YAML configuration and ignores the other flags that define the bucket API field.
--cors-rules-file string Path to a file containing YAML configuration for the CORS policy detail. It must contain an array of CORS rules.
--description string String description of bucket contents.
--enable-cors-policy If set, the custom policy defined in CORS_FILE takes effect.
Otherwise, CORS_FILE is ignored even if it has been set.
(default is false).
--enable-life-cycle-policy If set, the custom policy defined in LIFE_CYCLE_RULES_FILE takes effect.
Otherwise, LIFE_CYCLE_RULES_FILE is ignored even if it has been set.
(default is false).
--enable-locking-policy Locking policy that must be enabled when creating the bucket and cannot be disabled afterwards.
If unset, object locking and versioning is disabled and cannot be enabled.
The locking policy does not have a default amount of retention days.
Use the --retention-days flag to set the retention days.
--finalizers strings Comma-separated list of strings for finalizers.
--labels stringToString Comma-separated list of key-value pairs for labels. (default [])
--labels-file string Path to a file containing YAML configuration for labels.
--life-cycle-rules-file string Path to a file containing YAML configuration for the life cycle policy detail. It must contain an array of life cycle rules.
--log-http Log all HTTP server requests and responses to stderr.
--retention-days int32 Minimum number of days as an integer that each version of every object will be retained.
If set, the locking policy controlled by the --enable-locking-policy flag is enabled by default. (default -2147483648)
--storage-class string Storage class of the bucket. The available value is "Standard". (default "Standard")
GDCLOUD 全局标志
以下标志适用于所有命令:--configuration、--format、--help、--project、--quiet。
如需了解详情,请参阅 gdcloud CLI 参考概览页面。