storage.ObjectBuilder class

The Google Cloud Storage object builder interface.

Access viafunctions.storage.object().

Signature:

exportdeclareclassObjectBuilder

Methods

MethodModifiersDescription
onArchive(handler)Event handler sent only when a bucket has enabled object versioning. This event indicates that the live version of an object has become an archived version, either because it was archived or because it was overwritten by the upload of an object of the same name.
onDelete(handler)Event handler which fires every time a Google Cloud Storage deletion occurs.Sent when an object has been permanently deleted. This includes objects that are overwritten or are deleted as part of the bucket's lifecycle configuration. For buckets with object versioning enabled, this is not sent when an object is archived, even if archival occurs via thestorage.objects.delete method.
onFinalize(handler)Event handler which fires every time a Google Cloud Storage object creation occurs.Sent when a new object (or a new generation of an existing object) is successfully created in the bucket. This includes copying or rewriting an existing object. A failed upload does not trigger this event.
onMetadataUpdate(handler)Event handler which fires every time the metadata of an existing object changes.

storage.ObjectBuilder.onArchive()

Event handler sent only when a bucket has enabled object versioning. This event indicates that the live version of an object has become an archived version, either because it was archived or because it was overwritten by the upload of an object of the same name.

Signature:

onArchive(handler:(object:ObjectMetadata,context:EventContext)=>PromiseLike<any>|any):CloudFunction<ObjectMetadata>;

Parameters

ParameterTypeDescription
handler(object:ObjectMetadata, context:EventContext) => PromiseLike<any> | anyEvent handler which is run every time a Google Cloud Storage archival occurs.

Returns:

CloudFunction<ObjectMetadata>

A function which you can export and deploy.

storage.ObjectBuilder.onDelete()

Event handler which fires every time a Google Cloud Storage deletion occurs.

Sent when an object has been permanently deleted. This includes objects that are overwritten or are deleted as part of the bucket's lifecycle configuration. For buckets with object versioning enabled, this is not sent when an object is archived, even if archival occurs via thestorage.objects.delete method.

Signature:

onDelete(handler:(object:ObjectMetadata,context:EventContext)=>PromiseLike<any>|any):CloudFunction<ObjectMetadata>;

Parameters

ParameterTypeDescription
handler(object:ObjectMetadata, context:EventContext) => PromiseLike<any> | anyEvent handler which is run every time a Google Cloud Storage deletion occurs.

Returns:

CloudFunction<ObjectMetadata>

A function which you can export and deploy.

storage.ObjectBuilder.onFinalize()

Event handler which fires every time a Google Cloud Storage object creation occurs.

Sent when a new object (or a new generation of an existing object) is successfully created in the bucket. This includes copying or rewriting an existing object. A failed upload does not trigger this event.

Signature:

onFinalize(handler:(object:ObjectMetadata,context:EventContext)=>PromiseLike<any>|any):CloudFunction<ObjectMetadata>;

Parameters

ParameterTypeDescription
handler(object:ObjectMetadata, context:EventContext) => PromiseLike<any> | anyEvent handler which is run every time a Google Cloud Storage object creation occurs.

Returns:

CloudFunction<ObjectMetadata>

A function which you can export and deploy.

storage.ObjectBuilder.onMetadataUpdate()

Event handler which fires every time the metadata of an existing object changes.

Signature:

onMetadataUpdate(handler:(object:ObjectMetadata,context:EventContext)=>PromiseLike<any>|any):CloudFunction<ObjectMetadata>;

Parameters

ParameterTypeDescription
handler(object:ObjectMetadata, context:EventContext) => PromiseLike<any> | anyEvent handler which is run every time a Google Cloud Storage metadata update occurs.

Returns:

CloudFunction<ObjectMetadata>

A function which you can export and deploy.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2023-04-24 UTC.