Methods

onArchive

onArchive(handler) returns functions.CloudFunction

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.

Parameter

handler

function(non-null functions.storage.ObjectMetadata, optional non-null functions.EventContext)

Event handler which is run every time a Google Cloud Storage archival occurs.

Value must not be null.

Returns

non-null functions.CloudFunction A Cloud Function which you can export and deploy.

onDelete

onDelete(handler) returns functions.CloudFunction

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 the storage.objects.delete method.

Parameter

handler

function(non-null functions.storage.ObjectMetadata, optional non-null functions.EventContext)

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

Value must not be null.

Returns

non-null functions.CloudFunction A Cloud Function which you can export and deploy.

onFinalize

onFinalize(handler) returns functions.CloudFunction

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.

Parameter

handler

function(non-null functions.storage.ObjectMetadata, optional non-null functions.EventContext)

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

Value must not be null.

Returns

non-null functions.CloudFunction A Cloud Function which you can export and deploy.

onMetadataUpdate

onMetadataUpdate(handler) returns functions.CloudFunction

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

Parameter

handler

function(non-null functions.storage.ObjectMetadata, optional non-null functions.EventContext)

Event handler which is run every time a Google Cloud Storage metadata update occurs.

Value must not be null.

Returns

non-null functions.CloudFunction A Cloud Function which you can export and deploy.