diff --git a/java-life-sciences/google-cloud-life-sciences/src/main/java/com/google/cloud/lifesciences/v2beta/WorkflowsServiceV2BetaClient.java b/java-life-sciences/google-cloud-life-sciences/src/main/java/com/google/cloud/lifesciences/v2beta/WorkflowsServiceV2BetaClient.java
index a8969a9207ca..1751fe32f968 100644
--- a/java-life-sciences/google-cloud-life-sciences/src/main/java/com/google/cloud/lifesciences/v2beta/WorkflowsServiceV2BetaClient.java
+++ b/java-life-sciences/google-cloud-life-sciences/src/main/java/com/google/cloud/lifesciences/v2beta/WorkflowsServiceV2BetaClient.java
@@ -18,13 +18,13 @@
import com.google.api.core.BetaApi;
import com.google.api.gax.core.BackgroundResource;
+import com.google.api.gax.httpjson.longrunning.OperationsClient;
import com.google.api.gax.longrunning.OperationFuture;
import com.google.api.gax.rpc.OperationCallable;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.cloud.lifesciences.v2beta.stub.WorkflowsServiceV2BetaStub;
import com.google.cloud.lifesciences.v2beta.stub.WorkflowsServiceV2BetaStubSettings;
import com.google.longrunning.Operation;
-import com.google.longrunning.OperationsClient;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import javax.annotation.Generated;
@@ -104,6 +104,21 @@
* WorkflowsServiceV2BetaClient.create(workflowsServiceV2BetaSettings);
* }
*
+ * To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
+ * the wire:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * WorkflowsServiceV2BetaSettings workflowsServiceV2BetaSettings =
+ * WorkflowsServiceV2BetaSettings.newBuilder()
+ * .setTransportChannelProvider(
+ * WorkflowsServiceV2BetaSettings.defaultHttpJsonTransportProviderBuilder().build())
+ * .build();
+ * WorkflowsServiceV2BetaClient workflowsServiceV2BetaClient =
+ * WorkflowsServiceV2BetaClient.create(workflowsServiceV2BetaSettings);
+ * }
+ *
* Please refer to the GitHub repository's samples for more quickstart code snippets.
*/
@BetaApi
@@ -111,7 +126,8 @@
public class WorkflowsServiceV2BetaClient implements BackgroundResource {
private final WorkflowsServiceV2BetaSettings settings;
private final WorkflowsServiceV2BetaStub stub;
- private final OperationsClient operationsClient;
+ private final OperationsClient httpJsonOperationsClient;
+ private final com.google.longrunning.OperationsClient operationsClient;
/** Constructs an instance of WorkflowsServiceV2BetaClient with default settings. */
public static final WorkflowsServiceV2BetaClient create() throws IOException {
@@ -144,13 +160,17 @@ protected WorkflowsServiceV2BetaClient(WorkflowsServiceV2BetaSettings settings)
throws IOException {
this.settings = settings;
this.stub = ((WorkflowsServiceV2BetaStubSettings) settings.getStubSettings()).createStub();
- this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
+ this.operationsClient =
+ com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub());
+ this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub());
}
protected WorkflowsServiceV2BetaClient(WorkflowsServiceV2BetaStub stub) {
this.settings = null;
this.stub = stub;
- this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
+ this.operationsClient =
+ com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub());
+ this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub());
}
public final WorkflowsServiceV2BetaSettings getSettings() {
@@ -165,10 +185,18 @@ public WorkflowsServiceV2BetaStub getStub() {
* 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() {
+ public final com.google.longrunning.OperationsClient getOperationsClient() {
return operationsClient;
}
+ /**
+ * 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 getHttpJsonOperationsClient() {
+ return httpJsonOperationsClient;
+ }
+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Runs a pipeline. The returned Operation's [metadata] [google.longrunning.Operation.metadata]
diff --git a/java-life-sciences/google-cloud-life-sciences/src/main/java/com/google/cloud/lifesciences/v2beta/WorkflowsServiceV2BetaSettings.java b/java-life-sciences/google-cloud-life-sciences/src/main/java/com/google/cloud/lifesciences/v2beta/WorkflowsServiceV2BetaSettings.java
index 5d398f451307..01ad66f6825d 100644
--- a/java-life-sciences/google-cloud-life-sciences/src/main/java/com/google/cloud/lifesciences/v2beta/WorkflowsServiceV2BetaSettings.java
+++ b/java-life-sciences/google-cloud-life-sciences/src/main/java/com/google/cloud/lifesciences/v2beta/WorkflowsServiceV2BetaSettings.java
@@ -21,6 +21,7 @@
import com.google.api.gax.core.GoogleCredentialsProvider;
import com.google.api.gax.core.InstantiatingExecutorProvider;
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
+import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
import com.google.api.gax.rpc.ApiClientHeaderProvider;
import com.google.api.gax.rpc.ClientContext;
import com.google.api.gax.rpc.ClientSettings;
@@ -108,11 +109,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde
return WorkflowsServiceV2BetaStubSettings.defaultCredentialsProviderBuilder();
}
- /** Returns a builder for the default ChannelProvider for this service. */
+ /** Returns a builder for the default gRPC ChannelProvider for this service. */
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
return WorkflowsServiceV2BetaStubSettings.defaultGrpcTransportProviderBuilder();
}
+ /** Returns a builder for the default REST ChannelProvider for this service. */
+ @BetaApi
+ public static InstantiatingHttpJsonChannelProvider.Builder
+ defaultHttpJsonTransportProviderBuilder() {
+ return WorkflowsServiceV2BetaStubSettings.defaultHttpJsonTransportProviderBuilder();
+ }
+
public static TransportChannelProvider defaultTransportChannelProvider() {
return WorkflowsServiceV2BetaStubSettings.defaultTransportChannelProvider();
}
@@ -122,11 +130,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil
return WorkflowsServiceV2BetaStubSettings.defaultApiClientHeaderProviderBuilder();
}
- /** Returns a new builder for this class. */
+ /** Returns a new gRPC builder for this class. */
public static Builder newBuilder() {
return Builder.createDefault();
}
+ /** Returns a new REST builder for this class. */
+ @BetaApi
+ public static Builder newHttpJsonBuilder() {
+ return Builder.createHttpJsonDefault();
+ }
+
/** Returns a new builder for this class. */
public static Builder newBuilder(ClientContext clientContext) {
return new Builder(clientContext);
@@ -165,6 +179,11 @@ private static Builder createDefault() {
return new Builder(WorkflowsServiceV2BetaStubSettings.newBuilder());
}
+ @BetaApi
+ private static Builder createHttpJsonDefault() {
+ return new Builder(WorkflowsServiceV2BetaStubSettings.newHttpJsonBuilder());
+ }
+
public WorkflowsServiceV2BetaStubSettings.Builder getStubSettingsBuilder() {
return ((WorkflowsServiceV2BetaStubSettings.Builder) getStubSettings());
}
diff --git a/java-life-sciences/google-cloud-life-sciences/src/main/java/com/google/cloud/lifesciences/v2beta/stub/HttpJsonWorkflowsServiceV2BetaCallableFactory.java b/java-life-sciences/google-cloud-life-sciences/src/main/java/com/google/cloud/lifesciences/v2beta/stub/HttpJsonWorkflowsServiceV2BetaCallableFactory.java
new file mode 100644
index 000000000000..d174559488bc
--- /dev/null
+++ b/java-life-sciences/google-cloud-life-sciences/src/main/java/com/google/cloud/lifesciences/v2beta/stub/HttpJsonWorkflowsServiceV2BetaCallableFactory.java
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.lifesciences.v2beta.stub;
+
+import com.google.api.core.BetaApi;
+import com.google.api.gax.httpjson.HttpJsonCallSettings;
+import com.google.api.gax.httpjson.HttpJsonCallableFactory;
+import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable;
+import com.google.api.gax.httpjson.HttpJsonStubCallableFactory;
+import com.google.api.gax.httpjson.longrunning.stub.OperationsStub;
+import com.google.api.gax.rpc.BatchingCallSettings;
+import com.google.api.gax.rpc.ClientContext;
+import com.google.api.gax.rpc.OperationCallSettings;
+import com.google.api.gax.rpc.OperationCallable;
+import com.google.api.gax.rpc.PagedCallSettings;
+import com.google.api.gax.rpc.ServerStreamingCallSettings;
+import com.google.api.gax.rpc.ServerStreamingCallable;
+import com.google.api.gax.rpc.UnaryCallSettings;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.longrunning.Operation;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * REST callable factory implementation for the WorkflowsServiceV2Beta service API.
+ *
+ *
This class is for advanced usage.
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public class HttpJsonWorkflowsServiceV2BetaCallableFactory
+ implements HttpJsonStubCallableFactory {
+
+ @Override
+ public UnaryCallable createUnaryCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ UnaryCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createUnaryCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+
+ @Override
+ public
+ UnaryCallable createPagedCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ PagedCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createPagedCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+
+ @Override
+ public UnaryCallable createBatchingCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ BatchingCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createBatchingCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+
+ @BetaApi(
+ "The surface for long-running operations is not stable yet and may change in the future.")
+ @Override
+ public
+ OperationCallable createOperationCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ OperationCallSettings callSettings,
+ ClientContext clientContext,
+ OperationsStub operationsStub) {
+ UnaryCallable innerCallable =
+ HttpJsonCallableFactory.createBaseUnaryCallable(
+ httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext);
+ HttpJsonOperationSnapshotCallable initialCallable =
+ new HttpJsonOperationSnapshotCallable(
+ innerCallable,
+ httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory());
+ return HttpJsonCallableFactory.createOperationCallable(
+ callSettings, clientContext, operationsStub.longRunningClient(), initialCallable);
+ }
+
+ @Override
+ public
+ ServerStreamingCallable createServerStreamingCallable(
+ HttpJsonCallSettings httpJsonCallSettings,
+ ServerStreamingCallSettings callSettings,
+ ClientContext clientContext) {
+ return HttpJsonCallableFactory.createServerStreamingCallable(
+ httpJsonCallSettings, callSettings, clientContext);
+ }
+}
diff --git a/java-life-sciences/google-cloud-life-sciences/src/main/java/com/google/cloud/lifesciences/v2beta/stub/HttpJsonWorkflowsServiceV2BetaStub.java b/java-life-sciences/google-cloud-life-sciences/src/main/java/com/google/cloud/lifesciences/v2beta/stub/HttpJsonWorkflowsServiceV2BetaStub.java
new file mode 100644
index 000000000000..413442b56706
--- /dev/null
+++ b/java-life-sciences/google-cloud-life-sciences/src/main/java/com/google/cloud/lifesciences/v2beta/stub/HttpJsonWorkflowsServiceV2BetaStub.java
@@ -0,0 +1,230 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.lifesciences.v2beta.stub;
+
+import com.google.api.core.BetaApi;
+import com.google.api.core.InternalApi;
+import com.google.api.gax.core.BackgroundResource;
+import com.google.api.gax.core.BackgroundResourceAggregation;
+import com.google.api.gax.httpjson.ApiMethodDescriptor;
+import com.google.api.gax.httpjson.HttpJsonCallSettings;
+import com.google.api.gax.httpjson.HttpJsonOperationSnapshot;
+import com.google.api.gax.httpjson.HttpJsonStubCallableFactory;
+import com.google.api.gax.httpjson.ProtoMessageRequestFormatter;
+import com.google.api.gax.httpjson.ProtoMessageResponseParser;
+import com.google.api.gax.httpjson.ProtoRestSerializer;
+import com.google.api.gax.httpjson.longrunning.stub.HttpJsonOperationsStub;
+import com.google.api.gax.rpc.ClientContext;
+import com.google.api.gax.rpc.OperationCallable;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.cloud.lifesciences.v2beta.Metadata;
+import com.google.cloud.lifesciences.v2beta.RunPipelineRequest;
+import com.google.cloud.lifesciences.v2beta.RunPipelineResponse;
+import com.google.longrunning.Operation;
+import com.google.protobuf.TypeRegistry;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * REST stub implementation for the WorkflowsServiceV2Beta service API.
+ *
+ * This class is for advanced usage and reflects the underlying API directly.
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public class HttpJsonWorkflowsServiceV2BetaStub extends WorkflowsServiceV2BetaStub {
+ private static final TypeRegistry typeRegistry =
+ TypeRegistry.newBuilder()
+ .add(Metadata.getDescriptor())
+ .add(RunPipelineResponse.getDescriptor())
+ .build();
+
+ private static final ApiMethodDescriptor
+ runPipelineMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName(
+ "google.cloud.lifesciences.v2beta.WorkflowsServiceV2Beta/RunPipeline")
+ .setHttpMethod("POST")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v2beta/{parent=projects/*/locations/*}/pipelines:run",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "parent", request.getParent());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ return fields;
+ })
+ .setRequestBodyExtractor(
+ request ->
+ ProtoRestSerializer.create()
+ .toBody("*", request.toBuilder().clearParent().build()))
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(Operation.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .setOperationSnapshotFactory(
+ (RunPipelineRequest request, Operation response) ->
+ HttpJsonOperationSnapshot.create(response))
+ .build();
+
+ private final UnaryCallable runPipelineCallable;
+ private final OperationCallable
+ runPipelineOperationCallable;
+
+ private final BackgroundResource backgroundResources;
+ private final HttpJsonOperationsStub httpJsonOperationsStub;
+ private final HttpJsonStubCallableFactory callableFactory;
+
+ public static final HttpJsonWorkflowsServiceV2BetaStub create(
+ WorkflowsServiceV2BetaStubSettings settings) throws IOException {
+ return new HttpJsonWorkflowsServiceV2BetaStub(settings, ClientContext.create(settings));
+ }
+
+ public static final HttpJsonWorkflowsServiceV2BetaStub create(ClientContext clientContext)
+ throws IOException {
+ return new HttpJsonWorkflowsServiceV2BetaStub(
+ WorkflowsServiceV2BetaStubSettings.newHttpJsonBuilder().build(), clientContext);
+ }
+
+ public static final HttpJsonWorkflowsServiceV2BetaStub create(
+ ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException {
+ return new HttpJsonWorkflowsServiceV2BetaStub(
+ WorkflowsServiceV2BetaStubSettings.newHttpJsonBuilder().build(),
+ clientContext,
+ callableFactory);
+ }
+
+ /**
+ * Constructs an instance of HttpJsonWorkflowsServiceV2BetaStub, using the given settings. This is
+ * protected so that it is easy to make a subclass, but otherwise, the static factory methods
+ * should be preferred.
+ */
+ protected HttpJsonWorkflowsServiceV2BetaStub(
+ WorkflowsServiceV2BetaStubSettings settings, ClientContext clientContext) throws IOException {
+ this(settings, clientContext, new HttpJsonWorkflowsServiceV2BetaCallableFactory());
+ }
+
+ /**
+ * Constructs an instance of HttpJsonWorkflowsServiceV2BetaStub, using the given settings. This is
+ * protected so that it is easy to make a subclass, but otherwise, the static factory methods
+ * should be preferred.
+ */
+ protected HttpJsonWorkflowsServiceV2BetaStub(
+ WorkflowsServiceV2BetaStubSettings settings,
+ ClientContext clientContext,
+ HttpJsonStubCallableFactory callableFactory)
+ throws IOException {
+ this.callableFactory = callableFactory;
+ this.httpJsonOperationsStub =
+ HttpJsonOperationsStub.create(clientContext, callableFactory, typeRegistry);
+
+ HttpJsonCallSettings runPipelineTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(runPipelineMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+
+ this.runPipelineCallable =
+ callableFactory.createUnaryCallable(
+ runPipelineTransportSettings, settings.runPipelineSettings(), clientContext);
+ this.runPipelineOperationCallable =
+ callableFactory.createOperationCallable(
+ runPipelineTransportSettings,
+ settings.runPipelineOperationSettings(),
+ clientContext,
+ httpJsonOperationsStub);
+
+ this.backgroundResources =
+ new BackgroundResourceAggregation(clientContext.getBackgroundResources());
+ }
+
+ @InternalApi
+ public static List getMethodDescriptors() {
+ List methodDescriptors = new ArrayList<>();
+ methodDescriptors.add(runPipelineMethodDescriptor);
+ return methodDescriptors;
+ }
+
+ public HttpJsonOperationsStub getHttpJsonOperationsStub() {
+ return httpJsonOperationsStub;
+ }
+
+ @Override
+ public UnaryCallable runPipelineCallable() {
+ return runPipelineCallable;
+ }
+
+ @Override
+ public OperationCallable
+ runPipelineOperationCallable() {
+ return runPipelineOperationCallable;
+ }
+
+ @Override
+ public final void close() {
+ try {
+ backgroundResources.close();
+ } catch (RuntimeException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new IllegalStateException("Failed to close resource", e);
+ }
+ }
+
+ @Override
+ public void shutdown() {
+ backgroundResources.shutdown();
+ }
+
+ @Override
+ public boolean isShutdown() {
+ return backgroundResources.isShutdown();
+ }
+
+ @Override
+ public boolean isTerminated() {
+ return backgroundResources.isTerminated();
+ }
+
+ @Override
+ public void shutdownNow() {
+ backgroundResources.shutdownNow();
+ }
+
+ @Override
+ public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
+ return backgroundResources.awaitTermination(duration, unit);
+ }
+}
diff --git a/java-life-sciences/google-cloud-life-sciences/src/main/java/com/google/cloud/lifesciences/v2beta/stub/WorkflowsServiceV2BetaStub.java b/java-life-sciences/google-cloud-life-sciences/src/main/java/com/google/cloud/lifesciences/v2beta/stub/WorkflowsServiceV2BetaStub.java
index 816d639be143..09b93daeb515 100644
--- a/java-life-sciences/google-cloud-life-sciences/src/main/java/com/google/cloud/lifesciences/v2beta/stub/WorkflowsServiceV2BetaStub.java
+++ b/java-life-sciences/google-cloud-life-sciences/src/main/java/com/google/cloud/lifesciences/v2beta/stub/WorkflowsServiceV2BetaStub.java
@@ -38,7 +38,11 @@
public abstract class WorkflowsServiceV2BetaStub implements BackgroundResource {
public OperationsStub getOperationsStub() {
- throw new UnsupportedOperationException("Not implemented: getOperationsStub()");
+ return null;
+ }
+
+ public com.google.api.gax.httpjson.longrunning.stub.OperationsStub getHttpJsonOperationsStub() {
+ return null;
}
public OperationCallable
diff --git a/java-life-sciences/google-cloud-life-sciences/src/main/java/com/google/cloud/lifesciences/v2beta/stub/WorkflowsServiceV2BetaStubSettings.java b/java-life-sciences/google-cloud-life-sciences/src/main/java/com/google/cloud/lifesciences/v2beta/stub/WorkflowsServiceV2BetaStubSettings.java
index f88d79d82811..fcb0fee485f4 100644
--- a/java-life-sciences/google-cloud-life-sciences/src/main/java/com/google/cloud/lifesciences/v2beta/stub/WorkflowsServiceV2BetaStubSettings.java
+++ b/java-life-sciences/google-cloud-life-sciences/src/main/java/com/google/cloud/lifesciences/v2beta/stub/WorkflowsServiceV2BetaStubSettings.java
@@ -25,6 +25,9 @@
import com.google.api.gax.grpc.GrpcTransportChannel;
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
import com.google.api.gax.grpc.ProtoOperationTransformers;
+import com.google.api.gax.httpjson.GaxHttpJsonProperties;
+import com.google.api.gax.httpjson.HttpJsonTransportChannel;
+import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
import com.google.api.gax.longrunning.OperationSnapshot;
import com.google.api.gax.longrunning.OperationTimedPollAlgorithm;
import com.google.api.gax.retrying.RetrySettings;
@@ -112,6 +115,11 @@ public WorkflowsServiceV2BetaStub createStub() throws IOException {
.equals(GrpcTransportChannel.getGrpcTransportName())) {
return GrpcWorkflowsServiceV2BetaStub.create(this);
}
+ if (getTransportChannelProvider()
+ .getTransportName()
+ .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) {
+ return HttpJsonWorkflowsServiceV2BetaStub.create(this);
+ }
throw new UnsupportedOperationException(
String.format(
"Transport not supported: %s", getTransportChannelProvider().getTransportName()));
@@ -144,18 +152,25 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde
.setUseJwtAccessWithScope(true);
}
- /** Returns a builder for the default ChannelProvider for this service. */
+ /** Returns a builder for the default gRPC ChannelProvider for this service. */
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
return InstantiatingGrpcChannelProvider.newBuilder()
.setMaxInboundMessageSize(Integer.MAX_VALUE);
}
+ /** Returns a builder for the default REST ChannelProvider for this service. */
+ @BetaApi
+ public static InstantiatingHttpJsonChannelProvider.Builder
+ defaultHttpJsonTransportProviderBuilder() {
+ return InstantiatingHttpJsonChannelProvider.newBuilder();
+ }
+
public static TransportChannelProvider defaultTransportChannelProvider() {
return defaultGrpcTransportProviderBuilder().build();
}
@BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
- public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
+ public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() {
return ApiClientHeaderProvider.newBuilder()
.setGeneratedLibToken(
"gapic", GaxProperties.getLibraryVersion(WorkflowsServiceV2BetaStubSettings.class))
@@ -163,11 +178,30 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil
GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion());
}
- /** Returns a new builder for this class. */
+ @BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
+ public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() {
+ return ApiClientHeaderProvider.newBuilder()
+ .setGeneratedLibToken(
+ "gapic", GaxProperties.getLibraryVersion(WorkflowsServiceV2BetaStubSettings.class))
+ .setTransportToken(
+ GaxHttpJsonProperties.getHttpJsonTokenName(),
+ GaxHttpJsonProperties.getHttpJsonVersion());
+ }
+
+ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
+ return WorkflowsServiceV2BetaStubSettings.defaultGrpcApiClientHeaderProviderBuilder();
+ }
+
+ /** Returns a new gRPC builder for this class. */
public static Builder newBuilder() {
return Builder.createDefault();
}
+ /** Returns a new REST builder for this class. */
+ public static Builder newHttpJsonBuilder() {
+ return Builder.createHttpJsonDefault();
+ }
+
/** Returns a new builder for this class. */
public static Builder newBuilder(ClientContext clientContext) {
return new Builder(clientContext);
@@ -257,6 +291,19 @@ private static Builder createDefault() {
return initDefaults(builder);
}
+ private static Builder createHttpJsonDefault() {
+ Builder builder = new Builder(((ClientContext) null));
+
+ builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build());
+ builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
+ builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build());
+ builder.setEndpoint(getDefaultEndpoint());
+ builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
+ builder.setSwitchToMtlsEndpointAllowed(true);
+
+ return initDefaults(builder);
+ }
+
private static Builder initDefaults(Builder builder) {
builder
.runPipelineSettings()
diff --git a/java-life-sciences/google-cloud-life-sciences/src/test/java/com/google/cloud/lifesciences/v2beta/WorkflowsServiceV2BetaClientHttpJsonTest.java b/java-life-sciences/google-cloud-life-sciences/src/test/java/com/google/cloud/lifesciences/v2beta/WorkflowsServiceV2BetaClientHttpJsonTest.java
new file mode 100644
index 000000000000..579f3417864c
--- /dev/null
+++ b/java-life-sciences/google-cloud-life-sciences/src/test/java/com/google/cloud/lifesciences/v2beta/WorkflowsServiceV2BetaClientHttpJsonTest.java
@@ -0,0 +1,134 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.lifesciences.v2beta;
+
+import com.google.api.gax.core.NoCredentialsProvider;
+import com.google.api.gax.httpjson.GaxHttpJsonProperties;
+import com.google.api.gax.httpjson.testing.MockHttpService;
+import com.google.api.gax.rpc.ApiClientHeaderProvider;
+import com.google.api.gax.rpc.ApiException;
+import com.google.api.gax.rpc.ApiExceptionFactory;
+import com.google.api.gax.rpc.StatusCode;
+import com.google.api.gax.rpc.testing.FakeStatusCode;
+import com.google.cloud.lifesciences.v2beta.stub.HttpJsonWorkflowsServiceV2BetaStub;
+import com.google.longrunning.Operation;
+import com.google.protobuf.Any;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+import javax.annotation.Generated;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+@Generated("by gapic-generator-java")
+public class WorkflowsServiceV2BetaClientHttpJsonTest {
+ private static MockHttpService mockService;
+ private static WorkflowsServiceV2BetaClient client;
+
+ @BeforeClass
+ public static void startStaticServer() throws IOException {
+ mockService =
+ new MockHttpService(
+ HttpJsonWorkflowsServiceV2BetaStub.getMethodDescriptors(),
+ WorkflowsServiceV2BetaSettings.getDefaultEndpoint());
+ WorkflowsServiceV2BetaSettings settings =
+ WorkflowsServiceV2BetaSettings.newHttpJsonBuilder()
+ .setTransportChannelProvider(
+ WorkflowsServiceV2BetaSettings.defaultHttpJsonTransportProviderBuilder()
+ .setHttpTransport(mockService)
+ .build())
+ .setCredentialsProvider(NoCredentialsProvider.create())
+ .build();
+ client = WorkflowsServiceV2BetaClient.create(settings);
+ }
+
+ @AfterClass
+ public static void stopServer() {
+ client.close();
+ }
+
+ @Before
+ public void setUp() {}
+
+ @After
+ public void tearDown() throws Exception {
+ mockService.reset();
+ }
+
+ @Test
+ public void runPipelineTest() throws Exception {
+ RunPipelineResponse expectedResponse = RunPipelineResponse.newBuilder().build();
+ Operation resultOperation =
+ Operation.newBuilder()
+ .setName("runPipelineTest")
+ .setDone(true)
+ .setResponse(Any.pack(expectedResponse))
+ .build();
+ mockService.addResponse(resultOperation);
+
+ RunPipelineRequest request =
+ RunPipelineRequest.newBuilder()
+ .setParent("projects/project-5833/locations/location-5833")
+ .setPipeline(Pipeline.newBuilder().build())
+ .putAllLabels(new HashMap())
+ .setPubSubTopic("pubSubTopic320524524")
+ .build();
+
+ RunPipelineResponse actualResponse = client.runPipelineAsync(request).get();
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void runPipelineExceptionTest() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ RunPipelineRequest request =
+ RunPipelineRequest.newBuilder()
+ .setParent("projects/project-5833/locations/location-5833")
+ .setPipeline(Pipeline.newBuilder().build())
+ .putAllLabels(new HashMap())
+ .setPubSubTopic("pubSubTopic320524524")
+ .build();
+ client.runPipelineAsync(request).get();
+ Assert.fail("No exception raised");
+ } catch (ExecutionException e) {
+ }
+ }
+}
diff --git a/java-life-sciences/samples/snippets/generated/com/google/cloud/lifesciences/v2beta/stub/workflowsservicev2betastubsettings/runpipeline/SyncRunPipeline.java b/java-life-sciences/samples/snippets/generated/com/google/cloud/lifesciences/v2beta/stub/workflowsservicev2betastubsettings/runpipeline/SyncRunPipeline.java
new file mode 100644
index 000000000000..a09ba33fc57a
--- /dev/null
+++ b/java-life-sciences/samples/snippets/generated/com/google/cloud/lifesciences/v2beta/stub/workflowsservicev2betastubsettings/runpipeline/SyncRunPipeline.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.lifesciences.v2beta.stub.samples;
+
+// [START lifesciences_v2beta_generated_workflowsservicev2betastubsettings_runpipeline_sync]
+import com.google.cloud.lifesciences.v2beta.stub.WorkflowsServiceV2BetaStubSettings;
+import java.time.Duration;
+
+public class SyncRunPipeline {
+
+ public static void main(String[] args) throws Exception {
+ syncRunPipeline();
+ }
+
+ public static void syncRunPipeline() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ WorkflowsServiceV2BetaStubSettings.Builder workflowsServiceV2BetaSettingsBuilder =
+ WorkflowsServiceV2BetaStubSettings.newBuilder();
+ workflowsServiceV2BetaSettingsBuilder
+ .runPipelineSettings()
+ .setRetrySettings(
+ workflowsServiceV2BetaSettingsBuilder
+ .runPipelineSettings()
+ .getRetrySettings()
+ .toBuilder()
+ .setTotalTimeout(Duration.ofSeconds(30))
+ .build());
+ WorkflowsServiceV2BetaStubSettings workflowsServiceV2BetaSettings =
+ workflowsServiceV2BetaSettingsBuilder.build();
+ }
+}
+// [END lifesciences_v2beta_generated_workflowsservicev2betastubsettings_runpipeline_sync]
diff --git a/java-life-sciences/samples/snippets/generated/com/google/cloud/lifesciences/v2beta/workflowsservicev2betaclient/create/SyncCreateSetCredentialsProvider.java b/java-life-sciences/samples/snippets/generated/com/google/cloud/lifesciences/v2beta/workflowsservicev2betaclient/create/SyncCreateSetCredentialsProvider.java
new file mode 100644
index 000000000000..a6db70eb4480
--- /dev/null
+++ b/java-life-sciences/samples/snippets/generated/com/google/cloud/lifesciences/v2beta/workflowsservicev2betaclient/create/SyncCreateSetCredentialsProvider.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.lifesciences.v2beta.samples;
+
+// [START
+// lifesciences_v2beta_generated_workflowsservicev2betaclient_create_setcredentialsprovider_sync]
+import com.google.api.gax.core.FixedCredentialsProvider;
+import com.google.cloud.lifesciences.v2beta.WorkflowsServiceV2BetaClient;
+import com.google.cloud.lifesciences.v2beta.WorkflowsServiceV2BetaSettings;
+import com.google.cloud.lifesciences.v2beta.myCredentials;
+
+public class SyncCreateSetCredentialsProvider {
+
+ public static void main(String[] args) throws Exception {
+ syncCreateSetCredentialsProvider();
+ }
+
+ public static void syncCreateSetCredentialsProvider() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ WorkflowsServiceV2BetaSettings workflowsServiceV2BetaSettings =
+ WorkflowsServiceV2BetaSettings.newBuilder()
+ .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ .build();
+ WorkflowsServiceV2BetaClient workflowsServiceV2BetaClient =
+ WorkflowsServiceV2BetaClient.create(workflowsServiceV2BetaSettings);
+ }
+}
+// [END
+// lifesciences_v2beta_generated_workflowsservicev2betaclient_create_setcredentialsprovider_sync]
diff --git a/java-life-sciences/samples/snippets/generated/com/google/cloud/lifesciences/v2beta/workflowsservicev2betaclient/create/SyncCreateSetCredentialsProvider1.java b/java-life-sciences/samples/snippets/generated/com/google/cloud/lifesciences/v2beta/workflowsservicev2betaclient/create/SyncCreateSetCredentialsProvider1.java
new file mode 100644
index 000000000000..7edbfb52ca42
--- /dev/null
+++ b/java-life-sciences/samples/snippets/generated/com/google/cloud/lifesciences/v2beta/workflowsservicev2betaclient/create/SyncCreateSetCredentialsProvider1.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.lifesciences.v2beta.samples;
+
+// [START
+// lifesciences_v2beta_generated_workflowsservicev2betaclient_create_setcredentialsprovider1_sync]
+import com.google.cloud.lifesciences.v2beta.WorkflowsServiceV2BetaClient;
+import com.google.cloud.lifesciences.v2beta.WorkflowsServiceV2BetaSettings;
+
+public class SyncCreateSetCredentialsProvider1 {
+
+ public static void main(String[] args) throws Exception {
+ syncCreateSetCredentialsProvider1();
+ }
+
+ public static void syncCreateSetCredentialsProvider1() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ WorkflowsServiceV2BetaSettings workflowsServiceV2BetaSettings =
+ WorkflowsServiceV2BetaSettings.newBuilder()
+ .setTransportChannelProvider(
+ WorkflowsServiceV2BetaSettings.defaultHttpJsonTransportProviderBuilder().build())
+ .build();
+ WorkflowsServiceV2BetaClient workflowsServiceV2BetaClient =
+ WorkflowsServiceV2BetaClient.create(workflowsServiceV2BetaSettings);
+ }
+}
+// [END
+// lifesciences_v2beta_generated_workflowsservicev2betaclient_create_setcredentialsprovider1_sync]
diff --git a/java-life-sciences/samples/snippets/generated/com/google/cloud/lifesciences/v2beta/workflowsservicev2betaclient/create/SyncCreateSetEndpoint.java b/java-life-sciences/samples/snippets/generated/com/google/cloud/lifesciences/v2beta/workflowsservicev2betaclient/create/SyncCreateSetEndpoint.java
new file mode 100644
index 000000000000..ed0942ea3c5e
--- /dev/null
+++ b/java-life-sciences/samples/snippets/generated/com/google/cloud/lifesciences/v2beta/workflowsservicev2betaclient/create/SyncCreateSetEndpoint.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.lifesciences.v2beta.samples;
+
+// [START lifesciences_v2beta_generated_workflowsservicev2betaclient_create_setendpoint_sync]
+import com.google.cloud.lifesciences.v2beta.WorkflowsServiceV2BetaClient;
+import com.google.cloud.lifesciences.v2beta.WorkflowsServiceV2BetaSettings;
+import com.google.cloud.lifesciences.v2beta.myEndpoint;
+
+public class SyncCreateSetEndpoint {
+
+ public static void main(String[] args) throws Exception {
+ syncCreateSetEndpoint();
+ }
+
+ public static void syncCreateSetEndpoint() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ WorkflowsServiceV2BetaSettings workflowsServiceV2BetaSettings =
+ WorkflowsServiceV2BetaSettings.newBuilder().setEndpoint(myEndpoint).build();
+ WorkflowsServiceV2BetaClient workflowsServiceV2BetaClient =
+ WorkflowsServiceV2BetaClient.create(workflowsServiceV2BetaSettings);
+ }
+}
+// [END lifesciences_v2beta_generated_workflowsservicev2betaclient_create_setendpoint_sync]
diff --git a/java-life-sciences/samples/snippets/generated/com/google/cloud/lifesciences/v2beta/workflowsservicev2betaclient/runpipeline/AsyncRunPipeline.java b/java-life-sciences/samples/snippets/generated/com/google/cloud/lifesciences/v2beta/workflowsservicev2betaclient/runpipeline/AsyncRunPipeline.java
new file mode 100644
index 000000000000..93c52d0e51a0
--- /dev/null
+++ b/java-life-sciences/samples/snippets/generated/com/google/cloud/lifesciences/v2beta/workflowsservicev2betaclient/runpipeline/AsyncRunPipeline.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.lifesciences.v2beta.samples;
+
+// [START lifesciences_v2beta_generated_workflowsservicev2betaclient_runpipeline_async]
+import com.google.api.core.ApiFuture;
+import com.google.cloud.lifesciences.v2beta.Pipeline;
+import com.google.cloud.lifesciences.v2beta.RunPipelineRequest;
+import com.google.cloud.lifesciences.v2beta.WorkflowsServiceV2BetaClient;
+import com.google.longrunning.Operation;
+import java.util.HashMap;
+
+public class AsyncRunPipeline {
+
+ public static void main(String[] args) throws Exception {
+ asyncRunPipeline();
+ }
+
+ public static void asyncRunPipeline() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ try (WorkflowsServiceV2BetaClient workflowsServiceV2BetaClient =
+ WorkflowsServiceV2BetaClient.create()) {
+ RunPipelineRequest request =
+ RunPipelineRequest.newBuilder()
+ .setParent("parent-995424086")
+ .setPipeline(Pipeline.newBuilder().build())
+ .putAllLabels(new HashMap())
+ .setPubSubTopic("pubSubTopic320524524")
+ .build();
+ ApiFuture future =
+ workflowsServiceV2BetaClient.runPipelineCallable().futureCall(request);
+ // Do something.
+ Operation response = future.get();
+ }
+ }
+}
+// [END lifesciences_v2beta_generated_workflowsservicev2betaclient_runpipeline_async]
diff --git a/java-life-sciences/samples/snippets/generated/com/google/cloud/lifesciences/v2beta/workflowsservicev2betaclient/runpipeline/AsyncRunPipelineLRO.java b/java-life-sciences/samples/snippets/generated/com/google/cloud/lifesciences/v2beta/workflowsservicev2betaclient/runpipeline/AsyncRunPipelineLRO.java
new file mode 100644
index 000000000000..a183b6fe2cb1
--- /dev/null
+++ b/java-life-sciences/samples/snippets/generated/com/google/cloud/lifesciences/v2beta/workflowsservicev2betaclient/runpipeline/AsyncRunPipelineLRO.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.lifesciences.v2beta.samples;
+
+// [START lifesciences_v2beta_generated_workflowsservicev2betaclient_runpipeline_lro_async]
+import com.google.api.gax.longrunning.OperationFuture;
+import com.google.cloud.lifesciences.v2beta.Metadata;
+import com.google.cloud.lifesciences.v2beta.Pipeline;
+import com.google.cloud.lifesciences.v2beta.RunPipelineRequest;
+import com.google.cloud.lifesciences.v2beta.RunPipelineResponse;
+import com.google.cloud.lifesciences.v2beta.WorkflowsServiceV2BetaClient;
+import java.util.HashMap;
+
+public class AsyncRunPipelineLRO {
+
+ public static void main(String[] args) throws Exception {
+ asyncRunPipelineLRO();
+ }
+
+ public static void asyncRunPipelineLRO() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ try (WorkflowsServiceV2BetaClient workflowsServiceV2BetaClient =
+ WorkflowsServiceV2BetaClient.create()) {
+ RunPipelineRequest request =
+ RunPipelineRequest.newBuilder()
+ .setParent("parent-995424086")
+ .setPipeline(Pipeline.newBuilder().build())
+ .putAllLabels(new HashMap())
+ .setPubSubTopic("pubSubTopic320524524")
+ .build();
+ OperationFuture future =
+ workflowsServiceV2BetaClient.runPipelineOperationCallable().futureCall(request);
+ // Do something.
+ RunPipelineResponse response = future.get();
+ }
+ }
+}
+// [END lifesciences_v2beta_generated_workflowsservicev2betaclient_runpipeline_lro_async]
diff --git a/java-life-sciences/samples/snippets/generated/com/google/cloud/lifesciences/v2beta/workflowsservicev2betaclient/runpipeline/SyncRunPipeline.java b/java-life-sciences/samples/snippets/generated/com/google/cloud/lifesciences/v2beta/workflowsservicev2betaclient/runpipeline/SyncRunPipeline.java
new file mode 100644
index 000000000000..6a5b781a2357
--- /dev/null
+++ b/java-life-sciences/samples/snippets/generated/com/google/cloud/lifesciences/v2beta/workflowsservicev2betaclient/runpipeline/SyncRunPipeline.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.lifesciences.v2beta.samples;
+
+// [START lifesciences_v2beta_generated_workflowsservicev2betaclient_runpipeline_sync]
+import com.google.cloud.lifesciences.v2beta.Pipeline;
+import com.google.cloud.lifesciences.v2beta.RunPipelineRequest;
+import com.google.cloud.lifesciences.v2beta.RunPipelineResponse;
+import com.google.cloud.lifesciences.v2beta.WorkflowsServiceV2BetaClient;
+import java.util.HashMap;
+
+public class SyncRunPipeline {
+
+ public static void main(String[] args) throws Exception {
+ syncRunPipeline();
+ }
+
+ public static void syncRunPipeline() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ try (WorkflowsServiceV2BetaClient workflowsServiceV2BetaClient =
+ WorkflowsServiceV2BetaClient.create()) {
+ RunPipelineRequest request =
+ RunPipelineRequest.newBuilder()
+ .setParent("parent-995424086")
+ .setPipeline(Pipeline.newBuilder().build())
+ .putAllLabels(new HashMap())
+ .setPubSubTopic("pubSubTopic320524524")
+ .build();
+ RunPipelineResponse response = workflowsServiceV2BetaClient.runPipelineAsync(request).get();
+ }
+ }
+}
+// [END lifesciences_v2beta_generated_workflowsservicev2betaclient_runpipeline_sync]
diff --git a/java-life-sciences/samples/snippets/generated/com/google/cloud/lifesciences/v2beta/workflowsservicev2betasettings/runpipeline/SyncRunPipeline.java b/java-life-sciences/samples/snippets/generated/com/google/cloud/lifesciences/v2beta/workflowsservicev2betasettings/runpipeline/SyncRunPipeline.java
new file mode 100644
index 000000000000..945477ff6c38
--- /dev/null
+++ b/java-life-sciences/samples/snippets/generated/com/google/cloud/lifesciences/v2beta/workflowsservicev2betasettings/runpipeline/SyncRunPipeline.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2022 Google LLC
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.google.cloud.lifesciences.v2beta.samples;
+
+// [START lifesciences_v2beta_generated_workflowsservicev2betasettings_runpipeline_sync]
+import com.google.cloud.lifesciences.v2beta.WorkflowsServiceV2BetaSettings;
+import java.time.Duration;
+
+public class SyncRunPipeline {
+
+ public static void main(String[] args) throws Exception {
+ syncRunPipeline();
+ }
+
+ public static void syncRunPipeline() throws Exception {
+ // This snippet has been automatically generated for illustrative purposes only.
+ // It may require modifications to work in your environment.
+ WorkflowsServiceV2BetaSettings.Builder workflowsServiceV2BetaSettingsBuilder =
+ WorkflowsServiceV2BetaSettings.newBuilder();
+ workflowsServiceV2BetaSettingsBuilder
+ .runPipelineSettings()
+ .setRetrySettings(
+ workflowsServiceV2BetaSettingsBuilder
+ .runPipelineSettings()
+ .getRetrySettings()
+ .toBuilder()
+ .setTotalTimeout(Duration.ofSeconds(30))
+ .build());
+ WorkflowsServiceV2BetaSettings workflowsServiceV2BetaSettings =
+ workflowsServiceV2BetaSettingsBuilder.build();
+ }
+}
+// [END lifesciences_v2beta_generated_workflowsservicev2betasettings_runpipeline_sync]