Skip to content

Commit

Permalink
feat: Add SeekSubscription and Operations to API (#705)
Browse files Browse the repository at this point in the history
* chore: release gapic-generator-java v1.0.11

Committer: @miraleung
PiperOrigin-RevId: 378266372

Source-Author: Google APIs <noreply@google.com>
Source-Date: Tue Jun 8 15:56:51 2021 -0700
Source-Repo: googleapis/googleapis
Source-Sha: 9e3105549a35520f215359065c11e8dce15e18af
Source-Link: googleapis/googleapis@9e31055

* chore: release gapic-generator-java v1.0.12

Committer: @miraleung
PiperOrigin-RevId: 378718217

Source-Author: Google APIs <noreply@google.com>
Source-Date: Thu Jun 10 13:08:49 2021 -0700
Source-Repo: googleapis/googleapis
Source-Sha: 08c4eeb531c01ad031134dca94b18e3f7dd35902
Source-Link: googleapis/googleapis@08c4eeb

* chore: release gapic-generator-java v1.0.13

Committer: @miraleung
PiperOrigin-RevId: 379784268

Source-Author: Google APIs <noreply@google.com>
Source-Date: Wed Jun 16 12:29:58 2021 -0700
Source-Repo: googleapis/googleapis
Source-Sha: 551681f25e36b11829e87e580281350461f4f3f5
Source-Link: googleapis/googleapis@551681f

* feat: Add SeekSubscription and Operations to API

PiperOrigin-RevId: 380660182

Source-Author: Google APIs <noreply@google.com>
Source-Date: Mon Jun 21 14:05:46 2021 -0700
Source-Repo: googleapis/googleapis
Source-Sha: b601f026f724bbbd25f99273a3fd5e3c3cb8523c
Source-Link: googleapis/googleapis@b601f02

* chore: update dependencies

Co-authored-by: Neenu1995 <neenushaji@google.com>
  • Loading branch information
yoshi-automation and Neenu1995 committed Jul 7, 2021
1 parent 325790f commit 92d0246
Show file tree
Hide file tree
Showing 39 changed files with 4,722 additions and 348 deletions.
Expand Up @@ -21,9 +21,11 @@
import com.google.api.core.ApiFutures;
import com.google.api.core.BetaApi;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.longrunning.OperationFuture;
import com.google.api.gax.paging.AbstractFixedSizeCollection;
import com.google.api.gax.paging.AbstractPage;
import com.google.api.gax.paging.AbstractPagedListResponse;
import com.google.api.gax.rpc.OperationCallable;
import com.google.api.gax.rpc.PageContext;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.cloud.pubsublite.proto.CreateReservationRequest;
Expand All @@ -47,8 +49,11 @@
import com.google.cloud.pubsublite.proto.ListTopicsRequest;
import com.google.cloud.pubsublite.proto.ListTopicsResponse;
import com.google.cloud.pubsublite.proto.LocationName;
import com.google.cloud.pubsublite.proto.OperationMetadata;
import com.google.cloud.pubsublite.proto.Reservation;
import com.google.cloud.pubsublite.proto.ReservationName;
import com.google.cloud.pubsublite.proto.SeekSubscriptionRequest;
import com.google.cloud.pubsublite.proto.SeekSubscriptionResponse;
import com.google.cloud.pubsublite.proto.Subscription;
import com.google.cloud.pubsublite.proto.SubscriptionName;
import com.google.cloud.pubsublite.proto.Topic;
Expand All @@ -60,6 +65,8 @@
import com.google.cloud.pubsublite.v1.stub.AdminServiceStub;
import com.google.cloud.pubsublite.v1.stub.AdminServiceStubSettings;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.longrunning.Operation;
import com.google.longrunning.OperationsClient;
import com.google.protobuf.Empty;
import com.google.protobuf.FieldMask;
import java.io.IOException;
Expand Down Expand Up @@ -134,6 +141,7 @@
public class AdminServiceClient implements BackgroundResource {
private final AdminServiceSettings settings;
private final AdminServiceStub stub;
private final OperationsClient operationsClient;

/** Constructs an instance of AdminServiceClient with default settings. */
public static final AdminServiceClient create() throws IOException {
Expand Down Expand Up @@ -165,12 +173,14 @@ public static final AdminServiceClient create(AdminServiceStub stub) {
protected AdminServiceClient(AdminServiceSettings settings) throws IOException {
this.settings = settings;
this.stub = ((AdminServiceStubSettings) settings.getStubSettings()).createStub();
this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
}

@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
protected AdminServiceClient(AdminServiceStub stub) {
this.settings = null;
this.stub = stub;
this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
}

public final AdminServiceSettings getSettings() {
Expand All @@ -182,6 +192,14 @@ public AdminServiceStub getStub() {
return stub;
}

/**
* Returns the OperationsClient that can be used to query the status of a long-running operation
* returned by another API method call.
*/
public final OperationsClient getOperationsClient() {
return operationsClient;
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a new topic.
Expand Down Expand Up @@ -1435,6 +1453,129 @@ public final UnaryCallable<DeleteSubscriptionRequest, Empty> deleteSubscriptionC
return stub.deleteSubscriptionCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Performs an out-of-band seek for a subscription to a specified target, which may be timestamps
* or named positions within the message backlog. Seek translates these targets to cursors for
* each partition and orchestrates subscribers to start consuming messages from these seek
* cursors.
*
* <p>If an operation is returned, the seek has been registered and subscribers will eventually
* receive messages from the seek cursors (i.e. eventual consistency), as long as they are using a
* minimum supported client library version and not a system that tracks cursors independently of
* Pub/Sub Lite (e.g. Apache Beam, Dataflow, Spark). The seek operation will fail for unsupported
* clients.
*
* <p>If clients would like to know when subscribers react to the seek (or not), they can poll the
* operation. The seek operation will succeed and complete once subscribers are ready to receive
* messages from the seek cursors for all partitions of the topic. This means that the seek
* operation will not complete until all subscribers come online.
*
* <p>If the previous seek operation has not yet completed, it will be aborted and the new
* invocation of seek will supersede it.
*
* <p>Sample code:
*
* <pre>{@code
* try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) {
* SeekSubscriptionRequest request =
* SeekSubscriptionRequest.newBuilder()
* .setName(SubscriptionName.of("[PROJECT]", "[LOCATION]", "[SUBSCRIPTION]").toString())
* .build();
* SeekSubscriptionResponse response = adminServiceClient.seekSubscriptionAsync(request).get();
* }
* }</pre>
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final OperationFuture<SeekSubscriptionResponse, OperationMetadata> seekSubscriptionAsync(
SeekSubscriptionRequest request) {
return seekSubscriptionOperationCallable().futureCall(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Performs an out-of-band seek for a subscription to a specified target, which may be timestamps
* or named positions within the message backlog. Seek translates these targets to cursors for
* each partition and orchestrates subscribers to start consuming messages from these seek
* cursors.
*
* <p>If an operation is returned, the seek has been registered and subscribers will eventually
* receive messages from the seek cursors (i.e. eventual consistency), as long as they are using a
* minimum supported client library version and not a system that tracks cursors independently of
* Pub/Sub Lite (e.g. Apache Beam, Dataflow, Spark). The seek operation will fail for unsupported
* clients.
*
* <p>If clients would like to know when subscribers react to the seek (or not), they can poll the
* operation. The seek operation will succeed and complete once subscribers are ready to receive
* messages from the seek cursors for all partitions of the topic. This means that the seek
* operation will not complete until all subscribers come online.
*
* <p>If the previous seek operation has not yet completed, it will be aborted and the new
* invocation of seek will supersede it.
*
* <p>Sample code:
*
* <pre>{@code
* try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) {
* SeekSubscriptionRequest request =
* SeekSubscriptionRequest.newBuilder()
* .setName(SubscriptionName.of("[PROJECT]", "[LOCATION]", "[SUBSCRIPTION]").toString())
* .build();
* OperationFuture<SeekSubscriptionResponse, OperationMetadata> future =
* adminServiceClient.seekSubscriptionOperationCallable().futureCall(request);
* // Do something.
* SeekSubscriptionResponse response = future.get();
* }
* }</pre>
*/
public final OperationCallable<
SeekSubscriptionRequest, SeekSubscriptionResponse, OperationMetadata>
seekSubscriptionOperationCallable() {
return stub.seekSubscriptionOperationCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Performs an out-of-band seek for a subscription to a specified target, which may be timestamps
* or named positions within the message backlog. Seek translates these targets to cursors for
* each partition and orchestrates subscribers to start consuming messages from these seek
* cursors.
*
* <p>If an operation is returned, the seek has been registered and subscribers will eventually
* receive messages from the seek cursors (i.e. eventual consistency), as long as they are using a
* minimum supported client library version and not a system that tracks cursors independently of
* Pub/Sub Lite (e.g. Apache Beam, Dataflow, Spark). The seek operation will fail for unsupported
* clients.
*
* <p>If clients would like to know when subscribers react to the seek (or not), they can poll the
* operation. The seek operation will succeed and complete once subscribers are ready to receive
* messages from the seek cursors for all partitions of the topic. This means that the seek
* operation will not complete until all subscribers come online.
*
* <p>If the previous seek operation has not yet completed, it will be aborted and the new
* invocation of seek will supersede it.
*
* <p>Sample code:
*
* <pre>{@code
* try (AdminServiceClient adminServiceClient = AdminServiceClient.create()) {
* SeekSubscriptionRequest request =
* SeekSubscriptionRequest.newBuilder()
* .setName(SubscriptionName.of("[PROJECT]", "[LOCATION]", "[SUBSCRIPTION]").toString())
* .build();
* ApiFuture<Operation> future =
* adminServiceClient.seekSubscriptionCallable().futureCall(request);
* // Do something.
* Operation response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<SeekSubscriptionRequest, Operation> seekSubscriptionCallable() {
return stub.seekSubscriptionCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates a new reservation.
Expand Down
Expand Up @@ -30,6 +30,7 @@
import com.google.api.gax.rpc.ApiClientHeaderProvider;
import com.google.api.gax.rpc.ClientContext;
import com.google.api.gax.rpc.ClientSettings;
import com.google.api.gax.rpc.OperationCallSettings;
import com.google.api.gax.rpc.PagedCallSettings;
import com.google.api.gax.rpc.TransportChannelProvider;
import com.google.api.gax.rpc.UnaryCallSettings;
Expand All @@ -53,14 +54,18 @@
import com.google.cloud.pubsublite.proto.ListTopicSubscriptionsResponse;
import com.google.cloud.pubsublite.proto.ListTopicsRequest;
import com.google.cloud.pubsublite.proto.ListTopicsResponse;
import com.google.cloud.pubsublite.proto.OperationMetadata;
import com.google.cloud.pubsublite.proto.Reservation;
import com.google.cloud.pubsublite.proto.SeekSubscriptionRequest;
import com.google.cloud.pubsublite.proto.SeekSubscriptionResponse;
import com.google.cloud.pubsublite.proto.Subscription;
import com.google.cloud.pubsublite.proto.Topic;
import com.google.cloud.pubsublite.proto.TopicPartitions;
import com.google.cloud.pubsublite.proto.UpdateReservationRequest;
import com.google.cloud.pubsublite.proto.UpdateSubscriptionRequest;
import com.google.cloud.pubsublite.proto.UpdateTopicRequest;
import com.google.cloud.pubsublite.v1.stub.AdminServiceStubSettings;
import com.google.longrunning.Operation;
import com.google.protobuf.Empty;
import java.io.IOException;
import java.util.List;
Expand Down Expand Up @@ -168,6 +173,17 @@ public UnaryCallSettings<DeleteSubscriptionRequest, Empty> deleteSubscriptionSet
return ((AdminServiceStubSettings) getStubSettings()).deleteSubscriptionSettings();
}

/** Returns the object with the settings used for calls to seekSubscription. */
public UnaryCallSettings<SeekSubscriptionRequest, Operation> seekSubscriptionSettings() {
return ((AdminServiceStubSettings) getStubSettings()).seekSubscriptionSettings();
}

/** Returns the object with the settings used for calls to seekSubscription. */
public OperationCallSettings<SeekSubscriptionRequest, SeekSubscriptionResponse, OperationMetadata>
seekSubscriptionOperationSettings() {
return ((AdminServiceStubSettings) getStubSettings()).seekSubscriptionOperationSettings();
}

/** Returns the object with the settings used for calls to createReservation. */
public UnaryCallSettings<CreateReservationRequest, Reservation> createReservationSettings() {
return ((AdminServiceStubSettings) getStubSettings()).createReservationSettings();
Expand Down Expand Up @@ -374,6 +390,19 @@ public UnaryCallSettings.Builder<DeleteTopicRequest, Empty> deleteTopicSettings(
return getStubSettingsBuilder().deleteSubscriptionSettings();
}

/** Returns the builder for the settings used for calls to seekSubscription. */
public UnaryCallSettings.Builder<SeekSubscriptionRequest, Operation>
seekSubscriptionSettings() {
return getStubSettingsBuilder().seekSubscriptionSettings();
}

/** Returns the builder for the settings used for calls to seekSubscription. */
public OperationCallSettings.Builder<
SeekSubscriptionRequest, SeekSubscriptionResponse, OperationMetadata>
seekSubscriptionOperationSettings() {
return getStubSettingsBuilder().seekSubscriptionOperationSettings();
}

/** Returns the builder for the settings used for calls to createReservation. */
public UnaryCallSettings.Builder<CreateReservationRequest, Reservation>
createReservationSettings() {
Expand Down
Expand Up @@ -55,6 +55,9 @@
"ListTopics": {
"methods": ["listTopics", "listTopics", "listTopics", "listTopicsPagedCallable", "listTopicsCallable"]
},
"SeekSubscription": {
"methods": ["seekSubscriptionAsync", "seekSubscriptionOperationCallable", "seekSubscriptionCallable"]
},
"UpdateReservation": {
"methods": ["updateReservation", "updateReservation", "updateReservationCallable"]
},
Expand Down
Expand Up @@ -23,6 +23,7 @@
import static com.google.cloud.pubsublite.v1.AdminServiceClient.ListTopicsPagedResponse;

import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.rpc.OperationCallable;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.cloud.pubsublite.proto.CreateReservationRequest;
import com.google.cloud.pubsublite.proto.CreateSubscriptionRequest;
Expand All @@ -44,13 +45,18 @@
import com.google.cloud.pubsublite.proto.ListTopicSubscriptionsResponse;
import com.google.cloud.pubsublite.proto.ListTopicsRequest;
import com.google.cloud.pubsublite.proto.ListTopicsResponse;
import com.google.cloud.pubsublite.proto.OperationMetadata;
import com.google.cloud.pubsublite.proto.Reservation;
import com.google.cloud.pubsublite.proto.SeekSubscriptionRequest;
import com.google.cloud.pubsublite.proto.SeekSubscriptionResponse;
import com.google.cloud.pubsublite.proto.Subscription;
import com.google.cloud.pubsublite.proto.Topic;
import com.google.cloud.pubsublite.proto.TopicPartitions;
import com.google.cloud.pubsublite.proto.UpdateReservationRequest;
import com.google.cloud.pubsublite.proto.UpdateSubscriptionRequest;
import com.google.cloud.pubsublite.proto.UpdateTopicRequest;
import com.google.longrunning.Operation;
import com.google.longrunning.stub.OperationsStub;
import com.google.protobuf.Empty;
import javax.annotation.Generated;

Expand All @@ -63,6 +69,10 @@
@Generated("by gapic-generator-java")
public abstract class AdminServiceStub implements BackgroundResource {

public OperationsStub getOperationsStub() {
throw new UnsupportedOperationException("Not implemented: getOperationsStub()");
}

public UnaryCallable<CreateTopicRequest, Topic> createTopicCallable() {
throw new UnsupportedOperationException("Not implemented: createTopicCallable()");
}
Expand Down Expand Up @@ -128,6 +138,15 @@ public UnaryCallable<DeleteSubscriptionRequest, Empty> deleteSubscriptionCallabl
throw new UnsupportedOperationException("Not implemented: deleteSubscriptionCallable()");
}

public OperationCallable<SeekSubscriptionRequest, SeekSubscriptionResponse, OperationMetadata>
seekSubscriptionOperationCallable() {
throw new UnsupportedOperationException("Not implemented: seekSubscriptionOperationCallable()");
}

public UnaryCallable<SeekSubscriptionRequest, Operation> seekSubscriptionCallable() {
throw new UnsupportedOperationException("Not implemented: seekSubscriptionCallable()");
}

public UnaryCallable<CreateReservationRequest, Reservation> createReservationCallable() {
throw new UnsupportedOperationException("Not implemented: createReservationCallable()");
}
Expand Down

0 comments on commit 92d0246

Please sign in to comment.