Skip to main content

buckets

Creates, updates, deletes, gets or lists a buckets resource.

Overview

Namebuckets
TypeResource
Idgoogle.storage.buckets

Fields

NameDatatypeDescription
idstringThe ID of the bucket. For buckets, the id and name properties are the same.
namestringThe name of the bucket.
aclarrayAccess controls on the bucket.
autoclassobjectThe bucket's Autoclass configuration.
billingobjectThe bucket's billing configuration.
corsarrayThe bucket's Cross-Origin Resource Sharing (CORS) configuration.
customPlacementConfigobjectThe bucket's custom placement configuration for Custom Dual Regions.
defaultEventBasedHoldbooleanThe default value for event-based hold on newly created objects in this bucket. Event-based hold is a way to retain objects indefinitely until an event occurs, signified by the hold's release. After being released, such objects will be subject to bucket-level retention (if any). One sample use case of this flag is for banks to hold loan documents for at least 3 years after loan is paid in full. Here, bucket-level retention is 3 years and the event is loan being paid in full. In this example, these objects will be held intact for any number of years until the event has occurred (event-based hold on the object is released) and then 3 more years after that. That means retention duration of the objects begins from the moment event-based hold transitioned from true to false. Objects under event-based hold cannot be deleted, overwritten or archived until the hold is removed.
defaultObjectAclarrayDefault access controls to apply to new objects when no ACL is provided.
encryptionobjectEncryption configuration for a bucket.
etagstringHTTP 1.1 Entity tag for the bucket.
generationstringThe generation of this bucket.
hardDeleteTimestringThe hard delete time of the bucket in RFC 3339 format.
hierarchicalNamespaceobjectThe bucket's hierarchical namespace configuration.
iamConfigurationobjectThe bucket's IAM configuration.
ipFilterobjectThe bucket's IP filter configuration. Specifies the network sources that are allowed to access the operations on the bucket, as well as its underlying objects. Only enforced when the mode is set to 'Enabled'.
kindstringThe kind of item this is. For buckets, this is always storage#bucket.
labelsobjectUser-provided labels, in key/value pairs.
lifecycleobjectThe bucket's lifecycle configuration. See Lifecycle Management for more information.
locationstringThe location of the bucket. Object data for objects in the bucket resides in physical storage within this region. Defaults to US. See the Developer's Guide for the authoritative list.
locationTypestringThe type of the bucket location.
loggingobjectThe bucket's logging configuration, which defines the destination bucket and optional name prefix for the current bucket's logs.
metagenerationstringThe metadata generation of this bucket.
objectRetentionobjectThe bucket's object retention config.
ownerobjectThe owner of the bucket. This is always the project team's owner group.
projectNumberstringThe project number of the project the bucket belongs to.
retentionPolicyobjectThe bucket's retention policy. The retention policy enforces a minimum retention time for all objects contained in the bucket, based on their creation time. Any attempt to overwrite or delete objects younger than the retention period will result in a PERMISSION_DENIED error. An unlocked retention policy can be modified or removed from the bucket via a storage.buckets.update operation. A locked retention policy cannot be removed or shortened in duration for the lifetime of the bucket. Attempting to remove or decrease period of a locked retention policy will result in a PERMISSION_DENIED error.
rpostringThe Recovery Point Objective (RPO) of this bucket. Set to ASYNC_TURBO to turn on Turbo Replication on a bucket.
satisfiesPZIbooleanReserved for future use.
satisfiesPZSbooleanReserved for future use.
selfLinkstringThe URI of this bucket.
softDeletePolicyobjectThe bucket's soft delete policy, which defines the period of time that soft-deleted objects will be retained, and cannot be permanently deleted.
softDeleteTimestringThe soft delete time of the bucket in RFC 3339 format.
storageClassstringThe bucket's default storage class, used whenever no storageClass is specified for a newly-created object. This defines how objects in the bucket are stored and determines the SLA and the cost of storage. Values include MULTI_REGIONAL, REGIONAL, STANDARD, NEARLINE, COLDLINE, ARCHIVE, and DURABLE_REDUCED_AVAILABILITY. If this value is not specified when the bucket is created, it will default to STANDARD. For more information, see Storage Classes.
timeCreatedstringThe creation time of the bucket in RFC 3339 format.
updatedstringThe modification time of the bucket in RFC 3339 format.
versioningobjectThe bucket's versioning configuration.
websiteobjectThe 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.

Methods

NameAccessible byRequired ParamsDescription
getSELECTbucketReturns metadata for the specified bucket.
listSELECTprojectRetrieves a list of buckets for a given project.
insertINSERTprojectCreates a new bucket.
deleteDELETEbucketDeletes an empty bucket. Deletions are permanent unless soft delete is enabled on the bucket.
patchUPDATEbucketPatches a bucket. Changes to the bucket will be readable immediately after writing, but configuration changes may take time to propagate.
updateREPLACEbucketUpdates a bucket. Changes to the bucket will be readable immediately after writing, but configuration changes may take time to propagate.
lock_retention_policyEXECbucket, ifMetagenerationMatchLocks retention policy on a bucket.
restoreEXECbucket, generationRestores a soft-deleted bucket.

SELECT examples

Returns metadata for the specified bucket.

SELECT
id,
name,
acl,
autoclass,
billing,
cors,
customPlacementConfig,
defaultEventBasedHold,
defaultObjectAcl,
encryption,
etag,
generation,
hardDeleteTime,
hierarchicalNamespace,
iamConfiguration,
ipFilter,
kind,
labels,
lifecycle,
location,
locationType,
logging,
metageneration,
objectRetention,
owner,
projectNumber,
retentionPolicy,
rpo,
satisfiesPZI,
satisfiesPZS,
selfLink,
softDeletePolicy,
softDeleteTime,
storageClass,
timeCreated,
updated,
versioning,
website
FROM google.storage.buckets
WHERE bucket = '{{ bucket }}';

INSERT example

Use the following StackQL query and manifest file to create a new buckets resource.

/*+ create */
INSERT INTO google.storage.buckets (
project,
acl,
billing,
cors,
customPlacementConfig,
defaultEventBasedHold,
defaultObjectAcl,
encryption,
etag,
hierarchicalNamespace,
iamConfiguration,
ipFilter,
labels,
lifecycle,
autoclass,
location,
locationType,
logging,
generation,
metageneration,
name,
owner,
projectNumber,
retentionPolicy,
objectRetention,
rpo,
softDeletePolicy,
storageClass,
timeCreated,
updated,
softDeleteTime,
hardDeleteTime,
versioning,
website,
satisfiesPZS,
satisfiesPZI
)
SELECT
'{{ project }}',
'{{ acl }}',
'{{ billing }}',
'{{ cors }}',
'{{ customPlacementConfig }}',
{{ defaultEventBasedHold }},
'{{ defaultObjectAcl }}',
'{{ encryption }}',
'{{ etag }}',
'{{ hierarchicalNamespace }}',
'{{ iamConfiguration }}',
'{{ ipFilter }}',
'{{ labels }}',
'{{ lifecycle }}',
'{{ autoclass }}',
'{{ location }}',
'{{ locationType }}',
'{{ logging }}',
'{{ generation }}',
'{{ metageneration }}',
'{{ name }}',
'{{ owner }}',
'{{ projectNumber }}',
'{{ retentionPolicy }}',
'{{ objectRetention }}',
'{{ rpo }}',
'{{ softDeletePolicy }}',
'{{ storageClass }}',
'{{ timeCreated }}',
'{{ updated }}',
'{{ softDeleteTime }}',
'{{ hardDeleteTime }}',
'{{ versioning }}',
'{{ website }}',
{{ satisfiesPZS }},
{{ satisfiesPZI }}
;

UPDATE example

Updates a buckets resource.

/*+ update */
UPDATE google.storage.buckets
SET
acl = '{{ acl }}',
billing = '{{ billing }}',
cors = '{{ cors }}',
customPlacementConfig = '{{ customPlacementConfig }}',
defaultEventBasedHold = true|false,
defaultObjectAcl = '{{ defaultObjectAcl }}',
encryption = '{{ encryption }}',
etag = '{{ etag }}',
hierarchicalNamespace = '{{ hierarchicalNamespace }}',
iamConfiguration = '{{ iamConfiguration }}',
ipFilter = '{{ ipFilter }}',
labels = '{{ labels }}',
lifecycle = '{{ lifecycle }}',
autoclass = '{{ autoclass }}',
location = '{{ location }}',
locationType = '{{ locationType }}',
logging = '{{ logging }}',
generation = '{{ generation }}',
metageneration = '{{ metageneration }}',
name = '{{ name }}',
owner = '{{ owner }}',
projectNumber = '{{ projectNumber }}',
retentionPolicy = '{{ retentionPolicy }}',
objectRetention = '{{ objectRetention }}',
rpo = '{{ rpo }}',
softDeletePolicy = '{{ softDeletePolicy }}',
storageClass = '{{ storageClass }}',
timeCreated = '{{ timeCreated }}',
updated = '{{ updated }}',
softDeleteTime = '{{ softDeleteTime }}',
hardDeleteTime = '{{ hardDeleteTime }}',
versioning = '{{ versioning }}',
website = '{{ website }}',
satisfiesPZS = true|false,
satisfiesPZI = true|false
WHERE
bucket = '{{ bucket }}';

REPLACE example

Replaces all fields in the specified buckets resource.

/*+ update */
REPLACE google.storage.buckets
SET
acl = '{{ acl }}',
billing = '{{ billing }}',
cors = '{{ cors }}',
customPlacementConfig = '{{ customPlacementConfig }}',
defaultEventBasedHold = true|false,
defaultObjectAcl = '{{ defaultObjectAcl }}',
encryption = '{{ encryption }}',
etag = '{{ etag }}',
hierarchicalNamespace = '{{ hierarchicalNamespace }}',
iamConfiguration = '{{ iamConfiguration }}',
ipFilter = '{{ ipFilter }}',
labels = '{{ labels }}',
lifecycle = '{{ lifecycle }}',
autoclass = '{{ autoclass }}',
location = '{{ location }}',
locationType = '{{ locationType }}',
logging = '{{ logging }}',
generation = '{{ generation }}',
metageneration = '{{ metageneration }}',
name = '{{ name }}',
owner = '{{ owner }}',
projectNumber = '{{ projectNumber }}',
retentionPolicy = '{{ retentionPolicy }}',
objectRetention = '{{ objectRetention }}',
rpo = '{{ rpo }}',
softDeletePolicy = '{{ softDeletePolicy }}',
storageClass = '{{ storageClass }}',
timeCreated = '{{ timeCreated }}',
updated = '{{ updated }}',
softDeleteTime = '{{ softDeleteTime }}',
hardDeleteTime = '{{ hardDeleteTime }}',
versioning = '{{ versioning }}',
website = '{{ website }}',
satisfiesPZS = true|false,
satisfiesPZI = true|false
WHERE
bucket = '{{ bucket }}';

DELETE example

Deletes the specified buckets resource.

/*+ delete */
DELETE FROM google.storage.buckets
WHERE bucket = '{{ bucket }}';