Reference documentation and code samples for the Cloud Storage Client class Notification.
Cloud Pub/Sub Notifications sends information about changes to objects in your buckets to Google Cloud Pub/Sub, where the information is added to a Cloud Pub/Sub topic of your choice in the form of messages. For example, you can track objects that are created and deleted in your bucket. Each notification contains information describing both the event that triggered it and the object that changed.
To utilize this class and see more examples, please see the relevant notifications based methods exposed on Google\Cloud\Storage\Google\Cloud\Storage\Bucket .
Example:
use Google\Cloud\Storage\StorageClient;
$storage = new StorageClient();
// Fetch an existing notification by ID.
$bucket = $storage->bucket('my-bucket');
$notification = $bucket->notification('2482');
Methods
__construct
connection
Google\Cloud\Storage\Connection\ConnectionInterface
Represents a connection to Cloud Storage.
id
string
The notification's ID.
bucket
string
The name of the bucket associated with this notification.
info
array
[optional] The notification's metadata.
exists
Check whether or not the notification exists.
Example:
if ($notification->exists()) {
echo 'Notification exists!';
}
options
array
Configuration options.
bool
delete
Delete the notification.
Example:
$notification->delete();
options
array
[optional]
void
info
Retrieves the notification's details. If no notification data is cached a network request will be made to retrieve it.
Example:
$info = $notification->info();
echo $info['topic'];
options
array
[optional]
array
reload
Triggers a network request to reload the notification's details.
Example:
$notification->reload();
$info = $notification->info();
echo $info['topic'];
options
array
[optional]
array
id
Retrieves the notification's ID.
Example:
echo $notification->id();
string
identity
Retrieves the notification's identity.
Example:
echo $notification->identity()['bucket'];
array