Interface AdminClient

All Superinterfaces:
ApiBackgroundResource, AutoCloseable, com.google.api.gax.core.BackgroundResource
All Known Implementing Classes:
AdminClientImpl

public interface AdminClient extends ApiBackgroundResource
A client for performing Pub/Sub Lite admin operations.
  • Method Details

    • create

      static AdminClient create(AdminClientSettings settings) throws com.google.api.gax.rpc.ApiException
      Throws:
      com.google.api.gax.rpc.ApiException
    • region

      CloudRegion region()
      The Google Cloud region this client operates on.
    • createTopic

      com.google.api.core.ApiFuture<Topic> createTopic(Topic topic)
      Create the provided topic if it does not yet exist.
      Parameters:
      topic - The topic to create.
      Returns:
      A future that will have either an error ApiException or the topic on success.
    • getTopic

      com.google.api.core.ApiFuture<Topic> getTopic(TopicPath path)
      Get the topic with id id if it exists.
      Parameters:
      path - The path of the topic to retrieve.
      Returns:
      A future that will have either an error ApiException or the topic on success.
    • getTopicPartitionCount

      com.google.api.core.ApiFuture<Long> getTopicPartitionCount(TopicPath path)
      Get the partitioning info for the topic with id id if it exists.
      Parameters:
      path - The path of the topic to retrieve.
      Returns:
      A future that will have either an error ApiException or the number of topic partitions on success.
    • listTopics

      com.google.api.core.ApiFuture<List<Topic>> listTopics(LocationPath path)
      List all topics for the specified project.
      Parameters:
      path - The path of the project to list topics for.
      Returns:
      A future that will have either an error ApiException or the list of topic paths on success.
    • updateTopic

      com.google.api.core.ApiFuture<Topic> updateTopic(Topic topic, com.google.protobuf.FieldMask mask)
      Update the topic with path topic.getPath() if it exists.
      Parameters:
      topic - The topic to update.
      mask - The mask indicating which fields should be updated.
      Returns:
      A future that will have either an error ApiException or the resulting topic on success. Updating nonexistent topics will cause the future to have an exception with status StatusCode.Code.NOT_FOUND
    • deleteTopic

      com.google.api.core.ApiFuture<Void> deleteTopic(TopicPath path)
      Delete the topic with id id if it exists.
      Parameters:
      path - The path of the topic to retrieve.
      Returns:
      A future that will have either an error ApiException or void on success. Deleting nonexistent topics will cause the future to have an exception with status StatusCode.Code.NOT_FOUND
    • listTopicSubscriptions

      com.google.api.core.ApiFuture<List<SubscriptionPath>> listTopicSubscriptions(TopicPath path)
      Get the list of subscriptions for the topic with id id if it exists.
      Parameters:
      path - The path of the topic to retrieve.
      Returns:
      A future that will have either an error ApiException or the list of subscriptions on success.
    • createSubscription

      default com.google.api.core.ApiFuture<Subscription> createSubscription(Subscription subscription)
      Create the provided subscription if it does not yet exist.

      By default, a new subscription will only receive messages published after the subscription was created.

      Parameters:
      subscription - The subscription to create.
      Returns:
      A future that will have either an error ApiException or the subscription on success.
    • createSubscription

      com.google.api.core.ApiFuture<Subscription> createSubscription(Subscription subscription, BacklogLocation startingOffset)
      Create the provided subscription at the given starting offset if it does not yet exist.
      Parameters:
      subscription - The subscription to create.
      startingOffset - The offset at which the new subscription will start receiving messages.
      Returns:
      A future that will have either an error ApiException or the subscription on success.
    • createSubscription

      com.google.api.core.ApiFuture<Subscription> createSubscription(Subscription subscription, SeekTarget target)
      Create the provided subscription at the given target location within the message backlog, if it does not yet exist.

      A seek is initiated if the target location is a publish or event time. If the seek fails, the created subscription is not deleted.

      Parameters:
      subscription - The subscription to create.
      target - The target location that the subscription should be initialized to.
      Returns:
      A future that will have either an error ApiException or the subscription on success.
    • getSubscription

      com.google.api.core.ApiFuture<Subscription> getSubscription(SubscriptionPath path)
      Get the subscription with id id if it exists.
      Parameters:
      path - The path of the subscription to retrieve.
      Returns:
      A future that will have either an error ApiException or the subscription on success.
    • listSubscriptions

      com.google.api.core.ApiFuture<List<Subscription>> listSubscriptions(LocationPath path)
      List all subscriptions for the specified project.
      Parameters:
      path - The path of the project to list subscriptions for.
      Returns:
      A future that will have either an error ApiException or the list of subscription paths on success.
    • updateSubscription

      com.google.api.core.ApiFuture<Subscription> updateSubscription(Subscription subscription, com.google.protobuf.FieldMask mask)
      Update the subscription with path subscription.getPath() if it exists.
      Parameters:
      subscription - The subscription to update.
      mask - The mask indicating which fields should be updated.
      Returns:
      A future that will have either an error ApiException or the resulting subscription on success. Updating nonexistent subscriptions will cause the future to have an exception with status StatusCode.Code.NOT_FOUND
    • seekSubscription

      com.google.api.gax.longrunning.OperationFuture<SeekSubscriptionResponse,OperationMetadata> seekSubscription(SubscriptionPath path, SeekTarget target)
      Initiate an out-of-band seek for a subscription to a specified target, which may be timestamps or named positions within the message backlog.

      See https://cloud.google.com/pubsub/lite/docs/seek for more information.

      Parameters:
      path - The path of the subscription to seek.
      target - The location to seek to.
      Returns:
      A OperationFuture that returns an operation name if the seek was successfully initiated, or otherwise throw an ApiException. Future.get() will return a response if the seek operation completes successfully, or otherwise throw an ApiException.
    • deleteSubscription

      com.google.api.core.ApiFuture<Void> deleteSubscription(SubscriptionPath path)
      Delete the subscription with id id if it exists.
      Parameters:
      path - The path of the subscription to retrieve.
      Returns:
      A future that will have either an error ApiException or void on success. Deleting nonexistent subscriptions will cause the future to have an exception with status StatusCode.Code.NOT_FOUND
    • createReservation

      com.google.api.core.ApiFuture<Reservation> createReservation(Reservation reservation)
      Create the provided reservation if it does not yet exist.
      Parameters:
      reservation - The reservation to create.
      Returns:
      A future that will have either an error ApiException or the reservation on success.
    • getReservation

      com.google.api.core.ApiFuture<Reservation> getReservation(ReservationPath path)
      Get the reservation with id id if it exists.
      Parameters:
      path - The path of the reservation to retrieve.
      Returns:
      A future that will have either an error ApiException or the reservation on success.
    • listReservations

      com.google.api.core.ApiFuture<List<Reservation>> listReservations(LocationPath path)
      List all reservations for the specified project.
      Parameters:
      path - The path of the project to list reservations for.
      Returns:
      A future that will have either an error ApiException or the list of reservation paths on success.
    • updateReservation

      com.google.api.core.ApiFuture<Reservation> updateReservation(Reservation reservation, com.google.protobuf.FieldMask mask)
      Update the reservation with path reservation.getPath() if it exists.
      Parameters:
      reservation - The reservation to update.
      mask - The mask indicating which fields should be updated.
      Returns:
      A future that will have either an error ApiException or the resulting reservation on success. Updating nonexistent reservations will cause the future to have an exception with status StatusCode.Code.NOT_FOUND
    • deleteReservation

      com.google.api.core.ApiFuture<Void> deleteReservation(ReservationPath path)
      Delete the reservation with id id if it exists.
      Parameters:
      path - The path of the reservation to retrieve.
      Returns:
      A future that will have either an error ApiException or void on success. Deleting nonexistent reservations will cause the future to have an exception with status StatusCode.Code.NOT_FOUND
    • listReservationTopics

      com.google.api.core.ApiFuture<List<TopicPath>> listReservationTopics(ReservationPath path)
      Get the list of topics for the reservation with id id if it exists.
      Parameters:
      path - The path of the reservation to retrieve.
      Returns:
      A future that will have either an error ApiException or the list of topics on success.