Class: Google::Cloud::Storage::Notification
- Inherits:
-
Object
- Object
- Google::Cloud::Storage::Notification
- Defined in:
- lib/google/cloud/storage/notification.rb
Overview
Notification
Represents a Pub/Sub notification subscription for a Cloud Storage bucket.
Instance Attribute Summary collapse
-
#bucket ⇒ String
The name of the Bucket to which this notification belongs.
Instance Method Summary collapse
-
#api_url ⇒ Object
A URL that can be used to access the notification using the REST API.
-
#custom_attrs ⇒ Object
The custom attributes of this notification.
-
#delete ⇒ Boolean
Permanently deletes the notification.
-
#event_types ⇒ Object
The event types of this notification.
-
#id ⇒ Object
The ID of the notification.
-
#kind ⇒ Object
The kind of item this is.
-
#payload ⇒ Object
The desired content of the Pub/Sub message payload.
-
#prefix ⇒ Object
The file name prefix of this notification.
-
#topic ⇒ Object
The Cloud Pub/Sub topic to which this subscription publishes.
Instance Attribute Details
#bucket ⇒ String
The name of the Bucket to which this notification belongs.
50 51 52 |
# File 'lib/google/cloud/storage/notification.rb', line 50 def bucket @bucket end |
Instance Method Details
#api_url ⇒ Object
A URL that can be used to access the notification using the REST API.
89 90 91 |
# File 'lib/google/cloud/storage/notification.rb', line 89 def api_url @gapi.self_link end |
#custom_attrs ⇒ Object
The custom attributes of this notification. An optional list of additional attributes to attach to each Cloud Pub/Sub message published for this notification subscription.
97 98 99 |
# File 'lib/google/cloud/storage/notification.rb', line 97 def custom_attrs @gapi.custom_attributes end |
#delete ⇒ Boolean
Permanently deletes the notification.
The API call to delete the notification may be retried under certain conditions. See Google::Cloud#storage to control this behavior.
184 185 186 187 188 |
# File 'lib/google/cloud/storage/notification.rb', line 184 def delete ensure_service! @service.delete_notification bucket, id, user_project: @user_project true end |
#event_types ⇒ Object
The event types of this notification. If present, only send notifications about listed event types. If empty, sent notifications for all event types.
The following is a list of event types currently supported by Cloud Storage:
OBJECT_FINALIZE
- 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.OBJECT_METADATA_UPDATE
- Sent when the metadata of an existing object changes.OBJECT_DELETE
- 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 (seeOBJECT_ARCHIVE
), even if archival occurs via the File#delete method.OBJECT_ARCHIVE
- Only sent 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.
Important: Additional event types may be released later. Client code should either safely ignore unrecognized event types, or else explicitly specify in their notification configuration which event types they are prepared to accept.
132 133 134 |
# File 'lib/google/cloud/storage/notification.rb', line 132 def event_types @gapi.event_types end |
#id ⇒ Object
The ID of the notification.
83 84 85 |
# File 'lib/google/cloud/storage/notification.rb', line 83 def id @gapi.id end |
#kind ⇒ Object
The kind of item this is. For notifications, this is always storage#notification.
77 78 79 |
# File 'lib/google/cloud/storage/notification.rb', line 77 def kind @gapi.kind end |
#payload ⇒ Object
The desired content of the Pub/Sub message payload. Acceptable values are:
JSON_API_V1
- The payload will be a UTF-8 string containing the resource representation of the file's metadata.NONE
- No payload is included with the notification.
155 156 157 |
# File 'lib/google/cloud/storage/notification.rb', line 155 def payload @gapi.payload_format end |
#prefix ⇒ Object
The file name prefix of this notification. If present, only apply this notification configuration to file names that begin with this prefix.
141 142 143 |
# File 'lib/google/cloud/storage/notification.rb', line 141 def prefix @gapi.object_name_prefix end |
#topic ⇒ Object
The Cloud Pub/Sub topic to which this subscription publishes.
Formatted as:
//pubsub.googleapis.com/projects/{project-id}/topics/{my-topic}
163 164 165 |
# File 'lib/google/cloud/storage/notification.rb', line 163 def topic @gapi.topic end |