The Buckets resource represents a bucket
in
Cloud Storage. There is a single global namespace shared by all buckets. For more
information, see bucket name requirements
.
Buckets contain objects
which can be accessed by
their own methods. In addition to the acl
property, buckets contain bucketAccessControls
, for use in
fine-grained manipulation of an existing bucket's access controls.
A bucket is always owned by the associated project's projectOwner
convenience value
.
To try out the methods for this resource, such as creating a new bucket, see Methods .
Resource representations
{ "kind" : "storage#bucket" , "selfLink" : string , "id" : string , "name" : string , "projectNumber" : " unsigned long " , "generation" : " long " , "metageneration" : " long " , "location" : string , "storageClass" : string , "etag" : string , "defaultEventBasedHold" : boolean , "timeCreated" : " datetime " , "updated" : " datetime " , "softDeleteTime" : " datetime " , "hardDeleteTime" : " datetime " , "hierarchicalNamespace" : { "enabled" : boolean }, "encryption" : { "defaultKmsKeyName" : string , "googleManagedEncryptionEnforcementConfig" : { "restrictionMode" : string , "effectiveTime" : datetime }, "customerManagedEncryptionEnforcementConfig" : { "restrictionMode" : string , "effectiveTime" : datetime }, "customerSuppliedEncryptionEnforcementConfig" : { "restrictionMode" : string , "effectiveTime" : datetime }, }, "acl" : [ bucketAccessControls Resource ], "defaultObjectAcl" : [ defaultObjectAccessControls Resource ], "website" : { "mainPageSuffix" : string , "notFoundPage" : string }, "owner" : { "entity" : string , "entityId" : string }, "logging" : { "logBucket" : string , "logObjectPrefix" : string }, "cors" : [ { "origin" : [ string ], "method" : [ string ], "responseHeader" : [ string ], "maxAgeSeconds" : integer } ], "versioning" : { "enabled" : boolean }, "lifecycle" : { "rule" : [ { "action" : { "storageClass" : string , "type" : string }, "condition" : { "age" : integer , "createdBefore" : " date " , "isLive" : boolean , "numNewerVersions" : integer , "matchesStorageClass" : [ string ], "daysSinceCustomTime" : integer , "customTimeBefore" : " date " , "daysSinceNoncurrentTime" : integer , "noncurrentTimeBefore" : " date " , "matchesPrefix" : [ string ], "matchesSuffix" : [ string ] } } ] }, "autoclass" : { "enabled" : boolean , "toggleTime" : " datetime " , "terminalStorageClass" : string , "terminalStorageClassUpdateTime" : " datetime " }, "labels" : { ( key ) : string }, "retentionPolicy" : { "retentionPeriod" : " unsigned long " , "effectiveTime" : " datetime " , "isLocked" : boolean }, "objectRetention" : { "mode" : string }, "billing" : { "requesterPays" : boolean }, "iamConfiguration" : { "publicAccessPrevention" : string , "uniformBucketLevelAccess" : { "enabled" : boolean , "lockedTime" : " datetime " }, }, "ipFilter" : { "allowAllServiceAgentAccess" : boolean , "allowCrossOrgVpcs" : boolean , "mode" : string , "publicNetworkSource" : { "allowedIpCidrRanges" : [ string , ] }, "vpcNetworkSources" : [ { "network" : string , "allowedIpCidrRanges" : [ string , ] }, ] } "locationType" : string , "customPlacementConfig" : { "dataLocations" : [ string , string ] }, "softDeletePolicy" : { "retentionDurationSeconds" : long , "effectiveTime" : datetime }, "rpo" : string }
acl[]
list
iamConfiguration.uniformBucketLevelAccess.enabled
is set to true
, this field is omitted in responses, and requests that specify this field fail with a 400 Bad Request
response.autoclass
object
autoclass.enabled
boolean
autoclass.terminalStorageClass
string
NEARLINE
and ARCHIVE
. The default value is NEARLINE
.autoclass.terminalStorageClassUpdateTime
datetime
1
autoclass.toggleTime
datetime
1
billing
object
cors[].maxAgeSeconds
integer
cors[].method[]
list
"GET"
, "OPTIONS"
, and "POST"
.
cors[].responseHeader[]
list
customPlacementConfig
object
customPlacementConfig.dataLocations[]
list
defaultEventBasedHold
boolean
defaultObjectAcl[]
list
iamConfiguration.uniformBucketLevelAccess.enabled
is set to true
, this field is omitted in responses, and requests that specify this field fail.encryption
object
encryption.defaultKmsKeyName
string
encryption.googleManagedEncryptionEnforcementConfig
object
Controls the use of standard encryption (Google default encryption) to encrypt objects in this bucket. If omitted, then creating new objects with standard encryption is allowed. If set, then new objects must comply with the encryption enforcement configuration.
This property applies when new objects are created, including when soft-deleted objects are restored. Changing this property has no effect on existing objects.
encryption.googleManagedEncryptionEnforcementConfig.restrictionMode
string
-
NotRestricted: new objects can use standard encryption. -
FullyRestricted: new objects can't use standard encryption.
encryption.googleManagedEncryptionEnforcementConfig.effectiveTime
datetime
1
encryption.customerManagedEncryptionEnforcementConfig
object
Controls the use of customer-managed encryption keys (CMEKs) to encrypt objects in this bucket. If omitted, then creating new objects with CMEKs is allowed. If set, then new objects must comply with the encryption enforcement configuration.
This property applies when new objects are created, including when soft-deleted objects are restored. Changing this property has no effect on existing objects.
encryption.customerManagedEncryptionEnforcementConfig.restrictionMode
string
-
NotRestricted: new objects can use CMEKs. -
FullyRestricted: new objects can't use CMEKs.
encryption.customerManagedEncryptionEnforcementConfig.effectiveTime
datetime
1
encryption.customerSuppliedEncryptionEnforcementConfig
object
Controls the use of customer-supplied encryption keys to encrypt objects in this bucket. If omitted, then creating new objects with customer-supplied encryption keys is allowed. If set, then new objects must comply with the encryption enforcement configuration.
This property applies when new objects are created, including when soft-deleted objects are restored. Changing this property has no effect on existing objects.
encryption.customerSuppliedEncryptionEnforcementConfig.restrictionMode
string
-
NotRestricted: new objects can use customer-supplied encryption keys. -
FullyRestricted: new objects can't use customer-supplied encryption keys.
encryption.customerSuppliedEncryptionEnforcementConfig.effectiveTime
datetime
1
hierarchicalNamespace.enabled
boolean
iamConfiguration
object
iamConfiguration.publicAccessPrevention
string
"inherited"
or "enforced"
. If "inherited"
, the bucket uses public access prevention only if the bucket is subject to the public access prevention organization policy constraint
. Defaults to "inherited"
.iamConfiguration.uniformBucketLevelAccess
object
iamConfiguration.uniformBucketLevelAccess.enabled
boolean
iamConfiguration.uniformBucketLevelAccess.lockedTime
datetime
1
iamConfiguration.uniformBucketLevelAccess.enabled
from true
to false
, in RFC 3339
format. iamConfiguration.uniformBucketLevelAccess.enabled
might be changed from true
to false
until the locked time, after which the field is immutable.
id
string
id
and name
properties are the same.ipFilter
object
ipFilter.allowAllServiceAgentAccess
boolean
true
, other Google Cloud services can use service agents to access the bucket without IP-based validation.ipFilter.allowCrossOrgVpcs
boolean
vpcNetworkSources
to originate from a different organization. If set to true
, the request allows cross-organizational VPC networks. If set to false
, the request restricts the VPC networks to the same organization as the bucket. If not specified, the default value is false
.ipFilter.mode
string
Enabled
and Disabled
. When set to Enabled
, IP filtering rules are applied to a bucket and all incoming requests to the bucket are evaluated against these rules. When set to Disabled
, IP filtering rules are not applied to a bucket.ipFilter.publicNetworkSource
object
ipFilter.publicNetworkSource.allowedIpCidrRanges[]
list of strings
192.0.2.0/24
is accepted but 192.0.2.1/24
is not. Similarly, for IPv6, 2001:db8::/32
is accepted whereas 2001:db8::1/32
is not.ipFilter.vpcNetworkSources.network
string
Format:
projects/ PROJECT_ID
/global/networks/ NETWORK_NAME
ipFilter.vpcNetworkSources.allowedIpCidrRanges[]
list of strings
192.0.2.0/24
is accepted but 192.0.2.1/24
is not. Similarly, for IPv6, 2001:db8::/32
is accepted whereas 2001:db8::1/32
is not.kind
string
"storage#bucket"
.labels.(key)
string
lifecycle
object
lifecycle.rule[]
list
lifecycle.rule[].action
object
lifecycle.rule[].action.storageClass
string
action.type
is "SetStorageClass"
. See lifecycle actions
for a table of supported storage class transitions.lifecycle.rule[].action.type
string
"Delete"
, "SetStorageClass"
, and "AbortIncompleteMultipartUpload"
are supported.lifecycle.rule[].condition
object
lifecycle.rule[].condition.age
integer
lifecycle.rule[].condition.createdBefore
date
1
YYYY-MM-DD
. This condition is satisfied when an object is created before midnight of the specified date in UTC.lifecycle.rule[].condition.customTimeBefore
date
1
YYYY-MM-DD
. This condition is satisfied when the customTime
metadata for the object is set to an earlier date than the date used in this lifecycle condition.lifecycle.rule[].condition.daysSinceCustomTime
integer
customTime
metadata for the object. This condition is satisfied when the current date and time is at least the specified number of days after the customTime
.lifecycle.rule[].condition.daysSinceNoncurrentTime
integer
lifecycle.rule[].condition.isLive
boolean
true
, this condition matches the live version of objects; if the value is false
, it matches noncurrent versions of objects.lifecycle.rule[].condition.matchesPrefix[]
list of strings
lifecycle.rule[].condition.matchesStorageClass[]
list
"STANDARD"
, "NEARLINE"
, "COLDLINE"
, "ARCHIVE"
, "MULTI_REGIONAL"
, "REGIONAL"
, and "DURABLE_REDUCED_AVAILABILITY"
.lifecycle.rule[].condition.matchesSuffix[]
list of strings
lifecycle.rule[].condition.noncurrentTimeBefore
date
1
YYYY-MM-DD
. This condition is satisfied for objects that became noncurrent on a date prior to the one specified in this condition.lifecycle.rule[].condition.numNewerVersions
integer
N
, this condition is satisfied when there are at least N
versions (including the live version) newer than this version of the object.location
string
"US"
. See Cloud Storage bucket locations
for the
authoritative list.locationType
string
region
, dual-region
, and multi-region
.logging
object
logging.logBucket
string
logging.logObjectPrefix
string
generation
long
1
objectRetention.mode
string
Enabled
, retention configurations can be set on objects in the bucket.owner
object
owner.entity
string
"project-owner- projectId
"
.owner.entityId
string
projectNumber
unsigned long
1
selfLink
string
retentionPolicy
object
retentionPolicy.effectiveTime
datetime
1
retentionPolicy.isLocked
boolean
retentionPolicy.retentionPeriod
unsigned integer
1
rpo
string
"DEFAULT"
uses default replication. "ASYNC_TURBO"
enables turbo replication, valid for dual-region buckets only. If rpo
is not specified when the bucket is created, it defaults to "DEFAULT"
. For more information, see redundancy across regions
.softDeletePolicy
object
hardDeleteTime
.softDeletePolicy.effectiveTime
datetime
The datetime at which the soft delete policy becomes effective, in RFC 3339 format.
softDeletePolicy.effectiveTime
is updated whenever softDeletePolicy.retentionDurationSeconds
is increased.
softDeletePolicy.retentionDurationSeconds
long
604800
(7 days) and less than 7776000
(90 days). The value can also be set to 0
, which disables the soft delete policy.storageClass
string
storageClass
is specified for a newly-created object. If storageClass
is not specified when the bucket is created, it defaults to "STANDARD"
. For available storage classes, see Storage classes
.updated
datetime
1
hardDeleteTime
datetime
1
hardDeleteTime
of any soft-deleted object within the bucket.versioning
object
versioning.enabled
boolean
website
object
website.mainPageSuffix
string
index.html
objects to represent directory pages.website.notFoundPage
string
mainPageSuffix
object is missing, if applicable, the service returns the named object from this bucket as the content for a 404 Not Found
result.Methods
Available methods for Buckets resources are as follows:
- delete
- Deletes a bucket.
- get
- Returns metadata for the specified bucket.
- getIamPolicy
- Returns an IAM policy for the specified bucket.
- insert
- Creates a new bucket.
- list
- Retrieves a list of buckets for a given project.
- listChannels
- Retrieves a list of active Object Change Notification channels for a bucket.
- lockRetentionPolicy
- Irreversibly sets the retention policy on a bucket.
- patch
- Updates a bucket. Changes to the bucket will be readable immediately after writing, but configuration changes may take time to propagate. This method supports patch semantics.
- relocate
- Relocates a bucket to a different geographic location.
- restore
- Restores a soft-deleted bucket.
- setIamPolicy
- Updates an IAM policy for the specified bucket.
- testIamPermissions
- Tests a set of permissions on the given bucket to see which, if any, are held by the caller.
- update
- Updates a bucket. Changes to the bucket will be readable immediately after writing, but configuration changes may take time to propagate. This method sets the complete metadata of a bucket. If you want to change some of a bucket's metadata while leaving other parts unaffected, use the PATCH method instead.
For information about status and error codes returned by these APIs, see the reference page .
Try it for yourself
If you're new to Google Cloud, create an account to evaluate how Cloud Storage performs in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
Try Cloud Storage free
