class Google::Cloud::Storage::Notification
notification = bucket.create_notification topic.name
bucket = storage.bucket “my-bucket”
end
“serviceAccount:#{storage.service_account_email}”
p.add “roles/pubsub.publisher”,
topic.policy do |p|
topic = pubsub.create_topic “my-topic”
storage = Google::Cloud::Storage.new
pubsub = Google::Cloud::Pubsub.new
require “google/cloud/storage”
require “google/cloud/pubsub”
@example
notification belongs.
@attr_reader [String] bucket The name of the {Bucket} to which this
Pub/Sub Notifications for Google Cloud
@see cloud.google.com/storage/docs/pubsub-notifications Cloud
{Bucket#notification}.
See {Bucket#create_notification}, {Bucket#notifications}, and
bucket.
Represents a Pub/Sub notification subscription for a Cloud Storage
# Notification
#
def self.from_gapi bucket_name, gapi, service, user_project: nil
- Private: - New Notification from a
def self.from_gapi bucket_name, gapi, service, user_project: nil new.tap do |f| f.instance_variable_set :@bucket, bucket_name f.gapi = gapi f.service = service f.user_project = user_project end end
def api_url
-
(String)-
def api_url @gapi.self_link end
def custom_attrs
-
(Hash(String => String))-
def custom_attrs @gapi.custom_attributes end
def delete
-
(Boolean)- Returns `true` if the notification was deleted.
def delete ensure_service! @service.delete_notification bucket, id, user_project: @user_project true end
def ensure_service!
#
def ensure_service! raise "Must have active connection" unless service end
def event_types
-
(Array-)
def event_types @gapi.event_types end
def id
-
(String)-
def id @gapi.id end
def initialize
- Private: - Creates a Notification object.
def initialize @bucket = nil @service = nil @gapi = nil @user_project = nil end
def kind
-
(String)-
def kind @gapi.kind end
def payload
-
(String)-
def payload @gapi.payload_format end
def prefix
-
(String)-
def prefix @gapi.object_name_prefix end
def topic
-
(String)-
def topic @gapi.topic end