code: def sink_pubsub(client, to_delete):
      
      topic = _sink_pubsub_setup(client)
      to_delete.append(topic)
      SINK_NAME = "robots-pubsub-%d" % (_millis(),)
      FILTER = "logName:apache-access AND textPayload:robot"
      UPDATED_FILTER = "textPayload:robot"
  
      # [START sink_pubsub_create]
      DESTINATION = "pubsub.googleapis.com/%s" % (topic.full_name,)
      sink = client.sink(SINK_NAME, filter_=FILTER, destination=DESTINATION)
      assert not sink.exists()  # API call
      sink.create()  # API call
      assert sink.exists()  # API call
      # [END sink_pubsub_create]
      to_delete.insert(0, sink)  # delete sink before topic
  
      # [START client_list_sinks]
      for sink in client.list_sinks():  # API call(s)
          do_something_with(sink)
      # [END client_list_sinks]
  
      # [START sink_reload]
      existing_sink = client.sink(SINK_NAME)
      existing_sink.reload()
      # [END sink_reload]
      assert existing_sink.filter_ == FILTER
      assert existing_sink.destination == DESTINATION
  
      # [START sink_update]
      existing_sink.filter_ = UPDATED_FILTER
      existing_sink.update()
      # [END sink_update]
      existing_sink.reload()
      assert existing_sink.filter_ == UPDATED_FILTER
  
      # [START sink_delete]
      sink.delete()
      # [END sink_delete]
      to_delete.pop(0)
docs: Sink log entries to pubsub.