The Buckets resource represents a bucket in Google
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
project team owners group.
To try out the methods for this resource, see Methods.
Resource representations
{ "kind": "storage#bucket", "id": string, "selfLink": string, "projectNumber": unsigned long, "name": string, "timeCreated": datetime, "updated": datetime, "defaultEventBasedHold": boolean, "retentionPolicy": { "retentionPeriod": unsigned long, "effectiveTime": datetime, "isLocked": boolean }, "metageneration": long, "acl": [ bucketAccessControls Resource ], "defaultObjectAcl": [ defaultObjectAccessControls Resource ], "iamConfiguration": { "uniformBucketLevelAccess": { "enabled": boolean, "lockedTime":datetime, }, }, "encryption": { "defaultKmsKeyName": string }, "owner": { "entity": string, "entityId": string }, "location": string, "locationType": string, "website": { "mainPageSuffix": string, "notFoundPage": string }, "logging": { "logBucket": string, "logObjectPrefix": string }, "versioning": { "enabled": boolean }, "cors": [ { "origin": [ string ], "method": [ string ], "responseHeader": [ string ], "maxAgeSeconds": integer } ], "lifecycle": { "rule": [ { "action": { "type": string, "storageClass": string }, "condition": { "age": integer, "createdBefore": date, "isLive": boolean, "matchesStorageClass": [ string ], "numNewerVersions": integer } } ] }, "labels": { (key): string }, "storageClass": string, "billing": { "requesterPays": boolean }, "etag": string }
Property name | Value | Description | Notes |
---|---|---|---|
acl[] |
list |
Access controls on the bucket, containing one or more
bucketAccessControls Resources.
If 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.
|
writable |
billing |
object |
The bucket's billing configuration. | writable |
billing.requesterPays |
boolean |
When set to true, Requester Pays is enabled for this bucket. | writable |
cors[] |
list |
The bucket's Cross-Origin Resource Sharing (CORS) configuration. | writable |
cors[].maxAgeSeconds |
integer |
The value, in seconds, to return in the Access-Control-Max-Age header used in preflight responses. | writable |
cors[].method[] |
list |
The list of HTTP methods on which to include CORS response headers, (GET , OPTIONS , POST , etc) Note: "*" is permitted in the list of methods, and means "any method". |
writable |
cors[].origin[] |
list |
The list of Origins eligible to receive CORS response headers. Note: "*" is permitted in the list of origins, and means "any Origin". | writable |
cors[].responseHeader[] |
list |
The list of HTTP headers other than the simple response headers to give permission for the user-agent to share across domains. | writable |
defaultEventBasedHold |
boolean |
Whether or not to automatically apply an
eventBasedHold
to new objects added to the bucket. |
writable |
defaultObjectAcl[] |
list |
Default access controls to apply to new objects when no ACL is provided. This list
contains one or more defaultObjectAccessControls Resources.
If iamConfiguration.uniformBucketLevelAccess.enabled is set to true , this field is omitted
in responses, and requests that specify this field fail.
|
writable |
encryption |
object |
Encryption configuration for a bucket. | writable |
encryption.defaultKmsKeyName |
string |
A Cloud KMS key that will be used to encrypt objects inserted into this bucket, if no encryption method is specified. | |
etag |
string |
HTTP 1.1 Entity tag for the bucket. | |
iamConfiguration |
object |
The bucket's IAM configuration. | writable |
iamConfiguration.uniformBucketLevelAccess |
object |
The bucket's uniform bucket-level access configuration. Note: iamConfiguration also includes the bucketPolicyOnly field,
which uses a legacy name but has the same functionality as the uniformBucketLevelAccess field.
We recommend only using uniformBucketLevelAccess , as specifying
both fields may result in unreliable behavior.
|
writable |
iamConfiguration.uniformBucketLevelAccess.enabled |
boolean |
Whether or not the bucket uses uniform bucket-level access. If set, access checks only use bucket-level IAM policies or above. | writable |
iamConfiguration.uniformBucketLevelAccess.lockedTime |
datetime |
The deadline time for changing iamConfiguration.uniformBucketLevelAccess.enabled
from true to false , in
RFC 3339 format.
|
|
id |
string |
The ID of the bucket. For buckets, the id and name properties are the same. |
|
kind |
string |
The kind of item this is. For buckets, this is always storage#bucket . |
|
labels |
object |
User-provided bucket labels, in key/value pairs. | writable |
labels.(key) |
string |
An individual label entry. | writable |
lifecycle |
object |
The bucket's lifecycle configuration. See lifecycle management for more information. | writable |
lifecycle.rule[] |
list |
A lifecycle management rule, which is made of an action to take and the condition(s) under which the action will be taken. | |
lifecycle.rule[].action |
object |
The action to take. | |
lifecycle.rule[].action.storageClass |
string |
Target storage class. Required iff the type of the action is SetStorageClass. | |
lifecycle.rule[].action.type |
string |
Type of the action. Currently, only Delete and SetStorageClass are supported.
Acceptable values are:
|
|
lifecycle.rule[].condition |
object |
The condition(s) under which the action will be taken. | |
lifecycle.rule[].condition.age |
integer |
Age of an object (in days). This condition is satisfied when an object reaches the specified age. | |
lifecycle.rule[].condition.createdBefore |
date |
A date in RFC 3339 format with only the date part (for instance, "2013-01-15"). This condition is satisfied when an object is created before midnight of the specified date in UTC. | |
lifecycle.rule[].condition.isLive |
boolean |
Relevant only for versioned objects. If the value is true , this condition
matches the live version of objects; if the value is false , it matches
noncurrent versions of objects. |
|
lifecycle.rule[].condition.matchesStorageClass[] |
list |
Objects having any of the storage classes specified by this condition will be matched. Values include STANDARD , NEARLINE , COLDLINE , MULTI_REGIONAL , REGIONAL , and DURABLE_REDUCED_AVAILABILITY . |
|
lifecycle.rule[].condition.numNewerVersions |
integer |
Relevant only for versioned objects. If the value is 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 |
The location of the bucket. Object data for objects in the bucket resides in physical storage within this region. Defaults to US . See Cloud Storage bucket locations for the authoritative list. |
writable |
locationType |
string |
The type of location that the bucket resides in, as determined by the
location property. |
|
logging |
object |
The bucket's logging configuration, which defines the destination bucket and optional name prefix for the current bucket's logs. | writable |
logging.logBucket |
string |
The destination bucket where the current bucket's logs should be placed. | writable |
logging.logObjectPrefix |
string |
A prefix for log object names. The default prefix is the bucket name. | writable |
metageneration |
long |
The metadata generation of this bucket. | |
name |
string |
The name of the bucket. | |
owner |
object |
The owner of the bucket. This is always the project team's owner group. | |
owner.entity |
string |
The entity, in the form project-owner-projectId . |
|
owner.entityId |
string |
The ID for the entity. | |
projectNumber |
unsigned long |
The project number of the project the bucket belongs to. | |
selfLink |
string |
The URI of this bucket. | |
retentionPolicy |
object |
The bucket's retention policy, which defines the minimum age an object in the bucket must reach before it can be deleted or overwritten. | writable |
retentionPolicy.effectiveTime |
datetime |
The time from which the retentionPolicy was effective, in RFC 3339 format. | |
retentionPolicy.isLocked |
boolean |
Whether or not the retentionPolicy is locked. If true, the retentionPolicy cannot be removed and the retention period cannot be reduced. | |
retentionPolicy.retentionPeriod |
unsigned integer |
The period of time, in seconds, that objects in the bucket must be retained and cannot be deleted, overwritten, or made noncurrent. The value must be greater than 0 seconds and less than 3,155,760,000 seconds. | writable |
storageClass |
string |
The bucket's default storage class, used whenever no storageClass is
specified for a newly-created object. Valid values include STANDARD ,
NEARLINE , COLDLINE , MULTI-REGIONAL ,
REGIONAL and DURABLE_REDUCED_AVAILABILITY . If
storageClass is not specified when the bucket is created, it defaults to
STANDARD . For more information,
see storage classes. |
writable |
timeCreated |
datetime |
The creation time of the bucket in RFC 3339 format. | |
updated |
datetime |
The modification time of the bucket in RFC 3339 format. | |
versioning |
object |
The bucket's versioning configuration. | writable |
versioning.enabled |
boolean |
While set to true, versioning is fully enabled for this bucket. | writable |
website |
object |
The bucket's website configuration, controlling how the service behaves when accessing bucket contents as a web site. See the Static Website Examples for more information. | writable |
website.mainPageSuffix |
string |
If the requested object path is missing, the service will ensure the path has a trailing '/', append this suffix, and attempt to retrieve the resulting object. This allows the creation of index.html objects to represent directory pages. |
writable |
website.notFoundPage |
string |
If the requested object path is missing, and any mainPageSuffix object is missing, if applicable, the service will return the named object from this bucket as the content for a 404 Not Found result. |
writable |
Methods
Available methods for Buckets resources are as follows:
- delete
- Permanently deletes an empty 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.
- 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.
- 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.