Skip to main content

notifications

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

Overview

Namenotifications
TypeResource
Idgoogle.storage.notifications

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
idstringThe ID of the notification.
custom_attributesobjectAn optional list of additional attributes to attach to each Cloud PubSub message published for this notification subscription.
etagstringHTTP 1.1 Entity tag for this subscription notification.
event_typesarrayIf present, only send notifications about listed event types. If empty, sent notifications for all event types.
kindstringThe kind of item this is. For notifications, this is always storage#notification. (default: storage#notification)
object_name_prefixstringIf present, only apply this notification configuration to object names that begin with this prefix.
payload_formatstringThe desired content of the Payload. (default: JSON_API_V1)
selfLinkstringThe canonical URL of this notification.
topicstringThe Cloud PubSub topic to which this subscription publishes. Formatted as: '//pubsub.googleapis.com/projects/{project-identifier}/topics/{my-topic}'

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectbucket, notificationuserProjectView a notification configuration.
listselectbucketuserProjectRetrieves a list of notification subscriptions for a given bucket.
insertinsertbucketuserProjectCreates a notification subscription for a given bucket.
deletedeletebucket, notificationuserProjectPermanently deletes a notification subscription.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
bucketstring
notificationstring
userProjectstring

SELECT examples

View a notification configuration.

SELECT
id,
custom_attributes,
etag,
event_types,
kind,
object_name_prefix,
payload_format,
selfLink,
topic
FROM google.storage.notifications
WHERE bucket = '{{ bucket }}' -- required
AND notification = '{{ notification }}' -- required
AND userProject = '{{ userProject }}';

INSERT examples

Creates a notification subscription for a given bucket.

INSERT INTO google.storage.notifications (
data__custom_attributes,
data__etag,
data__event_types,
data__id,
data__kind,
data__object_name_prefix,
data__payload_format,
data__selfLink,
data__topic,
bucket,
userProject
)
SELECT
'{{ custom_attributes }}',
'{{ etag }}',
'{{ event_types }}',
'{{ id }}',
'{{ kind }}',
'{{ object_name_prefix }}',
'{{ payload_format }}',
'{{ selfLink }}',
'{{ topic }}',
'{{ bucket }}',
'{{ userProject }}'
RETURNING
id,
custom_attributes,
etag,
event_types,
kind,
object_name_prefix,
payload_format,
selfLink,
topic
;

DELETE examples

Permanently deletes a notification subscription.

DELETE FROM google.storage.notifications
WHERE bucket = '{{ bucket }}' --required
AND notification = '{{ notification }}' --required
AND userProject = '{{ userProject }}';