diff --git a/google-cloud-batch/src/main/java/com/google/cloud/batch/v1/BatchServiceClient.java b/google-cloud-batch/src/main/java/com/google/cloud/batch/v1/BatchServiceClient.java
index d88b6e9..13fe161 100644
--- a/google-cloud-batch/src/main/java/com/google/cloud/batch/v1/BatchServiceClient.java
+++ b/google-cloud-batch/src/main/java/com/google/cloud/batch/v1/BatchServiceClient.java
@@ -19,6 +19,7 @@
import com.google.api.core.ApiFuture;
import com.google.api.core.ApiFutures;
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.paging.AbstractFixedSizeCollection;
import com.google.api.gax.paging.AbstractPage;
@@ -30,7 +31,6 @@
import com.google.cloud.batch.v1.stub.BatchServiceStubSettings;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.longrunning.Operation;
-import com.google.longrunning.OperationsClient;
import com.google.protobuf.Empty;
import java.io.IOException;
import java.util.List;
@@ -39,8 +39,8 @@
// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
- * Service Description: Google Cloud Batch Service. The service manages user submitted batch jobs
- * and allocates Google Compute Engine VM instances to run the jobs.
+ * Service Description: Google Batch Service. The service manages user submitted batch jobs and
+ * allocates Google Compute Engine VM instances to run the jobs.
*
* This class provides the ability to make remote calls to the backing service through method
* calls that map to API methods. Sample code to get started:
@@ -104,13 +104,28 @@
* BatchServiceClient batchServiceClient = BatchServiceClient.create(batchServiceSettings);
* }
*
+ *
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.
+ * BatchServiceSettings batchServiceSettings =
+ * BatchServiceSettings.newBuilder()
+ * .setTransportChannelProvider(
+ * BatchServiceSettings.defaultHttpJsonTransportProviderBuilder().build())
+ * .build();
+ * BatchServiceClient batchServiceClient = BatchServiceClient.create(batchServiceSettings);
+ * }
+ *
* Please refer to the GitHub repository's samples for more quickstart code snippets.
*/
@Generated("by gapic-generator-java")
public class BatchServiceClient implements BackgroundResource {
private final BatchServiceSettings settings;
private final BatchServiceStub stub;
- private final OperationsClient operationsClient;
+ private final OperationsClient httpJsonOperationsClient;
+ private final com.google.longrunning.OperationsClient operationsClient;
/** Constructs an instance of BatchServiceClient with default settings. */
public static final BatchServiceClient create() throws IOException {
@@ -141,13 +156,17 @@ public static final BatchServiceClient create(BatchServiceStub stub) {
protected BatchServiceClient(BatchServiceSettings settings) throws IOException {
this.settings = settings;
this.stub = ((BatchServiceStubSettings) 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 BatchServiceClient(BatchServiceStub 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 BatchServiceSettings getSettings() {
@@ -162,10 +181,18 @@ public BatchServiceStub 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.
/**
* Create a Job.
@@ -183,8 +210,8 @@ public final OperationsClient getOperationsClient() {
* }
* }
*
- * @param parent Required. The parent resource name where the Job will be created. Format:
- * projects/{project}/locations/{location}
+ * @param parent Required. The parent resource name where the Job will be created. Pattern:
+ * "projects/{project}/locations/{location}"
* @param job Required. The Job to create.
* @param jobId ID used to uniquely identify the Job within its parent scope. This field should
* contain at most 63 characters. Only alphanumeric characters or '-' are accepted. The '-'
@@ -221,8 +248,8 @@ public final Job createJob(LocationName parent, Job job, String jobId) {
* }
* }
*
- * @param parent Required. The parent resource name where the Job will be created. Format:
- * projects/{project}/locations/{location}
+ * @param parent Required. The parent resource name where the Job will be created. Pattern:
+ * "projects/{project}/locations/{location}"
* @param job Required. The Job to create.
* @param jobId ID used to uniquely identify the Job within its parent scope. This field should
* contain at most 63 characters. Only alphanumeric characters or '-' are accepted. The '-'
@@ -495,7 +522,7 @@ public final UnaryCallable deleteJobCallable() {
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
- * List all Jobs for a project.
+ * List all Jobs for a project within a region.
*
* Sample code:
*
@@ -520,7 +547,7 @@ public final ListJobsPagedResponse listJobs(String parent) {
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
- * List all Jobs for a project.
+ * List all Jobs for a project within a region.
*
*
Sample code:
*
@@ -550,7 +577,7 @@ public final ListJobsPagedResponse listJobs(ListJobsRequest request) {
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
- * List all Jobs for a project.
+ * List all Jobs for a project within a region.
*
*
Sample code:
*
@@ -579,7 +606,7 @@ public final UnaryCallable listJobsPaged
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
- * List all Jobs for a project.
+ * List all Jobs for a project within a region.
*
* Sample code:
*
@@ -731,7 +758,8 @@ public final UnaryCallable getTaskCallable() {
* }
* }
*
- * @param parent Required. Path of the TaskGroup from which Tasks are being requested.
+ * @param parent Required. Name of a TaskGroup from which Tasks are being requested. Pattern:
+ * "projects/{project}/locations/{location}/jobs/{job}/taskGroups/{task_group}"
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListTasksPagedResponse listTasks(TaskGroupName parent) {
@@ -758,7 +786,8 @@ public final ListTasksPagedResponse listTasks(TaskGroupName parent) {
* }
* }
*
- * @param parent Required. Path of the TaskGroup from which Tasks are being requested.
+ * @param parent Required. Name of a TaskGroup from which Tasks are being requested. Pattern:
+ * "projects/{project}/locations/{location}/jobs/{job}/taskGroups/{task_group}"
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListTasksPagedResponse listTasks(String parent) {
diff --git a/google-cloud-batch/src/main/java/com/google/cloud/batch/v1/BatchServiceSettings.java b/google-cloud-batch/src/main/java/com/google/cloud/batch/v1/BatchServiceSettings.java
index c59f366..eec86fe 100644
--- a/google-cloud-batch/src/main/java/com/google/cloud/batch/v1/BatchServiceSettings.java
+++ b/google-cloud-batch/src/main/java/com/google/cloud/batch/v1/BatchServiceSettings.java
@@ -24,6 +24,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;
@@ -137,11 +138,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde
return BatchServiceStubSettings.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 BatchServiceStubSettings.defaultGrpcTransportProviderBuilder();
}
+ /** Returns a builder for the default REST ChannelProvider for this service. */
+ @BetaApi
+ public static InstantiatingHttpJsonChannelProvider.Builder
+ defaultHttpJsonTransportProviderBuilder() {
+ return BatchServiceStubSettings.defaultHttpJsonTransportProviderBuilder();
+ }
+
public static TransportChannelProvider defaultTransportChannelProvider() {
return BatchServiceStubSettings.defaultTransportChannelProvider();
}
@@ -151,11 +159,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil
return BatchServiceStubSettings.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);
@@ -193,6 +207,11 @@ private static Builder createDefault() {
return new Builder(BatchServiceStubSettings.newBuilder());
}
+ @BetaApi
+ private static Builder createHttpJsonDefault() {
+ return new Builder(BatchServiceStubSettings.newHttpJsonBuilder());
+ }
+
public BatchServiceStubSettings.Builder getStubSettingsBuilder() {
return ((BatchServiceStubSettings.Builder) getStubSettings());
}
diff --git a/google-cloud-batch/src/main/java/com/google/cloud/batch/v1/package-info.java b/google-cloud-batch/src/main/java/com/google/cloud/batch/v1/package-info.java
index 5cb6b88..e675510 100644
--- a/google-cloud-batch/src/main/java/com/google/cloud/batch/v1/package-info.java
+++ b/google-cloud-batch/src/main/java/com/google/cloud/batch/v1/package-info.java
@@ -21,8 +21,8 @@
*
* ======================= BatchServiceClient =======================
*
- *
Service Description: Google Cloud Batch Service. The service manages user submitted batch jobs
- * and allocates Google Compute Engine VM instances to run the jobs.
+ *
Service Description: Google Batch Service. The service manages user submitted batch jobs and
+ * allocates Google Compute Engine VM instances to run the jobs.
*
*
Sample for BatchServiceClient:
*
diff --git a/google-cloud-batch/src/main/java/com/google/cloud/batch/v1/stub/BatchServiceStub.java b/google-cloud-batch/src/main/java/com/google/cloud/batch/v1/stub/BatchServiceStub.java
index 90b37c9..f10d790 100644
--- a/google-cloud-batch/src/main/java/com/google/cloud/batch/v1/stub/BatchServiceStub.java
+++ b/google-cloud-batch/src/main/java/com/google/cloud/batch/v1/stub/BatchServiceStub.java
@@ -48,7 +48,11 @@
public abstract class BatchServiceStub 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 UnaryCallable createJobCallable() {
diff --git a/google-cloud-batch/src/main/java/com/google/cloud/batch/v1/stub/BatchServiceStubSettings.java b/google-cloud-batch/src/main/java/com/google/cloud/batch/v1/stub/BatchServiceStubSettings.java
index be72d6b..c729398 100644
--- a/google-cloud-batch/src/main/java/com/google/cloud/batch/v1/stub/BatchServiceStubSettings.java
+++ b/google-cloud-batch/src/main/java/com/google/cloud/batch/v1/stub/BatchServiceStubSettings.java
@@ -29,6 +29,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;
@@ -267,6 +270,11 @@ public BatchServiceStub createStub() throws IOException {
.equals(GrpcTransportChannel.getGrpcTransportName())) {
return GrpcBatchServiceStub.create(this);
}
+ if (getTransportChannelProvider()
+ .getTransportName()
+ .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) {
+ return HttpJsonBatchServiceStub.create(this);
+ }
throw new UnsupportedOperationException(
String.format(
"Transport not supported: %s", getTransportChannelProvider().getTransportName()));
@@ -299,18 +307,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(BatchServiceStubSettings.class))
@@ -318,11 +333,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(BatchServiceStubSettings.class))
+ .setTransportToken(
+ GaxHttpJsonProperties.getHttpJsonTokenName(),
+ GaxHttpJsonProperties.getHttpJsonVersion());
+ }
+
+ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
+ return BatchServiceStubSettings.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);
@@ -461,6 +495,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
.createJobSettings()
diff --git a/google-cloud-batch/src/main/java/com/google/cloud/batch/v1/stub/HttpJsonBatchServiceCallableFactory.java b/google-cloud-batch/src/main/java/com/google/cloud/batch/v1/stub/HttpJsonBatchServiceCallableFactory.java
new file mode 100644
index 0000000..9bae796
--- /dev/null
+++ b/google-cloud-batch/src/main/java/com/google/cloud/batch/v1/stub/HttpJsonBatchServiceCallableFactory.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.batch.v1.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 BatchService service API.
+ *
+ * This class is for advanced usage.
+ */
+@Generated("by gapic-generator-java")
+@BetaApi
+public class HttpJsonBatchServiceCallableFactory
+ 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/google-cloud-batch/src/main/java/com/google/cloud/batch/v1/stub/HttpJsonBatchServiceStub.java b/google-cloud-batch/src/main/java/com/google/cloud/batch/v1/stub/HttpJsonBatchServiceStub.java
new file mode 100644
index 0000000..2543029
--- /dev/null
+++ b/google-cloud-batch/src/main/java/com/google/cloud/batch/v1/stub/HttpJsonBatchServiceStub.java
@@ -0,0 +1,501 @@
+/*
+ * 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.batch.v1.stub;
+
+import static com.google.cloud.batch.v1.BatchServiceClient.ListJobsPagedResponse;
+import static com.google.cloud.batch.v1.BatchServiceClient.ListTasksPagedResponse;
+
+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.batch.v1.CreateJobRequest;
+import com.google.cloud.batch.v1.DeleteJobRequest;
+import com.google.cloud.batch.v1.GetJobRequest;
+import com.google.cloud.batch.v1.GetTaskRequest;
+import com.google.cloud.batch.v1.Job;
+import com.google.cloud.batch.v1.ListJobsRequest;
+import com.google.cloud.batch.v1.ListJobsResponse;
+import com.google.cloud.batch.v1.ListTasksRequest;
+import com.google.cloud.batch.v1.ListTasksResponse;
+import com.google.cloud.batch.v1.OperationMetadata;
+import com.google.cloud.batch.v1.Task;
+import com.google.longrunning.Operation;
+import com.google.protobuf.Empty;
+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 BatchService service API.
+ *
+ * This class is for advanced usage and reflects the underlying API directly.
+ */
+@Generated("by gapic-generator-java")
+@BetaApi
+public class HttpJsonBatchServiceStub extends BatchServiceStub {
+ private static final TypeRegistry typeRegistry =
+ TypeRegistry.newBuilder()
+ .add(Empty.getDescriptor())
+ .add(OperationMetadata.getDescriptor())
+ .build();
+
+ private static final ApiMethodDescriptor createJobMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.batch.v1.BatchService/CreateJob")
+ .setHttpMethod("POST")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{parent=projects/*/locations/*}/jobs",
+ 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();
+ serializer.putQueryParam(fields, "jobId", request.getJobId());
+ serializer.putQueryParam(fields, "requestId", request.getRequestId());
+ return fields;
+ })
+ .setRequestBodyExtractor(
+ request -> ProtoRestSerializer.create().toBody("job", request.getJob()))
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(Job.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor getJobMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.batch.v1.BatchService/GetJob")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{name=projects/*/locations/*/jobs/*}",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "name", request.getName());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(Job.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor deleteJobMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.batch.v1.BatchService/DeleteJob")
+ .setHttpMethod("DELETE")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{name=projects/*/locations/*/jobs/*}",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "name", request.getName());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(fields, "reason", request.getReason());
+ serializer.putQueryParam(fields, "requestId", request.getRequestId());
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(Operation.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .setOperationSnapshotFactory(
+ (DeleteJobRequest request, Operation response) ->
+ HttpJsonOperationSnapshot.create(response))
+ .build();
+
+ private static final ApiMethodDescriptor
+ listJobsMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.batch.v1.BatchService/ListJobs")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{parent=projects/*/locations/*}/jobs",
+ 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();
+ serializer.putQueryParam(fields, "filter", request.getFilter());
+ serializer.putQueryParam(fields, "pageSize", request.getPageSize());
+ serializer.putQueryParam(fields, "pageToken", request.getPageToken());
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(ListJobsResponse.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor getTaskMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.batch.v1.BatchService/GetTask")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{name=projects/*/locations/*/jobs/*/taskGroups/*/tasks/*}",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(fields, "name", request.getName());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(Task.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ listTasksMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.batch.v1.BatchService/ListTasks")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1/{parent=projects/*/locations/*/jobs/*/taskGroups/*}/tasks",
+ 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();
+ serializer.putQueryParam(fields, "filter", request.getFilter());
+ serializer.putQueryParam(fields, "pageSize", request.getPageSize());
+ serializer.putQueryParam(fields, "pageToken", request.getPageToken());
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(ListTasksResponse.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private final UnaryCallable createJobCallable;
+ private final UnaryCallable getJobCallable;
+ private final UnaryCallable deleteJobCallable;
+ private final OperationCallable
+ deleteJobOperationCallable;
+ private final UnaryCallable listJobsCallable;
+ private final UnaryCallable listJobsPagedCallable;
+ private final UnaryCallable getTaskCallable;
+ private final UnaryCallable listTasksCallable;
+ private final UnaryCallable listTasksPagedCallable;
+
+ private final BackgroundResource backgroundResources;
+ private final HttpJsonOperationsStub httpJsonOperationsStub;
+ private final HttpJsonStubCallableFactory callableFactory;
+
+ public static final HttpJsonBatchServiceStub create(BatchServiceStubSettings settings)
+ throws IOException {
+ return new HttpJsonBatchServiceStub(settings, ClientContext.create(settings));
+ }
+
+ public static final HttpJsonBatchServiceStub create(ClientContext clientContext)
+ throws IOException {
+ return new HttpJsonBatchServiceStub(
+ BatchServiceStubSettings.newHttpJsonBuilder().build(), clientContext);
+ }
+
+ public static final HttpJsonBatchServiceStub create(
+ ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException {
+ return new HttpJsonBatchServiceStub(
+ BatchServiceStubSettings.newHttpJsonBuilder().build(), clientContext, callableFactory);
+ }
+
+ /**
+ * Constructs an instance of HttpJsonBatchServiceStub, 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 HttpJsonBatchServiceStub(BatchServiceStubSettings settings, ClientContext clientContext)
+ throws IOException {
+ this(settings, clientContext, new HttpJsonBatchServiceCallableFactory());
+ }
+
+ /**
+ * Constructs an instance of HttpJsonBatchServiceStub, 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 HttpJsonBatchServiceStub(
+ BatchServiceStubSettings settings,
+ ClientContext clientContext,
+ HttpJsonStubCallableFactory callableFactory)
+ throws IOException {
+ this.callableFactory = callableFactory;
+ this.httpJsonOperationsStub =
+ HttpJsonOperationsStub.create(clientContext, callableFactory, typeRegistry);
+
+ HttpJsonCallSettings createJobTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(createJobMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings getJobTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(getJobMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings deleteJobTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(deleteJobMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings listJobsTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(listJobsMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings getTaskTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(getTaskMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+ HttpJsonCallSettings listTasksTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(listTasksMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .build();
+
+ this.createJobCallable =
+ callableFactory.createUnaryCallable(
+ createJobTransportSettings, settings.createJobSettings(), clientContext);
+ this.getJobCallable =
+ callableFactory.createUnaryCallable(
+ getJobTransportSettings, settings.getJobSettings(), clientContext);
+ this.deleteJobCallable =
+ callableFactory.createUnaryCallable(
+ deleteJobTransportSettings, settings.deleteJobSettings(), clientContext);
+ this.deleteJobOperationCallable =
+ callableFactory.createOperationCallable(
+ deleteJobTransportSettings,
+ settings.deleteJobOperationSettings(),
+ clientContext,
+ httpJsonOperationsStub);
+ this.listJobsCallable =
+ callableFactory.createUnaryCallable(
+ listJobsTransportSettings, settings.listJobsSettings(), clientContext);
+ this.listJobsPagedCallable =
+ callableFactory.createPagedCallable(
+ listJobsTransportSettings, settings.listJobsSettings(), clientContext);
+ this.getTaskCallable =
+ callableFactory.createUnaryCallable(
+ getTaskTransportSettings, settings.getTaskSettings(), clientContext);
+ this.listTasksCallable =
+ callableFactory.createUnaryCallable(
+ listTasksTransportSettings, settings.listTasksSettings(), clientContext);
+ this.listTasksPagedCallable =
+ callableFactory.createPagedCallable(
+ listTasksTransportSettings, settings.listTasksSettings(), clientContext);
+
+ this.backgroundResources =
+ new BackgroundResourceAggregation(clientContext.getBackgroundResources());
+ }
+
+ @InternalApi
+ public static List getMethodDescriptors() {
+ List methodDescriptors = new ArrayList<>();
+ methodDescriptors.add(createJobMethodDescriptor);
+ methodDescriptors.add(getJobMethodDescriptor);
+ methodDescriptors.add(deleteJobMethodDescriptor);
+ methodDescriptors.add(listJobsMethodDescriptor);
+ methodDescriptors.add(getTaskMethodDescriptor);
+ methodDescriptors.add(listTasksMethodDescriptor);
+ return methodDescriptors;
+ }
+
+ public HttpJsonOperationsStub getHttpJsonOperationsStub() {
+ return httpJsonOperationsStub;
+ }
+
+ @Override
+ public UnaryCallable createJobCallable() {
+ return createJobCallable;
+ }
+
+ @Override
+ public UnaryCallable getJobCallable() {
+ return getJobCallable;
+ }
+
+ @Override
+ public UnaryCallable deleteJobCallable() {
+ return deleteJobCallable;
+ }
+
+ @Override
+ public OperationCallable
+ deleteJobOperationCallable() {
+ return deleteJobOperationCallable;
+ }
+
+ @Override
+ public UnaryCallable listJobsCallable() {
+ return listJobsCallable;
+ }
+
+ @Override
+ public UnaryCallable listJobsPagedCallable() {
+ return listJobsPagedCallable;
+ }
+
+ @Override
+ public UnaryCallable getTaskCallable() {
+ return getTaskCallable;
+ }
+
+ @Override
+ public UnaryCallable listTasksCallable() {
+ return listTasksCallable;
+ }
+
+ @Override
+ public UnaryCallable listTasksPagedCallable() {
+ return listTasksPagedCallable;
+ }
+
+ @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/google-cloud-batch/src/main/java/com/google/cloud/batch/v1alpha/BatchServiceClient.java b/google-cloud-batch/src/main/java/com/google/cloud/batch/v1alpha/BatchServiceClient.java
new file mode 100644
index 0000000..02e9478
--- /dev/null
+++ b/google-cloud-batch/src/main/java/com/google/cloud/batch/v1alpha/BatchServiceClient.java
@@ -0,0 +1,1028 @@
+/*
+ * 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.batch.v1alpha;
+
+import com.google.api.core.ApiFuture;
+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.batch.v1alpha.stub.BatchServiceStub;
+import com.google.cloud.batch.v1alpha.stub.BatchServiceStubSettings;
+import com.google.common.util.concurrent.MoreExecutors;
+import com.google.longrunning.Operation;
+import com.google.longrunning.OperationsClient;
+import com.google.protobuf.Empty;
+import java.io.IOException;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * Service Description: Google Batch Service. The service manages user submitted batch jobs and
+ * allocates Google Compute Engine VM instances to run the jobs.
+ *
+ * This class provides the ability to make remote calls to the backing service through method
+ * calls that map to API methods. Sample code to get started:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
+ * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+ * Job job = Job.newBuilder().build();
+ * String jobId = "jobId101296568";
+ * Job response = batchServiceClient.createJob(parent, job, jobId);
+ * }
+ * }
+ *
+ * Note: close() needs to be called on the BatchServiceClient object to clean up resources such
+ * as threads. In the example above, try-with-resources is used, which automatically calls close().
+ *
+ *
The surface of this class includes several types of Java methods for each of the API's
+ * methods:
+ *
+ *
+ * - A "flattened" method. With this type of method, the fields of the request type have been
+ * converted into function parameters. It may be the case that not all fields are available as
+ * parameters, and not every API method will have a flattened method entry point.
+ *
- A "request object" method. This type of method only takes one parameter, a request object,
+ * which must be constructed before the call. Not every API method will have a request object
+ * method.
+ *
- A "callable" method. This type of method takes no parameters and returns an immutable API
+ * callable object, which can be used to initiate calls to the service.
+ *
+ *
+ * See the individual methods for example code.
+ *
+ *
Many parameters require resource names to be formatted in a particular way. To assist with
+ * these names, this class includes a format method for each type of name, and additionally a parse
+ * method to extract the individual identifiers contained within names that are returned.
+ *
+ *
This class can be customized by passing in a custom instance of BatchServiceSettings to
+ * create(). For example:
+ *
+ *
To customize credentials:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * BatchServiceSettings batchServiceSettings =
+ * BatchServiceSettings.newBuilder()
+ * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
+ * .build();
+ * BatchServiceClient batchServiceClient = BatchServiceClient.create(batchServiceSettings);
+ * }
+ *
+ * To customize the endpoint:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * BatchServiceSettings batchServiceSettings =
+ * BatchServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
+ * BatchServiceClient batchServiceClient = BatchServiceClient.create(batchServiceSettings);
+ * }
+ *
+ * Please refer to the GitHub repository's samples for more quickstart code snippets.
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public class BatchServiceClient implements BackgroundResource {
+ private final BatchServiceSettings settings;
+ private final BatchServiceStub stub;
+ private final OperationsClient operationsClient;
+
+ /** Constructs an instance of BatchServiceClient with default settings. */
+ public static final BatchServiceClient create() throws IOException {
+ return create(BatchServiceSettings.newBuilder().build());
+ }
+
+ /**
+ * Constructs an instance of BatchServiceClient, using the given settings. The channels are
+ * created based on the settings passed in, or defaults for any settings that are not set.
+ */
+ public static final BatchServiceClient create(BatchServiceSettings settings) throws IOException {
+ return new BatchServiceClient(settings);
+ }
+
+ /**
+ * Constructs an instance of BatchServiceClient, using the given stub for making calls. This is
+ * for advanced usage - prefer using create(BatchServiceSettings).
+ */
+ public static final BatchServiceClient create(BatchServiceStub stub) {
+ return new BatchServiceClient(stub);
+ }
+
+ /**
+ * Constructs an instance of BatchServiceClient, 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 BatchServiceClient(BatchServiceSettings settings) throws IOException {
+ this.settings = settings;
+ this.stub = ((BatchServiceStubSettings) settings.getStubSettings()).createStub();
+ this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
+ }
+
+ protected BatchServiceClient(BatchServiceStub stub) {
+ this.settings = null;
+ this.stub = stub;
+ this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
+ }
+
+ public final BatchServiceSettings getSettings() {
+ return settings;
+ }
+
+ public BatchServiceStub 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.
+ /**
+ * Create a Job.
+ *
+ *
Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
+ * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+ * Job job = Job.newBuilder().build();
+ * String jobId = "jobId101296568";
+ * Job response = batchServiceClient.createJob(parent, job, jobId);
+ * }
+ * }
+ *
+ * @param parent Required. The parent resource name where the Job will be created. Pattern:
+ * "projects/{project}/locations/{location}"
+ * @param job Required. The Job to create.
+ * @param jobId ID used to uniquely identify the Job within its parent scope. This field should
+ * contain at most 63 characters. Only alphanumeric characters or '-' are accepted. The '-'
+ * character cannot be the first or the last one. A system generated ID will be used if the
+ * field is not set.
+ * The job.name field in the request will be ignored and the created resource name of the
+ * Job will be "{parent}/jobs/{job_id}".
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Job createJob(LocationName parent, Job job, String jobId) {
+ CreateJobRequest request =
+ CreateJobRequest.newBuilder()
+ .setParent(parent == null ? null : parent.toString())
+ .setJob(job)
+ .setJobId(jobId)
+ .build();
+ return createJob(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Create a Job.
+ *
+ *
Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
+ * String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
+ * Job job = Job.newBuilder().build();
+ * String jobId = "jobId101296568";
+ * Job response = batchServiceClient.createJob(parent, job, jobId);
+ * }
+ * }
+ *
+ * @param parent Required. The parent resource name where the Job will be created. Pattern:
+ * "projects/{project}/locations/{location}"
+ * @param job Required. The Job to create.
+ * @param jobId ID used to uniquely identify the Job within its parent scope. This field should
+ * contain at most 63 characters. Only alphanumeric characters or '-' are accepted. The '-'
+ * character cannot be the first or the last one. A system generated ID will be used if the
+ * field is not set.
+ * The job.name field in the request will be ignored and the created resource name of the
+ * Job will be "{parent}/jobs/{job_id}".
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Job createJob(String parent, Job job, String jobId) {
+ CreateJobRequest request =
+ CreateJobRequest.newBuilder().setParent(parent).setJob(job).setJobId(jobId).build();
+ return createJob(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Create a Job.
+ *
+ *
Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
+ * CreateJobRequest request =
+ * CreateJobRequest.newBuilder()
+ * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+ * .setJobId("jobId101296568")
+ * .setJob(Job.newBuilder().build())
+ * .setRequestId("requestId693933066")
+ * .build();
+ * Job response = batchServiceClient.createJob(request);
+ * }
+ * }
+ *
+ * @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 Job createJob(CreateJobRequest request) {
+ return createJobCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Create a Job.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
+ * CreateJobRequest request =
+ * CreateJobRequest.newBuilder()
+ * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+ * .setJobId("jobId101296568")
+ * .setJob(Job.newBuilder().build())
+ * .setRequestId("requestId693933066")
+ * .build();
+ * ApiFuture future = batchServiceClient.createJobCallable().futureCall(request);
+ * // Do something.
+ * Job response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallable createJobCallable() {
+ return stub.createJobCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Get a Job specified by its resource name.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
+ * JobName name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]");
+ * Job response = batchServiceClient.getJob(name);
+ * }
+ * }
+ *
+ * @param name Required. Job name.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Job getJob(JobName name) {
+ GetJobRequest request =
+ GetJobRequest.newBuilder().setName(name == null ? null : name.toString()).build();
+ return getJob(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Get a Job specified by its resource name.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
+ * String name = JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString();
+ * Job response = batchServiceClient.getJob(name);
+ * }
+ * }
+ *
+ * @param name Required. Job name.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Job getJob(String name) {
+ GetJobRequest request = GetJobRequest.newBuilder().setName(name).build();
+ return getJob(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Get a Job specified by its resource name.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
+ * GetJobRequest request =
+ * GetJobRequest.newBuilder()
+ * .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+ * .build();
+ * Job response = batchServiceClient.getJob(request);
+ * }
+ * }
+ *
+ * @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 Job getJob(GetJobRequest request) {
+ return getJobCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Get a Job specified by its resource name.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
+ * GetJobRequest request =
+ * GetJobRequest.newBuilder()
+ * .setName(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+ * .build();
+ * ApiFuture future = batchServiceClient.getJobCallable().futureCall(request);
+ * // Do something.
+ * Job response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallable getJobCallable() {
+ return stub.getJobCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Delete a Job.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
+ * String name = "name3373707";
+ * batchServiceClient.deleteJobAsync(name).get();
+ * }
+ * }
+ *
+ * @param name Job name.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OperationFuture deleteJobAsync(String name) {
+ DeleteJobRequest request = DeleteJobRequest.newBuilder().setName(name).build();
+ return deleteJobAsync(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Delete a Job.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
+ * DeleteJobRequest request =
+ * DeleteJobRequest.newBuilder()
+ * .setName("name3373707")
+ * .setReason("reason-934964668")
+ * .setRequestId("requestId693933066")
+ * .build();
+ * batchServiceClient.deleteJobAsync(request).get();
+ * }
+ * }
+ *
+ * @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 deleteJobAsync(DeleteJobRequest request) {
+ return deleteJobOperationCallable().futureCall(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Delete a Job.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
+ * DeleteJobRequest request =
+ * DeleteJobRequest.newBuilder()
+ * .setName("name3373707")
+ * .setReason("reason-934964668")
+ * .setRequestId("requestId693933066")
+ * .build();
+ * OperationFuture future =
+ * batchServiceClient.deleteJobOperationCallable().futureCall(request);
+ * // Do something.
+ * future.get();
+ * }
+ * }
+ */
+ public final OperationCallable
+ deleteJobOperationCallable() {
+ return stub.deleteJobOperationCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Delete a Job.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
+ * DeleteJobRequest request =
+ * DeleteJobRequest.newBuilder()
+ * .setName("name3373707")
+ * .setReason("reason-934964668")
+ * .setRequestId("requestId693933066")
+ * .build();
+ * ApiFuture future = batchServiceClient.deleteJobCallable().futureCall(request);
+ * // Do something.
+ * future.get();
+ * }
+ * }
+ */
+ public final UnaryCallable deleteJobCallable() {
+ return stub.deleteJobCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * List all Jobs for a project within a region.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
+ * String parent = "parent-995424086";
+ * for (Job element : batchServiceClient.listJobs(parent).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ *
+ * @param parent Parent path.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListJobsPagedResponse listJobs(String parent) {
+ ListJobsRequest request = ListJobsRequest.newBuilder().setParent(parent).build();
+ return listJobs(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * List all Jobs for a project within a region.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
+ * ListJobsRequest request =
+ * ListJobsRequest.newBuilder()
+ * .setParent("parent-995424086")
+ * .setFilter("filter-1274492040")
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .build();
+ * for (Job element : batchServiceClient.listJobs(request).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ *
+ * @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 ListJobsPagedResponse listJobs(ListJobsRequest request) {
+ return listJobsPagedCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * List all Jobs for a project within a region.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
+ * ListJobsRequest request =
+ * ListJobsRequest.newBuilder()
+ * .setParent("parent-995424086")
+ * .setFilter("filter-1274492040")
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .build();
+ * ApiFuture future = batchServiceClient.listJobsPagedCallable().futureCall(request);
+ * // Do something.
+ * for (Job element : future.get().iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ */
+ public final UnaryCallable listJobsPagedCallable() {
+ return stub.listJobsPagedCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * List all Jobs for a project within a region.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
+ * ListJobsRequest request =
+ * ListJobsRequest.newBuilder()
+ * .setParent("parent-995424086")
+ * .setFilter("filter-1274492040")
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .build();
+ * while (true) {
+ * ListJobsResponse response = batchServiceClient.listJobsCallable().call(request);
+ * for (Job element : response.getJobsList()) {
+ * // doThingsWith(element);
+ * }
+ * String nextPageToken = response.getNextPageToken();
+ * if (!Strings.isNullOrEmpty(nextPageToken)) {
+ * request = request.toBuilder().setPageToken(nextPageToken).build();
+ * } else {
+ * break;
+ * }
+ * }
+ * }
+ * }
+ */
+ public final UnaryCallable listJobsCallable() {
+ return stub.listJobsCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Return a single Task.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
+ * TaskName name = TaskName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[TASK_GROUP]", "[TASK]");
+ * Task response = batchServiceClient.getTask(name);
+ * }
+ * }
+ *
+ * @param name Required. Task name.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Task getTask(TaskName name) {
+ GetTaskRequest request =
+ GetTaskRequest.newBuilder().setName(name == null ? null : name.toString()).build();
+ return getTask(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Return a single Task.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
+ * String name =
+ * TaskName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[TASK_GROUP]", "[TASK]").toString();
+ * Task response = batchServiceClient.getTask(name);
+ * }
+ * }
+ *
+ * @param name Required. Task name.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final Task getTask(String name) {
+ GetTaskRequest request = GetTaskRequest.newBuilder().setName(name).build();
+ return getTask(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Return a single Task.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
+ * GetTaskRequest request =
+ * GetTaskRequest.newBuilder()
+ * .setName(
+ * TaskName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[TASK_GROUP]", "[TASK]")
+ * .toString())
+ * .build();
+ * Task response = batchServiceClient.getTask(request);
+ * }
+ * }
+ *
+ * @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 Task getTask(GetTaskRequest request) {
+ return getTaskCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Return a single Task.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
+ * GetTaskRequest request =
+ * GetTaskRequest.newBuilder()
+ * .setName(
+ * TaskName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[TASK_GROUP]", "[TASK]")
+ * .toString())
+ * .build();
+ * ApiFuture future = batchServiceClient.getTaskCallable().futureCall(request);
+ * // Do something.
+ * Task response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallable getTaskCallable() {
+ return stub.getTaskCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * List Tasks associated with a job.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
+ * TaskGroupName parent = TaskGroupName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[TASK_GROUP]");
+ * for (Task element : batchServiceClient.listTasks(parent).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ *
+ * @param parent Required. Name of a TaskGroup from which Tasks are being requested. Pattern:
+ * "projects/{project}/locations/{location}/jobs/{job}/taskGroups/{task_group}"
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListTasksPagedResponse listTasks(TaskGroupName parent) {
+ ListTasksRequest request =
+ ListTasksRequest.newBuilder().setParent(parent == null ? null : parent.toString()).build();
+ return listTasks(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * List Tasks associated with a job.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
+ * String parent =
+ * TaskGroupName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[TASK_GROUP]").toString();
+ * for (Task element : batchServiceClient.listTasks(parent).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ *
+ * @param parent Required. Name of a TaskGroup from which Tasks are being requested. Pattern:
+ * "projects/{project}/locations/{location}/jobs/{job}/taskGroups/{task_group}"
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListTasksPagedResponse listTasks(String parent) {
+ ListTasksRequest request = ListTasksRequest.newBuilder().setParent(parent).build();
+ return listTasks(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * List Tasks associated with a job.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
+ * ListTasksRequest request =
+ * ListTasksRequest.newBuilder()
+ * .setParent(
+ * TaskGroupName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[TASK_GROUP]").toString())
+ * .setFilter("filter-1274492040")
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .build();
+ * for (Task element : batchServiceClient.listTasks(request).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ *
+ * @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 ListTasksPagedResponse listTasks(ListTasksRequest request) {
+ return listTasksPagedCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * List Tasks associated with a job.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
+ * ListTasksRequest request =
+ * ListTasksRequest.newBuilder()
+ * .setParent(
+ * TaskGroupName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[TASK_GROUP]").toString())
+ * .setFilter("filter-1274492040")
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .build();
+ * ApiFuture future = batchServiceClient.listTasksPagedCallable().futureCall(request);
+ * // Do something.
+ * for (Task element : future.get().iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ */
+ public final UnaryCallable listTasksPagedCallable() {
+ return stub.listTasksPagedCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * List Tasks associated with a job.
+ *
+ * Sample code:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
+ * ListTasksRequest request =
+ * ListTasksRequest.newBuilder()
+ * .setParent(
+ * TaskGroupName.of("[PROJECT]", "[LOCATION]", "[JOB]", "[TASK_GROUP]").toString())
+ * .setFilter("filter-1274492040")
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .build();
+ * while (true) {
+ * ListTasksResponse response = batchServiceClient.listTasksCallable().call(request);
+ * for (Task element : response.getTasksList()) {
+ * // doThingsWith(element);
+ * }
+ * String nextPageToken = response.getNextPageToken();
+ * if (!Strings.isNullOrEmpty(nextPageToken)) {
+ * request = request.toBuilder().setPageToken(nextPageToken).build();
+ * } else {
+ * break;
+ * }
+ * }
+ * }
+ * }
+ */
+ public final UnaryCallable listTasksCallable() {
+ return stub.listTasksCallable();
+ }
+
+ @Override
+ public final void close() {
+ stub.close();
+ }
+
+ @Override
+ public void shutdown() {
+ stub.shutdown();
+ }
+
+ @Override
+ public boolean isShutdown() {
+ return stub.isShutdown();
+ }
+
+ @Override
+ public boolean isTerminated() {
+ return stub.isTerminated();
+ }
+
+ @Override
+ public void shutdownNow() {
+ stub.shutdownNow();
+ }
+
+ @Override
+ public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
+ return stub.awaitTermination(duration, unit);
+ }
+
+ public static class ListJobsPagedResponse
+ extends AbstractPagedListResponse<
+ ListJobsRequest, ListJobsResponse, Job, ListJobsPage, ListJobsFixedSizeCollection> {
+
+ public static ApiFuture createAsync(
+ PageContext context,
+ ApiFuture futureResponse) {
+ ApiFuture futurePage =
+ ListJobsPage.createEmptyPage().createPageAsync(context, futureResponse);
+ return ApiFutures.transform(
+ futurePage, input -> new ListJobsPagedResponse(input), MoreExecutors.directExecutor());
+ }
+
+ private ListJobsPagedResponse(ListJobsPage page) {
+ super(page, ListJobsFixedSizeCollection.createEmptyCollection());
+ }
+ }
+
+ public static class ListJobsPage
+ extends AbstractPage {
+
+ private ListJobsPage(
+ PageContext context, ListJobsResponse response) {
+ super(context, response);
+ }
+
+ private static ListJobsPage createEmptyPage() {
+ return new ListJobsPage(null, null);
+ }
+
+ @Override
+ protected ListJobsPage createPage(
+ PageContext context, ListJobsResponse response) {
+ return new ListJobsPage(context, response);
+ }
+
+ @Override
+ public ApiFuture createPageAsync(
+ PageContext context,
+ ApiFuture futureResponse) {
+ return super.createPageAsync(context, futureResponse);
+ }
+ }
+
+ public static class ListJobsFixedSizeCollection
+ extends AbstractFixedSizeCollection<
+ ListJobsRequest, ListJobsResponse, Job, ListJobsPage, ListJobsFixedSizeCollection> {
+
+ private ListJobsFixedSizeCollection(List pages, int collectionSize) {
+ super(pages, collectionSize);
+ }
+
+ private static ListJobsFixedSizeCollection createEmptyCollection() {
+ return new ListJobsFixedSizeCollection(null, 0);
+ }
+
+ @Override
+ protected ListJobsFixedSizeCollection createCollection(
+ List pages, int collectionSize) {
+ return new ListJobsFixedSizeCollection(pages, collectionSize);
+ }
+ }
+
+ public static class ListTasksPagedResponse
+ extends AbstractPagedListResponse<
+ ListTasksRequest, ListTasksResponse, Task, ListTasksPage, ListTasksFixedSizeCollection> {
+
+ public static ApiFuture createAsync(
+ PageContext context,
+ ApiFuture futureResponse) {
+ ApiFuture futurePage =
+ ListTasksPage.createEmptyPage().createPageAsync(context, futureResponse);
+ return ApiFutures.transform(
+ futurePage, input -> new ListTasksPagedResponse(input), MoreExecutors.directExecutor());
+ }
+
+ private ListTasksPagedResponse(ListTasksPage page) {
+ super(page, ListTasksFixedSizeCollection.createEmptyCollection());
+ }
+ }
+
+ public static class ListTasksPage
+ extends AbstractPage {
+
+ private ListTasksPage(
+ PageContext context,
+ ListTasksResponse response) {
+ super(context, response);
+ }
+
+ private static ListTasksPage createEmptyPage() {
+ return new ListTasksPage(null, null);
+ }
+
+ @Override
+ protected ListTasksPage createPage(
+ PageContext context,
+ ListTasksResponse response) {
+ return new ListTasksPage(context, response);
+ }
+
+ @Override
+ public ApiFuture createPageAsync(
+ PageContext context,
+ ApiFuture futureResponse) {
+ return super.createPageAsync(context, futureResponse);
+ }
+ }
+
+ public static class ListTasksFixedSizeCollection
+ extends AbstractFixedSizeCollection<
+ ListTasksRequest, ListTasksResponse, Task, ListTasksPage, ListTasksFixedSizeCollection> {
+
+ private ListTasksFixedSizeCollection(List pages, int collectionSize) {
+ super(pages, collectionSize);
+ }
+
+ private static ListTasksFixedSizeCollection createEmptyCollection() {
+ return new ListTasksFixedSizeCollection(null, 0);
+ }
+
+ @Override
+ protected ListTasksFixedSizeCollection createCollection(
+ List pages, int collectionSize) {
+ return new ListTasksFixedSizeCollection(pages, collectionSize);
+ }
+ }
+}
diff --git a/google-cloud-batch/src/main/java/com/google/cloud/batch/v1alpha/BatchServiceSettings.java b/google-cloud-batch/src/main/java/com/google/cloud/batch/v1alpha/BatchServiceSettings.java
new file mode 100644
index 0000000..349888a
--- /dev/null
+++ b/google-cloud-batch/src/main/java/com/google/cloud/batch/v1alpha/BatchServiceSettings.java
@@ -0,0 +1,256 @@
+/*
+ * 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.batch.v1alpha;
+
+import static com.google.cloud.batch.v1alpha.BatchServiceClient.ListJobsPagedResponse;
+import static com.google.cloud.batch.v1alpha.BatchServiceClient.ListTasksPagedResponse;
+
+import com.google.api.core.ApiFunction;
+import com.google.api.core.BetaApi;
+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.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;
+import com.google.cloud.batch.v1alpha.stub.BatchServiceStubSettings;
+import com.google.longrunning.Operation;
+import com.google.protobuf.Empty;
+import java.io.IOException;
+import java.util.List;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * Settings class to configure an instance of {@link BatchServiceClient}.
+ *
+ * The default instance has everything set to sensible defaults:
+ *
+ *
+ * - The default service address (batch.googleapis.com) and default port (443) are used.
+ *
- Credentials are acquired automatically through Application Default Credentials.
+ *
- Retries are configured for idempotent methods but not for non-idempotent methods.
+ *
+ *
+ * The builder of this class is recursive, so contained classes are themselves builders. When
+ * build() is called, the tree of builders is called to create the complete settings object.
+ *
+ *
For example, to set the total timeout of createJob to 30 seconds:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * BatchServiceSettings.Builder batchServiceSettingsBuilder = BatchServiceSettings.newBuilder();
+ * batchServiceSettingsBuilder
+ * .createJobSettings()
+ * .setRetrySettings(
+ * batchServiceSettingsBuilder
+ * .createJobSettings()
+ * .getRetrySettings()
+ * .toBuilder()
+ * .setTotalTimeout(Duration.ofSeconds(30))
+ * .build());
+ * BatchServiceSettings batchServiceSettings = batchServiceSettingsBuilder.build();
+ * }
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public class BatchServiceSettings extends ClientSettings {
+
+ /** Returns the object with the settings used for calls to createJob. */
+ public UnaryCallSettings createJobSettings() {
+ return ((BatchServiceStubSettings) getStubSettings()).createJobSettings();
+ }
+
+ /** Returns the object with the settings used for calls to getJob. */
+ public UnaryCallSettings getJobSettings() {
+ return ((BatchServiceStubSettings) getStubSettings()).getJobSettings();
+ }
+
+ /** Returns the object with the settings used for calls to deleteJob. */
+ public UnaryCallSettings deleteJobSettings() {
+ return ((BatchServiceStubSettings) getStubSettings()).deleteJobSettings();
+ }
+
+ /** Returns the object with the settings used for calls to deleteJob. */
+ public OperationCallSettings
+ deleteJobOperationSettings() {
+ return ((BatchServiceStubSettings) getStubSettings()).deleteJobOperationSettings();
+ }
+
+ /** Returns the object with the settings used for calls to listJobs. */
+ public PagedCallSettings
+ listJobsSettings() {
+ return ((BatchServiceStubSettings) getStubSettings()).listJobsSettings();
+ }
+
+ /** Returns the object with the settings used for calls to getTask. */
+ public UnaryCallSettings getTaskSettings() {
+ return ((BatchServiceStubSettings) getStubSettings()).getTaskSettings();
+ }
+
+ /** Returns the object with the settings used for calls to listTasks. */
+ public PagedCallSettings
+ listTasksSettings() {
+ return ((BatchServiceStubSettings) getStubSettings()).listTasksSettings();
+ }
+
+ public static final BatchServiceSettings create(BatchServiceStubSettings stub)
+ throws IOException {
+ return new BatchServiceSettings.Builder(stub.toBuilder()).build();
+ }
+
+ /** Returns a builder for the default ExecutorProvider for this service. */
+ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() {
+ return BatchServiceStubSettings.defaultExecutorProviderBuilder();
+ }
+
+ /** Returns the default service endpoint. */
+ public static String getDefaultEndpoint() {
+ return BatchServiceStubSettings.getDefaultEndpoint();
+ }
+
+ /** Returns the default service scopes. */
+ public static List getDefaultServiceScopes() {
+ return BatchServiceStubSettings.getDefaultServiceScopes();
+ }
+
+ /** Returns a builder for the default credentials for this service. */
+ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
+ return BatchServiceStubSettings.defaultCredentialsProviderBuilder();
+ }
+
+ /** Returns a builder for the default ChannelProvider for this service. */
+ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
+ return BatchServiceStubSettings.defaultGrpcTransportProviderBuilder();
+ }
+
+ public static TransportChannelProvider defaultTransportChannelProvider() {
+ return BatchServiceStubSettings.defaultTransportChannelProvider();
+ }
+
+ @BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
+ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
+ return BatchServiceStubSettings.defaultApiClientHeaderProviderBuilder();
+ }
+
+ /** Returns a new builder for this class. */
+ public static Builder newBuilder() {
+ return Builder.createDefault();
+ }
+
+ /** Returns a new builder for this class. */
+ public static Builder newBuilder(ClientContext clientContext) {
+ return new Builder(clientContext);
+ }
+
+ /** Returns a builder containing all the values of this settings class. */
+ public Builder toBuilder() {
+ return new Builder(this);
+ }
+
+ protected BatchServiceSettings(Builder settingsBuilder) throws IOException {
+ super(settingsBuilder);
+ }
+
+ /** Builder for BatchServiceSettings. */
+ public static class Builder extends ClientSettings.Builder {
+
+ protected Builder() throws IOException {
+ this(((ClientContext) null));
+ }
+
+ protected Builder(ClientContext clientContext) {
+ super(BatchServiceStubSettings.newBuilder(clientContext));
+ }
+
+ protected Builder(BatchServiceSettings settings) {
+ super(settings.getStubSettings().toBuilder());
+ }
+
+ protected Builder(BatchServiceStubSettings.Builder stubSettings) {
+ super(stubSettings);
+ }
+
+ private static Builder createDefault() {
+ return new Builder(BatchServiceStubSettings.newBuilder());
+ }
+
+ public BatchServiceStubSettings.Builder getStubSettingsBuilder() {
+ return ((BatchServiceStubSettings.Builder) getStubSettings());
+ }
+
+ /**
+ * Applies the given settings updater function to all of the unary API methods in this service.
+ *
+ * Note: This method does not support applying settings to streaming methods.
+ */
+ public Builder applyToAllUnaryMethods(
+ ApiFunction, Void> settingsUpdater) {
+ super.applyToAllUnaryMethods(
+ getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater);
+ return this;
+ }
+
+ /** Returns the builder for the settings used for calls to createJob. */
+ public UnaryCallSettings.Builder createJobSettings() {
+ return getStubSettingsBuilder().createJobSettings();
+ }
+
+ /** Returns the builder for the settings used for calls to getJob. */
+ public UnaryCallSettings.Builder getJobSettings() {
+ return getStubSettingsBuilder().getJobSettings();
+ }
+
+ /** Returns the builder for the settings used for calls to deleteJob. */
+ public UnaryCallSettings.Builder deleteJobSettings() {
+ return getStubSettingsBuilder().deleteJobSettings();
+ }
+
+ /** Returns the builder for the settings used for calls to deleteJob. */
+ public OperationCallSettings.Builder
+ deleteJobOperationSettings() {
+ return getStubSettingsBuilder().deleteJobOperationSettings();
+ }
+
+ /** Returns the builder for the settings used for calls to listJobs. */
+ public PagedCallSettings.Builder
+ listJobsSettings() {
+ return getStubSettingsBuilder().listJobsSettings();
+ }
+
+ /** Returns the builder for the settings used for calls to getTask. */
+ public UnaryCallSettings.Builder getTaskSettings() {
+ return getStubSettingsBuilder().getTaskSettings();
+ }
+
+ /** Returns the builder for the settings used for calls to listTasks. */
+ public PagedCallSettings.Builder
+ listTasksSettings() {
+ return getStubSettingsBuilder().listTasksSettings();
+ }
+
+ @Override
+ public BatchServiceSettings build() throws IOException {
+ return new BatchServiceSettings(this);
+ }
+ }
+}
diff --git a/google-cloud-batch/src/main/java/com/google/cloud/batch/v1alpha/gapic_metadata.json b/google-cloud-batch/src/main/java/com/google/cloud/batch/v1alpha/gapic_metadata.json
new file mode 100644
index 0000000..154c03f
--- /dev/null
+++ b/google-cloud-batch/src/main/java/com/google/cloud/batch/v1alpha/gapic_metadata.json
@@ -0,0 +1,36 @@
+{
+ "schema": "1.0",
+ "comment": "This file maps proto services/RPCs to the corresponding library clients/methods",
+ "language": "java",
+ "protoPackage": "google.cloud.batch.v1alpha",
+ "libraryPackage": "com.google.cloud.batch.v1alpha",
+ "services": {
+ "BatchService": {
+ "clients": {
+ "grpc": {
+ "libraryClient": "BatchServiceClient",
+ "rpcs": {
+ "CreateJob": {
+ "methods": ["createJob", "createJob", "createJob", "createJobCallable"]
+ },
+ "DeleteJob": {
+ "methods": ["deleteJobAsync", "deleteJobAsync", "deleteJobOperationCallable", "deleteJobCallable"]
+ },
+ "GetJob": {
+ "methods": ["getJob", "getJob", "getJob", "getJobCallable"]
+ },
+ "GetTask": {
+ "methods": ["getTask", "getTask", "getTask", "getTaskCallable"]
+ },
+ "ListJobs": {
+ "methods": ["listJobs", "listJobs", "listJobsPagedCallable", "listJobsCallable"]
+ },
+ "ListTasks": {
+ "methods": ["listTasks", "listTasks", "listTasks", "listTasksPagedCallable", "listTasksCallable"]
+ }
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/google-cloud-batch/src/main/java/com/google/cloud/batch/v1alpha/package-info.java b/google-cloud-batch/src/main/java/com/google/cloud/batch/v1alpha/package-info.java
new file mode 100644
index 0000000..afb0037
--- /dev/null
+++ b/google-cloud-batch/src/main/java/com/google/cloud/batch/v1alpha/package-info.java
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+
+/**
+ * The interfaces provided are listed below, along with usage samples.
+ *
+ * ======================= BatchServiceClient =======================
+ *
+ *
Service Description: Google Batch Service. The service manages user submitted batch jobs and
+ * allocates Google Compute Engine VM instances to run the jobs.
+ *
+ *
Sample for BatchServiceClient:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
+ * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+ * Job job = Job.newBuilder().build();
+ * String jobId = "jobId101296568";
+ * Job response = batchServiceClient.createJob(parent, job, jobId);
+ * }
+ * }
+ */
+@Generated("by gapic-generator-java")
+package com.google.cloud.batch.v1alpha;
+
+import javax.annotation.Generated;
diff --git a/google-cloud-batch/src/main/java/com/google/cloud/batch/v1alpha/stub/BatchServiceStub.java b/google-cloud-batch/src/main/java/com/google/cloud/batch/v1alpha/stub/BatchServiceStub.java
new file mode 100644
index 0000000..44de4c2
--- /dev/null
+++ b/google-cloud-batch/src/main/java/com/google/cloud/batch/v1alpha/stub/BatchServiceStub.java
@@ -0,0 +1,95 @@
+/*
+ * 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.batch.v1alpha.stub;
+
+import static com.google.cloud.batch.v1alpha.BatchServiceClient.ListJobsPagedResponse;
+import static com.google.cloud.batch.v1alpha.BatchServiceClient.ListTasksPagedResponse;
+
+import com.google.api.core.BetaApi;
+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.batch.v1alpha.CreateJobRequest;
+import com.google.cloud.batch.v1alpha.DeleteJobRequest;
+import com.google.cloud.batch.v1alpha.GetJobRequest;
+import com.google.cloud.batch.v1alpha.GetTaskRequest;
+import com.google.cloud.batch.v1alpha.Job;
+import com.google.cloud.batch.v1alpha.ListJobsRequest;
+import com.google.cloud.batch.v1alpha.ListJobsResponse;
+import com.google.cloud.batch.v1alpha.ListTasksRequest;
+import com.google.cloud.batch.v1alpha.ListTasksResponse;
+import com.google.cloud.batch.v1alpha.OperationMetadata;
+import com.google.cloud.batch.v1alpha.Task;
+import com.google.longrunning.Operation;
+import com.google.longrunning.stub.OperationsStub;
+import com.google.protobuf.Empty;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * Base stub class for the BatchService service API.
+ *
+ * This class is for advanced usage and reflects the underlying API directly.
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public abstract class BatchServiceStub implements BackgroundResource {
+
+ public OperationsStub getOperationsStub() {
+ throw new UnsupportedOperationException("Not implemented: getOperationsStub()");
+ }
+
+ public UnaryCallable createJobCallable() {
+ throw new UnsupportedOperationException("Not implemented: createJobCallable()");
+ }
+
+ public UnaryCallable getJobCallable() {
+ throw new UnsupportedOperationException("Not implemented: getJobCallable()");
+ }
+
+ public OperationCallable
+ deleteJobOperationCallable() {
+ throw new UnsupportedOperationException("Not implemented: deleteJobOperationCallable()");
+ }
+
+ public UnaryCallable deleteJobCallable() {
+ throw new UnsupportedOperationException("Not implemented: deleteJobCallable()");
+ }
+
+ public UnaryCallable listJobsPagedCallable() {
+ throw new UnsupportedOperationException("Not implemented: listJobsPagedCallable()");
+ }
+
+ public UnaryCallable listJobsCallable() {
+ throw new UnsupportedOperationException("Not implemented: listJobsCallable()");
+ }
+
+ public UnaryCallable getTaskCallable() {
+ throw new UnsupportedOperationException("Not implemented: getTaskCallable()");
+ }
+
+ public UnaryCallable listTasksPagedCallable() {
+ throw new UnsupportedOperationException("Not implemented: listTasksPagedCallable()");
+ }
+
+ public UnaryCallable listTasksCallable() {
+ throw new UnsupportedOperationException("Not implemented: listTasksCallable()");
+ }
+
+ @Override
+ public abstract void close();
+}
diff --git a/google-cloud-batch/src/main/java/com/google/cloud/batch/v1alpha/stub/BatchServiceStubSettings.java b/google-cloud-batch/src/main/java/com/google/cloud/batch/v1alpha/stub/BatchServiceStubSettings.java
new file mode 100644
index 0000000..e21896b
--- /dev/null
+++ b/google-cloud-batch/src/main/java/com/google/cloud/batch/v1alpha/stub/BatchServiceStubSettings.java
@@ -0,0 +1,582 @@
+/*
+ * 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.batch.v1alpha.stub;
+
+import static com.google.cloud.batch.v1alpha.BatchServiceClient.ListJobsPagedResponse;
+import static com.google.cloud.batch.v1alpha.BatchServiceClient.ListTasksPagedResponse;
+
+import com.google.api.core.ApiFunction;
+import com.google.api.core.ApiFuture;
+import com.google.api.core.BetaApi;
+import com.google.api.gax.core.GaxProperties;
+import com.google.api.gax.core.GoogleCredentialsProvider;
+import com.google.api.gax.core.InstantiatingExecutorProvider;
+import com.google.api.gax.grpc.GaxGrpcProperties;
+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.longrunning.OperationSnapshot;
+import com.google.api.gax.longrunning.OperationTimedPollAlgorithm;
+import com.google.api.gax.retrying.RetrySettings;
+import com.google.api.gax.rpc.ApiCallContext;
+import com.google.api.gax.rpc.ApiClientHeaderProvider;
+import com.google.api.gax.rpc.ClientContext;
+import com.google.api.gax.rpc.OperationCallSettings;
+import com.google.api.gax.rpc.PageContext;
+import com.google.api.gax.rpc.PagedCallSettings;
+import com.google.api.gax.rpc.PagedListDescriptor;
+import com.google.api.gax.rpc.PagedListResponseFactory;
+import com.google.api.gax.rpc.StatusCode;
+import com.google.api.gax.rpc.StubSettings;
+import com.google.api.gax.rpc.TransportChannelProvider;
+import com.google.api.gax.rpc.UnaryCallSettings;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.cloud.batch.v1alpha.CreateJobRequest;
+import com.google.cloud.batch.v1alpha.DeleteJobRequest;
+import com.google.cloud.batch.v1alpha.GetJobRequest;
+import com.google.cloud.batch.v1alpha.GetTaskRequest;
+import com.google.cloud.batch.v1alpha.Job;
+import com.google.cloud.batch.v1alpha.ListJobsRequest;
+import com.google.cloud.batch.v1alpha.ListJobsResponse;
+import com.google.cloud.batch.v1alpha.ListTasksRequest;
+import com.google.cloud.batch.v1alpha.ListTasksResponse;
+import com.google.cloud.batch.v1alpha.OperationMetadata;
+import com.google.cloud.batch.v1alpha.Task;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Lists;
+import com.google.longrunning.Operation;
+import com.google.protobuf.Empty;
+import java.io.IOException;
+import java.util.List;
+import javax.annotation.Generated;
+import org.threeten.bp.Duration;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * Settings class to configure an instance of {@link BatchServiceStub}.
+ *
+ * The default instance has everything set to sensible defaults:
+ *
+ *
+ * - The default service address (batch.googleapis.com) and default port (443) are used.
+ *
- Credentials are acquired automatically through Application Default Credentials.
+ *
- Retries are configured for idempotent methods but not for non-idempotent methods.
+ *
+ *
+ * The builder of this class is recursive, so contained classes are themselves builders. When
+ * build() is called, the tree of builders is called to create the complete settings object.
+ *
+ *
For example, to set the total timeout of createJob to 30 seconds:
+ *
+ *
{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * BatchServiceStubSettings.Builder batchServiceSettingsBuilder =
+ * BatchServiceStubSettings.newBuilder();
+ * batchServiceSettingsBuilder
+ * .createJobSettings()
+ * .setRetrySettings(
+ * batchServiceSettingsBuilder
+ * .createJobSettings()
+ * .getRetrySettings()
+ * .toBuilder()
+ * .setTotalTimeout(Duration.ofSeconds(30))
+ * .build());
+ * BatchServiceStubSettings batchServiceSettings = batchServiceSettingsBuilder.build();
+ * }
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public class BatchServiceStubSettings extends StubSettings {
+ /** The default scopes of the service. */
+ private static final ImmutableList DEFAULT_SERVICE_SCOPES =
+ ImmutableList.builder().add("https://www.googleapis.com/auth/cloud-platform").build();
+
+ private final UnaryCallSettings createJobSettings;
+ private final UnaryCallSettings getJobSettings;
+ private final UnaryCallSettings deleteJobSettings;
+ private final OperationCallSettings
+ deleteJobOperationSettings;
+ private final PagedCallSettings
+ listJobsSettings;
+ private final UnaryCallSettings getTaskSettings;
+ private final PagedCallSettings
+ listTasksSettings;
+
+ private static final PagedListDescriptor
+ LIST_JOBS_PAGE_STR_DESC =
+ new PagedListDescriptor() {
+ @Override
+ public String emptyToken() {
+ return "";
+ }
+
+ @Override
+ public ListJobsRequest injectToken(ListJobsRequest payload, String token) {
+ return ListJobsRequest.newBuilder(payload).setPageToken(token).build();
+ }
+
+ @Override
+ public ListJobsRequest injectPageSize(ListJobsRequest payload, int pageSize) {
+ return ListJobsRequest.newBuilder(payload).setPageSize(pageSize).build();
+ }
+
+ @Override
+ public Integer extractPageSize(ListJobsRequest payload) {
+ return payload.getPageSize();
+ }
+
+ @Override
+ public String extractNextToken(ListJobsResponse payload) {
+ return payload.getNextPageToken();
+ }
+
+ @Override
+ public Iterable extractResources(ListJobsResponse payload) {
+ return payload.getJobsList() == null
+ ? ImmutableList.of()
+ : payload.getJobsList();
+ }
+ };
+
+ private static final PagedListDescriptor
+ LIST_TASKS_PAGE_STR_DESC =
+ new PagedListDescriptor() {
+ @Override
+ public String emptyToken() {
+ return "";
+ }
+
+ @Override
+ public ListTasksRequest injectToken(ListTasksRequest payload, String token) {
+ return ListTasksRequest.newBuilder(payload).setPageToken(token).build();
+ }
+
+ @Override
+ public ListTasksRequest injectPageSize(ListTasksRequest payload, int pageSize) {
+ return ListTasksRequest.newBuilder(payload).setPageSize(pageSize).build();
+ }
+
+ @Override
+ public Integer extractPageSize(ListTasksRequest payload) {
+ return payload.getPageSize();
+ }
+
+ @Override
+ public String extractNextToken(ListTasksResponse payload) {
+ return payload.getNextPageToken();
+ }
+
+ @Override
+ public Iterable extractResources(ListTasksResponse payload) {
+ return payload.getTasksList() == null
+ ? ImmutableList.of()
+ : payload.getTasksList();
+ }
+ };
+
+ private static final PagedListResponseFactory<
+ ListJobsRequest, ListJobsResponse, ListJobsPagedResponse>
+ LIST_JOBS_PAGE_STR_FACT =
+ new PagedListResponseFactory() {
+ @Override
+ public ApiFuture getFuturePagedResponse(
+ UnaryCallable callable,
+ ListJobsRequest request,
+ ApiCallContext context,
+ ApiFuture futureResponse) {
+ PageContext pageContext =
+ PageContext.create(callable, LIST_JOBS_PAGE_STR_DESC, request, context);
+ return ListJobsPagedResponse.createAsync(pageContext, futureResponse);
+ }
+ };
+
+ private static final PagedListResponseFactory<
+ ListTasksRequest, ListTasksResponse, ListTasksPagedResponse>
+ LIST_TASKS_PAGE_STR_FACT =
+ new PagedListResponseFactory<
+ ListTasksRequest, ListTasksResponse, ListTasksPagedResponse>() {
+ @Override
+ public ApiFuture getFuturePagedResponse(
+ UnaryCallable callable,
+ ListTasksRequest request,
+ ApiCallContext context,
+ ApiFuture futureResponse) {
+ PageContext pageContext =
+ PageContext.create(callable, LIST_TASKS_PAGE_STR_DESC, request, context);
+ return ListTasksPagedResponse.createAsync(pageContext, futureResponse);
+ }
+ };
+
+ /** Returns the object with the settings used for calls to createJob. */
+ public UnaryCallSettings createJobSettings() {
+ return createJobSettings;
+ }
+
+ /** Returns the object with the settings used for calls to getJob. */
+ public UnaryCallSettings getJobSettings() {
+ return getJobSettings;
+ }
+
+ /** Returns the object with the settings used for calls to deleteJob. */
+ public UnaryCallSettings deleteJobSettings() {
+ return deleteJobSettings;
+ }
+
+ /** Returns the object with the settings used for calls to deleteJob. */
+ public OperationCallSettings
+ deleteJobOperationSettings() {
+ return deleteJobOperationSettings;
+ }
+
+ /** Returns the object with the settings used for calls to listJobs. */
+ public PagedCallSettings
+ listJobsSettings() {
+ return listJobsSettings;
+ }
+
+ /** Returns the object with the settings used for calls to getTask. */
+ public UnaryCallSettings getTaskSettings() {
+ return getTaskSettings;
+ }
+
+ /** Returns the object with the settings used for calls to listTasks. */
+ public PagedCallSettings
+ listTasksSettings() {
+ return listTasksSettings;
+ }
+
+ public BatchServiceStub createStub() throws IOException {
+ if (getTransportChannelProvider()
+ .getTransportName()
+ .equals(GrpcTransportChannel.getGrpcTransportName())) {
+ return GrpcBatchServiceStub.create(this);
+ }
+ throw new UnsupportedOperationException(
+ String.format(
+ "Transport not supported: %s", getTransportChannelProvider().getTransportName()));
+ }
+
+ /** Returns a builder for the default ExecutorProvider for this service. */
+ public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() {
+ return InstantiatingExecutorProvider.newBuilder();
+ }
+
+ /** Returns the default service endpoint. */
+ public static String getDefaultEndpoint() {
+ return "batch.googleapis.com:443";
+ }
+
+ /** Returns the default mTLS service endpoint. */
+ public static String getDefaultMtlsEndpoint() {
+ return "batch.mtls.googleapis.com:443";
+ }
+
+ /** Returns the default service scopes. */
+ public static List getDefaultServiceScopes() {
+ return DEFAULT_SERVICE_SCOPES;
+ }
+
+ /** Returns a builder for the default credentials for this service. */
+ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
+ return GoogleCredentialsProvider.newBuilder()
+ .setScopesToApply(DEFAULT_SERVICE_SCOPES)
+ .setUseJwtAccessWithScope(true);
+ }
+
+ /** Returns a builder for the default ChannelProvider for this service. */
+ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
+ return InstantiatingGrpcChannelProvider.newBuilder()
+ .setMaxInboundMessageSize(Integer.MAX_VALUE);
+ }
+
+ 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() {
+ return ApiClientHeaderProvider.newBuilder()
+ .setGeneratedLibToken(
+ "gapic", GaxProperties.getLibraryVersion(BatchServiceStubSettings.class))
+ .setTransportToken(
+ GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion());
+ }
+
+ /** Returns a new builder for this class. */
+ public static Builder newBuilder() {
+ return Builder.createDefault();
+ }
+
+ /** Returns a new builder for this class. */
+ public static Builder newBuilder(ClientContext clientContext) {
+ return new Builder(clientContext);
+ }
+
+ /** Returns a builder containing all the values of this settings class. */
+ public Builder toBuilder() {
+ return new Builder(this);
+ }
+
+ protected BatchServiceStubSettings(Builder settingsBuilder) throws IOException {
+ super(settingsBuilder);
+
+ createJobSettings = settingsBuilder.createJobSettings().build();
+ getJobSettings = settingsBuilder.getJobSettings().build();
+ deleteJobSettings = settingsBuilder.deleteJobSettings().build();
+ deleteJobOperationSettings = settingsBuilder.deleteJobOperationSettings().build();
+ listJobsSettings = settingsBuilder.listJobsSettings().build();
+ getTaskSettings = settingsBuilder.getTaskSettings().build();
+ listTasksSettings = settingsBuilder.listTasksSettings().build();
+ }
+
+ /** Builder for BatchServiceStubSettings. */
+ public static class Builder extends StubSettings.Builder {
+ private final ImmutableList> unaryMethodSettingsBuilders;
+ private final UnaryCallSettings.Builder createJobSettings;
+ private final UnaryCallSettings.Builder getJobSettings;
+ private final UnaryCallSettings.Builder deleteJobSettings;
+ private final OperationCallSettings.Builder
+ deleteJobOperationSettings;
+ private final PagedCallSettings.Builder<
+ ListJobsRequest, ListJobsResponse, ListJobsPagedResponse>
+ listJobsSettings;
+ private final UnaryCallSettings.Builder getTaskSettings;
+ private final PagedCallSettings.Builder<
+ ListTasksRequest, ListTasksResponse, ListTasksPagedResponse>
+ listTasksSettings;
+ private static final ImmutableMap>
+ RETRYABLE_CODE_DEFINITIONS;
+
+ static {
+ ImmutableMap.Builder> definitions =
+ ImmutableMap.builder();
+ definitions.put(
+ "no_retry_1_codes", ImmutableSet.copyOf(Lists.newArrayList()));
+ definitions.put(
+ "retry_policy_0_codes",
+ ImmutableSet.copyOf(Lists.newArrayList(StatusCode.Code.UNAVAILABLE)));
+ RETRYABLE_CODE_DEFINITIONS = definitions.build();
+ }
+
+ private static final ImmutableMap RETRY_PARAM_DEFINITIONS;
+
+ static {
+ ImmutableMap.Builder definitions = ImmutableMap.builder();
+ RetrySettings settings = null;
+ settings =
+ RetrySettings.newBuilder()
+ .setInitialRpcTimeout(Duration.ofMillis(60000L))
+ .setRpcTimeoutMultiplier(1.0)
+ .setMaxRpcTimeout(Duration.ofMillis(60000L))
+ .setTotalTimeout(Duration.ofMillis(60000L))
+ .build();
+ definitions.put("no_retry_1_params", settings);
+ settings =
+ RetrySettings.newBuilder()
+ .setInitialRetryDelay(Duration.ofMillis(1000L))
+ .setRetryDelayMultiplier(1.3)
+ .setMaxRetryDelay(Duration.ofMillis(10000L))
+ .setInitialRpcTimeout(Duration.ofMillis(60000L))
+ .setRpcTimeoutMultiplier(1.0)
+ .setMaxRpcTimeout(Duration.ofMillis(60000L))
+ .setTotalTimeout(Duration.ofMillis(60000L))
+ .build();
+ definitions.put("retry_policy_0_params", settings);
+ RETRY_PARAM_DEFINITIONS = definitions.build();
+ }
+
+ protected Builder() {
+ this(((ClientContext) null));
+ }
+
+ protected Builder(ClientContext clientContext) {
+ super(clientContext);
+
+ createJobSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
+ getJobSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
+ deleteJobSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
+ deleteJobOperationSettings = OperationCallSettings.newBuilder();
+ listJobsSettings = PagedCallSettings.newBuilder(LIST_JOBS_PAGE_STR_FACT);
+ getTaskSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
+ listTasksSettings = PagedCallSettings.newBuilder(LIST_TASKS_PAGE_STR_FACT);
+
+ unaryMethodSettingsBuilders =
+ ImmutableList.>of(
+ createJobSettings,
+ getJobSettings,
+ deleteJobSettings,
+ listJobsSettings,
+ getTaskSettings,
+ listTasksSettings);
+ initDefaults(this);
+ }
+
+ protected Builder(BatchServiceStubSettings settings) {
+ super(settings);
+
+ createJobSettings = settings.createJobSettings.toBuilder();
+ getJobSettings = settings.getJobSettings.toBuilder();
+ deleteJobSettings = settings.deleteJobSettings.toBuilder();
+ deleteJobOperationSettings = settings.deleteJobOperationSettings.toBuilder();
+ listJobsSettings = settings.listJobsSettings.toBuilder();
+ getTaskSettings = settings.getTaskSettings.toBuilder();
+ listTasksSettings = settings.listTasksSettings.toBuilder();
+
+ unaryMethodSettingsBuilders =
+ ImmutableList.>of(
+ createJobSettings,
+ getJobSettings,
+ deleteJobSettings,
+ listJobsSettings,
+ getTaskSettings,
+ listTasksSettings);
+ }
+
+ private static Builder createDefault() {
+ Builder builder = new Builder(((ClientContext) null));
+
+ builder.setTransportChannelProvider(defaultTransportChannelProvider());
+ builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
+ builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build());
+ builder.setEndpoint(getDefaultEndpoint());
+ builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
+ builder.setSwitchToMtlsEndpointAllowed(true);
+
+ return initDefaults(builder);
+ }
+
+ private static Builder initDefaults(Builder builder) {
+ builder
+ .createJobSettings()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params"));
+
+ builder
+ .getJobSettings()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));
+
+ builder
+ .deleteJobSettings()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params"));
+
+ builder
+ .listJobsSettings()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));
+
+ builder
+ .getTaskSettings()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));
+
+ builder
+ .listTasksSettings()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));
+
+ builder
+ .deleteJobOperationSettings()
+ .setInitialCallSettings(
+ UnaryCallSettings.newUnaryCallSettingsBuilder()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params"))
+ .build())
+ .setResponseTransformer(
+ ProtoOperationTransformers.ResponseTransformer.create(Empty.class))
+ .setMetadataTransformer(
+ ProtoOperationTransformers.MetadataTransformer.create(OperationMetadata.class))
+ .setPollingAlgorithm(
+ OperationTimedPollAlgorithm.create(
+ RetrySettings.newBuilder()
+ .setInitialRetryDelay(Duration.ofMillis(5000L))
+ .setRetryDelayMultiplier(1.5)
+ .setMaxRetryDelay(Duration.ofMillis(45000L))
+ .setInitialRpcTimeout(Duration.ZERO)
+ .setRpcTimeoutMultiplier(1.0)
+ .setMaxRpcTimeout(Duration.ZERO)
+ .setTotalTimeout(Duration.ofMillis(300000L))
+ .build()));
+
+ return builder;
+ }
+
+ /**
+ * Applies the given settings updater function to all of the unary API methods in this service.
+ *
+ * Note: This method does not support applying settings to streaming methods.
+ */
+ public Builder applyToAllUnaryMethods(
+ ApiFunction, Void> settingsUpdater) {
+ super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater);
+ return this;
+ }
+
+ public ImmutableList> unaryMethodSettingsBuilders() {
+ return unaryMethodSettingsBuilders;
+ }
+
+ /** Returns the builder for the settings used for calls to createJob. */
+ public UnaryCallSettings.Builder createJobSettings() {
+ return createJobSettings;
+ }
+
+ /** Returns the builder for the settings used for calls to getJob. */
+ public UnaryCallSettings.Builder getJobSettings() {
+ return getJobSettings;
+ }
+
+ /** Returns the builder for the settings used for calls to deleteJob. */
+ public UnaryCallSettings.Builder deleteJobSettings() {
+ return deleteJobSettings;
+ }
+
+ /** Returns the builder for the settings used for calls to deleteJob. */
+ @BetaApi(
+ "The surface for use by generated code is not stable yet and may change in the future.")
+ public OperationCallSettings.Builder
+ deleteJobOperationSettings() {
+ return deleteJobOperationSettings;
+ }
+
+ /** Returns the builder for the settings used for calls to listJobs. */
+ public PagedCallSettings.Builder
+ listJobsSettings() {
+ return listJobsSettings;
+ }
+
+ /** Returns the builder for the settings used for calls to getTask. */
+ public UnaryCallSettings.Builder getTaskSettings() {
+ return getTaskSettings;
+ }
+
+ /** Returns the builder for the settings used for calls to listTasks. */
+ public PagedCallSettings.Builder
+ listTasksSettings() {
+ return listTasksSettings;
+ }
+
+ @Override
+ public BatchServiceStubSettings build() throws IOException {
+ return new BatchServiceStubSettings(this);
+ }
+ }
+}
diff --git a/google-cloud-batch/src/main/java/com/google/cloud/batch/v1alpha/stub/GrpcBatchServiceCallableFactory.java b/google-cloud-batch/src/main/java/com/google/cloud/batch/v1alpha/stub/GrpcBatchServiceCallableFactory.java
new file mode 100644
index 0000000..df78b47
--- /dev/null
+++ b/google-cloud-batch/src/main/java/com/google/cloud/batch/v1alpha/stub/GrpcBatchServiceCallableFactory.java
@@ -0,0 +1,115 @@
+/*
+ * 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.batch.v1alpha.stub;
+
+import com.google.api.core.BetaApi;
+import com.google.api.gax.grpc.GrpcCallSettings;
+import com.google.api.gax.grpc.GrpcCallableFactory;
+import com.google.api.gax.grpc.GrpcStubCallableFactory;
+import com.google.api.gax.rpc.BatchingCallSettings;
+import com.google.api.gax.rpc.BidiStreamingCallable;
+import com.google.api.gax.rpc.ClientContext;
+import com.google.api.gax.rpc.ClientStreamingCallable;
+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.StreamingCallSettings;
+import com.google.api.gax.rpc.UnaryCallSettings;
+import com.google.api.gax.rpc.UnaryCallable;
+import com.google.longrunning.Operation;
+import com.google.longrunning.stub.OperationsStub;
+import javax.annotation.Generated;
+
+// AUTO-GENERATED DOCUMENTATION AND CLASS.
+/**
+ * gRPC callable factory implementation for the BatchService service API.
+ *
+ * This class is for advanced usage.
+ */
+@BetaApi
+@Generated("by gapic-generator-java")
+public class GrpcBatchServiceCallableFactory implements GrpcStubCallableFactory {
+
+ @Override
+ public UnaryCallable createUnaryCallable(
+ GrpcCallSettings grpcCallSettings,
+ UnaryCallSettings callSettings,
+ ClientContext clientContext) {
+ return GrpcCallableFactory.createUnaryCallable(grpcCallSettings, callSettings, clientContext);
+ }
+
+ @Override
+ public
+ UnaryCallable createPagedCallable(
+ GrpcCallSettings grpcCallSettings,
+ PagedCallSettings callSettings,
+ ClientContext clientContext) {
+ return GrpcCallableFactory.createPagedCallable(grpcCallSettings, callSettings, clientContext);
+ }
+
+ @Override
+ public UnaryCallable createBatchingCallable(
+ GrpcCallSettings grpcCallSettings,
+ BatchingCallSettings callSettings,
+ ClientContext clientContext) {
+ return GrpcCallableFactory.createBatchingCallable(
+ grpcCallSettings, callSettings, clientContext);
+ }
+
+ @Override
+ public
+ OperationCallable