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 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');
Namespace
Google \ Cloud \ StorageMethods
__construct
Parameters | |
---|---|
Name | Description |
connection |
Connection\ConnectionInterface
Represents a connection to Cloud Storage. This object is created by StorageClient, and should not be instantiated outside of this client. |
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!';
}
Parameter | |
---|---|
Name | Description |
options |
array
Configuration options. |
Returns | |
---|---|
Type | Description |
bool |
delete
See also:
Parameter | |
---|---|
Name | Description |
options |
array
[optional] |
Returns | |
---|---|
Type | Description |
void |
info
See also:
Parameter | |
---|---|
Name | Description |
options |
array
[optional] |
Returns | |
---|---|
Type | Description |
array |
reload
See also:
Parameter | |
---|---|
Name | Description |
options |
array
[optional] |
Returns | |
---|---|
Type | Description |
array |
id
Retrieves the notification's ID.
Example:
echo $notification->id();
Returns | |
---|---|
Type | Description |
string |
identity
Retrieves the notification's identity.
Example:
echo $notification->identity()['bucket'];
Returns | |
---|---|
Type | Description |
array |