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()) { + * ListLocationsRequest request = + * ListLocationsRequest.newBuilder() + * .setName("name3373707") + * .setFilter("filter-1274492040") + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * for (Location element : batchServiceClient.listLocations(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 ListLocationsPagedResponse listLocations(ListLocationsRequest request) { + return listLocationsPagedCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Lists information about the supported locations for this service. + * + *
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()) { + * ListLocationsRequest request = + * ListLocationsRequest.newBuilder() + * .setName("name3373707") + * .setFilter("filter-1274492040") + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = + * batchServiceClient.listLocationsPagedCallable().futureCall(request); + * // Do something. + * for (Location element : future.get().iterateAll()) { + * // doThingsWith(element); + * } + * } + * }
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()) { + * ListLocationsRequest request = + * ListLocationsRequest.newBuilder() + * .setName("name3373707") + * .setFilter("filter-1274492040") + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * while (true) { + * ListLocationsResponse response = batchServiceClient.listLocationsCallable().call(request); + * for (Location element : response.getLocationsList()) { + * // doThingsWith(element); + * } + * String nextPageToken = response.getNextPageToken(); + * if (!Strings.isNullOrEmpty(nextPageToken)) { + * request = request.toBuilder().setPageToken(nextPageToken).build(); + * } else { + * break; + * } + * } + * } + * }+ */ + public final UnaryCallable
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()) { + * GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + * Location response = batchServiceClient.getLocation(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 Location getLocation(GetLocationRequest request) { + return getLocationCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets information about a location. + * + *
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()) { + * GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build(); + * ApiFuture+ */ + public final UnaryCallablefuture = batchServiceClient.getLocationCallable().futureCall(request); + * // Do something. + * Location response = future.get(); + * } + * }
Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors. + * + *
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()) { + * SetIamPolicyRequest request = + * SetIamPolicyRequest.newBuilder() + * .setResource(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + * .setPolicy(Policy.newBuilder().build()) + * .setUpdateMask(FieldMask.newBuilder().build()) + * .build(); + * Policy response = batchServiceClient.setIamPolicy(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 Policy setIamPolicy(SetIamPolicyRequest request) { + return setIamPolicyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Sets the access control policy on the specified resource. Replacesany existing policy. + * + *
Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors. + * + *
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()) { + * SetIamPolicyRequest request = + * SetIamPolicyRequest.newBuilder() + * .setResource(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + * .setPolicy(Policy.newBuilder().build()) + * .setUpdateMask(FieldMask.newBuilder().build()) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = batchServiceClient.setIamPolicyCallable().futureCall(request); + * // Do something. + * Policy response = future.get(); + * } + * }
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()) { + * GetIamPolicyRequest request = + * GetIamPolicyRequest.newBuilder() + * .setResource(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + * .setOptions(GetPolicyOptions.newBuilder().build()) + * .build(); + * Policy response = batchServiceClient.getIamPolicy(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 Policy getIamPolicy(GetIamPolicyRequest request) { + return getIamPolicyCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Gets the access control policy for a resource. Returns an empty policyif the resource exists + * and does not have a policy set. + * + *
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()) { + * GetIamPolicyRequest request = + * GetIamPolicyRequest.newBuilder() + * .setResource(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + * .setOptions(GetPolicyOptions.newBuilder().build()) + * .build(); + * ApiFuture+ */ + public final UnaryCallablefuture = batchServiceClient.getIamPolicyCallable().futureCall(request); + * // Do something. + * Policy response = future.get(); + * } + * }
Note: This operation is designed to be used for buildingpermission-aware UIs and + * command-line tools, not for authorizationchecking. This operation may "fail open" without + * warning. + * + *
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()) { + * TestIamPermissionsRequest request = + * TestIamPermissionsRequest.newBuilder() + * .setResource(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + * .addAllPermissions(new ArrayList+ * + * @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 TestIamPermissionsResponse testIamPermissions(TestIamPermissionsRequest request) { + return testIamPermissionsCallable().call(request); + } + + // AUTO-GENERATED DOCUMENTATION AND METHOD. + /** + * Returns permissions that a caller has on the specified resource. If theresource does not exist, + * this will return an empty set ofpermissions, not a `NOT_FOUND` error. + * + *()) + * .build(); + * TestIamPermissionsResponse response = batchServiceClient.testIamPermissions(request); + * } + * }
Note: This operation is designed to be used for buildingpermission-aware UIs and + * command-line tools, not for authorizationchecking. This operation may "fail open" without + * warning. + * + *
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()) { + * TestIamPermissionsRequest request = + * TestIamPermissionsRequest.newBuilder() + * .setResource(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString()) + * .addAllPermissions(new ArrayList+ */ + public final UnaryCallable()) + * .build(); + * ApiFuture future = + * batchServiceClient.testIamPermissionsCallable().futureCall(request); + * // Do something. + * TestIamPermissionsResponse response = future.get(); + * } + * }
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.
*/
@BetaApi
@@ -112,7 +135,8 @@
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 {
@@ -143,13 +167,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() {
@@ -164,10 +192,19 @@ 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.
+ */
+ @BetaApi
+ public final OperationsClient getHttpJsonOperationsClient() {
+ return httpJsonOperationsClient;
+ }
+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Create a Job.
@@ -868,6 +905,319 @@ public final UnaryCallable Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors.
+ *
+ * Sample code:
+ *
+ * Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors.
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Sample code:
+ *
+ * Note: This operation is designed to be used for buildingpermission-aware UIs and
+ * command-line tools, not for authorizationchecking. This operation may "fail open" without
+ * warning.
+ *
+ * Sample code:
+ *
+ * Note: This operation is designed to be used for buildingpermission-aware UIs and
+ * command-line tools, not for authorizationchecking. This operation may "fail open" without
+ * warning.
+ *
+ * Sample code:
+ *
+ * The interfaces provided are listed below, along with usage samples.
*
* ======================= BatchServiceClient =======================
*
diff --git a/java-batch/google-cloud-batch/src/main/java/com/google/cloud/batch/v1alpha/stub/BatchServiceStub.java b/java-batch/google-cloud-batch/src/main/java/com/google/cloud/batch/v1alpha/stub/BatchServiceStub.java
index 44de4c2ca901..0b3397bc8070 100644
--- a/java-batch/google-cloud-batch/src/main/java/com/google/cloud/batch/v1alpha/stub/BatchServiceStub.java
+++ b/java-batch/google-cloud-batch/src/main/java/com/google/cloud/batch/v1alpha/stub/BatchServiceStub.java
@@ -17,6 +17,7 @@
package com.google.cloud.batch.v1alpha.stub;
import static com.google.cloud.batch.v1alpha.BatchServiceClient.ListJobsPagedResponse;
+import static com.google.cloud.batch.v1alpha.BatchServiceClient.ListLocationsPagedResponse;
import static com.google.cloud.batch.v1alpha.BatchServiceClient.ListTasksPagedResponse;
import com.google.api.core.BetaApi;
@@ -34,6 +35,15 @@
import com.google.cloud.batch.v1alpha.ListTasksResponse;
import com.google.cloud.batch.v1alpha.OperationMetadata;
import com.google.cloud.batch.v1alpha.Task;
+import com.google.cloud.location.GetLocationRequest;
+import com.google.cloud.location.ListLocationsRequest;
+import com.google.cloud.location.ListLocationsResponse;
+import com.google.cloud.location.Location;
+import com.google.iam.v1.GetIamPolicyRequest;
+import com.google.iam.v1.Policy;
+import com.google.iam.v1.SetIamPolicyRequest;
+import com.google.iam.v1.TestIamPermissionsRequest;
+import com.google.iam.v1.TestIamPermissionsResponse;
import com.google.longrunning.Operation;
import com.google.longrunning.stub.OperationsStub;
import com.google.protobuf.Empty;
@@ -50,7 +60,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{@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()) {
+ * ListLocationsRequest request =
+ * ListLocationsRequest.newBuilder()
+ * .setName("name3373707")
+ * .setFilter("filter-1274492040")
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .build();
+ * for (Location element : batchServiceClient.listLocations(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 ListLocationsPagedResponse listLocations(ListLocationsRequest request) {
+ return listLocationsPagedCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Lists information about the supported locations for this service.
+ *
+ * {@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()) {
+ * ListLocationsRequest request =
+ * ListLocationsRequest.newBuilder()
+ * .setName("name3373707")
+ * .setFilter("filter-1274492040")
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .build();
+ * ApiFuture
+ */
+ public final UnaryCallable{@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()) {
+ * ListLocationsRequest request =
+ * ListLocationsRequest.newBuilder()
+ * .setName("name3373707")
+ * .setFilter("filter-1274492040")
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .build();
+ * while (true) {
+ * ListLocationsResponse response = batchServiceClient.listLocationsCallable().call(request);
+ * for (Location element : response.getLocationsList()) {
+ * // doThingsWith(element);
+ * }
+ * String nextPageToken = response.getNextPageToken();
+ * if (!Strings.isNullOrEmpty(nextPageToken)) {
+ * request = request.toBuilder().setPageToken(nextPageToken).build();
+ * } else {
+ * break;
+ * }
+ * }
+ * }
+ * }
+ */
+ public final UnaryCallable{@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()) {
+ * GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+ * Location response = batchServiceClient.getLocation(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 Location getLocation(GetLocationRequest request) {
+ return getLocationCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Gets information about a location.
+ *
+ * {@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()) {
+ * GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+ * ApiFuture
+ */
+ public final UnaryCallable{@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()) {
+ * SetIamPolicyRequest request =
+ * SetIamPolicyRequest.newBuilder()
+ * .setResource(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+ * .setPolicy(Policy.newBuilder().build())
+ * .setUpdateMask(FieldMask.newBuilder().build())
+ * .build();
+ * Policy response = batchServiceClient.setIamPolicy(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 Policy setIamPolicy(SetIamPolicyRequest request) {
+ return setIamPolicyCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Sets the access control policy on the specified resource. Replacesany existing policy.
+ *
+ * {@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()) {
+ * SetIamPolicyRequest request =
+ * SetIamPolicyRequest.newBuilder()
+ * .setResource(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+ * .setPolicy(Policy.newBuilder().build())
+ * .setUpdateMask(FieldMask.newBuilder().build())
+ * .build();
+ * ApiFuture
+ */
+ public final UnaryCallable{@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()) {
+ * GetIamPolicyRequest request =
+ * GetIamPolicyRequest.newBuilder()
+ * .setResource(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+ * .setOptions(GetPolicyOptions.newBuilder().build())
+ * .build();
+ * Policy response = batchServiceClient.getIamPolicy(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 Policy getIamPolicy(GetIamPolicyRequest request) {
+ return getIamPolicyCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Gets the access control policy for a resource. Returns an empty policyif the resource exists
+ * and does not have a policy set.
+ *
+ * {@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()) {
+ * GetIamPolicyRequest request =
+ * GetIamPolicyRequest.newBuilder()
+ * .setResource(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+ * .setOptions(GetPolicyOptions.newBuilder().build())
+ * .build();
+ * ApiFuture
+ */
+ public final UnaryCallable{@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()) {
+ * TestIamPermissionsRequest request =
+ * TestIamPermissionsRequest.newBuilder()
+ * .setResource(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+ * .addAllPermissions(new ArrayList
+ *
+ * @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 TestIamPermissionsResponse testIamPermissions(TestIamPermissionsRequest request) {
+ return testIamPermissionsCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Returns permissions that a caller has on the specified resource. If theresource does not exist,
+ * this will return an empty set ofpermissions, not a `NOT_FOUND` error.
+ *
+ * {@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()) {
+ * TestIamPermissionsRequest request =
+ * TestIamPermissionsRequest.newBuilder()
+ * .setResource(JobName.of("[PROJECT]", "[LOCATION]", "[JOB]").toString())
+ * .addAllPermissions(new ArrayList
+ */
+ public final UnaryCallable