Class AdminClientImpl
- java.lang.Object
-
- com.google.cloud.pubsublite.internal.ApiResourceAggregation
-
- com.google.cloud.pubsublite.internal.AdminClientImpl
-
- All Implemented Interfaces:
com.google.api.gax.core.BackgroundResource
,AdminClient
,ApiBackgroundResource
,AutoCloseable
public class AdminClientImpl extends ApiResourceAggregation implements AdminClient
-
-
Constructor Summary
Constructors Constructor Description AdminClientImpl(CloudRegion region, AdminServiceClient serviceClient)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.google.api.core.ApiFuture<Reservation>
createReservation(Reservation reservation)
Create the provided reservation if it does not yet exist.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.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.com.google.api.core.ApiFuture<Topic>
createTopic(Topic topic)
Create the provided topic if it does not yet exist.com.google.api.core.ApiFuture<Void>
deleteReservation(ReservationPath path)
Delete the reservation with idid
if it exists.com.google.api.core.ApiFuture<Void>
deleteSubscription(SubscriptionPath path)
Delete the subscription with idid
if it exists.com.google.api.core.ApiFuture<Void>
deleteTopic(TopicPath path)
Delete the topic with idid
if it exists.com.google.api.core.ApiFuture<Reservation>
getReservation(ReservationPath path)
Get the reservation with idid
if it exists.com.google.api.core.ApiFuture<Subscription>
getSubscription(SubscriptionPath path)
Get the subscription with idid
if it exists.com.google.api.core.ApiFuture<Topic>
getTopic(TopicPath path)
Get the topic with idid
if it exists.com.google.api.core.ApiFuture<Long>
getTopicPartitionCount(TopicPath path)
Get the partitioning info for the topic with idid
if it exists.com.google.api.core.ApiFuture<List<Reservation>>
listReservations(LocationPath path)
List all reservations for the specified project.com.google.api.core.ApiFuture<List<TopicPath>>
listReservationTopics(ReservationPath path)
Get the list of topics for the reservation with idid
if it exists.com.google.api.core.ApiFuture<List<Subscription>>
listSubscriptions(LocationPath path)
List all subscriptions for the specified project.com.google.api.core.ApiFuture<List<Topic>>
listTopics(LocationPath path)
List all topics for the specified project.com.google.api.core.ApiFuture<List<SubscriptionPath>>
listTopicSubscriptions(TopicPath path)
Get the list of subscriptions for the topic with idid
if it exists.CloudRegion
region()
The Google Cloud region this client operates on.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.com.google.api.core.ApiFuture<Reservation>
updateReservation(Reservation reservation, com.google.protobuf.FieldMask mask)
Update the reservation with pathreservation.getPath()
if it exists.com.google.api.core.ApiFuture<Subscription>
updateSubscription(Subscription subscription, com.google.protobuf.FieldMask mask)
Update the subscription with pathsubscription.getPath()
if it exists.com.google.api.core.ApiFuture<Topic>
updateTopic(Topic topic, com.google.protobuf.FieldMask mask)
Update the topic with pathtopic.getPath()
if it exists.-
Methods inherited from class com.google.cloud.pubsublite.internal.ApiResourceAggregation
awaitTermination, close, isShutdown, isTerminated, shutdown, shutdownNow
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.google.cloud.pubsublite.AdminClient
createSubscription
-
Methods inherited from interface com.google.cloud.pubsublite.internal.ApiBackgroundResource
close
-
-
-
-
Constructor Detail
-
AdminClientImpl
public AdminClientImpl(CloudRegion region, AdminServiceClient serviceClient)
-
-
Method Detail
-
region
public CloudRegion region()
Description copied from interface:AdminClient
The Google Cloud region this client operates on.- Specified by:
region
in interfaceAdminClient
-
createTopic
public com.google.api.core.ApiFuture<Topic> createTopic(Topic topic)
Description copied from interface:AdminClient
Create the provided topic if it does not yet exist.- Specified by:
createTopic
in interfaceAdminClient
- Parameters:
topic
- The topic to create.- Returns:
- A future that will have either an error
ApiException
or the topic on success.
-
getTopic
public com.google.api.core.ApiFuture<Topic> getTopic(TopicPath path)
Description copied from interface:AdminClient
Get the topic with idid
if it exists.- Specified by:
getTopic
in interfaceAdminClient
- 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
public com.google.api.core.ApiFuture<Long> getTopicPartitionCount(TopicPath path)
Description copied from interface:AdminClient
Get the partitioning info for the topic with idid
if it exists.- Specified by:
getTopicPartitionCount
in interfaceAdminClient
- 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
public com.google.api.core.ApiFuture<List<Topic>> listTopics(LocationPath path)
Description copied from interface:AdminClient
List all topics for the specified project.- Specified by:
listTopics
in interfaceAdminClient
- 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
public com.google.api.core.ApiFuture<Topic> updateTopic(Topic topic, com.google.protobuf.FieldMask mask)
Description copied from interface:AdminClient
Update the topic with pathtopic.getPath()
if it exists.- Specified by:
updateTopic
in interfaceAdminClient
- 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 statusStatusCode.Code.NOT_FOUND
-
deleteTopic
public com.google.api.core.ApiFuture<Void> deleteTopic(TopicPath path)
Description copied from interface:AdminClient
Delete the topic with idid
if it exists.- Specified by:
deleteTopic
in interfaceAdminClient
- 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 statusStatusCode.Code.NOT_FOUND
-
listTopicSubscriptions
public com.google.api.core.ApiFuture<List<SubscriptionPath>> listTopicSubscriptions(TopicPath path)
Description copied from interface:AdminClient
Get the list of subscriptions for the topic with idid
if it exists.- Specified by:
listTopicSubscriptions
in interfaceAdminClient
- 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
public com.google.api.core.ApiFuture<Subscription> createSubscription(Subscription subscription, BacklogLocation startingOffset)
Description copied from interface:AdminClient
Create the provided subscription at the given starting offset if it does not yet exist.- Specified by:
createSubscription
in interfaceAdminClient
- 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
public com.google.api.core.ApiFuture<Subscription> createSubscription(Subscription subscription, SeekTarget target)
Description copied from interface:AdminClient
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.
- Specified by:
createSubscription
in interfaceAdminClient
- 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
public com.google.api.core.ApiFuture<Subscription> getSubscription(SubscriptionPath path)
Description copied from interface:AdminClient
Get the subscription with idid
if it exists.- Specified by:
getSubscription
in interfaceAdminClient
- 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
public com.google.api.core.ApiFuture<List<Subscription>> listSubscriptions(LocationPath path)
Description copied from interface:AdminClient
List all subscriptions for the specified project.- Specified by:
listSubscriptions
in interfaceAdminClient
- 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
public com.google.api.core.ApiFuture<Subscription> updateSubscription(Subscription subscription, com.google.protobuf.FieldMask mask)
Description copied from interface:AdminClient
Update the subscription with pathsubscription.getPath()
if it exists.- Specified by:
updateSubscription
in interfaceAdminClient
- 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 statusStatusCode.Code.NOT_FOUND
-
seekSubscription
public com.google.api.gax.longrunning.OperationFuture<SeekSubscriptionResponse,OperationMetadata> seekSubscription(SubscriptionPath path, SeekTarget target)
Description copied from interface:AdminClient
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.
- Specified by:
seekSubscription
in interfaceAdminClient
- 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 anApiException
.Future.get()
will return a response if the seek operation completes successfully, or otherwise throw anApiException
.
-
deleteSubscription
public com.google.api.core.ApiFuture<Void> deleteSubscription(SubscriptionPath path)
Description copied from interface:AdminClient
Delete the subscription with idid
if it exists.- Specified by:
deleteSubscription
in interfaceAdminClient
- 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 statusStatusCode.Code.NOT_FOUND
-
createReservation
public com.google.api.core.ApiFuture<Reservation> createReservation(Reservation reservation)
Description copied from interface:AdminClient
Create the provided reservation if it does not yet exist.- Specified by:
createReservation
in interfaceAdminClient
- Parameters:
reservation
- The reservation to create.- Returns:
- A future that will have either an error
ApiException
or the reservation on success.
-
getReservation
public com.google.api.core.ApiFuture<Reservation> getReservation(ReservationPath path)
Description copied from interface:AdminClient
Get the reservation with idid
if it exists.- Specified by:
getReservation
in interfaceAdminClient
- 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
public com.google.api.core.ApiFuture<List<Reservation>> listReservations(LocationPath path)
Description copied from interface:AdminClient
List all reservations for the specified project.- Specified by:
listReservations
in interfaceAdminClient
- 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
public com.google.api.core.ApiFuture<Reservation> updateReservation(Reservation reservation, com.google.protobuf.FieldMask mask)
Description copied from interface:AdminClient
Update the reservation with pathreservation.getPath()
if it exists.- Specified by:
updateReservation
in interfaceAdminClient
- 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 statusStatusCode.Code.NOT_FOUND
-
deleteReservation
public com.google.api.core.ApiFuture<Void> deleteReservation(ReservationPath path)
Description copied from interface:AdminClient
Delete the reservation with idid
if it exists.- Specified by:
deleteReservation
in interfaceAdminClient
- 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 statusStatusCode.Code.NOT_FOUND
-
listReservationTopics
public com.google.api.core.ApiFuture<List<TopicPath>> listReservationTopics(ReservationPath path)
Description copied from interface:AdminClient
Get the list of topics for the reservation with idid
if it exists.- Specified by:
listReservationTopics
in interfaceAdminClient
- 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.
-
-