diff --git a/generation_config.yaml b/generation_config.yaml
index 80210954cf31..0b5a6a8a8211 100644
--- a/generation_config.yaml
+++ b/generation_config.yaml
@@ -1,6 +1,6 @@
gapic_generator_version: 2.38.1
protobuf_version: '25.2'
-googleapis_commitish: b0665ea5950660fca012c4cc8b7079dbc2d3f5dd
+googleapis_commitish: 0acc64cb759eb3a11c2230d42f24f1a35f81b178
owlbot_cli_image: sha256:623647ee79ac605858d09e60c1382a716c125fb776f69301b72de1cd35d49409
synthtool_commitish: 6612ab8f3afcd5e292aecd647f0fa68812c9f5b5
template_excludes:
diff --git a/java-batch/google-cloud-batch/src/main/java/com/google/cloud/batch/v1alpha/BatchServiceClient.java b/java-batch/google-cloud-batch/src/main/java/com/google/cloud/batch/v1alpha/BatchServiceClient.java
index 93d8438f1843..a46fb072eb8a 100644
--- a/java-batch/google-cloud-batch/src/main/java/com/google/cloud/batch/v1alpha/BatchServiceClient.java
+++ b/java-batch/google-cloud-batch/src/main/java/com/google/cloud/batch/v1alpha/BatchServiceClient.java
@@ -37,6 +37,7 @@
import com.google.common.util.concurrent.MoreExecutors;
import com.google.longrunning.Operation;
import com.google.protobuf.Empty;
+import com.google.protobuf.FieldMask;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.TimeUnit;
@@ -190,6 +191,102 @@
*
*
*
* ListLocations |
* Lists information about the supported locations for this service. |
*
@@ -1130,7 +1227,7 @@ public final UnaryCallable listTasksCallabl
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
- * Lists information about the supported locations for this service.
+ * Create a Resource Allowance.
*
* Sample code:
*
@@ -1141,29 +1238,42 @@ public final UnaryCallable listTasksCallabl
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* 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);
- * }
+ * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+ * ResourceAllowance resourceAllowance = ResourceAllowance.newBuilder().build();
+ * String resourceAllowanceId = "resourceAllowanceId-786470299";
+ * ResourceAllowance response =
+ * batchServiceClient.createResourceAllowance(
+ * parent, resourceAllowance, resourceAllowanceId);
* }
* }
*
- * @param request The request object containing all of the parameters for the API call.
+ * @param parent Required. The parent resource name where the ResourceAllowance will be created.
+ * Pattern: "projects/{project}/locations/{location}"
+ * @param resourceAllowance Required. The ResourceAllowance to create.
+ * @param resourceAllowanceId ID used to uniquely identify the ResourceAllowance within its parent
+ * scope. This field should contain at most 63 characters and must start with lowercase
+ * characters. Only lowercase characters, numbers and '-' 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 resource_allowance.name field in the request will be ignored and the created
+ * resource name of the ResourceAllowance will be
+ * "{parent}/resourceAllowances/{resource_allowance_id}".
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) {
- return listLocationsPagedCallable().call(request);
+ public final ResourceAllowance createResourceAllowance(
+ LocationName parent, ResourceAllowance resourceAllowance, String resourceAllowanceId) {
+ CreateResourceAllowanceRequest request =
+ CreateResourceAllowanceRequest.newBuilder()
+ .setParent(parent == null ? null : parent.toString())
+ .setResourceAllowance(resourceAllowance)
+ .setResourceAllowanceId(resourceAllowanceId)
+ .build();
+ return createResourceAllowance(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
- * Lists information about the supported locations for this service.
+ * Create a Resource Allowance.
*
* Sample code:
*
@@ -1174,30 +1284,73 @@ public final ListLocationsPagedResponse listLocations(ListLocationsRequest reque
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
- * ListLocationsRequest request =
- * ListLocationsRequest.newBuilder()
- * .setName("name3373707")
- * .setFilter("filter-1274492040")
- * .setPageSize(883849137)
- * .setPageToken("pageToken873572522")
+ * String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
+ * ResourceAllowance resourceAllowance = ResourceAllowance.newBuilder().build();
+ * String resourceAllowanceId = "resourceAllowanceId-786470299";
+ * ResourceAllowance response =
+ * batchServiceClient.createResourceAllowance(
+ * parent, resourceAllowance, resourceAllowanceId);
+ * }
+ * }
+ *
+ * @param parent Required. The parent resource name where the ResourceAllowance will be created.
+ * Pattern: "projects/{project}/locations/{location}"
+ * @param resourceAllowance Required. The ResourceAllowance to create.
+ * @param resourceAllowanceId ID used to uniquely identify the ResourceAllowance within its parent
+ * scope. This field should contain at most 63 characters and must start with lowercase
+ * characters. Only lowercase characters, numbers and '-' 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 resource_allowance.name field in the request will be ignored and the created
+ * resource name of the ResourceAllowance will be
+ * "{parent}/resourceAllowances/{resource_allowance_id}".
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ResourceAllowance createResourceAllowance(
+ String parent, ResourceAllowance resourceAllowance, String resourceAllowanceId) {
+ CreateResourceAllowanceRequest request =
+ CreateResourceAllowanceRequest.newBuilder()
+ .setParent(parent)
+ .setResourceAllowance(resourceAllowance)
+ .setResourceAllowanceId(resourceAllowanceId)
+ .build();
+ return createResourceAllowance(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Create a Resource Allowance.
+ *
+ * Sample code:
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
+ * CreateResourceAllowanceRequest request =
+ * CreateResourceAllowanceRequest.newBuilder()
+ * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+ * .setResourceAllowanceId("resourceAllowanceId-786470299")
+ * .setResourceAllowance(ResourceAllowance.newBuilder().build())
+ * .setRequestId("requestId693933066")
* .build();
- * ApiFuture future =
- * batchServiceClient.listLocationsPagedCallable().futureCall(request);
- * // Do something.
- * for (Location element : future.get().iterateAll()) {
- * // doThingsWith(element);
- * }
+ * ResourceAllowance response = batchServiceClient.createResourceAllowance(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 UnaryCallable
- listLocationsPagedCallable() {
- return stub.listLocationsPagedCallable();
+ public final ResourceAllowance createResourceAllowance(CreateResourceAllowanceRequest request) {
+ return createResourceAllowanceCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
- * Lists information about the supported locations for this service.
+ * Create a Resource Allowance.
*
* Sample code:
*
@@ -1208,35 +1361,28 @@ public final ListLocationsPagedResponse listLocations(ListLocationsRequest reque
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
- * ListLocationsRequest request =
- * ListLocationsRequest.newBuilder()
- * .setName("name3373707")
- * .setFilter("filter-1274492040")
- * .setPageSize(883849137)
- * .setPageToken("pageToken873572522")
+ * CreateResourceAllowanceRequest request =
+ * CreateResourceAllowanceRequest.newBuilder()
+ * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+ * .setResourceAllowanceId("resourceAllowanceId-786470299")
+ * .setResourceAllowance(ResourceAllowance.newBuilder().build())
+ * .setRequestId("requestId693933066")
* .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;
- * }
- * }
+ * ApiFuture future =
+ * batchServiceClient.createResourceAllowanceCallable().futureCall(request);
+ * // Do something.
+ * ResourceAllowance response = future.get();
* }
* }
*/
- public final UnaryCallable listLocationsCallable() {
- return stub.listLocationsCallable();
+ public final UnaryCallable
+ createResourceAllowanceCallable() {
+ return stub.createResourceAllowanceCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
- * Gets information about a location.
+ * Get a ResourceAllowance specified by its resource name.
*
* Sample code:
*
@@ -1247,21 +1393,26 @@ public final UnaryCallable listLoca
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
- * GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
- * Location response = batchServiceClient.getLocation(request);
+ * ResourceAllowanceName name =
+ * ResourceAllowanceName.of("[PROJECT]", "[LOCATION]", "[RESOURCE_ALLOWANCE]");
+ * ResourceAllowance response = batchServiceClient.getResourceAllowance(name);
* }
* }
*
- * @param request The request object containing all of the parameters for the API call.
+ * @param name Required. ResourceAllowance name.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- public final Location getLocation(GetLocationRequest request) {
- return getLocationCallable().call(request);
+ public final ResourceAllowance getResourceAllowance(ResourceAllowanceName name) {
+ GetResourceAllowanceRequest request =
+ GetResourceAllowanceRequest.newBuilder()
+ .setName(name == null ? null : name.toString())
+ .build();
+ return getResourceAllowance(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
- * Gets information about a location.
+ * Get a ResourceAllowance specified by its resource name.
*
* Sample code:
*
@@ -1272,40 +1423,688 @@ public final Location getLocation(GetLocationRequest request) {
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
- * GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
- * ApiFuture future = batchServiceClient.getLocationCallable().futureCall(request);
- * // Do something.
- * Location response = future.get();
+ * String name =
+ * ResourceAllowanceName.of("[PROJECT]", "[LOCATION]", "[RESOURCE_ALLOWANCE]").toString();
+ * ResourceAllowance response = batchServiceClient.getResourceAllowance(name);
* }
* }
+ *
+ * @param name Required. ResourceAllowance name.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
- public final UnaryCallable getLocationCallable() {
- return stub.getLocationCallable();
+ public final ResourceAllowance getResourceAllowance(String name) {
+ GetResourceAllowanceRequest request =
+ GetResourceAllowanceRequest.newBuilder().setName(name).build();
+ return getResourceAllowance(request);
}
- @Override
- public final void close() {
- stub.close();
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Get a ResourceAllowance specified by its resource name.
+ *
+ * Sample code:
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
+ * GetResourceAllowanceRequest request =
+ * GetResourceAllowanceRequest.newBuilder()
+ * .setName(
+ * ResourceAllowanceName.of("[PROJECT]", "[LOCATION]", "[RESOURCE_ALLOWANCE]")
+ * .toString())
+ * .build();
+ * ResourceAllowance response = batchServiceClient.getResourceAllowance(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 ResourceAllowance getResourceAllowance(GetResourceAllowanceRequest request) {
+ return getResourceAllowanceCallable().call(request);
}
- @Override
- public void shutdown() {
- stub.shutdown();
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Get a ResourceAllowance specified by its resource name.
+ *
+ * Sample code:
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
+ * GetResourceAllowanceRequest request =
+ * GetResourceAllowanceRequest.newBuilder()
+ * .setName(
+ * ResourceAllowanceName.of("[PROJECT]", "[LOCATION]", "[RESOURCE_ALLOWANCE]")
+ * .toString())
+ * .build();
+ * ApiFuture future =
+ * batchServiceClient.getResourceAllowanceCallable().futureCall(request);
+ * // Do something.
+ * ResourceAllowance response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallable
+ getResourceAllowanceCallable() {
+ return stub.getResourceAllowanceCallable();
}
- @Override
- public boolean isShutdown() {
- return stub.isShutdown();
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Delete a ResourceAllowance.
+ *
+ * Sample code:
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
+ * ResourceAllowanceName name =
+ * ResourceAllowanceName.of("[PROJECT]", "[LOCATION]", "[RESOURCE_ALLOWANCE]");
+ * batchServiceClient.deleteResourceAllowanceAsync(name).get();
+ * }
+ * }
+ *
+ * @param name Required. ResourceAllowance name.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OperationFuture deleteResourceAllowanceAsync(
+ ResourceAllowanceName name) {
+ DeleteResourceAllowanceRequest request =
+ DeleteResourceAllowanceRequest.newBuilder()
+ .setName(name == null ? null : name.toString())
+ .build();
+ return deleteResourceAllowanceAsync(request);
}
- @Override
- public boolean isTerminated() {
- return stub.isTerminated();
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Delete a ResourceAllowance.
+ *
+ * Sample code:
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
+ * String name =
+ * ResourceAllowanceName.of("[PROJECT]", "[LOCATION]", "[RESOURCE_ALLOWANCE]").toString();
+ * batchServiceClient.deleteResourceAllowanceAsync(name).get();
+ * }
+ * }
+ *
+ * @param name Required. ResourceAllowance name.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final OperationFuture deleteResourceAllowanceAsync(String name) {
+ DeleteResourceAllowanceRequest request =
+ DeleteResourceAllowanceRequest.newBuilder().setName(name).build();
+ return deleteResourceAllowanceAsync(request);
}
- @Override
- public void shutdownNow() {
- stub.shutdownNow();
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Delete a ResourceAllowance.
+ *
+ * Sample code:
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
+ * DeleteResourceAllowanceRequest request =
+ * DeleteResourceAllowanceRequest.newBuilder()
+ * .setName(
+ * ResourceAllowanceName.of("[PROJECT]", "[LOCATION]", "[RESOURCE_ALLOWANCE]")
+ * .toString())
+ * .setReason("reason-934964668")
+ * .setRequestId("requestId693933066")
+ * .build();
+ * batchServiceClient.deleteResourceAllowanceAsync(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 deleteResourceAllowanceAsync(
+ DeleteResourceAllowanceRequest request) {
+ return deleteResourceAllowanceOperationCallable().futureCall(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Delete a ResourceAllowance.
+ *
+ * Sample code:
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
+ * DeleteResourceAllowanceRequest request =
+ * DeleteResourceAllowanceRequest.newBuilder()
+ * .setName(
+ * ResourceAllowanceName.of("[PROJECT]", "[LOCATION]", "[RESOURCE_ALLOWANCE]")
+ * .toString())
+ * .setReason("reason-934964668")
+ * .setRequestId("requestId693933066")
+ * .build();
+ * OperationFuture future =
+ * batchServiceClient.deleteResourceAllowanceOperationCallable().futureCall(request);
+ * // Do something.
+ * future.get();
+ * }
+ * }
+ */
+ public final OperationCallable
+ deleteResourceAllowanceOperationCallable() {
+ return stub.deleteResourceAllowanceOperationCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Delete a ResourceAllowance.
+ *
+ * Sample code:
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
+ * DeleteResourceAllowanceRequest request =
+ * DeleteResourceAllowanceRequest.newBuilder()
+ * .setName(
+ * ResourceAllowanceName.of("[PROJECT]", "[LOCATION]", "[RESOURCE_ALLOWANCE]")
+ * .toString())
+ * .setReason("reason-934964668")
+ * .setRequestId("requestId693933066")
+ * .build();
+ * ApiFuture future =
+ * batchServiceClient.deleteResourceAllowanceCallable().futureCall(request);
+ * // Do something.
+ * future.get();
+ * }
+ * }
+ */
+ public final UnaryCallable
+ deleteResourceAllowanceCallable() {
+ return stub.deleteResourceAllowanceCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * List all ResourceAllowances for a project within a region.
+ *
+ * Sample code:
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
+ * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+ * for (ResourceAllowance element :
+ * batchServiceClient.listResourceAllowances(parent).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ *
+ * @param parent Required. Parent path.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListResourceAllowancesPagedResponse listResourceAllowances(LocationName parent) {
+ ListResourceAllowancesRequest request =
+ ListResourceAllowancesRequest.newBuilder()
+ .setParent(parent == null ? null : parent.toString())
+ .build();
+ return listResourceAllowances(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * List all ResourceAllowances for a project within a region.
+ *
+ * Sample code:
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
+ * String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
+ * for (ResourceAllowance element :
+ * batchServiceClient.listResourceAllowances(parent).iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ *
+ * @param parent Required. Parent path.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ListResourceAllowancesPagedResponse listResourceAllowances(String parent) {
+ ListResourceAllowancesRequest request =
+ ListResourceAllowancesRequest.newBuilder().setParent(parent).build();
+ return listResourceAllowances(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * List all ResourceAllowances for a project within a region.
+ *
+ * Sample code:
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
+ * ListResourceAllowancesRequest request =
+ * ListResourceAllowancesRequest.newBuilder()
+ * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .build();
+ * for (ResourceAllowance element :
+ * batchServiceClient.listResourceAllowances(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 ListResourceAllowancesPagedResponse listResourceAllowances(
+ ListResourceAllowancesRequest request) {
+ return listResourceAllowancesPagedCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * List all ResourceAllowances for a project within a region.
+ *
+ * Sample code:
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
+ * ListResourceAllowancesRequest request =
+ * ListResourceAllowancesRequest.newBuilder()
+ * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .build();
+ * ApiFuture future =
+ * batchServiceClient.listResourceAllowancesPagedCallable().futureCall(request);
+ * // Do something.
+ * for (ResourceAllowance element : future.get().iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ */
+ public final UnaryCallable
+ listResourceAllowancesPagedCallable() {
+ return stub.listResourceAllowancesPagedCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * List all ResourceAllowances for a project within a region.
+ *
+ * Sample code:
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
+ * ListResourceAllowancesRequest request =
+ * ListResourceAllowancesRequest.newBuilder()
+ * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .build();
+ * while (true) {
+ * ListResourceAllowancesResponse response =
+ * batchServiceClient.listResourceAllowancesCallable().call(request);
+ * for (ResourceAllowance element : response.getResourceAllowancesList()) {
+ * // doThingsWith(element);
+ * }
+ * String nextPageToken = response.getNextPageToken();
+ * if (!Strings.isNullOrEmpty(nextPageToken)) {
+ * request = request.toBuilder().setPageToken(nextPageToken).build();
+ * } else {
+ * break;
+ * }
+ * }
+ * }
+ * }
+ */
+ public final UnaryCallable
+ listResourceAllowancesCallable() {
+ return stub.listResourceAllowancesCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Update a Resource Allowance.
+ *
+ * Sample code:
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
+ * ResourceAllowance resourceAllowance = ResourceAllowance.newBuilder().build();
+ * FieldMask updateMask = FieldMask.newBuilder().build();
+ * ResourceAllowance response =
+ * batchServiceClient.updateResourceAllowance(resourceAllowance, updateMask);
+ * }
+ * }
+ *
+ * @param resourceAllowance Required. The ResourceAllowance to update. Update description. Only
+ * fields specified in `update_mask` are updated.
+ * @param updateMask Required. Mask of fields to update.
+ * Field mask is used to specify the fields to be overwritten in the ResourceAllowance
+ * resource by the update. The fields specified in the update_mask are relative to the
+ * resource, not the full request. A field will be overwritten if it is in the mask. If the
+ * user does not provide a mask then all fields will be overwritten.
+ * UpdateResourceAllowance request now only supports update on `limit` field.
+ * @throws com.google.api.gax.rpc.ApiException if the remote call fails
+ */
+ public final ResourceAllowance updateResourceAllowance(
+ ResourceAllowance resourceAllowance, FieldMask updateMask) {
+ UpdateResourceAllowanceRequest request =
+ UpdateResourceAllowanceRequest.newBuilder()
+ .setResourceAllowance(resourceAllowance)
+ .setUpdateMask(updateMask)
+ .build();
+ return updateResourceAllowance(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Update a Resource Allowance.
+ *
+ * Sample code:
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
+ * UpdateResourceAllowanceRequest request =
+ * UpdateResourceAllowanceRequest.newBuilder()
+ * .setResourceAllowance(ResourceAllowance.newBuilder().build())
+ * .setUpdateMask(FieldMask.newBuilder().build())
+ * .setRequestId("requestId693933066")
+ * .build();
+ * ResourceAllowance response = batchServiceClient.updateResourceAllowance(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 ResourceAllowance updateResourceAllowance(UpdateResourceAllowanceRequest request) {
+ return updateResourceAllowanceCallable().call(request);
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Update a Resource Allowance.
+ *
+ * Sample code:
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
+ * UpdateResourceAllowanceRequest request =
+ * UpdateResourceAllowanceRequest.newBuilder()
+ * .setResourceAllowance(ResourceAllowance.newBuilder().build())
+ * .setUpdateMask(FieldMask.newBuilder().build())
+ * .setRequestId("requestId693933066")
+ * .build();
+ * ApiFuture future =
+ * batchServiceClient.updateResourceAllowanceCallable().futureCall(request);
+ * // Do something.
+ * ResourceAllowance response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallable
+ updateResourceAllowanceCallable() {
+ return stub.updateResourceAllowanceCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Lists information about the supported locations for this service.
+ *
+ * Sample code:
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * 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 and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
+ * ListLocationsRequest request =
+ * ListLocationsRequest.newBuilder()
+ * .setName("name3373707")
+ * .setFilter("filter-1274492040")
+ * .setPageSize(883849137)
+ * .setPageToken("pageToken873572522")
+ * .build();
+ * ApiFuture future =
+ * batchServiceClient.listLocationsPagedCallable().futureCall(request);
+ * // Do something.
+ * for (Location element : future.get().iterateAll()) {
+ * // doThingsWith(element);
+ * }
+ * }
+ * }
+ */
+ public final UnaryCallable
+ listLocationsPagedCallable() {
+ return stub.listLocationsPagedCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Lists information about the supported locations for this service.
+ *
+ * Sample code:
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * 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 listLocationsCallable() {
+ return stub.listLocationsCallable();
+ }
+
+ // AUTO-GENERATED DOCUMENTATION AND METHOD.
+ /**
+ * Gets information about a location.
+ *
+ * Sample code:
+ *
+ * {@code
+ * // This snippet has been automatically generated and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * 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 and should be regarded as a code template only.
+ * // It will require modifications to work:
+ * // - It may require correct/in-range values for request initialization.
+ * // - It may require specifying regional endpoints when creating the service client as shown in
+ * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
+ * try (BatchServiceClient batchServiceClient = BatchServiceClient.create()) {
+ * GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
+ * ApiFuture future = batchServiceClient.getLocationCallable().futureCall(request);
+ * // Do something.
+ * Location response = future.get();
+ * }
+ * }
+ */
+ public final UnaryCallable getLocationCallable() {
+ return stub.getLocationCallable();
+ }
+
+ @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
@@ -1441,6 +2240,94 @@ protected ListTasksFixedSizeCollection createCollection(
}
}
+ public static class ListResourceAllowancesPagedResponse
+ extends AbstractPagedListResponse<
+ ListResourceAllowancesRequest,
+ ListResourceAllowancesResponse,
+ ResourceAllowance,
+ ListResourceAllowancesPage,
+ ListResourceAllowancesFixedSizeCollection> {
+
+ public static ApiFuture createAsync(
+ PageContext<
+ ListResourceAllowancesRequest, ListResourceAllowancesResponse, ResourceAllowance>
+ context,
+ ApiFuture futureResponse) {
+ ApiFuture futurePage =
+ ListResourceAllowancesPage.createEmptyPage().createPageAsync(context, futureResponse);
+ return ApiFutures.transform(
+ futurePage,
+ input -> new ListResourceAllowancesPagedResponse(input),
+ MoreExecutors.directExecutor());
+ }
+
+ private ListResourceAllowancesPagedResponse(ListResourceAllowancesPage page) {
+ super(page, ListResourceAllowancesFixedSizeCollection.createEmptyCollection());
+ }
+ }
+
+ public static class ListResourceAllowancesPage
+ extends AbstractPage<
+ ListResourceAllowancesRequest,
+ ListResourceAllowancesResponse,
+ ResourceAllowance,
+ ListResourceAllowancesPage> {
+
+ private ListResourceAllowancesPage(
+ PageContext<
+ ListResourceAllowancesRequest, ListResourceAllowancesResponse, ResourceAllowance>
+ context,
+ ListResourceAllowancesResponse response) {
+ super(context, response);
+ }
+
+ private static ListResourceAllowancesPage createEmptyPage() {
+ return new ListResourceAllowancesPage(null, null);
+ }
+
+ @Override
+ protected ListResourceAllowancesPage createPage(
+ PageContext<
+ ListResourceAllowancesRequest, ListResourceAllowancesResponse, ResourceAllowance>
+ context,
+ ListResourceAllowancesResponse response) {
+ return new ListResourceAllowancesPage(context, response);
+ }
+
+ @Override
+ public ApiFuture createPageAsync(
+ PageContext<
+ ListResourceAllowancesRequest, ListResourceAllowancesResponse, ResourceAllowance>
+ context,
+ ApiFuture futureResponse) {
+ return super.createPageAsync(context, futureResponse);
+ }
+ }
+
+ public static class ListResourceAllowancesFixedSizeCollection
+ extends AbstractFixedSizeCollection<
+ ListResourceAllowancesRequest,
+ ListResourceAllowancesResponse,
+ ResourceAllowance,
+ ListResourceAllowancesPage,
+ ListResourceAllowancesFixedSizeCollection> {
+
+ private ListResourceAllowancesFixedSizeCollection(
+ List pages, int collectionSize) {
+ super(pages, collectionSize);
+ }
+
+ private static ListResourceAllowancesFixedSizeCollection createEmptyCollection() {
+ return new ListResourceAllowancesFixedSizeCollection(null, 0);
+ }
+
+ @Override
+ protected ListResourceAllowancesFixedSizeCollection createCollection(
+ List pages, int collectionSize) {
+ return new ListResourceAllowancesFixedSizeCollection(pages, collectionSize);
+ }
+ }
+
public static class ListLocationsPagedResponse
extends AbstractPagedListResponse<
ListLocationsRequest,
diff --git a/java-batch/google-cloud-batch/src/main/java/com/google/cloud/batch/v1alpha/BatchServiceSettings.java b/java-batch/google-cloud-batch/src/main/java/com/google/cloud/batch/v1alpha/BatchServiceSettings.java
index bff00a4e974e..3c0f4fe89364 100644
--- a/java-batch/google-cloud-batch/src/main/java/com/google/cloud/batch/v1alpha/BatchServiceSettings.java
+++ b/java-batch/google-cloud-batch/src/main/java/com/google/cloud/batch/v1alpha/BatchServiceSettings.java
@@ -18,6 +18,7 @@
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.ListResourceAllowancesPagedResponse;
import static com.google.cloud.batch.v1alpha.BatchServiceClient.ListTasksPagedResponse;
import com.google.api.core.ApiFunction;
@@ -122,6 +123,46 @@ public UnaryCallSettings getTaskSettings() {
return ((BatchServiceStubSettings) getStubSettings()).listTasksSettings();
}
+ /** Returns the object with the settings used for calls to createResourceAllowance. */
+ public UnaryCallSettings
+ createResourceAllowanceSettings() {
+ return ((BatchServiceStubSettings) getStubSettings()).createResourceAllowanceSettings();
+ }
+
+ /** Returns the object with the settings used for calls to getResourceAllowance. */
+ public UnaryCallSettings
+ getResourceAllowanceSettings() {
+ return ((BatchServiceStubSettings) getStubSettings()).getResourceAllowanceSettings();
+ }
+
+ /** Returns the object with the settings used for calls to deleteResourceAllowance. */
+ public UnaryCallSettings
+ deleteResourceAllowanceSettings() {
+ return ((BatchServiceStubSettings) getStubSettings()).deleteResourceAllowanceSettings();
+ }
+
+ /** Returns the object with the settings used for calls to deleteResourceAllowance. */
+ public OperationCallSettings
+ deleteResourceAllowanceOperationSettings() {
+ return ((BatchServiceStubSettings) getStubSettings())
+ .deleteResourceAllowanceOperationSettings();
+ }
+
+ /** Returns the object with the settings used for calls to listResourceAllowances. */
+ public PagedCallSettings<
+ ListResourceAllowancesRequest,
+ ListResourceAllowancesResponse,
+ ListResourceAllowancesPagedResponse>
+ listResourceAllowancesSettings() {
+ return ((BatchServiceStubSettings) getStubSettings()).listResourceAllowancesSettings();
+ }
+
+ /** Returns the object with the settings used for calls to updateResourceAllowance. */
+ public UnaryCallSettings
+ updateResourceAllowanceSettings() {
+ return ((BatchServiceStubSettings) getStubSettings()).updateResourceAllowanceSettings();
+ }
+
/** Returns the object with the settings used for calls to listLocations. */
public PagedCallSettings
listLocationsSettings() {
@@ -283,6 +324,45 @@ public UnaryCallSettings.Builder getTaskSettings() {
return getStubSettingsBuilder().listTasksSettings();
}
+ /** Returns the builder for the settings used for calls to createResourceAllowance. */
+ public UnaryCallSettings.Builder
+ createResourceAllowanceSettings() {
+ return getStubSettingsBuilder().createResourceAllowanceSettings();
+ }
+
+ /** Returns the builder for the settings used for calls to getResourceAllowance. */
+ public UnaryCallSettings.Builder
+ getResourceAllowanceSettings() {
+ return getStubSettingsBuilder().getResourceAllowanceSettings();
+ }
+
+ /** Returns the builder for the settings used for calls to deleteResourceAllowance. */
+ public UnaryCallSettings.Builder
+ deleteResourceAllowanceSettings() {
+ return getStubSettingsBuilder().deleteResourceAllowanceSettings();
+ }
+
+ /** Returns the builder for the settings used for calls to deleteResourceAllowance. */
+ public OperationCallSettings.Builder
+ deleteResourceAllowanceOperationSettings() {
+ return getStubSettingsBuilder().deleteResourceAllowanceOperationSettings();
+ }
+
+ /** Returns the builder for the settings used for calls to listResourceAllowances. */
+ public PagedCallSettings.Builder<
+ ListResourceAllowancesRequest,
+ ListResourceAllowancesResponse,
+ ListResourceAllowancesPagedResponse>
+ listResourceAllowancesSettings() {
+ return getStubSettingsBuilder().listResourceAllowancesSettings();
+ }
+
+ /** Returns the builder for the settings used for calls to updateResourceAllowance. */
+ public UnaryCallSettings.Builder
+ updateResourceAllowanceSettings() {
+ return getStubSettingsBuilder().updateResourceAllowanceSettings();
+ }
+
/** Returns the builder for the settings used for calls to listLocations. */
public PagedCallSettings.Builder<
ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
diff --git a/java-batch/google-cloud-batch/src/main/java/com/google/cloud/batch/v1alpha/gapic_metadata.json b/java-batch/google-cloud-batch/src/main/java/com/google/cloud/batch/v1alpha/gapic_metadata.json
index f1bfae0a379e..cf6632748ef4 100644
--- a/java-batch/google-cloud-batch/src/main/java/com/google/cloud/batch/v1alpha/gapic_metadata.json
+++ b/java-batch/google-cloud-batch/src/main/java/com/google/cloud/batch/v1alpha/gapic_metadata.json
@@ -13,15 +13,24 @@
"CreateJob": {
"methods": ["createJob", "createJob", "createJob", "createJobCallable"]
},
+ "CreateResourceAllowance": {
+ "methods": ["createResourceAllowance", "createResourceAllowance", "createResourceAllowance", "createResourceAllowanceCallable"]
+ },
"DeleteJob": {
"methods": ["deleteJobAsync", "deleteJobAsync", "deleteJobOperationCallable", "deleteJobCallable"]
},
+ "DeleteResourceAllowance": {
+ "methods": ["deleteResourceAllowanceAsync", "deleteResourceAllowanceAsync", "deleteResourceAllowanceAsync", "deleteResourceAllowanceOperationCallable", "deleteResourceAllowanceCallable"]
+ },
"GetJob": {
"methods": ["getJob", "getJob", "getJob", "getJobCallable"]
},
"GetLocation": {
"methods": ["getLocation", "getLocationCallable"]
},
+ "GetResourceAllowance": {
+ "methods": ["getResourceAllowance", "getResourceAllowance", "getResourceAllowance", "getResourceAllowanceCallable"]
+ },
"GetTask": {
"methods": ["getTask", "getTask", "getTask", "getTaskCallable"]
},
@@ -31,8 +40,14 @@
"ListLocations": {
"methods": ["listLocations", "listLocationsPagedCallable", "listLocationsCallable"]
},
+ "ListResourceAllowances": {
+ "methods": ["listResourceAllowances", "listResourceAllowances", "listResourceAllowances", "listResourceAllowancesPagedCallable", "listResourceAllowancesCallable"]
+ },
"ListTasks": {
"methods": ["listTasks", "listTasks", "listTasks", "listTasksPagedCallable", "listTasksCallable"]
+ },
+ "UpdateResourceAllowance": {
+ "methods": ["updateResourceAllowance", "updateResourceAllowance", "updateResourceAllowanceCallable"]
}
}
}
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 9983004759fa..76bde9a810c2 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
@@ -18,6 +18,7 @@
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.ListResourceAllowancesPagedResponse;
import static com.google.cloud.batch.v1alpha.BatchServiceClient.ListTasksPagedResponse;
import com.google.api.core.BetaApi;
@@ -25,16 +26,23 @@
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.CreateResourceAllowanceRequest;
import com.google.cloud.batch.v1alpha.DeleteJobRequest;
+import com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest;
import com.google.cloud.batch.v1alpha.GetJobRequest;
+import com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest;
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.ListResourceAllowancesRequest;
+import com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse;
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.ResourceAllowance;
import com.google.cloud.batch.v1alpha.Task;
+import com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest;
import com.google.cloud.location.GetLocationRequest;
import com.google.cloud.location.ListLocationsRequest;
import com.google.cloud.location.ListLocationsResponse;
@@ -99,6 +107,43 @@ public UnaryCallable listTasksCallable() {
throw new UnsupportedOperationException("Not implemented: listTasksCallable()");
}
+ public UnaryCallable
+ createResourceAllowanceCallable() {
+ throw new UnsupportedOperationException("Not implemented: createResourceAllowanceCallable()");
+ }
+
+ public UnaryCallable
+ getResourceAllowanceCallable() {
+ throw new UnsupportedOperationException("Not implemented: getResourceAllowanceCallable()");
+ }
+
+ public OperationCallable
+ deleteResourceAllowanceOperationCallable() {
+ throw new UnsupportedOperationException(
+ "Not implemented: deleteResourceAllowanceOperationCallable()");
+ }
+
+ public UnaryCallable
+ deleteResourceAllowanceCallable() {
+ throw new UnsupportedOperationException("Not implemented: deleteResourceAllowanceCallable()");
+ }
+
+ public UnaryCallable
+ listResourceAllowancesPagedCallable() {
+ throw new UnsupportedOperationException(
+ "Not implemented: listResourceAllowancesPagedCallable()");
+ }
+
+ public UnaryCallable
+ listResourceAllowancesCallable() {
+ throw new UnsupportedOperationException("Not implemented: listResourceAllowancesCallable()");
+ }
+
+ public UnaryCallable
+ updateResourceAllowanceCallable() {
+ throw new UnsupportedOperationException("Not implemented: updateResourceAllowanceCallable()");
+ }
+
public UnaryCallable
listLocationsPagedCallable() {
throw new UnsupportedOperationException("Not implemented: listLocationsPagedCallable()");
diff --git a/java-batch/google-cloud-batch/src/main/java/com/google/cloud/batch/v1alpha/stub/BatchServiceStubSettings.java b/java-batch/google-cloud-batch/src/main/java/com/google/cloud/batch/v1alpha/stub/BatchServiceStubSettings.java
index eb8f769f8e09..89fb511abeff 100644
--- a/java-batch/google-cloud-batch/src/main/java/com/google/cloud/batch/v1alpha/stub/BatchServiceStubSettings.java
+++ b/java-batch/google-cloud-batch/src/main/java/com/google/cloud/batch/v1alpha/stub/BatchServiceStubSettings.java
@@ -18,6 +18,7 @@
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.ListResourceAllowancesPagedResponse;
import static com.google.cloud.batch.v1alpha.BatchServiceClient.ListTasksPagedResponse;
import com.google.api.core.ApiFunction;
@@ -50,16 +51,23 @@
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.CreateResourceAllowanceRequest;
import com.google.cloud.batch.v1alpha.DeleteJobRequest;
+import com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest;
import com.google.cloud.batch.v1alpha.GetJobRequest;
+import com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest;
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.ListResourceAllowancesRequest;
+import com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse;
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.ResourceAllowance;
import com.google.cloud.batch.v1alpha.Task;
+import com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest;
import com.google.cloud.location.GetLocationRequest;
import com.google.cloud.location.ListLocationsRequest;
import com.google.cloud.location.ListLocationsResponse;
@@ -129,6 +137,21 @@ public class BatchServiceStubSettings extends StubSettings getTaskSettings;
private final PagedCallSettings
listTasksSettings;
+ private final UnaryCallSettings
+ createResourceAllowanceSettings;
+ private final UnaryCallSettings
+ getResourceAllowanceSettings;
+ private final UnaryCallSettings
+ deleteResourceAllowanceSettings;
+ private final OperationCallSettings
+ deleteResourceAllowanceOperationSettings;
+ private final PagedCallSettings<
+ ListResourceAllowancesRequest,
+ ListResourceAllowancesResponse,
+ ListResourceAllowancesPagedResponse>
+ listResourceAllowancesSettings;
+ private final UnaryCallSettings
+ updateResourceAllowanceSettings;
private final PagedCallSettings<
ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings;
@@ -206,6 +229,49 @@ public Iterable extractResources(ListTasksResponse payload) {
}
};
+ private static final PagedListDescriptor<
+ ListResourceAllowancesRequest, ListResourceAllowancesResponse, ResourceAllowance>
+ LIST_RESOURCE_ALLOWANCES_PAGE_STR_DESC =
+ new PagedListDescriptor<
+ ListResourceAllowancesRequest, ListResourceAllowancesResponse, ResourceAllowance>() {
+ @Override
+ public String emptyToken() {
+ return "";
+ }
+
+ @Override
+ public ListResourceAllowancesRequest injectToken(
+ ListResourceAllowancesRequest payload, String token) {
+ return ListResourceAllowancesRequest.newBuilder(payload).setPageToken(token).build();
+ }
+
+ @Override
+ public ListResourceAllowancesRequest injectPageSize(
+ ListResourceAllowancesRequest payload, int pageSize) {
+ return ListResourceAllowancesRequest.newBuilder(payload)
+ .setPageSize(pageSize)
+ .build();
+ }
+
+ @Override
+ public Integer extractPageSize(ListResourceAllowancesRequest payload) {
+ return payload.getPageSize();
+ }
+
+ @Override
+ public String extractNextToken(ListResourceAllowancesResponse payload) {
+ return payload.getNextPageToken();
+ }
+
+ @Override
+ public Iterable extractResources(
+ ListResourceAllowancesResponse payload) {
+ return payload.getResourceAllowancesList() == null
+ ? ImmutableList.of()
+ : payload.getResourceAllowancesList();
+ }
+ };
+
private static final PagedListDescriptor
LIST_LOCATIONS_PAGE_STR_DESC =
new PagedListDescriptor() {
@@ -275,6 +341,33 @@ public ApiFuture getFuturePagedResponse(
}
};
+ private static final PagedListResponseFactory<
+ ListResourceAllowancesRequest,
+ ListResourceAllowancesResponse,
+ ListResourceAllowancesPagedResponse>
+ LIST_RESOURCE_ALLOWANCES_PAGE_STR_FACT =
+ new PagedListResponseFactory<
+ ListResourceAllowancesRequest,
+ ListResourceAllowancesResponse,
+ ListResourceAllowancesPagedResponse>() {
+ @Override
+ public ApiFuture getFuturePagedResponse(
+ UnaryCallable
+ callable,
+ ListResourceAllowancesRequest request,
+ ApiCallContext context,
+ ApiFuture futureResponse) {
+ PageContext<
+ ListResourceAllowancesRequest,
+ ListResourceAllowancesResponse,
+ ResourceAllowance>
+ pageContext =
+ PageContext.create(
+ callable, LIST_RESOURCE_ALLOWANCES_PAGE_STR_DESC, request, context);
+ return ListResourceAllowancesPagedResponse.createAsync(pageContext, futureResponse);
+ }
+ };
+
private static final PagedListResponseFactory<
ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
LIST_LOCATIONS_PAGE_STR_FACT =
@@ -330,6 +423,45 @@ public UnaryCallSettings getTaskSettings() {
return listTasksSettings;
}
+ /** Returns the object with the settings used for calls to createResourceAllowance. */
+ public UnaryCallSettings
+ createResourceAllowanceSettings() {
+ return createResourceAllowanceSettings;
+ }
+
+ /** Returns the object with the settings used for calls to getResourceAllowance. */
+ public UnaryCallSettings
+ getResourceAllowanceSettings() {
+ return getResourceAllowanceSettings;
+ }
+
+ /** Returns the object with the settings used for calls to deleteResourceAllowance. */
+ public UnaryCallSettings
+ deleteResourceAllowanceSettings() {
+ return deleteResourceAllowanceSettings;
+ }
+
+ /** Returns the object with the settings used for calls to deleteResourceAllowance. */
+ public OperationCallSettings
+ deleteResourceAllowanceOperationSettings() {
+ return deleteResourceAllowanceOperationSettings;
+ }
+
+ /** Returns the object with the settings used for calls to listResourceAllowances. */
+ public PagedCallSettings<
+ ListResourceAllowancesRequest,
+ ListResourceAllowancesResponse,
+ ListResourceAllowancesPagedResponse>
+ listResourceAllowancesSettings() {
+ return listResourceAllowancesSettings;
+ }
+
+ /** Returns the object with the settings used for calls to updateResourceAllowance. */
+ public UnaryCallSettings
+ updateResourceAllowanceSettings() {
+ return updateResourceAllowanceSettings;
+ }
+
/** Returns the object with the settings used for calls to listLocations. */
public PagedCallSettings
listLocationsSettings() {
@@ -467,6 +599,13 @@ protected BatchServiceStubSettings(Builder settingsBuilder) throws IOException {
listJobsSettings = settingsBuilder.listJobsSettings().build();
getTaskSettings = settingsBuilder.getTaskSettings().build();
listTasksSettings = settingsBuilder.listTasksSettings().build();
+ createResourceAllowanceSettings = settingsBuilder.createResourceAllowanceSettings().build();
+ getResourceAllowanceSettings = settingsBuilder.getResourceAllowanceSettings().build();
+ deleteResourceAllowanceSettings = settingsBuilder.deleteResourceAllowanceSettings().build();
+ deleteResourceAllowanceOperationSettings =
+ settingsBuilder.deleteResourceAllowanceOperationSettings().build();
+ listResourceAllowancesSettings = settingsBuilder.listResourceAllowancesSettings().build();
+ updateResourceAllowanceSettings = settingsBuilder.updateResourceAllowanceSettings().build();
listLocationsSettings = settingsBuilder.listLocationsSettings().build();
getLocationSettings = settingsBuilder.getLocationSettings().build();
}
@@ -486,6 +625,22 @@ public static class Builder extends StubSettings.Builder
listTasksSettings;
+ private final UnaryCallSettings.Builder
+ createResourceAllowanceSettings;
+ private final UnaryCallSettings.Builder
+ getResourceAllowanceSettings;
+ private final UnaryCallSettings.Builder
+ deleteResourceAllowanceSettings;
+ private final OperationCallSettings.Builder<
+ DeleteResourceAllowanceRequest, Empty, OperationMetadata>
+ deleteResourceAllowanceOperationSettings;
+ private final PagedCallSettings.Builder<
+ ListResourceAllowancesRequest,
+ ListResourceAllowancesResponse,
+ ListResourceAllowancesPagedResponse>
+ listResourceAllowancesSettings;
+ private final UnaryCallSettings.Builder
+ updateResourceAllowanceSettings;
private final PagedCallSettings.Builder<
ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings;
@@ -548,6 +703,13 @@ protected Builder(ClientContext clientContext) {
listJobsSettings = PagedCallSettings.newBuilder(LIST_JOBS_PAGE_STR_FACT);
getTaskSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
listTasksSettings = PagedCallSettings.newBuilder(LIST_TASKS_PAGE_STR_FACT);
+ createResourceAllowanceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
+ getResourceAllowanceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
+ deleteResourceAllowanceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
+ deleteResourceAllowanceOperationSettings = OperationCallSettings.newBuilder();
+ listResourceAllowancesSettings =
+ PagedCallSettings.newBuilder(LIST_RESOURCE_ALLOWANCES_PAGE_STR_FACT);
+ updateResourceAllowanceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
listLocationsSettings = PagedCallSettings.newBuilder(LIST_LOCATIONS_PAGE_STR_FACT);
getLocationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
@@ -559,6 +721,11 @@ protected Builder(ClientContext clientContext) {
listJobsSettings,
getTaskSettings,
listTasksSettings,
+ createResourceAllowanceSettings,
+ getResourceAllowanceSettings,
+ deleteResourceAllowanceSettings,
+ listResourceAllowancesSettings,
+ updateResourceAllowanceSettings,
listLocationsSettings,
getLocationSettings);
initDefaults(this);
@@ -574,6 +741,13 @@ protected Builder(BatchServiceStubSettings settings) {
listJobsSettings = settings.listJobsSettings.toBuilder();
getTaskSettings = settings.getTaskSettings.toBuilder();
listTasksSettings = settings.listTasksSettings.toBuilder();
+ createResourceAllowanceSettings = settings.createResourceAllowanceSettings.toBuilder();
+ getResourceAllowanceSettings = settings.getResourceAllowanceSettings.toBuilder();
+ deleteResourceAllowanceSettings = settings.deleteResourceAllowanceSettings.toBuilder();
+ deleteResourceAllowanceOperationSettings =
+ settings.deleteResourceAllowanceOperationSettings.toBuilder();
+ listResourceAllowancesSettings = settings.listResourceAllowancesSettings.toBuilder();
+ updateResourceAllowanceSettings = settings.updateResourceAllowanceSettings.toBuilder();
listLocationsSettings = settings.listLocationsSettings.toBuilder();
getLocationSettings = settings.getLocationSettings.toBuilder();
@@ -585,6 +759,11 @@ protected Builder(BatchServiceStubSettings settings) {
listJobsSettings,
getTaskSettings,
listTasksSettings,
+ createResourceAllowanceSettings,
+ getResourceAllowanceSettings,
+ deleteResourceAllowanceSettings,
+ listResourceAllowancesSettings,
+ updateResourceAllowanceSettings,
listLocationsSettings,
getLocationSettings);
}
@@ -644,6 +823,31 @@ private static Builder initDefaults(Builder builder) {
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));
+ builder
+ .createResourceAllowanceSettings()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params"));
+
+ builder
+ .getResourceAllowanceSettings()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));
+
+ builder
+ .deleteResourceAllowanceSettings()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params"));
+
+ builder
+ .listResourceAllowancesSettings()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));
+
+ builder
+ .updateResourceAllowanceSettings()
+ .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
+ .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params"));
+
builder
.listLocationsSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_codes"))
@@ -677,6 +881,30 @@ private static Builder initDefaults(Builder builder) {
.setTotalTimeout(Duration.ofMillis(300000L))
.build()));
+ builder
+ .deleteResourceAllowanceOperationSettings()
+ .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;
}
@@ -733,6 +961,45 @@ public UnaryCallSettings.Builder getTaskSettings() {
return listTasksSettings;
}
+ /** Returns the builder for the settings used for calls to createResourceAllowance. */
+ public UnaryCallSettings.Builder
+ createResourceAllowanceSettings() {
+ return createResourceAllowanceSettings;
+ }
+
+ /** Returns the builder for the settings used for calls to getResourceAllowance. */
+ public UnaryCallSettings.Builder
+ getResourceAllowanceSettings() {
+ return getResourceAllowanceSettings;
+ }
+
+ /** Returns the builder for the settings used for calls to deleteResourceAllowance. */
+ public UnaryCallSettings.Builder
+ deleteResourceAllowanceSettings() {
+ return deleteResourceAllowanceSettings;
+ }
+
+ /** Returns the builder for the settings used for calls to deleteResourceAllowance. */
+ public OperationCallSettings.Builder
+ deleteResourceAllowanceOperationSettings() {
+ return deleteResourceAllowanceOperationSettings;
+ }
+
+ /** Returns the builder for the settings used for calls to listResourceAllowances. */
+ public PagedCallSettings.Builder<
+ ListResourceAllowancesRequest,
+ ListResourceAllowancesResponse,
+ ListResourceAllowancesPagedResponse>
+ listResourceAllowancesSettings() {
+ return listResourceAllowancesSettings;
+ }
+
+ /** Returns the builder for the settings used for calls to updateResourceAllowance. */
+ public UnaryCallSettings.Builder
+ updateResourceAllowanceSettings() {
+ return updateResourceAllowanceSettings;
+ }
+
/** Returns the builder for the settings used for calls to listLocations. */
public PagedCallSettings.Builder<
ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
diff --git a/java-batch/google-cloud-batch/src/main/java/com/google/cloud/batch/v1alpha/stub/GrpcBatchServiceStub.java b/java-batch/google-cloud-batch/src/main/java/com/google/cloud/batch/v1alpha/stub/GrpcBatchServiceStub.java
index 9e435f420540..1d5976009874 100644
--- a/java-batch/google-cloud-batch/src/main/java/com/google/cloud/batch/v1alpha/stub/GrpcBatchServiceStub.java
+++ b/java-batch/google-cloud-batch/src/main/java/com/google/cloud/batch/v1alpha/stub/GrpcBatchServiceStub.java
@@ -18,6 +18,7 @@
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.ListResourceAllowancesPagedResponse;
import static com.google.cloud.batch.v1alpha.BatchServiceClient.ListTasksPagedResponse;
import com.google.api.core.BetaApi;
@@ -30,16 +31,23 @@
import com.google.api.gax.rpc.RequestParamsBuilder;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.cloud.batch.v1alpha.CreateJobRequest;
+import com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest;
import com.google.cloud.batch.v1alpha.DeleteJobRequest;
+import com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest;
import com.google.cloud.batch.v1alpha.GetJobRequest;
+import com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest;
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.ListResourceAllowancesRequest;
+import com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse;
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.ResourceAllowance;
import com.google.cloud.batch.v1alpha.Task;
+import com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest;
import com.google.cloud.location.GetLocationRequest;
import com.google.cloud.location.ListLocationsRequest;
import com.google.cloud.location.ListLocationsResponse;
@@ -112,6 +120,59 @@ public class GrpcBatchServiceStub extends BatchServiceStub {
.setResponseMarshaller(ProtoUtils.marshaller(ListTasksResponse.getDefaultInstance()))
.build();
+ private static final MethodDescriptor
+ createResourceAllowanceMethodDescriptor =
+ MethodDescriptor.newBuilder()
+ .setType(MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName("google.cloud.batch.v1alpha.BatchService/CreateResourceAllowance")
+ .setRequestMarshaller(
+ ProtoUtils.marshaller(CreateResourceAllowanceRequest.getDefaultInstance()))
+ .setResponseMarshaller(ProtoUtils.marshaller(ResourceAllowance.getDefaultInstance()))
+ .build();
+
+ private static final MethodDescriptor
+ getResourceAllowanceMethodDescriptor =
+ MethodDescriptor.newBuilder()
+ .setType(MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName("google.cloud.batch.v1alpha.BatchService/GetResourceAllowance")
+ .setRequestMarshaller(
+ ProtoUtils.marshaller(GetResourceAllowanceRequest.getDefaultInstance()))
+ .setResponseMarshaller(ProtoUtils.marshaller(ResourceAllowance.getDefaultInstance()))
+ .build();
+
+ private static final MethodDescriptor
+ deleteResourceAllowanceMethodDescriptor =
+ MethodDescriptor.newBuilder()
+ .setType(MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName("google.cloud.batch.v1alpha.BatchService/DeleteResourceAllowance")
+ .setRequestMarshaller(
+ ProtoUtils.marshaller(DeleteResourceAllowanceRequest.getDefaultInstance()))
+ .setResponseMarshaller(ProtoUtils.marshaller(Operation.getDefaultInstance()))
+ .build();
+
+ private static final MethodDescriptor<
+ ListResourceAllowancesRequest, ListResourceAllowancesResponse>
+ listResourceAllowancesMethodDescriptor =
+ MethodDescriptor
+ .newBuilder()
+ .setType(MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName("google.cloud.batch.v1alpha.BatchService/ListResourceAllowances")
+ .setRequestMarshaller(
+ ProtoUtils.marshaller(ListResourceAllowancesRequest.getDefaultInstance()))
+ .setResponseMarshaller(
+ ProtoUtils.marshaller(ListResourceAllowancesResponse.getDefaultInstance()))
+ .build();
+
+ private static final MethodDescriptor
+ updateResourceAllowanceMethodDescriptor =
+ MethodDescriptor.newBuilder()
+ .setType(MethodDescriptor.MethodType.UNARY)
+ .setFullMethodName("google.cloud.batch.v1alpha.BatchService/UpdateResourceAllowance")
+ .setRequestMarshaller(
+ ProtoUtils.marshaller(UpdateResourceAllowanceRequest.getDefaultInstance()))
+ .setResponseMarshaller(ProtoUtils.marshaller(ResourceAllowance.getDefaultInstance()))
+ .build();
+
private static final MethodDescriptor
listLocationsMethodDescriptor =
MethodDescriptor.newBuilder()
@@ -141,6 +202,20 @@ public class GrpcBatchServiceStub extends BatchServiceStub {
private final UnaryCallable getTaskCallable;
private final UnaryCallable listTasksCallable;
private final UnaryCallable listTasksPagedCallable;
+ private final UnaryCallable
+ createResourceAllowanceCallable;
+ private final UnaryCallable
+ getResourceAllowanceCallable;
+ private final UnaryCallable
+ deleteResourceAllowanceCallable;
+ private final OperationCallable
+ deleteResourceAllowanceOperationCallable;
+ private final UnaryCallable
+ listResourceAllowancesCallable;
+ private final UnaryCallable
+ listResourceAllowancesPagedCallable;
+ private final UnaryCallable
+ updateResourceAllowanceCallable;
private final UnaryCallable listLocationsCallable;
private final UnaryCallable
listLocationsPagedCallable;
@@ -248,6 +323,64 @@ protected GrpcBatchServiceStub(
return builder.build();
})
.build();
+ GrpcCallSettings
+ createResourceAllowanceTransportSettings =
+ GrpcCallSettings.newBuilder()
+ .setMethodDescriptor(createResourceAllowanceMethodDescriptor)
+ .setParamsExtractor(
+ request -> {
+ RequestParamsBuilder builder = RequestParamsBuilder.create();
+ builder.add("parent", String.valueOf(request.getParent()));
+ return builder.build();
+ })
+ .build();
+ GrpcCallSettings
+ getResourceAllowanceTransportSettings =
+ GrpcCallSettings.newBuilder()
+ .setMethodDescriptor(getResourceAllowanceMethodDescriptor)
+ .setParamsExtractor(
+ request -> {
+ RequestParamsBuilder builder = RequestParamsBuilder.create();
+ builder.add("name", String.valueOf(request.getName()));
+ return builder.build();
+ })
+ .build();
+ GrpcCallSettings
+ deleteResourceAllowanceTransportSettings =
+ GrpcCallSettings.newBuilder()
+ .setMethodDescriptor(deleteResourceAllowanceMethodDescriptor)
+ .setParamsExtractor(
+ request -> {
+ RequestParamsBuilder builder = RequestParamsBuilder.create();
+ builder.add("name", String.valueOf(request.getName()));
+ return builder.build();
+ })
+ .build();
+ GrpcCallSettings
+ listResourceAllowancesTransportSettings =
+ GrpcCallSettings
+ .newBuilder()
+ .setMethodDescriptor(listResourceAllowancesMethodDescriptor)
+ .setParamsExtractor(
+ request -> {
+ RequestParamsBuilder builder = RequestParamsBuilder.create();
+ builder.add("parent", String.valueOf(request.getParent()));
+ return builder.build();
+ })
+ .build();
+ GrpcCallSettings
+ updateResourceAllowanceTransportSettings =
+ GrpcCallSettings.newBuilder()
+ .setMethodDescriptor(updateResourceAllowanceMethodDescriptor)
+ .setParamsExtractor(
+ request -> {
+ RequestParamsBuilder builder = RequestParamsBuilder.create();
+ builder.add(
+ "resource_allowance.name",
+ String.valueOf(request.getResourceAllowance().getName()));
+ return builder.build();
+ })
+ .build();
GrpcCallSettings listLocationsTransportSettings =
GrpcCallSettings.newBuilder()
.setMethodDescriptor(listLocationsMethodDescriptor)
@@ -299,6 +432,42 @@ protected GrpcBatchServiceStub(
this.listTasksPagedCallable =
callableFactory.createPagedCallable(
listTasksTransportSettings, settings.listTasksSettings(), clientContext);
+ this.createResourceAllowanceCallable =
+ callableFactory.createUnaryCallable(
+ createResourceAllowanceTransportSettings,
+ settings.createResourceAllowanceSettings(),
+ clientContext);
+ this.getResourceAllowanceCallable =
+ callableFactory.createUnaryCallable(
+ getResourceAllowanceTransportSettings,
+ settings.getResourceAllowanceSettings(),
+ clientContext);
+ this.deleteResourceAllowanceCallable =
+ callableFactory.createUnaryCallable(
+ deleteResourceAllowanceTransportSettings,
+ settings.deleteResourceAllowanceSettings(),
+ clientContext);
+ this.deleteResourceAllowanceOperationCallable =
+ callableFactory.createOperationCallable(
+ deleteResourceAllowanceTransportSettings,
+ settings.deleteResourceAllowanceOperationSettings(),
+ clientContext,
+ operationsStub);
+ this.listResourceAllowancesCallable =
+ callableFactory.createUnaryCallable(
+ listResourceAllowancesTransportSettings,
+ settings.listResourceAllowancesSettings(),
+ clientContext);
+ this.listResourceAllowancesPagedCallable =
+ callableFactory.createPagedCallable(
+ listResourceAllowancesTransportSettings,
+ settings.listResourceAllowancesSettings(),
+ clientContext);
+ this.updateResourceAllowanceCallable =
+ callableFactory.createUnaryCallable(
+ updateResourceAllowanceTransportSettings,
+ settings.updateResourceAllowanceSettings(),
+ clientContext);
this.listLocationsCallable =
callableFactory.createUnaryCallable(
listLocationsTransportSettings, settings.listLocationsSettings(), clientContext);
@@ -363,6 +532,48 @@ public UnaryCallable listTasksPagedCal
return listTasksPagedCallable;
}
+ @Override
+ public UnaryCallable
+ createResourceAllowanceCallable() {
+ return createResourceAllowanceCallable;
+ }
+
+ @Override
+ public UnaryCallable
+ getResourceAllowanceCallable() {
+ return getResourceAllowanceCallable;
+ }
+
+ @Override
+ public UnaryCallable
+ deleteResourceAllowanceCallable() {
+ return deleteResourceAllowanceCallable;
+ }
+
+ @Override
+ public OperationCallable
+ deleteResourceAllowanceOperationCallable() {
+ return deleteResourceAllowanceOperationCallable;
+ }
+
+ @Override
+ public UnaryCallable
+ listResourceAllowancesCallable() {
+ return listResourceAllowancesCallable;
+ }
+
+ @Override
+ public UnaryCallable
+ listResourceAllowancesPagedCallable() {
+ return listResourceAllowancesPagedCallable;
+ }
+
+ @Override
+ public UnaryCallable
+ updateResourceAllowanceCallable() {
+ return updateResourceAllowanceCallable;
+ }
+
@Override
public UnaryCallable listLocationsCallable() {
return listLocationsCallable;
diff --git a/java-batch/google-cloud-batch/src/main/java/com/google/cloud/batch/v1alpha/stub/HttpJsonBatchServiceStub.java b/java-batch/google-cloud-batch/src/main/java/com/google/cloud/batch/v1alpha/stub/HttpJsonBatchServiceStub.java
index 65333f56dd53..7e1a9cf7238b 100644
--- a/java-batch/google-cloud-batch/src/main/java/com/google/cloud/batch/v1alpha/stub/HttpJsonBatchServiceStub.java
+++ b/java-batch/google-cloud-batch/src/main/java/com/google/cloud/batch/v1alpha/stub/HttpJsonBatchServiceStub.java
@@ -18,6 +18,7 @@
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.ListResourceAllowancesPagedResponse;
import static com.google.cloud.batch.v1alpha.BatchServiceClient.ListTasksPagedResponse;
import com.google.api.HttpRule;
@@ -38,16 +39,23 @@
import com.google.api.gax.rpc.RequestParamsBuilder;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.cloud.batch.v1alpha.CreateJobRequest;
+import com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest;
import com.google.cloud.batch.v1alpha.DeleteJobRequest;
+import com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest;
import com.google.cloud.batch.v1alpha.GetJobRequest;
+import com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest;
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.ListResourceAllowancesRequest;
+import com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse;
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.ResourceAllowance;
import com.google.cloud.batch.v1alpha.Task;
+import com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest;
import com.google.cloud.location.GetLocationRequest;
import com.google.cloud.location.ListLocationsRequest;
import com.google.cloud.location.ListLocationsResponse;
@@ -295,6 +303,201 @@ public class HttpJsonBatchServiceStub extends BatchServiceStub {
.build())
.build();
+ private static final ApiMethodDescriptor
+ createResourceAllowanceMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.batch.v1alpha.BatchService/CreateResourceAllowance")
+ .setHttpMethod("POST")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1alpha/{parent=projects/*/locations/*}/resourceAllowances",
+ 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, "requestId", request.getRequestId());
+ serializer.putQueryParam(
+ fields, "resourceAllowanceId", request.getResourceAllowanceId());
+ serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
+ return fields;
+ })
+ .setRequestBodyExtractor(
+ request ->
+ ProtoRestSerializer.create()
+ .toBody(
+ "resourceAllowance", request.getResourceAllowance(), true))
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(ResourceAllowance.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ getResourceAllowanceMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.batch.v1alpha.BatchService/GetResourceAllowance")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1alpha/{name=projects/*/locations/*/resourceAllowances/*}",
+ 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, "$alt", "json;enum-encoding=int");
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(ResourceAllowance.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ deleteResourceAllowanceMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.batch.v1alpha.BatchService/DeleteResourceAllowance")
+ .setHttpMethod("DELETE")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1alpha/{name=projects/*/locations/*/resourceAllowances/*}",
+ 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());
+ serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(Operation.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .setOperationSnapshotFactory(
+ (DeleteResourceAllowanceRequest request, Operation response) ->
+ HttpJsonOperationSnapshot.create(response))
+ .build();
+
+ private static final ApiMethodDescriptor<
+ ListResourceAllowancesRequest, ListResourceAllowancesResponse>
+ listResourceAllowancesMethodDescriptor =
+ ApiMethodDescriptor
+ .newBuilder()
+ .setFullMethodName("google.cloud.batch.v1alpha.BatchService/ListResourceAllowances")
+ .setHttpMethod("GET")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1alpha/{parent=projects/*/locations/*}/resourceAllowances",
+ 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, "pageSize", request.getPageSize());
+ serializer.putQueryParam(fields, "pageToken", request.getPageToken());
+ serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
+ return fields;
+ })
+ .setRequestBodyExtractor(request -> null)
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(ListResourceAllowancesResponse.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
+ private static final ApiMethodDescriptor
+ updateResourceAllowanceMethodDescriptor =
+ ApiMethodDescriptor.newBuilder()
+ .setFullMethodName("google.cloud.batch.v1alpha.BatchService/UpdateResourceAllowance")
+ .setHttpMethod("PATCH")
+ .setType(ApiMethodDescriptor.MethodType.UNARY)
+ .setRequestFormatter(
+ ProtoMessageRequestFormatter.newBuilder()
+ .setPath(
+ "/v1alpha/{resourceAllowance.name=projects/*/locations/*/resourceAllowances/*}",
+ request -> {
+ Map fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putPathParam(
+ fields,
+ "resourceAllowance.name",
+ request.getResourceAllowance().getName());
+ return fields;
+ })
+ .setQueryParamsExtractor(
+ request -> {
+ Map> fields = new HashMap<>();
+ ProtoRestSerializer serializer =
+ ProtoRestSerializer.create();
+ serializer.putQueryParam(fields, "requestId", request.getRequestId());
+ serializer.putQueryParam(fields, "updateMask", request.getUpdateMask());
+ serializer.putQueryParam(fields, "$alt", "json;enum-encoding=int");
+ return fields;
+ })
+ .setRequestBodyExtractor(
+ request ->
+ ProtoRestSerializer.create()
+ .toBody(
+ "resourceAllowance", request.getResourceAllowance(), true))
+ .build())
+ .setResponseParser(
+ ProtoMessageResponseParser.newBuilder()
+ .setDefaultInstance(ResourceAllowance.getDefaultInstance())
+ .setDefaultTypeRegistry(typeRegistry)
+ .build())
+ .build();
+
private static final ApiMethodDescriptor
listLocationsMethodDescriptor =
ApiMethodDescriptor.newBuilder()
@@ -373,6 +576,20 @@ public class HttpJsonBatchServiceStub extends BatchServiceStub {
private final UnaryCallable getTaskCallable;
private final UnaryCallable listTasksCallable;
private final UnaryCallable listTasksPagedCallable;
+ private final UnaryCallable
+ createResourceAllowanceCallable;
+ private final UnaryCallable
+ getResourceAllowanceCallable;
+ private final UnaryCallable
+ deleteResourceAllowanceCallable;
+ private final OperationCallable
+ deleteResourceAllowanceOperationCallable;
+ private final UnaryCallable
+ listResourceAllowancesCallable;
+ private final UnaryCallable
+ listResourceAllowancesPagedCallable;
+ private final UnaryCallable
+ updateResourceAllowanceCallable;
private final UnaryCallable listLocationsCallable;
private final UnaryCallable
listLocationsPagedCallable;
@@ -514,6 +731,69 @@ protected HttpJsonBatchServiceStub(
return builder.build();
})
.build();
+ HttpJsonCallSettings
+ createResourceAllowanceTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(createResourceAllowanceMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .setParamsExtractor(
+ request -> {
+ RequestParamsBuilder builder = RequestParamsBuilder.create();
+ builder.add("parent", String.valueOf(request.getParent()));
+ return builder.build();
+ })
+ .build();
+ HttpJsonCallSettings
+ getResourceAllowanceTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(getResourceAllowanceMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .setParamsExtractor(
+ request -> {
+ RequestParamsBuilder builder = RequestParamsBuilder.create();
+ builder.add("name", String.valueOf(request.getName()));
+ return builder.build();
+ })
+ .build();
+ HttpJsonCallSettings
+ deleteResourceAllowanceTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(deleteResourceAllowanceMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .setParamsExtractor(
+ request -> {
+ RequestParamsBuilder builder = RequestParamsBuilder.create();
+ builder.add("name", String.valueOf(request.getName()));
+ return builder.build();
+ })
+ .build();
+ HttpJsonCallSettings
+ listResourceAllowancesTransportSettings =
+ HttpJsonCallSettings
+ .newBuilder()
+ .setMethodDescriptor(listResourceAllowancesMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .setParamsExtractor(
+ request -> {
+ RequestParamsBuilder builder = RequestParamsBuilder.create();
+ builder.add("parent", String.valueOf(request.getParent()));
+ return builder.build();
+ })
+ .build();
+ HttpJsonCallSettings
+ updateResourceAllowanceTransportSettings =
+ HttpJsonCallSettings.newBuilder()
+ .setMethodDescriptor(updateResourceAllowanceMethodDescriptor)
+ .setTypeRegistry(typeRegistry)
+ .setParamsExtractor(
+ request -> {
+ RequestParamsBuilder builder = RequestParamsBuilder.create();
+ builder.add(
+ "resource_allowance.name",
+ String.valueOf(request.getResourceAllowance().getName()));
+ return builder.build();
+ })
+ .build();
HttpJsonCallSettings
listLocationsTransportSettings =
HttpJsonCallSettings.newBuilder()
@@ -568,6 +848,42 @@ protected HttpJsonBatchServiceStub(
this.listTasksPagedCallable =
callableFactory.createPagedCallable(
listTasksTransportSettings, settings.listTasksSettings(), clientContext);
+ this.createResourceAllowanceCallable =
+ callableFactory.createUnaryCallable(
+ createResourceAllowanceTransportSettings,
+ settings.createResourceAllowanceSettings(),
+ clientContext);
+ this.getResourceAllowanceCallable =
+ callableFactory.createUnaryCallable(
+ getResourceAllowanceTransportSettings,
+ settings.getResourceAllowanceSettings(),
+ clientContext);
+ this.deleteResourceAllowanceCallable =
+ callableFactory.createUnaryCallable(
+ deleteResourceAllowanceTransportSettings,
+ settings.deleteResourceAllowanceSettings(),
+ clientContext);
+ this.deleteResourceAllowanceOperationCallable =
+ callableFactory.createOperationCallable(
+ deleteResourceAllowanceTransportSettings,
+ settings.deleteResourceAllowanceOperationSettings(),
+ clientContext,
+ httpJsonOperationsStub);
+ this.listResourceAllowancesCallable =
+ callableFactory.createUnaryCallable(
+ listResourceAllowancesTransportSettings,
+ settings.listResourceAllowancesSettings(),
+ clientContext);
+ this.listResourceAllowancesPagedCallable =
+ callableFactory.createPagedCallable(
+ listResourceAllowancesTransportSettings,
+ settings.listResourceAllowancesSettings(),
+ clientContext);
+ this.updateResourceAllowanceCallable =
+ callableFactory.createUnaryCallable(
+ updateResourceAllowanceTransportSettings,
+ settings.updateResourceAllowanceSettings(),
+ clientContext);
this.listLocationsCallable =
callableFactory.createUnaryCallable(
listLocationsTransportSettings, settings.listLocationsSettings(), clientContext);
@@ -591,6 +907,11 @@ public static List getMethodDescriptors() {
methodDescriptors.add(listJobsMethodDescriptor);
methodDescriptors.add(getTaskMethodDescriptor);
methodDescriptors.add(listTasksMethodDescriptor);
+ methodDescriptors.add(createResourceAllowanceMethodDescriptor);
+ methodDescriptors.add(getResourceAllowanceMethodDescriptor);
+ methodDescriptors.add(deleteResourceAllowanceMethodDescriptor);
+ methodDescriptors.add(listResourceAllowancesMethodDescriptor);
+ methodDescriptors.add(updateResourceAllowanceMethodDescriptor);
methodDescriptors.add(listLocationsMethodDescriptor);
methodDescriptors.add(getLocationMethodDescriptor);
return methodDescriptors;
@@ -646,6 +967,48 @@ public UnaryCallable listTasksPagedCal
return listTasksPagedCallable;
}
+ @Override
+ public UnaryCallable
+ createResourceAllowanceCallable() {
+ return createResourceAllowanceCallable;
+ }
+
+ @Override
+ public UnaryCallable
+ getResourceAllowanceCallable() {
+ return getResourceAllowanceCallable;
+ }
+
+ @Override
+ public UnaryCallable
+ deleteResourceAllowanceCallable() {
+ return deleteResourceAllowanceCallable;
+ }
+
+ @Override
+ public OperationCallable
+ deleteResourceAllowanceOperationCallable() {
+ return deleteResourceAllowanceOperationCallable;
+ }
+
+ @Override
+ public UnaryCallable
+ listResourceAllowancesCallable() {
+ return listResourceAllowancesCallable;
+ }
+
+ @Override
+ public UnaryCallable
+ listResourceAllowancesPagedCallable() {
+ return listResourceAllowancesPagedCallable;
+ }
+
+ @Override
+ public UnaryCallable
+ updateResourceAllowanceCallable() {
+ return updateResourceAllowanceCallable;
+ }
+
@Override
public UnaryCallable listLocationsCallable() {
return listLocationsCallable;
diff --git a/java-batch/google-cloud-batch/src/main/resources/META-INF/native-image/com.google.cloud.batch.v1alpha/reflect-config.json b/java-batch/google-cloud-batch/src/main/resources/META-INF/native-image/com.google.cloud.batch.v1alpha/reflect-config.json
index 7a4a6206cf34..1049569a5806 100644
--- a/java-batch/google-cloud-batch/src/main/resources/META-INF/native-image/com.google.cloud.batch.v1alpha/reflect-config.json
+++ b/java-batch/google-cloud-batch/src/main/resources/META-INF/native-image/com.google.cloud.batch.v1alpha/reflect-config.json
@@ -593,6 +593,15 @@
"allDeclaredClasses": true,
"allPublicClasses": true
},
+ {
+ "name": "com.google.cloud.batch.v1alpha.CalendarPeriod",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
{
"name": "com.google.cloud.batch.v1alpha.ComputeResource",
"queryAllDeclaredConstructors": true,
@@ -629,6 +638,24 @@
"allDeclaredClasses": true,
"allPublicClasses": true
},
+ {
+ "name": "com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
{
"name": "com.google.cloud.batch.v1alpha.DeleteJobRequest",
"queryAllDeclaredConstructors": true,
@@ -647,6 +674,24 @@
"allDeclaredClasses": true,
"allPublicClasses": true
},
+ {
+ "name": "com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
{
"name": "com.google.cloud.batch.v1alpha.Environment",
"queryAllDeclaredConstructors": true,
@@ -719,6 +764,24 @@
"allDeclaredClasses": true,
"allPublicClasses": true
},
+ {
+ "name": "com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
{
"name": "com.google.cloud.batch.v1alpha.GetTaskRequest",
"queryAllDeclaredConstructors": true,
@@ -980,6 +1043,42 @@
"allDeclaredClasses": true,
"allPublicClasses": true
},
+ {
+ "name": "com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
{
"name": "com.google.cloud.batch.v1alpha.ListTasksRequest",
"queryAllDeclaredConstructors": true,
@@ -1079,6 +1178,24 @@
"allDeclaredClasses": true,
"allPublicClasses": true
},
+ {
+ "name": "com.google.cloud.batch.v1alpha.Notification",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.cloud.batch.v1alpha.Notification$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
{
"name": "com.google.cloud.batch.v1alpha.OperationMetadata",
"queryAllDeclaredConstructors": true,
@@ -1115,6 +1232,33 @@
"allDeclaredClasses": true,
"allPublicClasses": true
},
+ {
+ "name": "com.google.cloud.batch.v1alpha.ResourceAllowance",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.cloud.batch.v1alpha.ResourceAllowance$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.cloud.batch.v1alpha.ResourceAllowanceState",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
{
"name": "com.google.cloud.batch.v1alpha.ResourceUsage",
"queryAllDeclaredConstructors": true,
@@ -1367,6 +1511,150 @@
"allDeclaredClasses": true,
"allPublicClasses": true
},
+ {
+ "name": "com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.cloud.batch.v1alpha.UsageResourceAllowance",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.cloud.batch.v1alpha.UsageResourceAllowance$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec$Limit",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec$Limit$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus$ConsumptionReport",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus$ConsumptionReport$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus$LimitStatus",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus$LimitStatus$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus$PeriodConsumption",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus$PeriodConsumption$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
{
"name": "com.google.cloud.batch.v1alpha.Volume",
"queryAllDeclaredConstructors": true,
@@ -2384,6 +2672,24 @@
"allDeclaredClasses": true,
"allPublicClasses": true
},
+ {
+ "name": "com.google.protobuf.FieldMask",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
+ {
+ "name": "com.google.protobuf.FieldMask$Builder",
+ "queryAllDeclaredConstructors": true,
+ "queryAllPublicConstructors": true,
+ "queryAllDeclaredMethods": true,
+ "allPublicMethods": true,
+ "allDeclaredClasses": true,
+ "allPublicClasses": true
+ },
{
"name": "com.google.protobuf.Timestamp",
"queryAllDeclaredConstructors": true,
diff --git a/java-batch/google-cloud-batch/src/test/java/com/google/cloud/batch/v1alpha/BatchServiceClientHttpJsonTest.java b/java-batch/google-cloud-batch/src/test/java/com/google/cloud/batch/v1alpha/BatchServiceClientHttpJsonTest.java
index 65de16b2573d..665988797913 100644
--- a/java-batch/google-cloud-batch/src/test/java/com/google/cloud/batch/v1alpha/BatchServiceClientHttpJsonTest.java
+++ b/java-batch/google-cloud-batch/src/test/java/com/google/cloud/batch/v1alpha/BatchServiceClientHttpJsonTest.java
@@ -18,6 +18,7 @@
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.ListResourceAllowancesPagedResponse;
import static com.google.cloud.batch.v1alpha.BatchServiceClient.ListTasksPagedResponse;
import com.google.api.gax.core.NoCredentialsProvider;
@@ -38,6 +39,7 @@
import com.google.longrunning.Operation;
import com.google.protobuf.Any;
import com.google.protobuf.Empty;
+import com.google.protobuf.FieldMask;
import com.google.protobuf.Timestamp;
import java.io.IOException;
import java.util.ArrayList;
@@ -613,6 +615,485 @@ public void listTasksExceptionTest2() throws Exception {
}
}
+ @Test
+ public void createResourceAllowanceTest() throws Exception {
+ ResourceAllowance expectedResponse =
+ ResourceAllowance.newBuilder()
+ .setName(
+ ResourceAllowanceName.of("[PROJECT]", "[LOCATION]", "[RESOURCE_ALLOWANCE]")
+ .toString())
+ .setUid("uid115792")
+ .setCreateTime(Timestamp.newBuilder().build())
+ .putAllLabels(new HashMap())
+ .addAllNotifications(new ArrayList())
+ .build();
+ mockService.addResponse(expectedResponse);
+
+ LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+ ResourceAllowance resourceAllowance = ResourceAllowance.newBuilder().build();
+ String resourceAllowanceId = "resourceAllowanceId-786470299";
+
+ ResourceAllowance actualResponse =
+ client.createResourceAllowance(parent, resourceAllowance, resourceAllowanceId);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void createResourceAllowanceExceptionTest() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+ ResourceAllowance resourceAllowance = ResourceAllowance.newBuilder().build();
+ String resourceAllowanceId = "resourceAllowanceId-786470299";
+ client.createResourceAllowance(parent, resourceAllowance, resourceAllowanceId);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void createResourceAllowanceTest2() throws Exception {
+ ResourceAllowance expectedResponse =
+ ResourceAllowance.newBuilder()
+ .setName(
+ ResourceAllowanceName.of("[PROJECT]", "[LOCATION]", "[RESOURCE_ALLOWANCE]")
+ .toString())
+ .setUid("uid115792")
+ .setCreateTime(Timestamp.newBuilder().build())
+ .putAllLabels(new HashMap())
+ .addAllNotifications(new ArrayList())
+ .build();
+ mockService.addResponse(expectedResponse);
+
+ String parent = "projects/project-5833/locations/location-5833";
+ ResourceAllowance resourceAllowance = ResourceAllowance.newBuilder().build();
+ String resourceAllowanceId = "resourceAllowanceId-786470299";
+
+ ResourceAllowance actualResponse =
+ client.createResourceAllowance(parent, resourceAllowance, resourceAllowanceId);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void createResourceAllowanceExceptionTest2() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ String parent = "projects/project-5833/locations/location-5833";
+ ResourceAllowance resourceAllowance = ResourceAllowance.newBuilder().build();
+ String resourceAllowanceId = "resourceAllowanceId-786470299";
+ client.createResourceAllowance(parent, resourceAllowance, resourceAllowanceId);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void getResourceAllowanceTest() throws Exception {
+ ResourceAllowance expectedResponse =
+ ResourceAllowance.newBuilder()
+ .setName(
+ ResourceAllowanceName.of("[PROJECT]", "[LOCATION]", "[RESOURCE_ALLOWANCE]")
+ .toString())
+ .setUid("uid115792")
+ .setCreateTime(Timestamp.newBuilder().build())
+ .putAllLabels(new HashMap())
+ .addAllNotifications(new ArrayList())
+ .build();
+ mockService.addResponse(expectedResponse);
+
+ ResourceAllowanceName name =
+ ResourceAllowanceName.of("[PROJECT]", "[LOCATION]", "[RESOURCE_ALLOWANCE]");
+
+ ResourceAllowance actualResponse = client.getResourceAllowance(name);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void getResourceAllowanceExceptionTest() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ ResourceAllowanceName name =
+ ResourceAllowanceName.of("[PROJECT]", "[LOCATION]", "[RESOURCE_ALLOWANCE]");
+ client.getResourceAllowance(name);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void getResourceAllowanceTest2() throws Exception {
+ ResourceAllowance expectedResponse =
+ ResourceAllowance.newBuilder()
+ .setName(
+ ResourceAllowanceName.of("[PROJECT]", "[LOCATION]", "[RESOURCE_ALLOWANCE]")
+ .toString())
+ .setUid("uid115792")
+ .setCreateTime(Timestamp.newBuilder().build())
+ .putAllLabels(new HashMap())
+ .addAllNotifications(new ArrayList())
+ .build();
+ mockService.addResponse(expectedResponse);
+
+ String name =
+ "projects/project-1945/locations/location-1945/resourceAllowances/resourceAllowance-1945";
+
+ ResourceAllowance actualResponse = client.getResourceAllowance(name);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void getResourceAllowanceExceptionTest2() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ String name =
+ "projects/project-1945/locations/location-1945/resourceAllowances/resourceAllowance-1945";
+ client.getResourceAllowance(name);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void deleteResourceAllowanceTest() throws Exception {
+ Empty expectedResponse = Empty.newBuilder().build();
+ Operation resultOperation =
+ Operation.newBuilder()
+ .setName("deleteResourceAllowanceTest")
+ .setDone(true)
+ .setResponse(Any.pack(expectedResponse))
+ .build();
+ mockService.addResponse(resultOperation);
+
+ ResourceAllowanceName name =
+ ResourceAllowanceName.of("[PROJECT]", "[LOCATION]", "[RESOURCE_ALLOWANCE]");
+
+ client.deleteResourceAllowanceAsync(name).get();
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void deleteResourceAllowanceExceptionTest() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ ResourceAllowanceName name =
+ ResourceAllowanceName.of("[PROJECT]", "[LOCATION]", "[RESOURCE_ALLOWANCE]");
+ client.deleteResourceAllowanceAsync(name).get();
+ Assert.fail("No exception raised");
+ } catch (ExecutionException e) {
+ }
+ }
+
+ @Test
+ public void deleteResourceAllowanceTest2() throws Exception {
+ Empty expectedResponse = Empty.newBuilder().build();
+ Operation resultOperation =
+ Operation.newBuilder()
+ .setName("deleteResourceAllowanceTest")
+ .setDone(true)
+ .setResponse(Any.pack(expectedResponse))
+ .build();
+ mockService.addResponse(resultOperation);
+
+ String name =
+ "projects/project-1945/locations/location-1945/resourceAllowances/resourceAllowance-1945";
+
+ client.deleteResourceAllowanceAsync(name).get();
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void deleteResourceAllowanceExceptionTest2() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ String name =
+ "projects/project-1945/locations/location-1945/resourceAllowances/resourceAllowance-1945";
+ client.deleteResourceAllowanceAsync(name).get();
+ Assert.fail("No exception raised");
+ } catch (ExecutionException e) {
+ }
+ }
+
+ @Test
+ public void listResourceAllowancesTest() throws Exception {
+ ResourceAllowance responsesElement = ResourceAllowance.newBuilder().build();
+ ListResourceAllowancesResponse expectedResponse =
+ ListResourceAllowancesResponse.newBuilder()
+ .setNextPageToken("")
+ .addAllResourceAllowances(Arrays.asList(responsesElement))
+ .build();
+ mockService.addResponse(expectedResponse);
+
+ LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+
+ ListResourceAllowancesPagedResponse pagedListResponse = client.listResourceAllowances(parent);
+
+ List resources = Lists.newArrayList(pagedListResponse.iterateAll());
+
+ Assert.assertEquals(1, resources.size());
+ Assert.assertEquals(expectedResponse.getResourceAllowancesList().get(0), resources.get(0));
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void listResourceAllowancesExceptionTest() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+ client.listResourceAllowances(parent);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void listResourceAllowancesTest2() throws Exception {
+ ResourceAllowance responsesElement = ResourceAllowance.newBuilder().build();
+ ListResourceAllowancesResponse expectedResponse =
+ ListResourceAllowancesResponse.newBuilder()
+ .setNextPageToken("")
+ .addAllResourceAllowances(Arrays.asList(responsesElement))
+ .build();
+ mockService.addResponse(expectedResponse);
+
+ String parent = "projects/project-5833/locations/location-5833";
+
+ ListResourceAllowancesPagedResponse pagedListResponse = client.listResourceAllowances(parent);
+
+ List resources = Lists.newArrayList(pagedListResponse.iterateAll());
+
+ Assert.assertEquals(1, resources.size());
+ Assert.assertEquals(expectedResponse.getResourceAllowancesList().get(0), resources.get(0));
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void listResourceAllowancesExceptionTest2() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ String parent = "projects/project-5833/locations/location-5833";
+ client.listResourceAllowances(parent);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void updateResourceAllowanceTest() throws Exception {
+ ResourceAllowance expectedResponse =
+ ResourceAllowance.newBuilder()
+ .setName(
+ ResourceAllowanceName.of("[PROJECT]", "[LOCATION]", "[RESOURCE_ALLOWANCE]")
+ .toString())
+ .setUid("uid115792")
+ .setCreateTime(Timestamp.newBuilder().build())
+ .putAllLabels(new HashMap())
+ .addAllNotifications(new ArrayList())
+ .build();
+ mockService.addResponse(expectedResponse);
+
+ ResourceAllowance resourceAllowance =
+ ResourceAllowance.newBuilder()
+ .setName(
+ ResourceAllowanceName.of("[PROJECT]", "[LOCATION]", "[RESOURCE_ALLOWANCE]")
+ .toString())
+ .setUid("uid115792")
+ .setCreateTime(Timestamp.newBuilder().build())
+ .putAllLabels(new HashMap())
+ .addAllNotifications(new ArrayList())
+ .build();
+ FieldMask updateMask = FieldMask.newBuilder().build();
+
+ ResourceAllowance actualResponse =
+ client.updateResourceAllowance(resourceAllowance, updateMask);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockService.getRequestPaths();
+ Assert.assertEquals(1, actualRequests.size());
+
+ String apiClientHeaderKey =
+ mockService
+ .getRequestHeaders()
+ .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey())
+ .iterator()
+ .next();
+ Assert.assertTrue(
+ GaxHttpJsonProperties.getDefaultApiClientHeaderPattern()
+ .matcher(apiClientHeaderKey)
+ .matches());
+ }
+
+ @Test
+ public void updateResourceAllowanceExceptionTest() throws Exception {
+ ApiException exception =
+ ApiExceptionFactory.createException(
+ new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false);
+ mockService.addException(exception);
+
+ try {
+ ResourceAllowance resourceAllowance =
+ ResourceAllowance.newBuilder()
+ .setName(
+ ResourceAllowanceName.of("[PROJECT]", "[LOCATION]", "[RESOURCE_ALLOWANCE]")
+ .toString())
+ .setUid("uid115792")
+ .setCreateTime(Timestamp.newBuilder().build())
+ .putAllLabels(new HashMap())
+ .addAllNotifications(new ArrayList())
+ .build();
+ FieldMask updateMask = FieldMask.newBuilder().build();
+ client.updateResourceAllowance(resourceAllowance, updateMask);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
@Test
public void listLocationsTest() throws Exception {
Location responsesElement = Location.newBuilder().build();
diff --git a/java-batch/google-cloud-batch/src/test/java/com/google/cloud/batch/v1alpha/BatchServiceClientTest.java b/java-batch/google-cloud-batch/src/test/java/com/google/cloud/batch/v1alpha/BatchServiceClientTest.java
index d1638503c891..813d9463460d 100644
--- a/java-batch/google-cloud-batch/src/test/java/com/google/cloud/batch/v1alpha/BatchServiceClientTest.java
+++ b/java-batch/google-cloud-batch/src/test/java/com/google/cloud/batch/v1alpha/BatchServiceClientTest.java
@@ -18,6 +18,7 @@
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.ListResourceAllowancesPagedResponse;
import static com.google.cloud.batch.v1alpha.BatchServiceClient.ListTasksPagedResponse;
import com.google.api.gax.core.NoCredentialsProvider;
@@ -37,6 +38,7 @@
import com.google.protobuf.AbstractMessage;
import com.google.protobuf.Any;
import com.google.protobuf.Empty;
+import com.google.protobuf.FieldMask;
import com.google.protobuf.Timestamp;
import io.grpc.StatusRuntimeException;
import java.io.IOException;
@@ -563,6 +565,429 @@ public void listTasksExceptionTest2() throws Exception {
}
}
+ @Test
+ public void createResourceAllowanceTest() throws Exception {
+ ResourceAllowance expectedResponse =
+ ResourceAllowance.newBuilder()
+ .setName(
+ ResourceAllowanceName.of("[PROJECT]", "[LOCATION]", "[RESOURCE_ALLOWANCE]")
+ .toString())
+ .setUid("uid115792")
+ .setCreateTime(Timestamp.newBuilder().build())
+ .putAllLabels(new HashMap())
+ .addAllNotifications(new ArrayList())
+ .build();
+ mockBatchService.addResponse(expectedResponse);
+
+ LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+ ResourceAllowance resourceAllowance = ResourceAllowance.newBuilder().build();
+ String resourceAllowanceId = "resourceAllowanceId-786470299";
+
+ ResourceAllowance actualResponse =
+ client.createResourceAllowance(parent, resourceAllowance, resourceAllowanceId);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockBatchService.getRequests();
+ Assert.assertEquals(1, actualRequests.size());
+ CreateResourceAllowanceRequest actualRequest =
+ ((CreateResourceAllowanceRequest) actualRequests.get(0));
+
+ Assert.assertEquals(parent.toString(), actualRequest.getParent());
+ Assert.assertEquals(resourceAllowance, actualRequest.getResourceAllowance());
+ Assert.assertEquals(resourceAllowanceId, actualRequest.getResourceAllowanceId());
+ Assert.assertTrue(
+ channelProvider.isHeaderSent(
+ ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
+ GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
+ }
+
+ @Test
+ public void createResourceAllowanceExceptionTest() throws Exception {
+ StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
+ mockBatchService.addException(exception);
+
+ try {
+ LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+ ResourceAllowance resourceAllowance = ResourceAllowance.newBuilder().build();
+ String resourceAllowanceId = "resourceAllowanceId-786470299";
+ client.createResourceAllowance(parent, resourceAllowance, resourceAllowanceId);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void createResourceAllowanceTest2() throws Exception {
+ ResourceAllowance expectedResponse =
+ ResourceAllowance.newBuilder()
+ .setName(
+ ResourceAllowanceName.of("[PROJECT]", "[LOCATION]", "[RESOURCE_ALLOWANCE]")
+ .toString())
+ .setUid("uid115792")
+ .setCreateTime(Timestamp.newBuilder().build())
+ .putAllLabels(new HashMap())
+ .addAllNotifications(new ArrayList())
+ .build();
+ mockBatchService.addResponse(expectedResponse);
+
+ String parent = "parent-995424086";
+ ResourceAllowance resourceAllowance = ResourceAllowance.newBuilder().build();
+ String resourceAllowanceId = "resourceAllowanceId-786470299";
+
+ ResourceAllowance actualResponse =
+ client.createResourceAllowance(parent, resourceAllowance, resourceAllowanceId);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockBatchService.getRequests();
+ Assert.assertEquals(1, actualRequests.size());
+ CreateResourceAllowanceRequest actualRequest =
+ ((CreateResourceAllowanceRequest) actualRequests.get(0));
+
+ Assert.assertEquals(parent, actualRequest.getParent());
+ Assert.assertEquals(resourceAllowance, actualRequest.getResourceAllowance());
+ Assert.assertEquals(resourceAllowanceId, actualRequest.getResourceAllowanceId());
+ Assert.assertTrue(
+ channelProvider.isHeaderSent(
+ ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
+ GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
+ }
+
+ @Test
+ public void createResourceAllowanceExceptionTest2() throws Exception {
+ StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
+ mockBatchService.addException(exception);
+
+ try {
+ String parent = "parent-995424086";
+ ResourceAllowance resourceAllowance = ResourceAllowance.newBuilder().build();
+ String resourceAllowanceId = "resourceAllowanceId-786470299";
+ client.createResourceAllowance(parent, resourceAllowance, resourceAllowanceId);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void getResourceAllowanceTest() throws Exception {
+ ResourceAllowance expectedResponse =
+ ResourceAllowance.newBuilder()
+ .setName(
+ ResourceAllowanceName.of("[PROJECT]", "[LOCATION]", "[RESOURCE_ALLOWANCE]")
+ .toString())
+ .setUid("uid115792")
+ .setCreateTime(Timestamp.newBuilder().build())
+ .putAllLabels(new HashMap())
+ .addAllNotifications(new ArrayList())
+ .build();
+ mockBatchService.addResponse(expectedResponse);
+
+ ResourceAllowanceName name =
+ ResourceAllowanceName.of("[PROJECT]", "[LOCATION]", "[RESOURCE_ALLOWANCE]");
+
+ ResourceAllowance actualResponse = client.getResourceAllowance(name);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockBatchService.getRequests();
+ Assert.assertEquals(1, actualRequests.size());
+ GetResourceAllowanceRequest actualRequest =
+ ((GetResourceAllowanceRequest) actualRequests.get(0));
+
+ Assert.assertEquals(name.toString(), actualRequest.getName());
+ Assert.assertTrue(
+ channelProvider.isHeaderSent(
+ ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
+ GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
+ }
+
+ @Test
+ public void getResourceAllowanceExceptionTest() throws Exception {
+ StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
+ mockBatchService.addException(exception);
+
+ try {
+ ResourceAllowanceName name =
+ ResourceAllowanceName.of("[PROJECT]", "[LOCATION]", "[RESOURCE_ALLOWANCE]");
+ client.getResourceAllowance(name);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void getResourceAllowanceTest2() throws Exception {
+ ResourceAllowance expectedResponse =
+ ResourceAllowance.newBuilder()
+ .setName(
+ ResourceAllowanceName.of("[PROJECT]", "[LOCATION]", "[RESOURCE_ALLOWANCE]")
+ .toString())
+ .setUid("uid115792")
+ .setCreateTime(Timestamp.newBuilder().build())
+ .putAllLabels(new HashMap())
+ .addAllNotifications(new ArrayList())
+ .build();
+ mockBatchService.addResponse(expectedResponse);
+
+ String name = "name3373707";
+
+ ResourceAllowance actualResponse = client.getResourceAllowance(name);
+ Assert.assertEquals(expectedResponse, actualResponse);
+
+ List actualRequests = mockBatchService.getRequests();
+ Assert.assertEquals(1, actualRequests.size());
+ GetResourceAllowanceRequest actualRequest =
+ ((GetResourceAllowanceRequest) actualRequests.get(0));
+
+ Assert.assertEquals(name, actualRequest.getName());
+ Assert.assertTrue(
+ channelProvider.isHeaderSent(
+ ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
+ GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
+ }
+
+ @Test
+ public void getResourceAllowanceExceptionTest2() throws Exception {
+ StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
+ mockBatchService.addException(exception);
+
+ try {
+ String name = "name3373707";
+ client.getResourceAllowance(name);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void deleteResourceAllowanceTest() throws Exception {
+ Empty expectedResponse = Empty.newBuilder().build();
+ Operation resultOperation =
+ Operation.newBuilder()
+ .setName("deleteResourceAllowanceTest")
+ .setDone(true)
+ .setResponse(Any.pack(expectedResponse))
+ .build();
+ mockBatchService.addResponse(resultOperation);
+
+ ResourceAllowanceName name =
+ ResourceAllowanceName.of("[PROJECT]", "[LOCATION]", "[RESOURCE_ALLOWANCE]");
+
+ client.deleteResourceAllowanceAsync(name).get();
+
+ List actualRequests = mockBatchService.getRequests();
+ Assert.assertEquals(1, actualRequests.size());
+ DeleteResourceAllowanceRequest actualRequest =
+ ((DeleteResourceAllowanceRequest) actualRequests.get(0));
+
+ Assert.assertEquals(name.toString(), actualRequest.getName());
+ Assert.assertTrue(
+ channelProvider.isHeaderSent(
+ ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
+ GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
+ }
+
+ @Test
+ public void deleteResourceAllowanceExceptionTest() throws Exception {
+ StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
+ mockBatchService.addException(exception);
+
+ try {
+ ResourceAllowanceName name =
+ ResourceAllowanceName.of("[PROJECT]", "[LOCATION]", "[RESOURCE_ALLOWANCE]");
+ client.deleteResourceAllowanceAsync(name).get();
+ Assert.fail("No exception raised");
+ } catch (ExecutionException e) {
+ Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass());
+ InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause());
+ Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode());
+ }
+ }
+
+ @Test
+ public void deleteResourceAllowanceTest2() throws Exception {
+ Empty expectedResponse = Empty.newBuilder().build();
+ Operation resultOperation =
+ Operation.newBuilder()
+ .setName("deleteResourceAllowanceTest")
+ .setDone(true)
+ .setResponse(Any.pack(expectedResponse))
+ .build();
+ mockBatchService.addResponse(resultOperation);
+
+ String name = "name3373707";
+
+ client.deleteResourceAllowanceAsync(name).get();
+
+ List actualRequests = mockBatchService.getRequests();
+ Assert.assertEquals(1, actualRequests.size());
+ DeleteResourceAllowanceRequest actualRequest =
+ ((DeleteResourceAllowanceRequest) actualRequests.get(0));
+
+ Assert.assertEquals(name, actualRequest.getName());
+ Assert.assertTrue(
+ channelProvider.isHeaderSent(
+ ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
+ GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
+ }
+
+ @Test
+ public void deleteResourceAllowanceExceptionTest2() throws Exception {
+ StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
+ mockBatchService.addException(exception);
+
+ try {
+ String name = "name3373707";
+ client.deleteResourceAllowanceAsync(name).get();
+ Assert.fail("No exception raised");
+ } catch (ExecutionException e) {
+ Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass());
+ InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause());
+ Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode());
+ }
+ }
+
+ @Test
+ public void listResourceAllowancesTest() throws Exception {
+ ResourceAllowance responsesElement = ResourceAllowance.newBuilder().build();
+ ListResourceAllowancesResponse expectedResponse =
+ ListResourceAllowancesResponse.newBuilder()
+ .setNextPageToken("")
+ .addAllResourceAllowances(Arrays.asList(responsesElement))
+ .build();
+ mockBatchService.addResponse(expectedResponse);
+
+ LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+
+ ListResourceAllowancesPagedResponse pagedListResponse = client.listResourceAllowances(parent);
+
+ List resources = Lists.newArrayList(pagedListResponse.iterateAll());
+
+ Assert.assertEquals(1, resources.size());
+ Assert.assertEquals(expectedResponse.getResourceAllowancesList().get(0), resources.get(0));
+
+ List actualRequests = mockBatchService.getRequests();
+ Assert.assertEquals(1, actualRequests.size());
+ ListResourceAllowancesRequest actualRequest =
+ ((ListResourceAllowancesRequest) actualRequests.get(0));
+
+ Assert.assertEquals(parent.toString(), actualRequest.getParent());
+ Assert.assertTrue(
+ channelProvider.isHeaderSent(
+ ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
+ GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
+ }
+
+ @Test
+ public void listResourceAllowancesExceptionTest() throws Exception {
+ StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
+ mockBatchService.addException(exception);
+
+ try {
+ LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
+ client.listResourceAllowances(parent);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void listResourceAllowancesTest2() throws Exception {
+ ResourceAllowance responsesElement = ResourceAllowance.newBuilder().build();
+ ListResourceAllowancesResponse expectedResponse =
+ ListResourceAllowancesResponse.newBuilder()
+ .setNextPageToken("")
+ .addAllResourceAllowances(Arrays.asList(responsesElement))
+ .build();
+ mockBatchService.addResponse(expectedResponse);
+
+ String parent = "parent-995424086";
+
+ ListResourceAllowancesPagedResponse pagedListResponse = client.listResourceAllowances(parent);
+
+ List resources = Lists.newArrayList(pagedListResponse.iterateAll());
+
+ Assert.assertEquals(1, resources.size());
+ Assert.assertEquals(expectedResponse.getResourceAllowancesList().get(0), resources.get(0));
+
+ List actualRequests = mockBatchService.getRequests();
+ Assert.assertEquals(1, actualRequests.size());
+ ListResourceAllowancesRequest actualRequest =
+ ((ListResourceAllowancesRequest) actualRequests.get(0));
+
+ Assert.assertEquals(parent, actualRequest.getParent());
+ Assert.assertTrue(
+ channelProvider.isHeaderSent(
+ ApiClientHeaderProvider.getDefaultApiClientHeaderKey(),
+ GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
+ }
+
+ @Test
+ public void listResourceAllowancesExceptionTest2() throws Exception {
+ StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
+ mockBatchService.addException(exception);
+
+ try {
+ String parent = "parent-995424086";
+ client.listResourceAllowances(parent);
+ Assert.fail("No exception raised");
+ } catch (InvalidArgumentException e) {
+ // Expected exception.
+ }
+ }
+
+ @Test
+ public void updateResourceAllowanceTest() throws Exception {
+ ResourceAllowance expectedResponse =
+ ResourceAllowance.newBuilder()
+ .setName(
+ ResourceAllowanceName.of("[PROJECT]", "[LOCATION]", "[RESOURCE_ALLOWANCE]")
+ .toString())
+ .setUid("uid115792")
+ .setCreateTime(Timestamp.newBuilder().build())
+ .putAllLabels(new HashMap())
+ .addAllNotifications(new ArrayList |