class Google::Cloud::Storage::Service

def insert_notification bucket_name, topic_name, custom_attrs: nil,

Creates a new Pub/Sub notification subscription for a bucket.
#
def insert_notification bucket_name, topic_name, custom_attrs: nil,
                        event_types: nil, prefix: nil, payload: nil,
                        user_project: nil, options: {}
  params =
    { custom_attributes: custom_attrs,
      event_types: event_types(event_types),
      object_name_prefix: prefix,
      payload_format: payload_format(payload),
      topic: topic_path(topic_name) }.delete_if { |_k, v| v.nil? }
  new_notification = Google::Apis::StorageV1::Notification.new(**params)
  if options[:retries].nil?
    options = options.merge({ retries: 0 })
  end
  execute do
    service.insert_notification \
      bucket_name, new_notification,
      user_project: user_project(user_project),
      options: options
  end
end