Delete a Pub/Sub notification

Delete a Pub/Sub notification from a Cloud Storage storage bucket.

Documentation pages that include this code sample

To view the code sample used in context, see the following documentation:

Code sample


For more information, see the Cloud Storage C++ API reference documentation.

namespace gcs = ::google::cloud::storage;
[](gcs::Client client, std::string const& bucket_name,
   std::string const& notification_id) {
  google::cloud::Status status =
      client.DeleteNotification(bucket_name, notification_id);
  if (!status.ok()) throw std::runtime_error(status.message());

  std::cout << "Successfully deleted notification " << notification_id
            << " on bucket " << bucket_name << "\n";

What's next

To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser.