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 @@ * * * + *

CreateResourceAllowance + *

Create a Resource Allowance. + * + *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ * + *

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

+ * + *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ * + * + * + * + *

GetResourceAllowance + *

Get a ResourceAllowance specified by its resource name. + * + *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ * + *

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

+ * + *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ * + * + * + * + *

DeleteResourceAllowance + *

Delete a ResourceAllowance. + * + *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ * + *

Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.

+ * + *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ * + * + * + * + *

ListResourceAllowances + *

List all ResourceAllowances for a project within a region. + * + *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ * + *

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

+ * + *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ * + * + * + * + *

UpdateResourceAllowance + *

Update a Resource Allowance. + * + *

Request object method variants only take one parameter, a request object, which must be constructed before the call.

+ * + *

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

+ * + *

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

+ * + * + * + * *

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()) + .build(); + mockBatchService.addResponse(expectedResponse); + + ResourceAllowance resourceAllowance = ResourceAllowance.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + ResourceAllowance actualResponse = + client.updateResourceAllowance(resourceAllowance, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockBatchService.getRequests(); + Assert.assertEquals(1, actualRequests.size()); + UpdateResourceAllowanceRequest actualRequest = + ((UpdateResourceAllowanceRequest) actualRequests.get(0)); + + Assert.assertEquals(resourceAllowance, actualRequest.getResourceAllowance()); + Assert.assertEquals(updateMask, actualRequest.getUpdateMask()); + Assert.assertTrue( + channelProvider.isHeaderSent( + ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), + GaxGrpcProperties.getDefaultApiClientHeaderPattern())); + } + + @Test + public void updateResourceAllowanceExceptionTest() throws Exception { + StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT); + mockBatchService.addException(exception); + + try { + ResourceAllowance resourceAllowance = ResourceAllowance.newBuilder().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/MockBatchServiceImpl.java b/java-batch/google-cloud-batch/src/test/java/com/google/cloud/batch/v1alpha/MockBatchServiceImpl.java index db28931af811..d293fe98a74f 100644 --- a/java-batch/google-cloud-batch/src/test/java/com/google/cloud/batch/v1alpha/MockBatchServiceImpl.java +++ b/java-batch/google-cloud-batch/src/test/java/com/google/cloud/batch/v1alpha/MockBatchServiceImpl.java @@ -179,4 +179,110 @@ public void listTasks( Exception.class.getName()))); } } + + @Override + public void createResourceAllowance( + CreateResourceAllowanceRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof ResourceAllowance) { + requests.add(request); + responseObserver.onNext(((ResourceAllowance) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method CreateResourceAllowance, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + ResourceAllowance.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void getResourceAllowance( + GetResourceAllowanceRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof ResourceAllowance) { + requests.add(request); + responseObserver.onNext(((ResourceAllowance) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method GetResourceAllowance, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + ResourceAllowance.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void deleteResourceAllowance( + DeleteResourceAllowanceRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof Operation) { + requests.add(request); + responseObserver.onNext(((Operation) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method DeleteResourceAllowance, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + Operation.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void listResourceAllowances( + ListResourceAllowancesRequest request, + StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof ListResourceAllowancesResponse) { + requests.add(request); + responseObserver.onNext(((ListResourceAllowancesResponse) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method ListResourceAllowances, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + ListResourceAllowancesResponse.class.getName(), + Exception.class.getName()))); + } + } + + @Override + public void updateResourceAllowance( + UpdateResourceAllowanceRequest request, StreamObserver responseObserver) { + Object response = responses.poll(); + if (response instanceof ResourceAllowance) { + requests.add(request); + responseObserver.onNext(((ResourceAllowance) response)); + responseObserver.onCompleted(); + } else if (response instanceof Exception) { + responseObserver.onError(((Exception) response)); + } else { + responseObserver.onError( + new IllegalArgumentException( + String.format( + "Unrecognized response type %s for method UpdateResourceAllowance, expected %s or %s", + response == null ? "null" : response.getClass().getName(), + ResourceAllowance.class.getName(), + Exception.class.getName()))); + } + } } diff --git a/java-batch/grpc-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/BatchServiceGrpc.java b/java-batch/grpc-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/BatchServiceGrpc.java index 427ce66c5433..9e26ad54dd1a 100644 --- a/java-batch/grpc-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/BatchServiceGrpc.java +++ b/java-batch/grpc-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/BatchServiceGrpc.java @@ -290,6 +290,254 @@ private BatchServiceGrpc() {} return getListTasksMethod; } + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest, + com.google.cloud.batch.v1alpha.ResourceAllowance> + getCreateResourceAllowanceMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "CreateResourceAllowance", + requestType = com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest.class, + responseType = com.google.cloud.batch.v1alpha.ResourceAllowance.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest, + com.google.cloud.batch.v1alpha.ResourceAllowance> + getCreateResourceAllowanceMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest, + com.google.cloud.batch.v1alpha.ResourceAllowance> + getCreateResourceAllowanceMethod; + if ((getCreateResourceAllowanceMethod = BatchServiceGrpc.getCreateResourceAllowanceMethod) + == null) { + synchronized (BatchServiceGrpc.class) { + if ((getCreateResourceAllowanceMethod = BatchServiceGrpc.getCreateResourceAllowanceMethod) + == null) { + BatchServiceGrpc.getCreateResourceAllowanceMethod = + getCreateResourceAllowanceMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName(SERVICE_NAME, "CreateResourceAllowance")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.batch.v1alpha.ResourceAllowance + .getDefaultInstance())) + .setSchemaDescriptor( + new BatchServiceMethodDescriptorSupplier("CreateResourceAllowance")) + .build(); + } + } + } + return getCreateResourceAllowanceMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest, + com.google.cloud.batch.v1alpha.ResourceAllowance> + getGetResourceAllowanceMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "GetResourceAllowance", + requestType = com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest.class, + responseType = com.google.cloud.batch.v1alpha.ResourceAllowance.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest, + com.google.cloud.batch.v1alpha.ResourceAllowance> + getGetResourceAllowanceMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest, + com.google.cloud.batch.v1alpha.ResourceAllowance> + getGetResourceAllowanceMethod; + if ((getGetResourceAllowanceMethod = BatchServiceGrpc.getGetResourceAllowanceMethod) == null) { + synchronized (BatchServiceGrpc.class) { + if ((getGetResourceAllowanceMethod = BatchServiceGrpc.getGetResourceAllowanceMethod) + == null) { + BatchServiceGrpc.getGetResourceAllowanceMethod = + getGetResourceAllowanceMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName(SERVICE_NAME, "GetResourceAllowance")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.batch.v1alpha.ResourceAllowance + .getDefaultInstance())) + .setSchemaDescriptor( + new BatchServiceMethodDescriptorSupplier("GetResourceAllowance")) + .build(); + } + } + } + return getGetResourceAllowanceMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest, + com.google.longrunning.Operation> + getDeleteResourceAllowanceMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "DeleteResourceAllowance", + requestType = com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest.class, + responseType = com.google.longrunning.Operation.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest, + com.google.longrunning.Operation> + getDeleteResourceAllowanceMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest, + com.google.longrunning.Operation> + getDeleteResourceAllowanceMethod; + if ((getDeleteResourceAllowanceMethod = BatchServiceGrpc.getDeleteResourceAllowanceMethod) + == null) { + synchronized (BatchServiceGrpc.class) { + if ((getDeleteResourceAllowanceMethod = BatchServiceGrpc.getDeleteResourceAllowanceMethod) + == null) { + BatchServiceGrpc.getDeleteResourceAllowanceMethod = + getDeleteResourceAllowanceMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName(SERVICE_NAME, "DeleteResourceAllowance")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.longrunning.Operation.getDefaultInstance())) + .setSchemaDescriptor( + new BatchServiceMethodDescriptorSupplier("DeleteResourceAllowance")) + .build(); + } + } + } + return getDeleteResourceAllowanceMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest, + com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse> + getListResourceAllowancesMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "ListResourceAllowances", + requestType = com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest.class, + responseType = com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest, + com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse> + getListResourceAllowancesMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest, + com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse> + getListResourceAllowancesMethod; + if ((getListResourceAllowancesMethod = BatchServiceGrpc.getListResourceAllowancesMethod) + == null) { + synchronized (BatchServiceGrpc.class) { + if ((getListResourceAllowancesMethod = BatchServiceGrpc.getListResourceAllowancesMethod) + == null) { + BatchServiceGrpc.getListResourceAllowancesMethod = + getListResourceAllowancesMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName(SERVICE_NAME, "ListResourceAllowances")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse + .getDefaultInstance())) + .setSchemaDescriptor( + new BatchServiceMethodDescriptorSupplier("ListResourceAllowances")) + .build(); + } + } + } + return getListResourceAllowancesMethod; + } + + private static volatile io.grpc.MethodDescriptor< + com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest, + com.google.cloud.batch.v1alpha.ResourceAllowance> + getUpdateResourceAllowanceMethod; + + @io.grpc.stub.annotations.RpcMethod( + fullMethodName = SERVICE_NAME + '/' + "UpdateResourceAllowance", + requestType = com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest.class, + responseType = com.google.cloud.batch.v1alpha.ResourceAllowance.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) + public static io.grpc.MethodDescriptor< + com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest, + com.google.cloud.batch.v1alpha.ResourceAllowance> + getUpdateResourceAllowanceMethod() { + io.grpc.MethodDescriptor< + com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest, + com.google.cloud.batch.v1alpha.ResourceAllowance> + getUpdateResourceAllowanceMethod; + if ((getUpdateResourceAllowanceMethod = BatchServiceGrpc.getUpdateResourceAllowanceMethod) + == null) { + synchronized (BatchServiceGrpc.class) { + if ((getUpdateResourceAllowanceMethod = BatchServiceGrpc.getUpdateResourceAllowanceMethod) + == null) { + BatchServiceGrpc.getUpdateResourceAllowanceMethod = + getUpdateResourceAllowanceMethod = + io.grpc.MethodDescriptor + . + newBuilder() + .setType(io.grpc.MethodDescriptor.MethodType.UNARY) + .setFullMethodName( + generateFullMethodName(SERVICE_NAME, "UpdateResourceAllowance")) + .setSampledToLocalTracing(true) + .setRequestMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest + .getDefaultInstance())) + .setResponseMarshaller( + io.grpc.protobuf.ProtoUtils.marshaller( + com.google.cloud.batch.v1alpha.ResourceAllowance + .getDefaultInstance())) + .setSchemaDescriptor( + new BatchServiceMethodDescriptorSupplier("UpdateResourceAllowance")) + .build(); + } + } + } + return getUpdateResourceAllowanceMethod; + } + /** Creates a new async stub that supports all call types for the service */ public static BatchServiceStub newStub(io.grpc.Channel channel) { io.grpc.stub.AbstractStub.StubFactory factory = @@ -421,6 +669,80 @@ default void listTasks( responseObserver) { io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getListTasksMethod(), responseObserver); } + + /** + * + * + *
+     * Create a Resource Allowance.
+     * 
+ */ + default void createResourceAllowance( + com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getCreateResourceAllowanceMethod(), responseObserver); + } + + /** + * + * + *
+     * Get a ResourceAllowance specified by its resource name.
+     * 
+ */ + default void getResourceAllowance( + com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getGetResourceAllowanceMethod(), responseObserver); + } + + /** + * + * + *
+     * Delete a ResourceAllowance.
+     * 
+ */ + default void deleteResourceAllowance( + com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getDeleteResourceAllowanceMethod(), responseObserver); + } + + /** + * + * + *
+     * List all ResourceAllowances for a project within a region.
+     * 
+ */ + default void listResourceAllowances( + com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getListResourceAllowancesMethod(), responseObserver); + } + + /** + * + * + *
+     * Update a Resource Allowance.
+     * 
+ */ + default void updateResourceAllowance( + com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall( + getUpdateResourceAllowanceMethod(), responseObserver); + } } /** @@ -546,6 +868,90 @@ public void listTasks( io.grpc.stub.ClientCalls.asyncUnaryCall( getChannel().newCall(getListTasksMethod(), getCallOptions()), request, responseObserver); } + + /** + * + * + *
+     * Create a Resource Allowance.
+     * 
+ */ + public void createResourceAllowance( + com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getCreateResourceAllowanceMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Get a ResourceAllowance specified by its resource name.
+     * 
+ */ + public void getResourceAllowance( + com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getGetResourceAllowanceMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Delete a ResourceAllowance.
+     * 
+ */ + public void deleteResourceAllowance( + com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest request, + io.grpc.stub.StreamObserver responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getDeleteResourceAllowanceMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * List all ResourceAllowances for a project within a region.
+     * 
+ */ + public void listResourceAllowances( + com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getListResourceAllowancesMethod(), getCallOptions()), + request, + responseObserver); + } + + /** + * + * + *
+     * Update a Resource Allowance.
+     * 
+ */ + public void updateResourceAllowance( + com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest request, + io.grpc.stub.StreamObserver + responseObserver) { + io.grpc.stub.ClientCalls.asyncUnaryCall( + getChannel().newCall(getUpdateResourceAllowanceMethod(), getCallOptions()), + request, + responseObserver); + } } /** @@ -646,6 +1052,71 @@ public com.google.cloud.batch.v1alpha.ListTasksResponse listTasks( return io.grpc.stub.ClientCalls.blockingUnaryCall( getChannel(), getListTasksMethod(), getCallOptions(), request); } + + /** + * + * + *
+     * Create a Resource Allowance.
+     * 
+ */ + public com.google.cloud.batch.v1alpha.ResourceAllowance createResourceAllowance( + com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getCreateResourceAllowanceMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Get a ResourceAllowance specified by its resource name.
+     * 
+ */ + public com.google.cloud.batch.v1alpha.ResourceAllowance getResourceAllowance( + com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getGetResourceAllowanceMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Delete a ResourceAllowance.
+     * 
+ */ + public com.google.longrunning.Operation deleteResourceAllowance( + com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getDeleteResourceAllowanceMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * List all ResourceAllowances for a project within a region.
+     * 
+ */ + public com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse listResourceAllowances( + com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getListResourceAllowancesMethod(), getCallOptions(), request); + } + + /** + * + * + *
+     * Update a Resource Allowance.
+     * 
+ */ + public com.google.cloud.batch.v1alpha.ResourceAllowance updateResourceAllowance( + com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest request) { + return io.grpc.stub.ClientCalls.blockingUnaryCall( + getChannel(), getUpdateResourceAllowanceMethod(), getCallOptions(), request); + } } /** @@ -748,6 +1219,79 @@ protected BatchServiceFutureStub build( return io.grpc.stub.ClientCalls.futureUnaryCall( getChannel().newCall(getListTasksMethod(), getCallOptions()), request); } + + /** + * + * + *
+     * Create a Resource Allowance.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.batch.v1alpha.ResourceAllowance> + createResourceAllowance( + com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getCreateResourceAllowanceMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Get a ResourceAllowance specified by its resource name.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.batch.v1alpha.ResourceAllowance> + getResourceAllowance(com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getGetResourceAllowanceMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Delete a ResourceAllowance.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture + deleteResourceAllowance( + com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getDeleteResourceAllowanceMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * List all ResourceAllowances for a project within a region.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse> + listResourceAllowances( + com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getListResourceAllowancesMethod(), getCallOptions()), request); + } + + /** + * + * + *
+     * Update a Resource Allowance.
+     * 
+ */ + public com.google.common.util.concurrent.ListenableFuture< + com.google.cloud.batch.v1alpha.ResourceAllowance> + updateResourceAllowance( + com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest request) { + return io.grpc.stub.ClientCalls.futureUnaryCall( + getChannel().newCall(getUpdateResourceAllowanceMethod(), getCallOptions()), request); + } } private static final int METHODID_CREATE_JOB = 0; @@ -756,6 +1300,11 @@ protected BatchServiceFutureStub build( private static final int METHODID_LIST_JOBS = 3; private static final int METHODID_GET_TASK = 4; private static final int METHODID_LIST_TASKS = 5; + private static final int METHODID_CREATE_RESOURCE_ALLOWANCE = 6; + private static final int METHODID_GET_RESOURCE_ALLOWANCE = 7; + private static final int METHODID_DELETE_RESOURCE_ALLOWANCE = 8; + private static final int METHODID_LIST_RESOURCE_ALLOWANCES = 9; + private static final int METHODID_UPDATE_RESOURCE_ALLOWANCE = 10; private static final class MethodHandlers implements io.grpc.stub.ServerCalls.UnaryMethod, @@ -806,6 +1355,36 @@ public void invoke(Req request, io.grpc.stub.StreamObserver responseObserv (io.grpc.stub.StreamObserver) responseObserver); break; + case METHODID_CREATE_RESOURCE_ALLOWANCE: + serviceImpl.createResourceAllowance( + (com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_GET_RESOURCE_ALLOWANCE: + serviceImpl.getResourceAllowance( + (com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; + case METHODID_DELETE_RESOURCE_ALLOWANCE: + serviceImpl.deleteResourceAllowance( + (com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest) request, + (io.grpc.stub.StreamObserver) responseObserver); + break; + case METHODID_LIST_RESOURCE_ALLOWANCES: + serviceImpl.listResourceAllowances( + (com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest) request, + (io.grpc.stub.StreamObserver< + com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse>) + responseObserver); + break; + case METHODID_UPDATE_RESOURCE_ALLOWANCE: + serviceImpl.updateResourceAllowance( + (com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest) request, + (io.grpc.stub.StreamObserver) + responseObserver); + break; default: throw new AssertionError(); } @@ -861,6 +1440,40 @@ public static final io.grpc.ServerServiceDefinition bindService(AsyncService ser com.google.cloud.batch.v1alpha.ListTasksRequest, com.google.cloud.batch.v1alpha.ListTasksResponse>( service, METHODID_LIST_TASKS))) + .addMethod( + getCreateResourceAllowanceMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest, + com.google.cloud.batch.v1alpha.ResourceAllowance>( + service, METHODID_CREATE_RESOURCE_ALLOWANCE))) + .addMethod( + getGetResourceAllowanceMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest, + com.google.cloud.batch.v1alpha.ResourceAllowance>( + service, METHODID_GET_RESOURCE_ALLOWANCE))) + .addMethod( + getDeleteResourceAllowanceMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest, + com.google.longrunning.Operation>(service, METHODID_DELETE_RESOURCE_ALLOWANCE))) + .addMethod( + getListResourceAllowancesMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest, + com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse>( + service, METHODID_LIST_RESOURCE_ALLOWANCES))) + .addMethod( + getUpdateResourceAllowanceMethod(), + io.grpc.stub.ServerCalls.asyncUnaryCall( + new MethodHandlers< + com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest, + com.google.cloud.batch.v1alpha.ResourceAllowance>( + service, METHODID_UPDATE_RESOURCE_ALLOWANCE))) .build(); } @@ -918,6 +1531,11 @@ public static io.grpc.ServiceDescriptor getServiceDescriptor() { .addMethod(getListJobsMethod()) .addMethod(getGetTaskMethod()) .addMethod(getListTasksMethod()) + .addMethod(getCreateResourceAllowanceMethod()) + .addMethod(getGetResourceAllowanceMethod()) + .addMethod(getDeleteResourceAllowanceMethod()) + .addMethod(getListResourceAllowancesMethod()) + .addMethod(getUpdateResourceAllowanceMethod()) .build(); } } diff --git a/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/BatchProto.java b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/BatchProto.java index e845ebee2c08..2fb0a5704d9d 100644 --- a/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/BatchProto.java +++ b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/BatchProto.java @@ -60,6 +60,30 @@ public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry r internal_static_google_cloud_batch_v1alpha_GetTaskRequest_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internal_static_google_cloud_batch_v1alpha_GetTaskRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_batch_v1alpha_CreateResourceAllowanceRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_batch_v1alpha_CreateResourceAllowanceRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_batch_v1alpha_GetResourceAllowanceRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_batch_v1alpha_GetResourceAllowanceRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_batch_v1alpha_DeleteResourceAllowanceRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_batch_v1alpha_DeleteResourceAllowanceRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_batch_v1alpha_ListResourceAllowancesRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_batch_v1alpha_ListResourceAllowancesRequest_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_batch_v1alpha_ListResourceAllowancesResponse_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_batch_v1alpha_ListResourceAllowancesResponse_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_batch_v1alpha_UpdateResourceAllowanceRequest_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_batch_v1alpha_UpdateResourceAllowanceRequest_fieldAccessorTable; static final com.google.protobuf.Descriptors.Descriptor internal_static_google_cloud_batch_v1alpha_OperationMetadata_descriptor; static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable @@ -79,38 +103,65 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "oto\032\037google/api/field_behavior.proto\032\033go" + "ogle/api/field_info.proto\032\031google/api/re" + "source.proto\032$google/cloud/batch/v1alpha" - + "/job.proto\032%google/cloud/batch/v1alpha/t" - + "ask.proto\032#google/longrunning/operations" - + ".proto\032\033google/protobuf/empty.proto\032\037goo" - + "gle/protobuf/timestamp.proto\"\240\001\n\020CreateJ" - + "obRequest\0220\n\006parent\030\001 \001(\tB \340A\002\372A\032\022\030batch" - + ".googleapis.com/Job\022\016\n\006job_id\030\002 \001(\t\0221\n\003j" - + "ob\030\003 \001(\0132\037.google.cloud.batch.v1alpha.Jo" - + "bB\003\340A\002\022\027\n\nrequest_id\030\004 \001(\tB\003\340A\001\"?\n\rGetJo" - + "bRequest\022.\n\004name\030\001 \001(\tB \340A\002\372A\032\n\030batch.go" - + "ogleapis.com/Job\"N\n\020DeleteJobRequest\022\014\n\004" - + "name\030\001 \001(\t\022\023\n\006reason\030\002 \001(\tB\003\340A\001\022\027\n\nreque" - + "st_id\030\004 \001(\tB\003\340A\001\"o\n\017ListJobsRequest\022\016\n\006p" - + "arent\030\001 \001(\t\022\016\n\006filter\030\004 \001(\t\022\025\n\010order_by\030" - + "\005 \001(\tB\003\340A\001\022\021\n\tpage_size\030\002 \001(\005\022\022\n\npage_to" - + "ken\030\003 \001(\t\"o\n\020ListJobsResponse\022-\n\004jobs\030\001 " - + "\003(\0132\037.google.cloud.batch.v1alpha.Job\022\027\n\017" - + "next_page_token\030\002 \001(\t\022\023\n\013unreachable\030\003 \003" - + "(\t\"\223\001\n\020ListTasksRequest\0226\n\006parent\030\001 \001(\tB" - + "&\340A\002\372A \n\036batch.googleapis.com/TaskGroup\022" - + "\016\n\006filter\030\002 \001(\t\022\020\n\010order_by\030\005 \001(\t\022\021\n\tpag" - + "e_size\030\003 \001(\005\022\022\n\npage_token\030\004 \001(\t\"r\n\021List" - + "TasksResponse\022/\n\005tasks\030\001 \003(\0132 .google.cl" - + "oud.batch.v1alpha.Task\022\027\n\017next_page_toke" - + "n\030\002 \001(\t\022\023\n\013unreachable\030\003 \003(\t\"A\n\016GetTaskR" - + "equest\022/\n\004name\030\001 \001(\tB!\340A\002\372A\033\n\031batch.goog" - + "leapis.com/Task\"\200\002\n\021OperationMetadata\0224\n" + + "/job.proto\0323google/cloud/batch/v1alpha/r" + + "esource_allowance.proto\032%google/cloud/ba" + + "tch/v1alpha/task.proto\032#google/longrunni" + + "ng/operations.proto\032\033google/protobuf/emp" + + "ty.proto\032 google/protobuf/field_mask.pro" + + "to\032\037google/protobuf/timestamp.proto\"\240\001\n\020" + + "CreateJobRequest\0220\n\006parent\030\001 \001(\tB \340A\002\372A\032" + + "\022\030batch.googleapis.com/Job\022\016\n\006job_id\030\002 \001" + + "(\t\0221\n\003job\030\003 \001(\0132\037.google.cloud.batch.v1a" + + "lpha.JobB\003\340A\002\022\027\n\nrequest_id\030\004 \001(\tB\003\340A\001\"?" + + "\n\rGetJobRequest\022.\n\004name\030\001 \001(\tB \340A\002\372A\032\n\030b" + + "atch.googleapis.com/Job\"N\n\020DeleteJobRequ" + + "est\022\014\n\004name\030\001 \001(\t\022\023\n\006reason\030\002 \001(\tB\003\340A\001\022\027" + + "\n\nrequest_id\030\004 \001(\tB\003\340A\001\"o\n\017ListJobsReque" + + "st\022\016\n\006parent\030\001 \001(\t\022\016\n\006filter\030\004 \001(\t\022\025\n\010or" + + "der_by\030\005 \001(\tB\003\340A\001\022\021\n\tpage_size\030\002 \001(\005\022\022\n\n" + + "page_token\030\003 \001(\t\"o\n\020ListJobsResponse\022-\n\004" + + "jobs\030\001 \003(\0132\037.google.cloud.batch.v1alpha." + + "Job\022\027\n\017next_page_token\030\002 \001(\t\022\023\n\013unreacha" + + "ble\030\003 \003(\t\"\223\001\n\020ListTasksRequest\0226\n\006parent" + + "\030\001 \001(\tB&\340A\002\372A \n\036batch.googleapis.com/Tas" + + "kGroup\022\016\n\006filter\030\002 \001(\t\022\020\n\010order_by\030\005 \001(\t" + + "\022\021\n\tpage_size\030\003 \001(\005\022\022\n\npage_token\030\004 \001(\t\"" + + "r\n\021ListTasksResponse\022/\n\005tasks\030\001 \003(\0132 .go" + + "ogle.cloud.batch.v1alpha.Task\022\027\n\017next_pa" + + "ge_token\030\002 \001(\t\022\023\n\013unreachable\030\003 \003(\t\"A\n\016G" + + "etTaskRequest\022/\n\004name\030\001 \001(\tB!\340A\002\372A\033\n\031bat" + + "ch.googleapis.com/Task\"\360\001\n\036CreateResourc" + + "eAllowanceRequest\022>\n\006parent\030\001 \001(\tB.\340A\002\372A" + + "(\022&batch.googleapis.com/ResourceAllowanc" + + "e\022\035\n\025resource_allowance_id\030\002 \001(\t\022N\n\022reso" + + "urce_allowance\030\003 \001(\0132-.google.cloud.batc" + + "h.v1alpha.ResourceAllowanceB\003\340A\002\022\037\n\nrequ" + + "est_id\030\004 \001(\tB\013\340A\001\342\214\317\327\010\002\010\001\"[\n\033GetResource" + + "AllowanceRequest\022<\n\004name\030\001 \001(\tB.\340A\002\372A(\n&" + + "batch.googleapis.com/ResourceAllowance\"\224" + + "\001\n\036DeleteResourceAllowanceRequest\022<\n\004nam" + + "e\030\001 \001(\tB.\340A\002\372A(\n&batch.googleapis.com/Re" + + "sourceAllowance\022\023\n\006reason\030\002 \001(\tB\003\340A\001\022\037\n\n" + + "request_id\030\004 \001(\tB\013\340A\001\342\214\317\327\010\002\010\001\"\220\001\n\035ListRe" + + "sourceAllowancesRequest\022>\n\006parent\030\001 \001(\tB" + + ".\340A\002\372A(\022&batch.googleapis.com/ResourceAl" + + "lowance\022\026\n\tpage_size\030\002 \001(\005B\003\340A\001\022\027\n\npage_" + + "token\030\003 \001(\tB\003\340A\001\"\232\001\n\036ListResourceAllowan" + + "cesResponse\022J\n\023resource_allowances\030\001 \003(\013" + + "2-.google.cloud.batch.v1alpha.ResourceAl" + + "lowance\022\027\n\017next_page_token\030\002 \001(\t\022\023\n\013unre" + + "achable\030\003 \003(\t\"\307\001\n\036UpdateResourceAllowanc" + + "eRequest\022N\n\022resource_allowance\030\001 \001(\0132-.g" + + "oogle.cloud.batch.v1alpha.ResourceAllowa" + + "nceB\003\340A\002\0224\n\013update_mask\030\002 \001(\0132\032.google.p" + + "rotobuf.FieldMaskB\003\340A\002\022\037\n\nrequest_id\030\003 \001" + + "(\tB\013\340A\001\342\214\317\327\010\002\010\001\"\200\002\n\021OperationMetadata\0224\n" + "\013create_time\030\001 \001(\0132\032.google.protobuf.Tim" + "estampB\003\340A\003\0221\n\010end_time\030\002 \001(\0132\032.google.p" + "rotobuf.TimestampB\003\340A\003\022\023\n\006target\030\003 \001(\tB\003" + "\340A\003\022\021\n\004verb\030\004 \001(\tB\003\340A\003\022\033\n\016status_message" + "\030\005 \001(\tB\003\340A\003\022#\n\026requested_cancellation\030\006 " - + "\001(\010B\003\340A\003\022\030\n\013api_version\030\007 \001(\tB\003\340A\0032\221\t\n\014B" + + "\001(\010B\003\340A\003\022\030\n\013api_version\030\007 \001(\tB\003\340A\0032\362\022\n\014B" + "atchService\022\252\001\n\tCreateJob\022,.google.cloud" + ".batch.v1alpha.CreateJobRequest\032\037.google" + ".cloud.batch.v1alpha.Job\"N\332A\021parent,job," @@ -138,14 +189,45 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "\032-.google.cloud.batch.v1alpha.ListTasksR" + "esponse\"S\332A\006parent\202\323\344\223\002D\022B/v1alpha/{pare" + "nt=projects/*/locations/*/jobs/*/taskGro" - + "ups/*}/tasks\032H\312A\024batch.googleapis.com\322A." - + "https://www.googleapis.com/auth/cloud-pl" - + "atformB\304\001\n\036com.google.cloud.batch.v1alph" - + "aB\nBatchProtoP\001Z4cloud.google.com/go/bat" - + "ch/apiv1alpha/batchpb;batchpb\242\002\003GCB\252\002\032Go" - + "ogle.Cloud.Batch.V1Alpha\312\002\032Google\\Cloud\\" - + "Batch\\V1alpha\352\002\035Google::Cloud::Batch::V1" - + "alphab\006proto3" + + "ups/*}/tasks\022\220\002\n\027CreateResourceAllowance" + + "\022:.google.cloud.batch.v1alpha.CreateReso" + + "urceAllowanceRequest\032-.google.cloud.batc" + + "h.v1alpha.ResourceAllowance\"\211\001\332A/parent," + + "resource_allowance,resource_allowance_id" + + "\202\323\344\223\002Q\";/v1alpha/{parent=projects/*/loca" + + "tions/*}/resourceAllowances:\022resource_al" + + "lowance\022\312\001\n\024GetResourceAllowance\0227.googl" + + "e.cloud.batch.v1alpha.GetResourceAllowan" + + "ceRequest\032-.google.cloud.batch.v1alpha.R" + + "esourceAllowance\"J\332A\004name\202\323\344\223\002=\022;/v1alph" + + "a/{name=projects/*/locations/*/resourceA" + + "llowances/*}\022\211\002\n\027DeleteResourceAllowance" + + "\022:.google.cloud.batch.v1alpha.DeleteReso" + + "urceAllowanceRequest\032\035.google.longrunnin" + + "g.Operation\"\222\001\312AE\n\025google.protobuf.Empty" + + "\022,google.cloud.batch.v1alpha.OperationMe" + + "tadata\332A\004name\202\323\344\223\002=*;/v1alpha/{name=proj" + + "ects/*/locations/*/resourceAllowances/*}" + + "\022\335\001\n\026ListResourceAllowances\0229.google.clo" + + "ud.batch.v1alpha.ListResourceAllowancesR" + + "equest\032:.google.cloud.batch.v1alpha.List" + + "ResourceAllowancesResponse\"L\332A\006parent\202\323\344" + + "\223\002=\022;/v1alpha/{parent=projects/*/locatio" + + "ns/*}/resourceAllowances\022\222\002\n\027UpdateResou" + + "rceAllowance\022:.google.cloud.batch.v1alph" + + "a.UpdateResourceAllowanceRequest\032-.googl" + + "e.cloud.batch.v1alpha.ResourceAllowance\"" + + "\213\001\332A\036resource_allowance,update_mask\202\323\344\223\002" + + "d2N/v1alpha/{resource_allowance.name=pro" + + "jects/*/locations/*/resourceAllowances/*" + + "}:\022resource_allowance\032H\312A\024batch.googleap" + + "is.com\322A.https://www.googleapis.com/auth" + + "/cloud-platformB\304\001\n\036com.google.cloud.bat" + + "ch.v1alphaB\nBatchProtoP\001Z4cloud.google.c" + + "om/go/batch/apiv1alpha/batchpb;batchpb\242\002" + + "\003GCB\252\002\032Google.Cloud.Batch.V1Alpha\312\002\032Goog" + + "le\\Cloud\\Batch\\V1alpha\352\002\035Google::Cloud::" + + "Batch::V1alphab\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( @@ -157,9 +239,11 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { com.google.api.FieldInfoProto.getDescriptor(), com.google.api.ResourceProto.getDescriptor(), com.google.cloud.batch.v1alpha.JobProto.getDescriptor(), + com.google.cloud.batch.v1alpha.ResourceAllowanceProto.getDescriptor(), com.google.cloud.batch.v1alpha.TaskProto.getDescriptor(), com.google.longrunning.OperationsProto.getDescriptor(), com.google.protobuf.EmptyProto.getDescriptor(), + com.google.protobuf.FieldMaskProto.getDescriptor(), com.google.protobuf.TimestampProto.getDescriptor(), }); internal_static_google_cloud_batch_v1alpha_CreateJobRequest_descriptor = @@ -226,8 +310,56 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new java.lang.String[] { "Name", }); - internal_static_google_cloud_batch_v1alpha_OperationMetadata_descriptor = + internal_static_google_cloud_batch_v1alpha_CreateResourceAllowanceRequest_descriptor = getDescriptor().getMessageTypes().get(8); + internal_static_google_cloud_batch_v1alpha_CreateResourceAllowanceRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_batch_v1alpha_CreateResourceAllowanceRequest_descriptor, + new java.lang.String[] { + "Parent", "ResourceAllowanceId", "ResourceAllowance", "RequestId", + }); + internal_static_google_cloud_batch_v1alpha_GetResourceAllowanceRequest_descriptor = + getDescriptor().getMessageTypes().get(9); + internal_static_google_cloud_batch_v1alpha_GetResourceAllowanceRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_batch_v1alpha_GetResourceAllowanceRequest_descriptor, + new java.lang.String[] { + "Name", + }); + internal_static_google_cloud_batch_v1alpha_DeleteResourceAllowanceRequest_descriptor = + getDescriptor().getMessageTypes().get(10); + internal_static_google_cloud_batch_v1alpha_DeleteResourceAllowanceRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_batch_v1alpha_DeleteResourceAllowanceRequest_descriptor, + new java.lang.String[] { + "Name", "Reason", "RequestId", + }); + internal_static_google_cloud_batch_v1alpha_ListResourceAllowancesRequest_descriptor = + getDescriptor().getMessageTypes().get(11); + internal_static_google_cloud_batch_v1alpha_ListResourceAllowancesRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_batch_v1alpha_ListResourceAllowancesRequest_descriptor, + new java.lang.String[] { + "Parent", "PageSize", "PageToken", + }); + internal_static_google_cloud_batch_v1alpha_ListResourceAllowancesResponse_descriptor = + getDescriptor().getMessageTypes().get(12); + internal_static_google_cloud_batch_v1alpha_ListResourceAllowancesResponse_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_batch_v1alpha_ListResourceAllowancesResponse_descriptor, + new java.lang.String[] { + "ResourceAllowances", "NextPageToken", "Unreachable", + }); + internal_static_google_cloud_batch_v1alpha_UpdateResourceAllowanceRequest_descriptor = + getDescriptor().getMessageTypes().get(13); + internal_static_google_cloud_batch_v1alpha_UpdateResourceAllowanceRequest_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_batch_v1alpha_UpdateResourceAllowanceRequest_descriptor, + new java.lang.String[] { + "ResourceAllowance", "UpdateMask", "RequestId", + }); + internal_static_google_cloud_batch_v1alpha_OperationMetadata_descriptor = + getDescriptor().getMessageTypes().get(14); internal_static_google_cloud_batch_v1alpha_OperationMetadata_fieldAccessorTable = new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( internal_static_google_cloud_batch_v1alpha_OperationMetadata_descriptor, @@ -244,6 +376,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { com.google.protobuf.ExtensionRegistry.newInstance(); registry.add(com.google.api.ClientProto.defaultHost); registry.add(com.google.api.FieldBehaviorProto.fieldBehavior); + registry.add(com.google.api.FieldInfoProto.fieldInfo); registry.add(com.google.api.AnnotationsProto.http); registry.add(com.google.api.ClientProto.methodSignature); registry.add(com.google.api.ClientProto.oauthScopes); @@ -257,9 +390,11 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { com.google.api.FieldInfoProto.getDescriptor(); com.google.api.ResourceProto.getDescriptor(); com.google.cloud.batch.v1alpha.JobProto.getDescriptor(); + com.google.cloud.batch.v1alpha.ResourceAllowanceProto.getDescriptor(); com.google.cloud.batch.v1alpha.TaskProto.getDescriptor(); com.google.longrunning.OperationsProto.getDescriptor(); com.google.protobuf.EmptyProto.getDescriptor(); + com.google.protobuf.FieldMaskProto.getDescriptor(); com.google.protobuf.TimestampProto.getDescriptor(); } diff --git a/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/CalendarPeriod.java b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/CalendarPeriod.java new file mode 100644 index 000000000000..2ddbfa64c1f2 --- /dev/null +++ b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/CalendarPeriod.java @@ -0,0 +1,251 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/batch/v1alpha/resource_allowance.proto + +// Protobuf Java Version: 3.25.2 +package com.google.cloud.batch.v1alpha; + +/** + * + * + *
+ * A `CalendarPeriod` represents the abstract concept of a time period that
+ * has a canonical start. All calendar times begin at 12 AM US and Canadian
+ * Pacific Time (UTC-8).
+ * 
+ * + * Protobuf enum {@code google.cloud.batch.v1alpha.CalendarPeriod} + */ +public enum CalendarPeriod implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+   * Unspecified.
+   * 
+ * + * CALENDAR_PERIOD_UNSPECIFIED = 0; + */ + CALENDAR_PERIOD_UNSPECIFIED(0), + /** + * + * + *
+   * The month starts on the first date of the month and resets at the beginning
+   * of each month.
+   * 
+ * + * MONTH = 1; + */ + MONTH(1), + /** + * + * + *
+   * The quarter starts on dates January 1, April 1, July 1, and October 1 of
+   * each year and resets at the beginning of the next quarter.
+   * 
+ * + * QUARTER = 2; + */ + QUARTER(2), + /** + * + * + *
+   * The year starts on January 1 and resets at the beginning of the next year.
+   * 
+ * + * YEAR = 3; + */ + YEAR(3), + /** + * + * + *
+   * The week period starts and resets every Monday.
+   * 
+ * + * WEEK = 4; + */ + WEEK(4), + /** + * + * + *
+   * The day starts at 12:00am.
+   * 
+ * + * DAY = 5; + */ + DAY(5), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+   * Unspecified.
+   * 
+ * + * CALENDAR_PERIOD_UNSPECIFIED = 0; + */ + public static final int CALENDAR_PERIOD_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+   * The month starts on the first date of the month and resets at the beginning
+   * of each month.
+   * 
+ * + * MONTH = 1; + */ + public static final int MONTH_VALUE = 1; + /** + * + * + *
+   * The quarter starts on dates January 1, April 1, July 1, and October 1 of
+   * each year and resets at the beginning of the next quarter.
+   * 
+ * + * QUARTER = 2; + */ + public static final int QUARTER_VALUE = 2; + /** + * + * + *
+   * The year starts on January 1 and resets at the beginning of the next year.
+   * 
+ * + * YEAR = 3; + */ + public static final int YEAR_VALUE = 3; + /** + * + * + *
+   * The week period starts and resets every Monday.
+   * 
+ * + * WEEK = 4; + */ + public static final int WEEK_VALUE = 4; + /** + * + * + *
+   * The day starts at 12:00am.
+   * 
+ * + * DAY = 5; + */ + public static final int DAY_VALUE = 5; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static CalendarPeriod valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static CalendarPeriod forNumber(int value) { + switch (value) { + case 0: + return CALENDAR_PERIOD_UNSPECIFIED; + case 1: + return MONTH; + case 2: + return QUARTER; + case 3: + return YEAR; + case 4: + return WEEK; + case 5: + return DAY; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public CalendarPeriod findValueByNumber(int number) { + return CalendarPeriod.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.cloud.batch.v1alpha.ResourceAllowanceProto.getDescriptor() + .getEnumTypes() + .get(0); + } + + private static final CalendarPeriod[] VALUES = values(); + + public static CalendarPeriod valueOf(com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private CalendarPeriod(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.batch.v1alpha.CalendarPeriod) +} diff --git a/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/CreateResourceAllowanceRequest.java b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/CreateResourceAllowanceRequest.java new file mode 100644 index 000000000000..ac72baca8c59 --- /dev/null +++ b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/CreateResourceAllowanceRequest.java @@ -0,0 +1,1487 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/batch/v1alpha/batch.proto + +// Protobuf Java Version: 3.25.2 +package com.google.cloud.batch.v1alpha; + +/** + * + * + *
+ * CreateResourceAllowance Request.
+ * 
+ * + * Protobuf type {@code google.cloud.batch.v1alpha.CreateResourceAllowanceRequest} + */ +public final class CreateResourceAllowanceRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.batch.v1alpha.CreateResourceAllowanceRequest) + CreateResourceAllowanceRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use CreateResourceAllowanceRequest.newBuilder() to construct. + private CreateResourceAllowanceRequest( + com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private CreateResourceAllowanceRequest() { + parent_ = ""; + resourceAllowanceId_ = ""; + requestId_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new CreateResourceAllowanceRequest(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.batch.v1alpha.BatchProto + .internal_static_google_cloud_batch_v1alpha_CreateResourceAllowanceRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.batch.v1alpha.BatchProto + .internal_static_google_cloud_batch_v1alpha_CreateResourceAllowanceRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest.class, + com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest.Builder.class); + } + + private int bitField0_; + public static final int PARENT_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object parent_ = ""; + /** + * + * + *
+   * Required. The parent resource name where the ResourceAllowance will be
+   * created. Pattern: "projects/{project}/locations/{location}"
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + @java.lang.Override + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The parent resource name where the ResourceAllowance will be
+   * created. Pattern: "projects/{project}/locations/{location}"
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + @java.lang.Override + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int RESOURCE_ALLOWANCE_ID_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private volatile java.lang.Object 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}".
+   * 
+ * + * string resource_allowance_id = 2; + * + * @return The resourceAllowanceId. + */ + @java.lang.Override + public java.lang.String getResourceAllowanceId() { + java.lang.Object ref = resourceAllowanceId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + resourceAllowanceId_ = s; + return s; + } + } + /** + * + * + *
+   * 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}".
+   * 
+ * + * string resource_allowance_id = 2; + * + * @return The bytes for resourceAllowanceId. + */ + @java.lang.Override + public com.google.protobuf.ByteString getResourceAllowanceIdBytes() { + java.lang.Object ref = resourceAllowanceId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + resourceAllowanceId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int RESOURCE_ALLOWANCE_FIELD_NUMBER = 3; + private com.google.cloud.batch.v1alpha.ResourceAllowance resourceAllowance_; + /** + * + * + *
+   * Required. The ResourceAllowance to create.
+   * 
+ * + * + * .google.cloud.batch.v1alpha.ResourceAllowance resource_allowance = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the resourceAllowance field is set. + */ + @java.lang.Override + public boolean hasResourceAllowance() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * + * + *
+   * Required. The ResourceAllowance to create.
+   * 
+ * + * + * .google.cloud.batch.v1alpha.ResourceAllowance resource_allowance = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The resourceAllowance. + */ + @java.lang.Override + public com.google.cloud.batch.v1alpha.ResourceAllowance getResourceAllowance() { + return resourceAllowance_ == null + ? com.google.cloud.batch.v1alpha.ResourceAllowance.getDefaultInstance() + : resourceAllowance_; + } + /** + * + * + *
+   * Required. The ResourceAllowance to create.
+   * 
+ * + * + * .google.cloud.batch.v1alpha.ResourceAllowance resource_allowance = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.batch.v1alpha.ResourceAllowanceOrBuilder getResourceAllowanceOrBuilder() { + return resourceAllowance_ == null + ? com.google.cloud.batch.v1alpha.ResourceAllowance.getDefaultInstance() + : resourceAllowance_; + } + + public static final int REQUEST_ID_FIELD_NUMBER = 4; + + @SuppressWarnings("serial") + private volatile java.lang.Object requestId_ = ""; + /** + * + * + *
+   * Optional. An optional request ID to identify requests. Specify a unique
+   * request ID so that if you must retry your request, the server will know to
+   * ignore the request if it has already been completed. The server will
+   * guarantee that for at least 60 minutes since the first request.
+   *
+   * For example, consider a situation where you make an initial request and
+   * the request times out. If you make the request again with the same request
+   * ID, the server can check if original operation with the same request ID
+   * was received, and if so, will ignore the second request. This prevents
+   * clients from accidentally creating duplicate commitments.
+   *
+   * The request ID must be a valid UUID with the exception that zero UUID is
+   * not supported (00000000-0000-0000-0000-000000000000).
+   * 
+ * + * + * string request_id = 4 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { ... } + * + * + * @return The requestId. + */ + @java.lang.Override + public java.lang.String getRequestId() { + java.lang.Object ref = requestId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + requestId_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. An optional request ID to identify requests. Specify a unique
+   * request ID so that if you must retry your request, the server will know to
+   * ignore the request if it has already been completed. The server will
+   * guarantee that for at least 60 minutes since the first request.
+   *
+   * For example, consider a situation where you make an initial request and
+   * the request times out. If you make the request again with the same request
+   * ID, the server can check if original operation with the same request ID
+   * was received, and if so, will ignore the second request. This prevents
+   * clients from accidentally creating duplicate commitments.
+   *
+   * The request ID must be a valid UUID with the exception that zero UUID is
+   * not supported (00000000-0000-0000-0000-000000000000).
+   * 
+ * + * + * string request_id = 4 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { ... } + * + * + * @return The bytes for requestId. + */ + @java.lang.Override + public com.google.protobuf.ByteString getRequestIdBytes() { + java.lang.Object ref = requestId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + requestId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(resourceAllowanceId_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, resourceAllowanceId_); + } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(3, getResourceAllowance()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(requestId_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, requestId_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(resourceAllowanceId_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, resourceAllowanceId_); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getResourceAllowance()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(requestId_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, requestId_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest)) { + return super.equals(obj); + } + com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest other = + (com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (!getResourceAllowanceId().equals(other.getResourceAllowanceId())) return false; + if (hasResourceAllowance() != other.hasResourceAllowance()) return false; + if (hasResourceAllowance()) { + if (!getResourceAllowance().equals(other.getResourceAllowance())) return false; + } + if (!getRequestId().equals(other.getRequestId())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + hash = (37 * hash) + RESOURCE_ALLOWANCE_ID_FIELD_NUMBER; + hash = (53 * hash) + getResourceAllowanceId().hashCode(); + if (hasResourceAllowance()) { + hash = (37 * hash) + RESOURCE_ALLOWANCE_FIELD_NUMBER; + hash = (53 * hash) + getResourceAllowance().hashCode(); + } + hash = (37 * hash) + REQUEST_ID_FIELD_NUMBER; + hash = (53 * hash) + getRequestId().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * CreateResourceAllowance Request.
+   * 
+ * + * Protobuf type {@code google.cloud.batch.v1alpha.CreateResourceAllowanceRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.batch.v1alpha.CreateResourceAllowanceRequest) + com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.batch.v1alpha.BatchProto + .internal_static_google_cloud_batch_v1alpha_CreateResourceAllowanceRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.batch.v1alpha.BatchProto + .internal_static_google_cloud_batch_v1alpha_CreateResourceAllowanceRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest.class, + com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest.Builder.class); + } + + // Construct using com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getResourceAllowanceFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + parent_ = ""; + resourceAllowanceId_ = ""; + resourceAllowance_ = null; + if (resourceAllowanceBuilder_ != null) { + resourceAllowanceBuilder_.dispose(); + resourceAllowanceBuilder_ = null; + } + requestId_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.batch.v1alpha.BatchProto + .internal_static_google_cloud_batch_v1alpha_CreateResourceAllowanceRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest + getDefaultInstanceForType() { + return com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest build() { + com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest buildPartial() { + com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest result = + new com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0( + com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.parent_ = parent_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.resourceAllowanceId_ = resourceAllowanceId_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000004) != 0)) { + result.resourceAllowance_ = + resourceAllowanceBuilder_ == null + ? resourceAllowance_ + : resourceAllowanceBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000008) != 0)) { + result.requestId_ = requestId_; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest) { + return mergeFrom((com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest other) { + if (other + == com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest.getDefaultInstance()) + return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getResourceAllowanceId().isEmpty()) { + resourceAllowanceId_ = other.resourceAllowanceId_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (other.hasResourceAllowance()) { + mergeResourceAllowance(other.getResourceAllowance()); + } + if (!other.getRequestId().isEmpty()) { + requestId_ = other.requestId_; + bitField0_ |= 0x00000008; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + parent_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + resourceAllowanceId_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: + { + input.readMessage( + getResourceAllowanceFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000004; + break; + } // case 26 + case 34: + { + requestId_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000008; + break; + } // case 34 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. The parent resource name where the ResourceAllowance will be
+     * created. Pattern: "projects/{project}/locations/{location}"
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The parent resource name where the ResourceAllowance will be
+     * created. Pattern: "projects/{project}/locations/{location}"
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The parent resource name where the ResourceAllowance will be
+     * created. Pattern: "projects/{project}/locations/{location}"
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The parent to set. + * @return This builder for chaining. + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + parent_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The parent resource name where the ResourceAllowance will be
+     * created. Pattern: "projects/{project}/locations/{location}"
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearParent() { + parent_ = getDefaultInstance().getParent(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The parent resource name where the ResourceAllowance will be
+     * created. Pattern: "projects/{project}/locations/{location}"
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for parent to set. + * @return This builder for chaining. + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + parent_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object 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}".
+     * 
+ * + * string resource_allowance_id = 2; + * + * @return The resourceAllowanceId. + */ + public java.lang.String getResourceAllowanceId() { + java.lang.Object ref = resourceAllowanceId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + resourceAllowanceId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * 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}".
+     * 
+ * + * string resource_allowance_id = 2; + * + * @return The bytes for resourceAllowanceId. + */ + public com.google.protobuf.ByteString getResourceAllowanceIdBytes() { + java.lang.Object ref = resourceAllowanceId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + resourceAllowanceId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * 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}".
+     * 
+ * + * string resource_allowance_id = 2; + * + * @param value The resourceAllowanceId to set. + * @return This builder for chaining. + */ + public Builder setResourceAllowanceId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + resourceAllowanceId_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * 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}".
+     * 
+ * + * string resource_allowance_id = 2; + * + * @return This builder for chaining. + */ + public Builder clearResourceAllowanceId() { + resourceAllowanceId_ = getDefaultInstance().getResourceAllowanceId(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * + * + *
+     * 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}".
+     * 
+ * + * string resource_allowance_id = 2; + * + * @param value The bytes for resourceAllowanceId to set. + * @return This builder for chaining. + */ + public Builder setResourceAllowanceIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + resourceAllowanceId_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private com.google.cloud.batch.v1alpha.ResourceAllowance resourceAllowance_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.batch.v1alpha.ResourceAllowance, + com.google.cloud.batch.v1alpha.ResourceAllowance.Builder, + com.google.cloud.batch.v1alpha.ResourceAllowanceOrBuilder> + resourceAllowanceBuilder_; + /** + * + * + *
+     * Required. The ResourceAllowance to create.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.ResourceAllowance resource_allowance = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the resourceAllowance field is set. + */ + public boolean hasResourceAllowance() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + * + * + *
+     * Required. The ResourceAllowance to create.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.ResourceAllowance resource_allowance = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The resourceAllowance. + */ + public com.google.cloud.batch.v1alpha.ResourceAllowance getResourceAllowance() { + if (resourceAllowanceBuilder_ == null) { + return resourceAllowance_ == null + ? com.google.cloud.batch.v1alpha.ResourceAllowance.getDefaultInstance() + : resourceAllowance_; + } else { + return resourceAllowanceBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The ResourceAllowance to create.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.ResourceAllowance resource_allowance = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setResourceAllowance(com.google.cloud.batch.v1alpha.ResourceAllowance value) { + if (resourceAllowanceBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + resourceAllowance_ = value; + } else { + resourceAllowanceBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The ResourceAllowance to create.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.ResourceAllowance resource_allowance = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setResourceAllowance( + com.google.cloud.batch.v1alpha.ResourceAllowance.Builder builderForValue) { + if (resourceAllowanceBuilder_ == null) { + resourceAllowance_ = builderForValue.build(); + } else { + resourceAllowanceBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The ResourceAllowance to create.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.ResourceAllowance resource_allowance = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeResourceAllowance(com.google.cloud.batch.v1alpha.ResourceAllowance value) { + if (resourceAllowanceBuilder_ == null) { + if (((bitField0_ & 0x00000004) != 0) + && resourceAllowance_ != null + && resourceAllowance_ + != com.google.cloud.batch.v1alpha.ResourceAllowance.getDefaultInstance()) { + getResourceAllowanceBuilder().mergeFrom(value); + } else { + resourceAllowance_ = value; + } + } else { + resourceAllowanceBuilder_.mergeFrom(value); + } + if (resourceAllowance_ != null) { + bitField0_ |= 0x00000004; + onChanged(); + } + return this; + } + /** + * + * + *
+     * Required. The ResourceAllowance to create.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.ResourceAllowance resource_allowance = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearResourceAllowance() { + bitField0_ = (bitField0_ & ~0x00000004); + resourceAllowance_ = null; + if (resourceAllowanceBuilder_ != null) { + resourceAllowanceBuilder_.dispose(); + resourceAllowanceBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The ResourceAllowance to create.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.ResourceAllowance resource_allowance = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.batch.v1alpha.ResourceAllowance.Builder getResourceAllowanceBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return getResourceAllowanceFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The ResourceAllowance to create.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.ResourceAllowance resource_allowance = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.batch.v1alpha.ResourceAllowanceOrBuilder + getResourceAllowanceOrBuilder() { + if (resourceAllowanceBuilder_ != null) { + return resourceAllowanceBuilder_.getMessageOrBuilder(); + } else { + return resourceAllowance_ == null + ? com.google.cloud.batch.v1alpha.ResourceAllowance.getDefaultInstance() + : resourceAllowance_; + } + } + /** + * + * + *
+     * Required. The ResourceAllowance to create.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.ResourceAllowance resource_allowance = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.batch.v1alpha.ResourceAllowance, + com.google.cloud.batch.v1alpha.ResourceAllowance.Builder, + com.google.cloud.batch.v1alpha.ResourceAllowanceOrBuilder> + getResourceAllowanceFieldBuilder() { + if (resourceAllowanceBuilder_ == null) { + resourceAllowanceBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.batch.v1alpha.ResourceAllowance, + com.google.cloud.batch.v1alpha.ResourceAllowance.Builder, + com.google.cloud.batch.v1alpha.ResourceAllowanceOrBuilder>( + getResourceAllowance(), getParentForChildren(), isClean()); + resourceAllowance_ = null; + } + return resourceAllowanceBuilder_; + } + + private java.lang.Object requestId_ = ""; + /** + * + * + *
+     * Optional. An optional request ID to identify requests. Specify a unique
+     * request ID so that if you must retry your request, the server will know to
+     * ignore the request if it has already been completed. The server will
+     * guarantee that for at least 60 minutes since the first request.
+     *
+     * For example, consider a situation where you make an initial request and
+     * the request times out. If you make the request again with the same request
+     * ID, the server can check if original operation with the same request ID
+     * was received, and if so, will ignore the second request. This prevents
+     * clients from accidentally creating duplicate commitments.
+     *
+     * The request ID must be a valid UUID with the exception that zero UUID is
+     * not supported (00000000-0000-0000-0000-000000000000).
+     * 
+ * + * + * string request_id = 4 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { ... } + * + * + * @return The requestId. + */ + public java.lang.String getRequestId() { + java.lang.Object ref = requestId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + requestId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. An optional request ID to identify requests. Specify a unique
+     * request ID so that if you must retry your request, the server will know to
+     * ignore the request if it has already been completed. The server will
+     * guarantee that for at least 60 minutes since the first request.
+     *
+     * For example, consider a situation where you make an initial request and
+     * the request times out. If you make the request again with the same request
+     * ID, the server can check if original operation with the same request ID
+     * was received, and if so, will ignore the second request. This prevents
+     * clients from accidentally creating duplicate commitments.
+     *
+     * The request ID must be a valid UUID with the exception that zero UUID is
+     * not supported (00000000-0000-0000-0000-000000000000).
+     * 
+ * + * + * string request_id = 4 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { ... } + * + * + * @return The bytes for requestId. + */ + public com.google.protobuf.ByteString getRequestIdBytes() { + java.lang.Object ref = requestId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + requestId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. An optional request ID to identify requests. Specify a unique
+     * request ID so that if you must retry your request, the server will know to
+     * ignore the request if it has already been completed. The server will
+     * guarantee that for at least 60 minutes since the first request.
+     *
+     * For example, consider a situation where you make an initial request and
+     * the request times out. If you make the request again with the same request
+     * ID, the server can check if original operation with the same request ID
+     * was received, and if so, will ignore the second request. This prevents
+     * clients from accidentally creating duplicate commitments.
+     *
+     * The request ID must be a valid UUID with the exception that zero UUID is
+     * not supported (00000000-0000-0000-0000-000000000000).
+     * 
+ * + * + * string request_id = 4 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { ... } + * + * + * @param value The requestId to set. + * @return This builder for chaining. + */ + public Builder setRequestId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + requestId_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. An optional request ID to identify requests. Specify a unique
+     * request ID so that if you must retry your request, the server will know to
+     * ignore the request if it has already been completed. The server will
+     * guarantee that for at least 60 minutes since the first request.
+     *
+     * For example, consider a situation where you make an initial request and
+     * the request times out. If you make the request again with the same request
+     * ID, the server can check if original operation with the same request ID
+     * was received, and if so, will ignore the second request. This prevents
+     * clients from accidentally creating duplicate commitments.
+     *
+     * The request ID must be a valid UUID with the exception that zero UUID is
+     * not supported (00000000-0000-0000-0000-000000000000).
+     * 
+ * + * + * string request_id = 4 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearRequestId() { + requestId_ = getDefaultInstance().getRequestId(); + bitField0_ = (bitField0_ & ~0x00000008); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. An optional request ID to identify requests. Specify a unique
+     * request ID so that if you must retry your request, the server will know to
+     * ignore the request if it has already been completed. The server will
+     * guarantee that for at least 60 minutes since the first request.
+     *
+     * For example, consider a situation where you make an initial request and
+     * the request times out. If you make the request again with the same request
+     * ID, the server can check if original operation with the same request ID
+     * was received, and if so, will ignore the second request. This prevents
+     * clients from accidentally creating duplicate commitments.
+     *
+     * The request ID must be a valid UUID with the exception that zero UUID is
+     * not supported (00000000-0000-0000-0000-000000000000).
+     * 
+ * + * + * string request_id = 4 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { ... } + * + * + * @param value The bytes for requestId to set. + * @return This builder for chaining. + */ + public Builder setRequestIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + requestId_ = value; + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.batch.v1alpha.CreateResourceAllowanceRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.batch.v1alpha.CreateResourceAllowanceRequest) + private static final com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest(); + } + + public static com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public CreateResourceAllowanceRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/CreateResourceAllowanceRequestOrBuilder.java b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/CreateResourceAllowanceRequestOrBuilder.java new file mode 100644 index 000000000000..438669c44ab6 --- /dev/null +++ b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/CreateResourceAllowanceRequestOrBuilder.java @@ -0,0 +1,194 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/batch/v1alpha/batch.proto + +// Protobuf Java Version: 3.25.2 +package com.google.cloud.batch.v1alpha; + +public interface CreateResourceAllowanceRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.batch.v1alpha.CreateResourceAllowanceRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The parent resource name where the ResourceAllowance will be
+   * created. Pattern: "projects/{project}/locations/{location}"
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. The parent resource name where the ResourceAllowance will be
+   * created. Pattern: "projects/{project}/locations/{location}"
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * 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}".
+   * 
+ * + * string resource_allowance_id = 2; + * + * @return The resourceAllowanceId. + */ + java.lang.String getResourceAllowanceId(); + /** + * + * + *
+   * 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}".
+   * 
+ * + * string resource_allowance_id = 2; + * + * @return The bytes for resourceAllowanceId. + */ + com.google.protobuf.ByteString getResourceAllowanceIdBytes(); + + /** + * + * + *
+   * Required. The ResourceAllowance to create.
+   * 
+ * + * + * .google.cloud.batch.v1alpha.ResourceAllowance resource_allowance = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the resourceAllowance field is set. + */ + boolean hasResourceAllowance(); + /** + * + * + *
+   * Required. The ResourceAllowance to create.
+   * 
+ * + * + * .google.cloud.batch.v1alpha.ResourceAllowance resource_allowance = 3 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The resourceAllowance. + */ + com.google.cloud.batch.v1alpha.ResourceAllowance getResourceAllowance(); + /** + * + * + *
+   * Required. The ResourceAllowance to create.
+   * 
+ * + * + * .google.cloud.batch.v1alpha.ResourceAllowance resource_allowance = 3 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.batch.v1alpha.ResourceAllowanceOrBuilder getResourceAllowanceOrBuilder(); + + /** + * + * + *
+   * Optional. An optional request ID to identify requests. Specify a unique
+   * request ID so that if you must retry your request, the server will know to
+   * ignore the request if it has already been completed. The server will
+   * guarantee that for at least 60 minutes since the first request.
+   *
+   * For example, consider a situation where you make an initial request and
+   * the request times out. If you make the request again with the same request
+   * ID, the server can check if original operation with the same request ID
+   * was received, and if so, will ignore the second request. This prevents
+   * clients from accidentally creating duplicate commitments.
+   *
+   * The request ID must be a valid UUID with the exception that zero UUID is
+   * not supported (00000000-0000-0000-0000-000000000000).
+   * 
+ * + * + * string request_id = 4 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { ... } + * + * + * @return The requestId. + */ + java.lang.String getRequestId(); + /** + * + * + *
+   * Optional. An optional request ID to identify requests. Specify a unique
+   * request ID so that if you must retry your request, the server will know to
+   * ignore the request if it has already been completed. The server will
+   * guarantee that for at least 60 minutes since the first request.
+   *
+   * For example, consider a situation where you make an initial request and
+   * the request times out. If you make the request again with the same request
+   * ID, the server can check if original operation with the same request ID
+   * was received, and if so, will ignore the second request. This prevents
+   * clients from accidentally creating duplicate commitments.
+   *
+   * The request ID must be a valid UUID with the exception that zero UUID is
+   * not supported (00000000-0000-0000-0000-000000000000).
+   * 
+ * + * + * string request_id = 4 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { ... } + * + * + * @return The bytes for requestId. + */ + com.google.protobuf.ByteString getRequestIdBytes(); +} diff --git a/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/DeleteResourceAllowanceRequest.java b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/DeleteResourceAllowanceRequest.java new file mode 100644 index 000000000000..3eca101abea1 --- /dev/null +++ b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/DeleteResourceAllowanceRequest.java @@ -0,0 +1,1107 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/batch/v1alpha/batch.proto + +// Protobuf Java Version: 3.25.2 +package com.google.cloud.batch.v1alpha; + +/** + * + * + *
+ * DeleteResourceAllowance Request.
+ * 
+ * + * Protobuf type {@code google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest} + */ +public final class DeleteResourceAllowanceRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest) + DeleteResourceAllowanceRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use DeleteResourceAllowanceRequest.newBuilder() to construct. + private DeleteResourceAllowanceRequest( + com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private DeleteResourceAllowanceRequest() { + name_ = ""; + reason_ = ""; + requestId_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new DeleteResourceAllowanceRequest(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.batch.v1alpha.BatchProto + .internal_static_google_cloud_batch_v1alpha_DeleteResourceAllowanceRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.batch.v1alpha.BatchProto + .internal_static_google_cloud_batch_v1alpha_DeleteResourceAllowanceRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest.class, + com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** + * + * + *
+   * Required. ResourceAllowance name.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. ResourceAllowance name.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int REASON_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private volatile java.lang.Object reason_ = ""; + /** + * + * + *
+   * Optional. Reason for this deletion.
+   * 
+ * + * string reason = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The reason. + */ + @java.lang.Override + public java.lang.String getReason() { + java.lang.Object ref = reason_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + reason_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. Reason for this deletion.
+   * 
+ * + * string reason = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for reason. + */ + @java.lang.Override + public com.google.protobuf.ByteString getReasonBytes() { + java.lang.Object ref = reason_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + reason_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int REQUEST_ID_FIELD_NUMBER = 4; + + @SuppressWarnings("serial") + private volatile java.lang.Object requestId_ = ""; + /** + * + * + *
+   * Optional. An optional request ID to identify requests. Specify a unique
+   * request ID so that if you must retry your request, the server will know to
+   * ignore the request if it has already been completed. The server will
+   * guarantee that for at least 60 minutes after the first request.
+   *
+   * For example, consider a situation where you make an initial request and
+   * the request times out. If you make the request again with the same request
+   * ID, the server can check if original operation with the same request ID
+   * was received, and if so, will ignore the second request. This prevents
+   * clients from accidentally creating duplicate commitments.
+   *
+   * The request ID must be a valid UUID with the exception that zero UUID is
+   * not supported (00000000-0000-0000-0000-000000000000).
+   * 
+ * + * + * string request_id = 4 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { ... } + * + * + * @return The requestId. + */ + @java.lang.Override + public java.lang.String getRequestId() { + java.lang.Object ref = requestId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + requestId_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. An optional request ID to identify requests. Specify a unique
+   * request ID so that if you must retry your request, the server will know to
+   * ignore the request if it has already been completed. The server will
+   * guarantee that for at least 60 minutes after the first request.
+   *
+   * For example, consider a situation where you make an initial request and
+   * the request times out. If you make the request again with the same request
+   * ID, the server can check if original operation with the same request ID
+   * was received, and if so, will ignore the second request. This prevents
+   * clients from accidentally creating duplicate commitments.
+   *
+   * The request ID must be a valid UUID with the exception that zero UUID is
+   * not supported (00000000-0000-0000-0000-000000000000).
+   * 
+ * + * + * string request_id = 4 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { ... } + * + * + * @return The bytes for requestId. + */ + @java.lang.Override + public com.google.protobuf.ByteString getRequestIdBytes() { + java.lang.Object ref = requestId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + requestId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(reason_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, reason_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(requestId_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 4, requestId_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(reason_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, reason_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(requestId_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, requestId_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest)) { + return super.equals(obj); + } + com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest other = + (com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (!getReason().equals(other.getReason())) return false; + if (!getRequestId().equals(other.getRequestId())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + REASON_FIELD_NUMBER; + hash = (53 * hash) + getReason().hashCode(); + hash = (37 * hash) + REQUEST_ID_FIELD_NUMBER; + hash = (53 * hash) + getRequestId().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * DeleteResourceAllowance Request.
+   * 
+ * + * Protobuf type {@code google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest) + com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.batch.v1alpha.BatchProto + .internal_static_google_cloud_batch_v1alpha_DeleteResourceAllowanceRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.batch.v1alpha.BatchProto + .internal_static_google_cloud_batch_v1alpha_DeleteResourceAllowanceRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest.class, + com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest.Builder.class); + } + + // Construct using com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + name_ = ""; + reason_ = ""; + requestId_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.batch.v1alpha.BatchProto + .internal_static_google_cloud_batch_v1alpha_DeleteResourceAllowanceRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest + getDefaultInstanceForType() { + return com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest build() { + com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest buildPartial() { + com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest result = + new com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0( + com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.name_ = name_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.reason_ = reason_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.requestId_ = requestId_; + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest) { + return mergeFrom((com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest other) { + if (other + == com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getReason().isEmpty()) { + reason_ = other.reason_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (!other.getRequestId().isEmpty()) { + requestId_ = other.requestId_; + bitField0_ |= 0x00000004; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + reason_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 34: + { + requestId_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000004; + break; + } // case 34 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. ResourceAllowance name.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. ResourceAllowance name.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. ResourceAllowance name.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. ResourceAllowance name.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. ResourceAllowance name.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object reason_ = ""; + /** + * + * + *
+     * Optional. Reason for this deletion.
+     * 
+ * + * string reason = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The reason. + */ + public java.lang.String getReason() { + java.lang.Object ref = reason_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + reason_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. Reason for this deletion.
+     * 
+ * + * string reason = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for reason. + */ + public com.google.protobuf.ByteString getReasonBytes() { + java.lang.Object ref = reason_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + reason_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. Reason for this deletion.
+     * 
+ * + * string reason = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The reason to set. + * @return This builder for chaining. + */ + public Builder setReason(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + reason_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Reason for this deletion.
+     * 
+ * + * string reason = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearReason() { + reason_ = getDefaultInstance().getReason(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Reason for this deletion.
+     * 
+ * + * string reason = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for reason to set. + * @return This builder for chaining. + */ + public Builder setReasonBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + reason_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private java.lang.Object requestId_ = ""; + /** + * + * + *
+     * Optional. An optional request ID to identify requests. Specify a unique
+     * request ID so that if you must retry your request, the server will know to
+     * ignore the request if it has already been completed. The server will
+     * guarantee that for at least 60 minutes after the first request.
+     *
+     * For example, consider a situation where you make an initial request and
+     * the request times out. If you make the request again with the same request
+     * ID, the server can check if original operation with the same request ID
+     * was received, and if so, will ignore the second request. This prevents
+     * clients from accidentally creating duplicate commitments.
+     *
+     * The request ID must be a valid UUID with the exception that zero UUID is
+     * not supported (00000000-0000-0000-0000-000000000000).
+     * 
+ * + * + * string request_id = 4 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { ... } + * + * + * @return The requestId. + */ + public java.lang.String getRequestId() { + java.lang.Object ref = requestId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + requestId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. An optional request ID to identify requests. Specify a unique
+     * request ID so that if you must retry your request, the server will know to
+     * ignore the request if it has already been completed. The server will
+     * guarantee that for at least 60 minutes after the first request.
+     *
+     * For example, consider a situation where you make an initial request and
+     * the request times out. If you make the request again with the same request
+     * ID, the server can check if original operation with the same request ID
+     * was received, and if so, will ignore the second request. This prevents
+     * clients from accidentally creating duplicate commitments.
+     *
+     * The request ID must be a valid UUID with the exception that zero UUID is
+     * not supported (00000000-0000-0000-0000-000000000000).
+     * 
+ * + * + * string request_id = 4 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { ... } + * + * + * @return The bytes for requestId. + */ + public com.google.protobuf.ByteString getRequestIdBytes() { + java.lang.Object ref = requestId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + requestId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. An optional request ID to identify requests. Specify a unique
+     * request ID so that if you must retry your request, the server will know to
+     * ignore the request if it has already been completed. The server will
+     * guarantee that for at least 60 minutes after the first request.
+     *
+     * For example, consider a situation where you make an initial request and
+     * the request times out. If you make the request again with the same request
+     * ID, the server can check if original operation with the same request ID
+     * was received, and if so, will ignore the second request. This prevents
+     * clients from accidentally creating duplicate commitments.
+     *
+     * The request ID must be a valid UUID with the exception that zero UUID is
+     * not supported (00000000-0000-0000-0000-000000000000).
+     * 
+ * + * + * string request_id = 4 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { ... } + * + * + * @param value The requestId to set. + * @return This builder for chaining. + */ + public Builder setRequestId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + requestId_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. An optional request ID to identify requests. Specify a unique
+     * request ID so that if you must retry your request, the server will know to
+     * ignore the request if it has already been completed. The server will
+     * guarantee that for at least 60 minutes after the first request.
+     *
+     * For example, consider a situation where you make an initial request and
+     * the request times out. If you make the request again with the same request
+     * ID, the server can check if original operation with the same request ID
+     * was received, and if so, will ignore the second request. This prevents
+     * clients from accidentally creating duplicate commitments.
+     *
+     * The request ID must be a valid UUID with the exception that zero UUID is
+     * not supported (00000000-0000-0000-0000-000000000000).
+     * 
+ * + * + * string request_id = 4 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearRequestId() { + requestId_ = getDefaultInstance().getRequestId(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. An optional request ID to identify requests. Specify a unique
+     * request ID so that if you must retry your request, the server will know to
+     * ignore the request if it has already been completed. The server will
+     * guarantee that for at least 60 minutes after the first request.
+     *
+     * For example, consider a situation where you make an initial request and
+     * the request times out. If you make the request again with the same request
+     * ID, the server can check if original operation with the same request ID
+     * was received, and if so, will ignore the second request. This prevents
+     * clients from accidentally creating duplicate commitments.
+     *
+     * The request ID must be a valid UUID with the exception that zero UUID is
+     * not supported (00000000-0000-0000-0000-000000000000).
+     * 
+ * + * + * string request_id = 4 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { ... } + * + * + * @param value The bytes for requestId to set. + * @return This builder for chaining. + */ + public Builder setRequestIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + requestId_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest) + private static final com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest(); + } + + public static com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public DeleteResourceAllowanceRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/DeleteResourceAllowanceRequestOrBuilder.java b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/DeleteResourceAllowanceRequestOrBuilder.java new file mode 100644 index 000000000000..85aad4c360be --- /dev/null +++ b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/DeleteResourceAllowanceRequestOrBuilder.java @@ -0,0 +1,133 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/batch/v1alpha/batch.proto + +// Protobuf Java Version: 3.25.2 +package com.google.cloud.batch.v1alpha; + +public interface DeleteResourceAllowanceRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. ResourceAllowance name.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. ResourceAllowance name.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * Optional. Reason for this deletion.
+   * 
+ * + * string reason = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The reason. + */ + java.lang.String getReason(); + /** + * + * + *
+   * Optional. Reason for this deletion.
+   * 
+ * + * string reason = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for reason. + */ + com.google.protobuf.ByteString getReasonBytes(); + + /** + * + * + *
+   * Optional. An optional request ID to identify requests. Specify a unique
+   * request ID so that if you must retry your request, the server will know to
+   * ignore the request if it has already been completed. The server will
+   * guarantee that for at least 60 minutes after the first request.
+   *
+   * For example, consider a situation where you make an initial request and
+   * the request times out. If you make the request again with the same request
+   * ID, the server can check if original operation with the same request ID
+   * was received, and if so, will ignore the second request. This prevents
+   * clients from accidentally creating duplicate commitments.
+   *
+   * The request ID must be a valid UUID with the exception that zero UUID is
+   * not supported (00000000-0000-0000-0000-000000000000).
+   * 
+ * + * + * string request_id = 4 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { ... } + * + * + * @return The requestId. + */ + java.lang.String getRequestId(); + /** + * + * + *
+   * Optional. An optional request ID to identify requests. Specify a unique
+   * request ID so that if you must retry your request, the server will know to
+   * ignore the request if it has already been completed. The server will
+   * guarantee that for at least 60 minutes after the first request.
+   *
+   * For example, consider a situation where you make an initial request and
+   * the request times out. If you make the request again with the same request
+   * ID, the server can check if original operation with the same request ID
+   * was received, and if so, will ignore the second request. This prevents
+   * clients from accidentally creating duplicate commitments.
+   *
+   * The request ID must be a valid UUID with the exception that zero UUID is
+   * not supported (00000000-0000-0000-0000-000000000000).
+   * 
+ * + * + * string request_id = 4 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { ... } + * + * + * @return The bytes for requestId. + */ + com.google.protobuf.ByteString getRequestIdBytes(); +} diff --git a/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/GetResourceAllowanceRequest.java b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/GetResourceAllowanceRequest.java new file mode 100644 index 000000000000..b32905683213 --- /dev/null +++ b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/GetResourceAllowanceRequest.java @@ -0,0 +1,640 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/batch/v1alpha/batch.proto + +// Protobuf Java Version: 3.25.2 +package com.google.cloud.batch.v1alpha; + +/** + * + * + *
+ * GetResourceAllowance Request.
+ * 
+ * + * Protobuf type {@code google.cloud.batch.v1alpha.GetResourceAllowanceRequest} + */ +public final class GetResourceAllowanceRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.batch.v1alpha.GetResourceAllowanceRequest) + GetResourceAllowanceRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use GetResourceAllowanceRequest.newBuilder() to construct. + private GetResourceAllowanceRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private GetResourceAllowanceRequest() { + name_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new GetResourceAllowanceRequest(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.batch.v1alpha.BatchProto + .internal_static_google_cloud_batch_v1alpha_GetResourceAllowanceRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.batch.v1alpha.BatchProto + .internal_static_google_cloud_batch_v1alpha_GetResourceAllowanceRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest.class, + com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest.Builder.class); + } + + public static final int NAME_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** + * + * + *
+   * Required. ResourceAllowance name.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Required. ResourceAllowance name.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest)) { + return super.equals(obj); + } + com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest other = + (com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest) obj; + + if (!getName().equals(other.getName())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * GetResourceAllowance Request.
+   * 
+ * + * Protobuf type {@code google.cloud.batch.v1alpha.GetResourceAllowanceRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.batch.v1alpha.GetResourceAllowanceRequest) + com.google.cloud.batch.v1alpha.GetResourceAllowanceRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.batch.v1alpha.BatchProto + .internal_static_google_cloud_batch_v1alpha_GetResourceAllowanceRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.batch.v1alpha.BatchProto + .internal_static_google_cloud_batch_v1alpha_GetResourceAllowanceRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest.class, + com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest.Builder.class); + } + + // Construct using com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + name_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.batch.v1alpha.BatchProto + .internal_static_google_cloud_batch_v1alpha_GetResourceAllowanceRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest getDefaultInstanceForType() { + return com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest build() { + com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest buildPartial() { + com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest result = + new com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.name_ = name_; + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest) { + return mergeFrom((com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest other) { + if (other == com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + bitField0_ |= 0x00000001; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Required. ResourceAllowance name.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. ResourceAllowance name.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. ResourceAllowance name.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. ResourceAllowance name.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearName() { + name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. ResourceAllowance name.
+     * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.batch.v1alpha.GetResourceAllowanceRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.batch.v1alpha.GetResourceAllowanceRequest) + private static final com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest(); + } + + public static com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public GetResourceAllowanceRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/GetResourceAllowanceRequestOrBuilder.java b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/GetResourceAllowanceRequestOrBuilder.java new file mode 100644 index 000000000000..58cff32716b3 --- /dev/null +++ b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/GetResourceAllowanceRequestOrBuilder.java @@ -0,0 +1,55 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/batch/v1alpha/batch.proto + +// Protobuf Java Version: 3.25.2 +package com.google.cloud.batch.v1alpha; + +public interface GetResourceAllowanceRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.batch.v1alpha.GetResourceAllowanceRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. ResourceAllowance name.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Required. ResourceAllowance name.
+   * 
+ * + * + * string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); +} diff --git a/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/ListResourceAllowancesRequest.java b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/ListResourceAllowancesRequest.java new file mode 100644 index 000000000000..af7d9577b103 --- /dev/null +++ b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/ListResourceAllowancesRequest.java @@ -0,0 +1,919 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/batch/v1alpha/batch.proto + +// Protobuf Java Version: 3.25.2 +package com.google.cloud.batch.v1alpha; + +/** + * + * + *
+ * ListResourceAllowances Request.
+ * 
+ * + * Protobuf type {@code google.cloud.batch.v1alpha.ListResourceAllowancesRequest} + */ +public final class ListResourceAllowancesRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.batch.v1alpha.ListResourceAllowancesRequest) + ListResourceAllowancesRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListResourceAllowancesRequest.newBuilder() to construct. + private ListResourceAllowancesRequest(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListResourceAllowancesRequest() { + parent_ = ""; + pageToken_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListResourceAllowancesRequest(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.batch.v1alpha.BatchProto + .internal_static_google_cloud_batch_v1alpha_ListResourceAllowancesRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.batch.v1alpha.BatchProto + .internal_static_google_cloud_batch_v1alpha_ListResourceAllowancesRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest.class, + com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest.Builder.class); + } + + public static final int PARENT_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object parent_ = ""; + /** + * + * + *
+   * Required. Parent path.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + @java.lang.Override + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } + } + /** + * + * + *
+   * Required. Parent path.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + @java.lang.Override + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int PAGE_SIZE_FIELD_NUMBER = 2; + private int pageSize_ = 0; + /** + * + * + *
+   * Optional. Page size.
+   * 
+ * + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + + public static final int PAGE_TOKEN_FIELD_NUMBER = 3; + + @SuppressWarnings("serial") + private volatile java.lang.Object pageToken_ = ""; + /** + * + * + *
+   * Optional. Page token.
+   * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageToken. + */ + @java.lang.Override + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. Page token.
+   * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for pageToken. + */ + @java.lang.Override + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, parent_); + } + if (pageSize_ != 0) { + output.writeInt32(2, pageSize_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pageToken_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, pageToken_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(parent_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, parent_); + } + if (pageSize_ != 0) { + size += com.google.protobuf.CodedOutputStream.computeInt32Size(2, pageSize_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pageToken_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, pageToken_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest)) { + return super.equals(obj); + } + com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest other = + (com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest) obj; + + if (!getParent().equals(other.getParent())) return false; + if (getPageSize() != other.getPageSize()) return false; + if (!getPageToken().equals(other.getPageToken())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PARENT_FIELD_NUMBER; + hash = (53 * hash) + getParent().hashCode(); + hash = (37 * hash) + PAGE_SIZE_FIELD_NUMBER; + hash = (53 * hash) + getPageSize(); + hash = (37 * hash) + PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getPageToken().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * ListResourceAllowances Request.
+   * 
+ * + * Protobuf type {@code google.cloud.batch.v1alpha.ListResourceAllowancesRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.batch.v1alpha.ListResourceAllowancesRequest) + com.google.cloud.batch.v1alpha.ListResourceAllowancesRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.batch.v1alpha.BatchProto + .internal_static_google_cloud_batch_v1alpha_ListResourceAllowancesRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.batch.v1alpha.BatchProto + .internal_static_google_cloud_batch_v1alpha_ListResourceAllowancesRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest.class, + com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest.Builder.class); + } + + // Construct using com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + parent_ = ""; + pageSize_ = 0; + pageToken_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.batch.v1alpha.BatchProto + .internal_static_google_cloud_batch_v1alpha_ListResourceAllowancesRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest + getDefaultInstanceForType() { + return com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest build() { + com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest buildPartial() { + com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest result = + new com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0( + com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.parent_ = parent_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.pageSize_ = pageSize_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.pageToken_ = pageToken_; + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest) { + return mergeFrom((com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest other) { + if (other + == com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest.getDefaultInstance()) + return this; + if (!other.getParent().isEmpty()) { + parent_ = other.parent_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (other.getPageSize() != 0) { + setPageSize(other.getPageSize()); + } + if (!other.getPageToken().isEmpty()) { + pageToken_ = other.pageToken_; + bitField0_ |= 0x00000004; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + parent_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 16: + { + pageSize_ = input.readInt32(); + bitField0_ |= 0x00000002; + break; + } // case 16 + case 26: + { + pageToken_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object parent_ = ""; + /** + * + * + *
+     * Required. Parent path.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + public java.lang.String getParent() { + java.lang.Object ref = parent_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + parent_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. Parent path.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + public com.google.protobuf.ByteString getParentBytes() { + java.lang.Object ref = parent_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + parent_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. Parent path.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The parent to set. + * @return This builder for chaining. + */ + public Builder setParent(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + parent_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Parent path.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearParent() { + parent_ = getDefaultInstance().getParent(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Parent path.
+     * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @param value The bytes for parent to set. + * @return This builder for chaining. + */ + public Builder setParentBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + parent_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private int pageSize_; + /** + * + * + *
+     * Optional. Page size.
+     * 
+ * + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageSize. + */ + @java.lang.Override + public int getPageSize() { + return pageSize_; + } + /** + * + * + *
+     * Optional. Page size.
+     * 
+ * + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The pageSize to set. + * @return This builder for chaining. + */ + public Builder setPageSize(int value) { + + pageSize_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Page size.
+     * 
+ * + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearPageSize() { + bitField0_ = (bitField0_ & ~0x00000002); + pageSize_ = 0; + onChanged(); + return this; + } + + private java.lang.Object pageToken_ = ""; + /** + * + * + *
+     * Optional. Page token.
+     * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageToken. + */ + public java.lang.String getPageToken() { + java.lang.Object ref = pageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. Page token.
+     * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for pageToken. + */ + public com.google.protobuf.ByteString getPageTokenBytes() { + java.lang.Object ref = pageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. Page token.
+     * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + pageToken_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Page token.
+     * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return This builder for chaining. + */ + public Builder clearPageToken() { + pageToken_ = getDefaultInstance().getPageToken(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. Page token.
+     * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @param value The bytes for pageToken to set. + * @return This builder for chaining. + */ + public Builder setPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + pageToken_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.batch.v1alpha.ListResourceAllowancesRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.batch.v1alpha.ListResourceAllowancesRequest) + private static final com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest(); + } + + public static com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListResourceAllowancesRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/ListResourceAllowancesRequestOrBuilder.java b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/ListResourceAllowancesRequestOrBuilder.java new file mode 100644 index 000000000000..5edc2c971c47 --- /dev/null +++ b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/ListResourceAllowancesRequestOrBuilder.java @@ -0,0 +1,93 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/batch/v1alpha/batch.proto + +// Protobuf Java Version: 3.25.2 +package com.google.cloud.batch.v1alpha; + +public interface ListResourceAllowancesRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.batch.v1alpha.ListResourceAllowancesRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Parent path.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The parent. + */ + java.lang.String getParent(); + /** + * + * + *
+   * Required. Parent path.
+   * 
+ * + * + * string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } + * + * + * @return The bytes for parent. + */ + com.google.protobuf.ByteString getParentBytes(); + + /** + * + * + *
+   * Optional. Page size.
+   * 
+ * + * int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageSize. + */ + int getPageSize(); + + /** + * + * + *
+   * Optional. Page token.
+   * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The pageToken. + */ + java.lang.String getPageToken(); + /** + * + * + *
+   * Optional. Page token.
+   * 
+ * + * string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * + * @return The bytes for pageToken. + */ + com.google.protobuf.ByteString getPageTokenBytes(); +} diff --git a/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/ListResourceAllowancesResponse.java b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/ListResourceAllowancesResponse.java new file mode 100644 index 000000000000..cdd6a69791d0 --- /dev/null +++ b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/ListResourceAllowancesResponse.java @@ -0,0 +1,1417 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/batch/v1alpha/batch.proto + +// Protobuf Java Version: 3.25.2 +package com.google.cloud.batch.v1alpha; + +/** + * + * + *
+ * ListResourceAllowances Response.
+ * 
+ * + * Protobuf type {@code google.cloud.batch.v1alpha.ListResourceAllowancesResponse} + */ +public final class ListResourceAllowancesResponse extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.batch.v1alpha.ListResourceAllowancesResponse) + ListResourceAllowancesResponseOrBuilder { + private static final long serialVersionUID = 0L; + // Use ListResourceAllowancesResponse.newBuilder() to construct. + private ListResourceAllowancesResponse( + com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ListResourceAllowancesResponse() { + resourceAllowances_ = java.util.Collections.emptyList(); + nextPageToken_ = ""; + unreachable_ = com.google.protobuf.LazyStringArrayList.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ListResourceAllowancesResponse(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.batch.v1alpha.BatchProto + .internal_static_google_cloud_batch_v1alpha_ListResourceAllowancesResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.batch.v1alpha.BatchProto + .internal_static_google_cloud_batch_v1alpha_ListResourceAllowancesResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse.class, + com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse.Builder.class); + } + + public static final int RESOURCE_ALLOWANCES_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private java.util.List resourceAllowances_; + /** + * + * + *
+   * ResourceAllowances.
+   * 
+ * + * repeated .google.cloud.batch.v1alpha.ResourceAllowance resource_allowances = 1; + */ + @java.lang.Override + public java.util.List + getResourceAllowancesList() { + return resourceAllowances_; + } + /** + * + * + *
+   * ResourceAllowances.
+   * 
+ * + * repeated .google.cloud.batch.v1alpha.ResourceAllowance resource_allowances = 1; + */ + @java.lang.Override + public java.util.List + getResourceAllowancesOrBuilderList() { + return resourceAllowances_; + } + /** + * + * + *
+   * ResourceAllowances.
+   * 
+ * + * repeated .google.cloud.batch.v1alpha.ResourceAllowance resource_allowances = 1; + */ + @java.lang.Override + public int getResourceAllowancesCount() { + return resourceAllowances_.size(); + } + /** + * + * + *
+   * ResourceAllowances.
+   * 
+ * + * repeated .google.cloud.batch.v1alpha.ResourceAllowance resource_allowances = 1; + */ + @java.lang.Override + public com.google.cloud.batch.v1alpha.ResourceAllowance getResourceAllowances(int index) { + return resourceAllowances_.get(index); + } + /** + * + * + *
+   * ResourceAllowances.
+   * 
+ * + * repeated .google.cloud.batch.v1alpha.ResourceAllowance resource_allowances = 1; + */ + @java.lang.Override + public com.google.cloud.batch.v1alpha.ResourceAllowanceOrBuilder getResourceAllowancesOrBuilder( + int index) { + return resourceAllowances_.get(index); + } + + public static final int NEXT_PAGE_TOKEN_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private volatile java.lang.Object nextPageToken_ = ""; + /** + * + * + *
+   * Next page token.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + @java.lang.Override + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } + } + /** + * + * + *
+   * Next page token.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int UNREACHABLE_FIELD_NUMBER = 3; + + @SuppressWarnings("serial") + private com.google.protobuf.LazyStringArrayList unreachable_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + /** + * + * + *
+   * Locations that could not be reached.
+   * 
+ * + * repeated string unreachable = 3; + * + * @return A list containing the unreachable. + */ + public com.google.protobuf.ProtocolStringList getUnreachableList() { + return unreachable_; + } + /** + * + * + *
+   * Locations that could not be reached.
+   * 
+ * + * repeated string unreachable = 3; + * + * @return The count of unreachable. + */ + public int getUnreachableCount() { + return unreachable_.size(); + } + /** + * + * + *
+   * Locations that could not be reached.
+   * 
+ * + * repeated string unreachable = 3; + * + * @param index The index of the element to return. + * @return The unreachable at the given index. + */ + public java.lang.String getUnreachable(int index) { + return unreachable_.get(index); + } + /** + * + * + *
+   * Locations that could not be reached.
+   * 
+ * + * repeated string unreachable = 3; + * + * @param index The index of the value to return. + * @return The bytes of the unreachable at the given index. + */ + public com.google.protobuf.ByteString getUnreachableBytes(int index) { + return unreachable_.getByteString(index); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + for (int i = 0; i < resourceAllowances_.size(); i++) { + output.writeMessage(1, resourceAllowances_.get(i)); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextPageToken_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, nextPageToken_); + } + for (int i = 0; i < unreachable_.size(); i++) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, unreachable_.getRaw(i)); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < resourceAllowances_.size(); i++) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize(1, resourceAllowances_.get(i)); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(nextPageToken_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, nextPageToken_); + } + { + int dataSize = 0; + for (int i = 0; i < unreachable_.size(); i++) { + dataSize += computeStringSizeNoTag(unreachable_.getRaw(i)); + } + size += dataSize; + size += 1 * getUnreachableList().size(); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse)) { + return super.equals(obj); + } + com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse other = + (com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse) obj; + + if (!getResourceAllowancesList().equals(other.getResourceAllowancesList())) return false; + if (!getNextPageToken().equals(other.getNextPageToken())) return false; + if (!getUnreachableList().equals(other.getUnreachableList())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getResourceAllowancesCount() > 0) { + hash = (37 * hash) + RESOURCE_ALLOWANCES_FIELD_NUMBER; + hash = (53 * hash) + getResourceAllowancesList().hashCode(); + } + hash = (37 * hash) + NEXT_PAGE_TOKEN_FIELD_NUMBER; + hash = (53 * hash) + getNextPageToken().hashCode(); + if (getUnreachableCount() > 0) { + hash = (37 * hash) + UNREACHABLE_FIELD_NUMBER; + hash = (53 * hash) + getUnreachableList().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * ListResourceAllowances Response.
+   * 
+ * + * Protobuf type {@code google.cloud.batch.v1alpha.ListResourceAllowancesResponse} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.batch.v1alpha.ListResourceAllowancesResponse) + com.google.cloud.batch.v1alpha.ListResourceAllowancesResponseOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.batch.v1alpha.BatchProto + .internal_static_google_cloud_batch_v1alpha_ListResourceAllowancesResponse_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.batch.v1alpha.BatchProto + .internal_static_google_cloud_batch_v1alpha_ListResourceAllowancesResponse_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse.class, + com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse.Builder.class); + } + + // Construct using com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + if (resourceAllowancesBuilder_ == null) { + resourceAllowances_ = java.util.Collections.emptyList(); + } else { + resourceAllowances_ = null; + resourceAllowancesBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + nextPageToken_ = ""; + unreachable_ = com.google.protobuf.LazyStringArrayList.emptyList(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.batch.v1alpha.BatchProto + .internal_static_google_cloud_batch_v1alpha_ListResourceAllowancesResponse_descriptor; + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse + getDefaultInstanceForType() { + return com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse build() { + com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse buildPartial() { + com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse result = + new com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse(this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields( + com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse result) { + if (resourceAllowancesBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + resourceAllowances_ = java.util.Collections.unmodifiableList(resourceAllowances_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.resourceAllowances_ = resourceAllowances_; + } else { + result.resourceAllowances_ = resourceAllowancesBuilder_.build(); + } + } + + private void buildPartial0( + com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000002) != 0)) { + result.nextPageToken_ = nextPageToken_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + unreachable_.makeImmutable(); + result.unreachable_ = unreachable_; + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse) { + return mergeFrom((com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse other) { + if (other + == com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse.getDefaultInstance()) + return this; + if (resourceAllowancesBuilder_ == null) { + if (!other.resourceAllowances_.isEmpty()) { + if (resourceAllowances_.isEmpty()) { + resourceAllowances_ = other.resourceAllowances_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureResourceAllowancesIsMutable(); + resourceAllowances_.addAll(other.resourceAllowances_); + } + onChanged(); + } + } else { + if (!other.resourceAllowances_.isEmpty()) { + if (resourceAllowancesBuilder_.isEmpty()) { + resourceAllowancesBuilder_.dispose(); + resourceAllowancesBuilder_ = null; + resourceAllowances_ = other.resourceAllowances_; + bitField0_ = (bitField0_ & ~0x00000001); + resourceAllowancesBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getResourceAllowancesFieldBuilder() + : null; + } else { + resourceAllowancesBuilder_.addAllMessages(other.resourceAllowances_); + } + } + } + if (!other.getNextPageToken().isEmpty()) { + nextPageToken_ = other.nextPageToken_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (!other.unreachable_.isEmpty()) { + if (unreachable_.isEmpty()) { + unreachable_ = other.unreachable_; + bitField0_ |= 0x00000004; + } else { + ensureUnreachableIsMutable(); + unreachable_.addAll(other.unreachable_); + } + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.cloud.batch.v1alpha.ResourceAllowance m = + input.readMessage( + com.google.cloud.batch.v1alpha.ResourceAllowance.parser(), + extensionRegistry); + if (resourceAllowancesBuilder_ == null) { + ensureResourceAllowancesIsMutable(); + resourceAllowances_.add(m); + } else { + resourceAllowancesBuilder_.addMessage(m); + } + break; + } // case 10 + case 18: + { + nextPageToken_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: + { + java.lang.String s = input.readStringRequireUtf8(); + ensureUnreachableIsMutable(); + unreachable_.add(s); + break; + } // case 26 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.util.List resourceAllowances_ = + java.util.Collections.emptyList(); + + private void ensureResourceAllowancesIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + resourceAllowances_ = + new java.util.ArrayList( + resourceAllowances_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.batch.v1alpha.ResourceAllowance, + com.google.cloud.batch.v1alpha.ResourceAllowance.Builder, + com.google.cloud.batch.v1alpha.ResourceAllowanceOrBuilder> + resourceAllowancesBuilder_; + + /** + * + * + *
+     * ResourceAllowances.
+     * 
+ * + * repeated .google.cloud.batch.v1alpha.ResourceAllowance resource_allowances = 1; + */ + public java.util.List + getResourceAllowancesList() { + if (resourceAllowancesBuilder_ == null) { + return java.util.Collections.unmodifiableList(resourceAllowances_); + } else { + return resourceAllowancesBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * ResourceAllowances.
+     * 
+ * + * repeated .google.cloud.batch.v1alpha.ResourceAllowance resource_allowances = 1; + */ + public int getResourceAllowancesCount() { + if (resourceAllowancesBuilder_ == null) { + return resourceAllowances_.size(); + } else { + return resourceAllowancesBuilder_.getCount(); + } + } + /** + * + * + *
+     * ResourceAllowances.
+     * 
+ * + * repeated .google.cloud.batch.v1alpha.ResourceAllowance resource_allowances = 1; + */ + public com.google.cloud.batch.v1alpha.ResourceAllowance getResourceAllowances(int index) { + if (resourceAllowancesBuilder_ == null) { + return resourceAllowances_.get(index); + } else { + return resourceAllowancesBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * ResourceAllowances.
+     * 
+ * + * repeated .google.cloud.batch.v1alpha.ResourceAllowance resource_allowances = 1; + */ + public Builder setResourceAllowances( + int index, com.google.cloud.batch.v1alpha.ResourceAllowance value) { + if (resourceAllowancesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureResourceAllowancesIsMutable(); + resourceAllowances_.set(index, value); + onChanged(); + } else { + resourceAllowancesBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * ResourceAllowances.
+     * 
+ * + * repeated .google.cloud.batch.v1alpha.ResourceAllowance resource_allowances = 1; + */ + public Builder setResourceAllowances( + int index, com.google.cloud.batch.v1alpha.ResourceAllowance.Builder builderForValue) { + if (resourceAllowancesBuilder_ == null) { + ensureResourceAllowancesIsMutable(); + resourceAllowances_.set(index, builderForValue.build()); + onChanged(); + } else { + resourceAllowancesBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * ResourceAllowances.
+     * 
+ * + * repeated .google.cloud.batch.v1alpha.ResourceAllowance resource_allowances = 1; + */ + public Builder addResourceAllowances(com.google.cloud.batch.v1alpha.ResourceAllowance value) { + if (resourceAllowancesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureResourceAllowancesIsMutable(); + resourceAllowances_.add(value); + onChanged(); + } else { + resourceAllowancesBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * ResourceAllowances.
+     * 
+ * + * repeated .google.cloud.batch.v1alpha.ResourceAllowance resource_allowances = 1; + */ + public Builder addResourceAllowances( + int index, com.google.cloud.batch.v1alpha.ResourceAllowance value) { + if (resourceAllowancesBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureResourceAllowancesIsMutable(); + resourceAllowances_.add(index, value); + onChanged(); + } else { + resourceAllowancesBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * ResourceAllowances.
+     * 
+ * + * repeated .google.cloud.batch.v1alpha.ResourceAllowance resource_allowances = 1; + */ + public Builder addResourceAllowances( + com.google.cloud.batch.v1alpha.ResourceAllowance.Builder builderForValue) { + if (resourceAllowancesBuilder_ == null) { + ensureResourceAllowancesIsMutable(); + resourceAllowances_.add(builderForValue.build()); + onChanged(); + } else { + resourceAllowancesBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * ResourceAllowances.
+     * 
+ * + * repeated .google.cloud.batch.v1alpha.ResourceAllowance resource_allowances = 1; + */ + public Builder addResourceAllowances( + int index, com.google.cloud.batch.v1alpha.ResourceAllowance.Builder builderForValue) { + if (resourceAllowancesBuilder_ == null) { + ensureResourceAllowancesIsMutable(); + resourceAllowances_.add(index, builderForValue.build()); + onChanged(); + } else { + resourceAllowancesBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * ResourceAllowances.
+     * 
+ * + * repeated .google.cloud.batch.v1alpha.ResourceAllowance resource_allowances = 1; + */ + public Builder addAllResourceAllowances( + java.lang.Iterable values) { + if (resourceAllowancesBuilder_ == null) { + ensureResourceAllowancesIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, resourceAllowances_); + onChanged(); + } else { + resourceAllowancesBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * ResourceAllowances.
+     * 
+ * + * repeated .google.cloud.batch.v1alpha.ResourceAllowance resource_allowances = 1; + */ + public Builder clearResourceAllowances() { + if (resourceAllowancesBuilder_ == null) { + resourceAllowances_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + resourceAllowancesBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * ResourceAllowances.
+     * 
+ * + * repeated .google.cloud.batch.v1alpha.ResourceAllowance resource_allowances = 1; + */ + public Builder removeResourceAllowances(int index) { + if (resourceAllowancesBuilder_ == null) { + ensureResourceAllowancesIsMutable(); + resourceAllowances_.remove(index); + onChanged(); + } else { + resourceAllowancesBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * ResourceAllowances.
+     * 
+ * + * repeated .google.cloud.batch.v1alpha.ResourceAllowance resource_allowances = 1; + */ + public com.google.cloud.batch.v1alpha.ResourceAllowance.Builder getResourceAllowancesBuilder( + int index) { + return getResourceAllowancesFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * ResourceAllowances.
+     * 
+ * + * repeated .google.cloud.batch.v1alpha.ResourceAllowance resource_allowances = 1; + */ + public com.google.cloud.batch.v1alpha.ResourceAllowanceOrBuilder getResourceAllowancesOrBuilder( + int index) { + if (resourceAllowancesBuilder_ == null) { + return resourceAllowances_.get(index); + } else { + return resourceAllowancesBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * ResourceAllowances.
+     * 
+ * + * repeated .google.cloud.batch.v1alpha.ResourceAllowance resource_allowances = 1; + */ + public java.util.List + getResourceAllowancesOrBuilderList() { + if (resourceAllowancesBuilder_ != null) { + return resourceAllowancesBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(resourceAllowances_); + } + } + /** + * + * + *
+     * ResourceAllowances.
+     * 
+ * + * repeated .google.cloud.batch.v1alpha.ResourceAllowance resource_allowances = 1; + */ + public com.google.cloud.batch.v1alpha.ResourceAllowance.Builder addResourceAllowancesBuilder() { + return getResourceAllowancesFieldBuilder() + .addBuilder(com.google.cloud.batch.v1alpha.ResourceAllowance.getDefaultInstance()); + } + /** + * + * + *
+     * ResourceAllowances.
+     * 
+ * + * repeated .google.cloud.batch.v1alpha.ResourceAllowance resource_allowances = 1; + */ + public com.google.cloud.batch.v1alpha.ResourceAllowance.Builder addResourceAllowancesBuilder( + int index) { + return getResourceAllowancesFieldBuilder() + .addBuilder(index, com.google.cloud.batch.v1alpha.ResourceAllowance.getDefaultInstance()); + } + /** + * + * + *
+     * ResourceAllowances.
+     * 
+ * + * repeated .google.cloud.batch.v1alpha.ResourceAllowance resource_allowances = 1; + */ + public java.util.List + getResourceAllowancesBuilderList() { + return getResourceAllowancesFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.batch.v1alpha.ResourceAllowance, + com.google.cloud.batch.v1alpha.ResourceAllowance.Builder, + com.google.cloud.batch.v1alpha.ResourceAllowanceOrBuilder> + getResourceAllowancesFieldBuilder() { + if (resourceAllowancesBuilder_ == null) { + resourceAllowancesBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.batch.v1alpha.ResourceAllowance, + com.google.cloud.batch.v1alpha.ResourceAllowance.Builder, + com.google.cloud.batch.v1alpha.ResourceAllowanceOrBuilder>( + resourceAllowances_, + ((bitField0_ & 0x00000001) != 0), + getParentForChildren(), + isClean()); + resourceAllowances_ = null; + } + return resourceAllowancesBuilder_; + } + + private java.lang.Object nextPageToken_ = ""; + /** + * + * + *
+     * Next page token.
+     * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + public java.lang.String getNextPageToken() { + java.lang.Object ref = nextPageToken_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + nextPageToken_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Next page token.
+     * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + public com.google.protobuf.ByteString getNextPageTokenBytes() { + java.lang.Object ref = nextPageToken_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + nextPageToken_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Next page token.
+     * 
+ * + * string next_page_token = 2; + * + * @param value The nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageToken(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + nextPageToken_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Next page token.
+     * 
+ * + * string next_page_token = 2; + * + * @return This builder for chaining. + */ + public Builder clearNextPageToken() { + nextPageToken_ = getDefaultInstance().getNextPageToken(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * + * + *
+     * Next page token.
+     * 
+ * + * string next_page_token = 2; + * + * @param value The bytes for nextPageToken to set. + * @return This builder for chaining. + */ + public Builder setNextPageTokenBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + nextPageToken_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private com.google.protobuf.LazyStringArrayList unreachable_ = + com.google.protobuf.LazyStringArrayList.emptyList(); + + private void ensureUnreachableIsMutable() { + if (!unreachable_.isModifiable()) { + unreachable_ = new com.google.protobuf.LazyStringArrayList(unreachable_); + } + bitField0_ |= 0x00000004; + } + /** + * + * + *
+     * Locations that could not be reached.
+     * 
+ * + * repeated string unreachable = 3; + * + * @return A list containing the unreachable. + */ + public com.google.protobuf.ProtocolStringList getUnreachableList() { + unreachable_.makeImmutable(); + return unreachable_; + } + /** + * + * + *
+     * Locations that could not be reached.
+     * 
+ * + * repeated string unreachable = 3; + * + * @return The count of unreachable. + */ + public int getUnreachableCount() { + return unreachable_.size(); + } + /** + * + * + *
+     * Locations that could not be reached.
+     * 
+ * + * repeated string unreachable = 3; + * + * @param index The index of the element to return. + * @return The unreachable at the given index. + */ + public java.lang.String getUnreachable(int index) { + return unreachable_.get(index); + } + /** + * + * + *
+     * Locations that could not be reached.
+     * 
+ * + * repeated string unreachable = 3; + * + * @param index The index of the value to return. + * @return The bytes of the unreachable at the given index. + */ + public com.google.protobuf.ByteString getUnreachableBytes(int index) { + return unreachable_.getByteString(index); + } + /** + * + * + *
+     * Locations that could not be reached.
+     * 
+ * + * repeated string unreachable = 3; + * + * @param index The index to set the value at. + * @param value The unreachable to set. + * @return This builder for chaining. + */ + public Builder setUnreachable(int index, java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureUnreachableIsMutable(); + unreachable_.set(index, value); + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * Locations that could not be reached.
+     * 
+ * + * repeated string unreachable = 3; + * + * @param value The unreachable to add. + * @return This builder for chaining. + */ + public Builder addUnreachable(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + ensureUnreachableIsMutable(); + unreachable_.add(value); + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * Locations that could not be reached.
+     * 
+ * + * repeated string unreachable = 3; + * + * @param values The unreachable to add. + * @return This builder for chaining. + */ + public Builder addAllUnreachable(java.lang.Iterable values) { + ensureUnreachableIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, unreachable_); + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * Locations that could not be reached.
+     * 
+ * + * repeated string unreachable = 3; + * + * @return This builder for chaining. + */ + public Builder clearUnreachable() { + unreachable_ = com.google.protobuf.LazyStringArrayList.emptyList(); + bitField0_ = (bitField0_ & ~0x00000004); + ; + onChanged(); + return this; + } + /** + * + * + *
+     * Locations that could not be reached.
+     * 
+ * + * repeated string unreachable = 3; + * + * @param value The bytes of the unreachable to add. + * @return This builder for chaining. + */ + public Builder addUnreachableBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + ensureUnreachableIsMutable(); + unreachable_.add(value); + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.batch.v1alpha.ListResourceAllowancesResponse) + } + + // @@protoc_insertion_point(class_scope:google.cloud.batch.v1alpha.ListResourceAllowancesResponse) + private static final com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse(); + } + + public static com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ListResourceAllowancesResponse parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/ListResourceAllowancesResponseOrBuilder.java b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/ListResourceAllowancesResponseOrBuilder.java new file mode 100644 index 000000000000..5b8573f10b23 --- /dev/null +++ b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/ListResourceAllowancesResponseOrBuilder.java @@ -0,0 +1,155 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/batch/v1alpha/batch.proto + +// Protobuf Java Version: 3.25.2 +package com.google.cloud.batch.v1alpha; + +public interface ListResourceAllowancesResponseOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.batch.v1alpha.ListResourceAllowancesResponse) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * ResourceAllowances.
+   * 
+ * + * repeated .google.cloud.batch.v1alpha.ResourceAllowance resource_allowances = 1; + */ + java.util.List getResourceAllowancesList(); + /** + * + * + *
+   * ResourceAllowances.
+   * 
+ * + * repeated .google.cloud.batch.v1alpha.ResourceAllowance resource_allowances = 1; + */ + com.google.cloud.batch.v1alpha.ResourceAllowance getResourceAllowances(int index); + /** + * + * + *
+   * ResourceAllowances.
+   * 
+ * + * repeated .google.cloud.batch.v1alpha.ResourceAllowance resource_allowances = 1; + */ + int getResourceAllowancesCount(); + /** + * + * + *
+   * ResourceAllowances.
+   * 
+ * + * repeated .google.cloud.batch.v1alpha.ResourceAllowance resource_allowances = 1; + */ + java.util.List + getResourceAllowancesOrBuilderList(); + /** + * + * + *
+   * ResourceAllowances.
+   * 
+ * + * repeated .google.cloud.batch.v1alpha.ResourceAllowance resource_allowances = 1; + */ + com.google.cloud.batch.v1alpha.ResourceAllowanceOrBuilder getResourceAllowancesOrBuilder( + int index); + + /** + * + * + *
+   * Next page token.
+   * 
+ * + * string next_page_token = 2; + * + * @return The nextPageToken. + */ + java.lang.String getNextPageToken(); + /** + * + * + *
+   * Next page token.
+   * 
+ * + * string next_page_token = 2; + * + * @return The bytes for nextPageToken. + */ + com.google.protobuf.ByteString getNextPageTokenBytes(); + + /** + * + * + *
+   * Locations that could not be reached.
+   * 
+ * + * repeated string unreachable = 3; + * + * @return A list containing the unreachable. + */ + java.util.List getUnreachableList(); + /** + * + * + *
+   * Locations that could not be reached.
+   * 
+ * + * repeated string unreachable = 3; + * + * @return The count of unreachable. + */ + int getUnreachableCount(); + /** + * + * + *
+   * Locations that could not be reached.
+   * 
+ * + * repeated string unreachable = 3; + * + * @param index The index of the element to return. + * @return The unreachable at the given index. + */ + java.lang.String getUnreachable(int index); + /** + * + * + *
+   * Locations that could not be reached.
+   * 
+ * + * repeated string unreachable = 3; + * + * @param index The index of the value to return. + * @return The bytes of the unreachable at the given index. + */ + com.google.protobuf.ByteString getUnreachableBytes(int index); +} diff --git a/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/Notification.java b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/Notification.java new file mode 100644 index 000000000000..db8d5427a1ff --- /dev/null +++ b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/Notification.java @@ -0,0 +1,652 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/batch/v1alpha/notification.proto + +// Protobuf Java Version: 3.25.2 +package com.google.cloud.batch.v1alpha; + +/** + * + * + *
+ * Notification on resource state change.
+ * 
+ * + * Protobuf type {@code google.cloud.batch.v1alpha.Notification} + */ +public final class Notification extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.batch.v1alpha.Notification) + NotificationOrBuilder { + private static final long serialVersionUID = 0L; + // Use Notification.newBuilder() to construct. + private Notification(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Notification() { + pubsubTopic_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Notification(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.batch.v1alpha.NotificationProto + .internal_static_google_cloud_batch_v1alpha_Notification_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.batch.v1alpha.NotificationProto + .internal_static_google_cloud_batch_v1alpha_Notification_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.batch.v1alpha.Notification.class, + com.google.cloud.batch.v1alpha.Notification.Builder.class); + } + + public static final int PUBSUB_TOPIC_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object pubsubTopic_ = ""; + /** + * + * + *
+   * Required. The Pub/Sub topic where notifications like the resource allowance
+   * state changes will be published. The topic must exist in the same project
+   * as the job and billings will be charged to this project. If not specified,
+   * no Pub/Sub messages will be sent. Topic format:
+   * `projects/{project}/topics/{topic}`.
+   * 
+ * + * string pubsub_topic = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The pubsubTopic. + */ + @java.lang.Override + public java.lang.String getPubsubTopic() { + java.lang.Object ref = pubsubTopic_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pubsubTopic_ = s; + return s; + } + } + /** + * + * + *
+   * Required. The Pub/Sub topic where notifications like the resource allowance
+   * state changes will be published. The topic must exist in the same project
+   * as the job and billings will be charged to this project. If not specified,
+   * no Pub/Sub messages will be sent. Topic format:
+   * `projects/{project}/topics/{topic}`.
+   * 
+ * + * string pubsub_topic = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for pubsubTopic. + */ + @java.lang.Override + public com.google.protobuf.ByteString getPubsubTopicBytes() { + java.lang.Object ref = pubsubTopic_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pubsubTopic_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pubsubTopic_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, pubsubTopic_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pubsubTopic_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, pubsubTopic_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.batch.v1alpha.Notification)) { + return super.equals(obj); + } + com.google.cloud.batch.v1alpha.Notification other = + (com.google.cloud.batch.v1alpha.Notification) obj; + + if (!getPubsubTopic().equals(other.getPubsubTopic())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + PUBSUB_TOPIC_FIELD_NUMBER; + hash = (53 * hash) + getPubsubTopic().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.batch.v1alpha.Notification parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.batch.v1alpha.Notification parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.Notification parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.batch.v1alpha.Notification parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.Notification parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.batch.v1alpha.Notification parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.Notification parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.batch.v1alpha.Notification parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.Notification parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.batch.v1alpha.Notification parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.Notification parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.batch.v1alpha.Notification parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.batch.v1alpha.Notification prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Notification on resource state change.
+   * 
+ * + * Protobuf type {@code google.cloud.batch.v1alpha.Notification} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.batch.v1alpha.Notification) + com.google.cloud.batch.v1alpha.NotificationOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.batch.v1alpha.NotificationProto + .internal_static_google_cloud_batch_v1alpha_Notification_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.batch.v1alpha.NotificationProto + .internal_static_google_cloud_batch_v1alpha_Notification_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.batch.v1alpha.Notification.class, + com.google.cloud.batch.v1alpha.Notification.Builder.class); + } + + // Construct using com.google.cloud.batch.v1alpha.Notification.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + pubsubTopic_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.batch.v1alpha.NotificationProto + .internal_static_google_cloud_batch_v1alpha_Notification_descriptor; + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.Notification getDefaultInstanceForType() { + return com.google.cloud.batch.v1alpha.Notification.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.Notification build() { + com.google.cloud.batch.v1alpha.Notification result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.Notification buildPartial() { + com.google.cloud.batch.v1alpha.Notification result = + new com.google.cloud.batch.v1alpha.Notification(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.cloud.batch.v1alpha.Notification result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.pubsubTopic_ = pubsubTopic_; + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.batch.v1alpha.Notification) { + return mergeFrom((com.google.cloud.batch.v1alpha.Notification) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.batch.v1alpha.Notification other) { + if (other == com.google.cloud.batch.v1alpha.Notification.getDefaultInstance()) return this; + if (!other.getPubsubTopic().isEmpty()) { + pubsubTopic_ = other.pubsubTopic_; + bitField0_ |= 0x00000001; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + pubsubTopic_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object pubsubTopic_ = ""; + /** + * + * + *
+     * Required. The Pub/Sub topic where notifications like the resource allowance
+     * state changes will be published. The topic must exist in the same project
+     * as the job and billings will be charged to this project. If not specified,
+     * no Pub/Sub messages will be sent. Topic format:
+     * `projects/{project}/topics/{topic}`.
+     * 
+ * + * string pubsub_topic = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The pubsubTopic. + */ + public java.lang.String getPubsubTopic() { + java.lang.Object ref = pubsubTopic_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + pubsubTopic_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. The Pub/Sub topic where notifications like the resource allowance
+     * state changes will be published. The topic must exist in the same project
+     * as the job and billings will be charged to this project. If not specified,
+     * no Pub/Sub messages will be sent. Topic format:
+     * `projects/{project}/topics/{topic}`.
+     * 
+ * + * string pubsub_topic = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for pubsubTopic. + */ + public com.google.protobuf.ByteString getPubsubTopicBytes() { + java.lang.Object ref = pubsubTopic_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + pubsubTopic_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. The Pub/Sub topic where notifications like the resource allowance
+     * state changes will be published. The topic must exist in the same project
+     * as the job and billings will be charged to this project. If not specified,
+     * no Pub/Sub messages will be sent. Topic format:
+     * `projects/{project}/topics/{topic}`.
+     * 
+ * + * string pubsub_topic = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The pubsubTopic to set. + * @return This builder for chaining. + */ + public Builder setPubsubTopic(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + pubsubTopic_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The Pub/Sub topic where notifications like the resource allowance
+     * state changes will be published. The topic must exist in the same project
+     * as the job and billings will be charged to this project. If not specified,
+     * no Pub/Sub messages will be sent. Topic format:
+     * `projects/{project}/topics/{topic}`.
+     * 
+ * + * string pubsub_topic = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearPubsubTopic() { + pubsubTopic_ = getDefaultInstance().getPubsubTopic(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The Pub/Sub topic where notifications like the resource allowance
+     * state changes will be published. The topic must exist in the same project
+     * as the job and billings will be charged to this project. If not specified,
+     * no Pub/Sub messages will be sent. Topic format:
+     * `projects/{project}/topics/{topic}`.
+     * 
+ * + * string pubsub_topic = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for pubsubTopic to set. + * @return This builder for chaining. + */ + public Builder setPubsubTopicBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + pubsubTopic_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.batch.v1alpha.Notification) + } + + // @@protoc_insertion_point(class_scope:google.cloud.batch.v1alpha.Notification) + private static final com.google.cloud.batch.v1alpha.Notification DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.batch.v1alpha.Notification(); + } + + public static com.google.cloud.batch.v1alpha.Notification getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Notification parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.Notification getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/NotificationOrBuilder.java b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/NotificationOrBuilder.java new file mode 100644 index 000000000000..3bcf0cccb74f --- /dev/null +++ b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/NotificationOrBuilder.java @@ -0,0 +1,59 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/batch/v1alpha/notification.proto + +// Protobuf Java Version: 3.25.2 +package com.google.cloud.batch.v1alpha; + +public interface NotificationOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.batch.v1alpha.Notification) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The Pub/Sub topic where notifications like the resource allowance
+   * state changes will be published. The topic must exist in the same project
+   * as the job and billings will be charged to this project. If not specified,
+   * no Pub/Sub messages will be sent. Topic format:
+   * `projects/{project}/topics/{topic}`.
+   * 
+ * + * string pubsub_topic = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The pubsubTopic. + */ + java.lang.String getPubsubTopic(); + /** + * + * + *
+   * Required. The Pub/Sub topic where notifications like the resource allowance
+   * state changes will be published. The topic must exist in the same project
+   * as the job and billings will be charged to this project. If not specified,
+   * no Pub/Sub messages will be sent. Topic format:
+   * `projects/{project}/topics/{topic}`.
+   * 
+ * + * string pubsub_topic = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for pubsubTopic. + */ + com.google.protobuf.ByteString getPubsubTopicBytes(); +} diff --git a/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/NotificationProto.java b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/NotificationProto.java index f561b173ab45..968af7673309 100644 --- a/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/NotificationProto.java +++ b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/NotificationProto.java @@ -28,6 +28,11 @@ public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry r registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry); } + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_batch_v1alpha_Notification_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_batch_v1alpha_Notification_fieldAccessorTable; + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { return descriptor; } @@ -38,13 +43,14 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { java.lang.String[] descriptorData = { "\n-google/cloud/batch/v1alpha/notificatio" + "n.proto\022\032google.cloud.batch.v1alpha\032\037goo" - + "gle/api/field_behavior.protoB\313\001\n\036com.goo" - + "gle.cloud.batch.v1alphaB\021NotificationPro" - + "toP\001Z4cloud.google.com/go/batch/apiv1alp" - + "ha/batchpb;batchpb\242\002\003GCB\252\002\032Google.Cloud." - + "Batch.V1Alpha\312\002\032Google\\Cloud\\Batch\\V1alp" - + "ha\352\002\035Google::Cloud::Batch::V1alphab\006prot" - + "o3" + + "gle/api/field_behavior.proto\")\n\014Notifica" + + "tion\022\031\n\014pubsub_topic\030\001 \001(\tB\003\340A\002B\313\001\n\036com." + + "google.cloud.batch.v1alphaB\021Notification" + + "ProtoP\001Z4cloud.google.com/go/batch/apiv1" + + "alpha/batchpb;batchpb\242\002\003GCB\252\002\032Google.Clo" + + "ud.Batch.V1Alpha\312\002\032Google\\Cloud\\Batch\\V1" + + "alpha\352\002\035Google::Cloud::Batch::V1alphab\006p" + + "roto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( @@ -52,6 +58,19 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { new com.google.protobuf.Descriptors.FileDescriptor[] { com.google.api.FieldBehaviorProto.getDescriptor(), }); + internal_static_google_cloud_batch_v1alpha_Notification_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_google_cloud_batch_v1alpha_Notification_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_batch_v1alpha_Notification_descriptor, + new java.lang.String[] { + "PubsubTopic", + }); + com.google.protobuf.ExtensionRegistry registry = + com.google.protobuf.ExtensionRegistry.newInstance(); + registry.add(com.google.api.FieldBehaviorProto.fieldBehavior); + com.google.protobuf.Descriptors.FileDescriptor.internalUpdateFileDescriptor( + descriptor, registry); com.google.api.FieldBehaviorProto.getDescriptor(); } diff --git a/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/ResourceAllowance.java b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/ResourceAllowance.java new file mode 100644 index 000000000000..ecc4ca45049a --- /dev/null +++ b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/ResourceAllowance.java @@ -0,0 +1,2513 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/batch/v1alpha/resource_allowance.proto + +// Protobuf Java Version: 3.25.2 +package com.google.cloud.batch.v1alpha; + +/** + * + * + *
+ * The Resource Allowance description for Cloud Batch.
+ * 
+ * + * Protobuf type {@code google.cloud.batch.v1alpha.ResourceAllowance} + */ +public final class ResourceAllowance extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.batch.v1alpha.ResourceAllowance) + ResourceAllowanceOrBuilder { + private static final long serialVersionUID = 0L; + // Use ResourceAllowance.newBuilder() to construct. + private ResourceAllowance(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ResourceAllowance() { + name_ = ""; + uid_ = ""; + notifications_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ResourceAllowance(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.batch.v1alpha.ResourceAllowanceProto + .internal_static_google_cloud_batch_v1alpha_ResourceAllowance_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection( + int number) { + switch (number) { + case 5: + return internalGetLabels(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.batch.v1alpha.ResourceAllowanceProto + .internal_static_google_cloud_batch_v1alpha_ResourceAllowance_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.batch.v1alpha.ResourceAllowance.class, + com.google.cloud.batch.v1alpha.ResourceAllowance.Builder.class); + } + + private int bitField0_; + private int resourceAllowanceCase_ = 0; + + @SuppressWarnings("serial") + private java.lang.Object resourceAllowance_; + + public enum ResourceAllowanceCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + USAGE_RESOURCE_ALLOWANCE(4), + RESOURCEALLOWANCE_NOT_SET(0); + private final int value; + + private ResourceAllowanceCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static ResourceAllowanceCase valueOf(int value) { + return forNumber(value); + } + + public static ResourceAllowanceCase forNumber(int value) { + switch (value) { + case 4: + return USAGE_RESOURCE_ALLOWANCE; + case 0: + return RESOURCEALLOWANCE_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public ResourceAllowanceCase getResourceAllowanceCase() { + return ResourceAllowanceCase.forNumber(resourceAllowanceCase_); + } + + public static final int USAGE_RESOURCE_ALLOWANCE_FIELD_NUMBER = 4; + /** + * + * + *
+   * The detail of usage resource allowance.
+   * 
+ * + * .google.cloud.batch.v1alpha.UsageResourceAllowance usage_resource_allowance = 4; + * + * @return Whether the usageResourceAllowance field is set. + */ + @java.lang.Override + public boolean hasUsageResourceAllowance() { + return resourceAllowanceCase_ == 4; + } + /** + * + * + *
+   * The detail of usage resource allowance.
+   * 
+ * + * .google.cloud.batch.v1alpha.UsageResourceAllowance usage_resource_allowance = 4; + * + * @return The usageResourceAllowance. + */ + @java.lang.Override + public com.google.cloud.batch.v1alpha.UsageResourceAllowance getUsageResourceAllowance() { + if (resourceAllowanceCase_ == 4) { + return (com.google.cloud.batch.v1alpha.UsageResourceAllowance) resourceAllowance_; + } + return com.google.cloud.batch.v1alpha.UsageResourceAllowance.getDefaultInstance(); + } + /** + * + * + *
+   * The detail of usage resource allowance.
+   * 
+ * + * .google.cloud.batch.v1alpha.UsageResourceAllowance usage_resource_allowance = 4; + */ + @java.lang.Override + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceOrBuilder + getUsageResourceAllowanceOrBuilder() { + if (resourceAllowanceCase_ == 4) { + return (com.google.cloud.batch.v1alpha.UsageResourceAllowance) resourceAllowance_; + } + return com.google.cloud.batch.v1alpha.UsageResourceAllowance.getDefaultInstance(); + } + + public static final int NAME_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** + * + * + *
+   * Identifier. ResourceAllowance name.
+   * For example:
+   * "projects/123456/locations/us-central1/resourceAllowances/resource-allowance-1".
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * Identifier. ResourceAllowance name.
+   * For example:
+   * "projects/123456/locations/us-central1/resourceAllowances/resource-allowance-1".
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int UID_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private volatile java.lang.Object uid_ = ""; + /** + * + * + *
+   * Output only. A system generated unique ID (in UUID4 format) for the
+   * ResourceAllowance.
+   * 
+ * + * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.field_info) = { ... } + * + * + * @return The uid. + */ + @java.lang.Override + public java.lang.String getUid() { + java.lang.Object ref = uid_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + uid_ = s; + return s; + } + } + /** + * + * + *
+   * Output only. A system generated unique ID (in UUID4 format) for the
+   * ResourceAllowance.
+   * 
+ * + * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.field_info) = { ... } + * + * + * @return The bytes for uid. + */ + @java.lang.Override + public com.google.protobuf.ByteString getUidBytes() { + java.lang.Object ref = uid_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + uid_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int CREATE_TIME_FIELD_NUMBER = 3; + private com.google.protobuf.Timestamp createTime_; + /** + * + * + *
+   * Output only. Time when the ResourceAllowance was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the createTime field is set. + */ + @java.lang.Override + public boolean hasCreateTime() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * + * + *
+   * Output only. Time when the ResourceAllowance was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The createTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getCreateTime() { + return createTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : createTime_; + } + /** + * + * + *
+   * Output only. Time when the ResourceAllowance was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { + return createTime_ == null ? com.google.protobuf.Timestamp.getDefaultInstance() : createTime_; + } + + public static final int LABELS_FIELD_NUMBER = 5; + + private static final class LabelsDefaultEntryHolder { + static final com.google.protobuf.MapEntry defaultEntry = + com.google.protobuf.MapEntry.newDefaultInstance( + com.google.cloud.batch.v1alpha.ResourceAllowanceProto + .internal_static_google_cloud_batch_v1alpha_ResourceAllowance_LabelsEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.STRING, + ""); + } + + @SuppressWarnings("serial") + private com.google.protobuf.MapField labels_; + + private com.google.protobuf.MapField internalGetLabels() { + if (labels_ == null) { + return com.google.protobuf.MapField.emptyMapField(LabelsDefaultEntryHolder.defaultEntry); + } + return labels_; + } + + public int getLabelsCount() { + return internalGetLabels().getMap().size(); + } + /** + * + * + *
+   * Optional. Labels are attributes that can be set and used by both the
+   * user and by Batch. Labels must meet the following constraints:
+   *
+   * * Keys and values can contain only lowercase letters, numeric characters,
+   * underscores, and dashes.
+   * * All characters must use UTF-8 encoding, and international characters are
+   * allowed.
+   * * Keys must start with a lowercase letter or international character.
+   * * Each resource is limited to a maximum of 64 labels.
+   *
+   * Both keys and values are additionally constrained to be <= 128 bytes.
+   * 
+ * + * map<string, string> labels = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + @java.lang.Override + public boolean containsLabels(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetLabels().getMap().containsKey(key); + } + /** Use {@link #getLabelsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getLabels() { + return getLabelsMap(); + } + /** + * + * + *
+   * Optional. Labels are attributes that can be set and used by both the
+   * user and by Batch. Labels must meet the following constraints:
+   *
+   * * Keys and values can contain only lowercase letters, numeric characters,
+   * underscores, and dashes.
+   * * All characters must use UTF-8 encoding, and international characters are
+   * allowed.
+   * * Keys must start with a lowercase letter or international character.
+   * * Each resource is limited to a maximum of 64 labels.
+   *
+   * Both keys and values are additionally constrained to be <= 128 bytes.
+   * 
+ * + * map<string, string> labels = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + @java.lang.Override + public java.util.Map getLabelsMap() { + return internalGetLabels().getMap(); + } + /** + * + * + *
+   * Optional. Labels are attributes that can be set and used by both the
+   * user and by Batch. Labels must meet the following constraints:
+   *
+   * * Keys and values can contain only lowercase letters, numeric characters,
+   * underscores, and dashes.
+   * * All characters must use UTF-8 encoding, and international characters are
+   * allowed.
+   * * Keys must start with a lowercase letter or international character.
+   * * Each resource is limited to a maximum of 64 labels.
+   *
+   * Both keys and values are additionally constrained to be <= 128 bytes.
+   * 
+ * + * map<string, string> labels = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + @java.lang.Override + public /* nullable */ java.lang.String getLabelsOrDefault( + java.lang.String key, + /* nullable */ + java.lang.String defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetLabels().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+   * Optional. Labels are attributes that can be set and used by both the
+   * user and by Batch. Labels must meet the following constraints:
+   *
+   * * Keys and values can contain only lowercase letters, numeric characters,
+   * underscores, and dashes.
+   * * All characters must use UTF-8 encoding, and international characters are
+   * allowed.
+   * * Keys must start with a lowercase letter or international character.
+   * * Each resource is limited to a maximum of 64 labels.
+   *
+   * Both keys and values are additionally constrained to be <= 128 bytes.
+   * 
+ * + * map<string, string> labels = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + @java.lang.Override + public java.lang.String getLabelsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetLabels().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public static final int NOTIFICATIONS_FIELD_NUMBER = 6; + + @SuppressWarnings("serial") + private java.util.List notifications_; + /** + * + * + *
+   * Optional. Notification configurations.
+   * 
+ * + * + * repeated .google.cloud.batch.v1alpha.Notification notifications = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public java.util.List getNotificationsList() { + return notifications_; + } + /** + * + * + *
+   * Optional. Notification configurations.
+   * 
+ * + * + * repeated .google.cloud.batch.v1alpha.Notification notifications = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public java.util.List + getNotificationsOrBuilderList() { + return notifications_; + } + /** + * + * + *
+   * Optional. Notification configurations.
+   * 
+ * + * + * repeated .google.cloud.batch.v1alpha.Notification notifications = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public int getNotificationsCount() { + return notifications_.size(); + } + /** + * + * + *
+   * Optional. Notification configurations.
+   * 
+ * + * + * repeated .google.cloud.batch.v1alpha.Notification notifications = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.cloud.batch.v1alpha.Notification getNotifications(int index) { + return notifications_.get(index); + } + /** + * + * + *
+   * Optional. Notification configurations.
+   * 
+ * + * + * repeated .google.cloud.batch.v1alpha.Notification notifications = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + @java.lang.Override + public com.google.cloud.batch.v1alpha.NotificationOrBuilder getNotificationsOrBuilder(int index) { + return notifications_.get(index); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(uid_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, uid_); + } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(3, getCreateTime()); + } + if (resourceAllowanceCase_ == 4) { + output.writeMessage( + 4, (com.google.cloud.batch.v1alpha.UsageResourceAllowance) resourceAllowance_); + } + com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + output, internalGetLabels(), LabelsDefaultEntryHolder.defaultEntry, 5); + for (int i = 0; i < notifications_.size(); i++) { + output.writeMessage(6, notifications_.get(i)); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(uid_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, uid_); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getCreateTime()); + } + if (resourceAllowanceCase_ == 4) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize( + 4, (com.google.cloud.batch.v1alpha.UsageResourceAllowance) resourceAllowance_); + } + for (java.util.Map.Entry entry : + internalGetLabels().getMap().entrySet()) { + com.google.protobuf.MapEntry labels__ = + LabelsDefaultEntryHolder.defaultEntry + .newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += com.google.protobuf.CodedOutputStream.computeMessageSize(5, labels__); + } + for (int i = 0; i < notifications_.size(); i++) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(6, notifications_.get(i)); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.batch.v1alpha.ResourceAllowance)) { + return super.equals(obj); + } + com.google.cloud.batch.v1alpha.ResourceAllowance other = + (com.google.cloud.batch.v1alpha.ResourceAllowance) obj; + + if (!getName().equals(other.getName())) return false; + if (!getUid().equals(other.getUid())) return false; + if (hasCreateTime() != other.hasCreateTime()) return false; + if (hasCreateTime()) { + if (!getCreateTime().equals(other.getCreateTime())) return false; + } + if (!internalGetLabels().equals(other.internalGetLabels())) return false; + if (!getNotificationsList().equals(other.getNotificationsList())) return false; + if (!getResourceAllowanceCase().equals(other.getResourceAllowanceCase())) return false; + switch (resourceAllowanceCase_) { + case 4: + if (!getUsageResourceAllowance().equals(other.getUsageResourceAllowance())) return false; + break; + case 0: + default: + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + UID_FIELD_NUMBER; + hash = (53 * hash) + getUid().hashCode(); + if (hasCreateTime()) { + hash = (37 * hash) + CREATE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getCreateTime().hashCode(); + } + if (!internalGetLabels().getMap().isEmpty()) { + hash = (37 * hash) + LABELS_FIELD_NUMBER; + hash = (53 * hash) + internalGetLabels().hashCode(); + } + if (getNotificationsCount() > 0) { + hash = (37 * hash) + NOTIFICATIONS_FIELD_NUMBER; + hash = (53 * hash) + getNotificationsList().hashCode(); + } + switch (resourceAllowanceCase_) { + case 4: + hash = (37 * hash) + USAGE_RESOURCE_ALLOWANCE_FIELD_NUMBER; + hash = (53 * hash) + getUsageResourceAllowance().hashCode(); + break; + case 0: + default: + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.batch.v1alpha.ResourceAllowance parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.batch.v1alpha.ResourceAllowance parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.ResourceAllowance parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.batch.v1alpha.ResourceAllowance parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.ResourceAllowance parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.batch.v1alpha.ResourceAllowance parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.ResourceAllowance parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.batch.v1alpha.ResourceAllowance parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.ResourceAllowance parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.batch.v1alpha.ResourceAllowance parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.ResourceAllowance parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.batch.v1alpha.ResourceAllowance parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.batch.v1alpha.ResourceAllowance prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * The Resource Allowance description for Cloud Batch.
+   * 
+ * + * Protobuf type {@code google.cloud.batch.v1alpha.ResourceAllowance} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.batch.v1alpha.ResourceAllowance) + com.google.cloud.batch.v1alpha.ResourceAllowanceOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.batch.v1alpha.ResourceAllowanceProto + .internal_static_google_cloud_batch_v1alpha_ResourceAllowance_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection( + int number) { + switch (number) { + case 5: + return internalGetLabels(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMutableMapFieldReflection( + int number) { + switch (number) { + case 5: + return internalGetMutableLabels(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.batch.v1alpha.ResourceAllowanceProto + .internal_static_google_cloud_batch_v1alpha_ResourceAllowance_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.batch.v1alpha.ResourceAllowance.class, + com.google.cloud.batch.v1alpha.ResourceAllowance.Builder.class); + } + + // Construct using com.google.cloud.batch.v1alpha.ResourceAllowance.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getCreateTimeFieldBuilder(); + getNotificationsFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + if (usageResourceAllowanceBuilder_ != null) { + usageResourceAllowanceBuilder_.clear(); + } + name_ = ""; + uid_ = ""; + createTime_ = null; + if (createTimeBuilder_ != null) { + createTimeBuilder_.dispose(); + createTimeBuilder_ = null; + } + internalGetMutableLabels().clear(); + if (notificationsBuilder_ == null) { + notifications_ = java.util.Collections.emptyList(); + } else { + notifications_ = null; + notificationsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000020); + resourceAllowanceCase_ = 0; + resourceAllowance_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.batch.v1alpha.ResourceAllowanceProto + .internal_static_google_cloud_batch_v1alpha_ResourceAllowance_descriptor; + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.ResourceAllowance getDefaultInstanceForType() { + return com.google.cloud.batch.v1alpha.ResourceAllowance.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.ResourceAllowance build() { + com.google.cloud.batch.v1alpha.ResourceAllowance result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.ResourceAllowance buildPartial() { + com.google.cloud.batch.v1alpha.ResourceAllowance result = + new com.google.cloud.batch.v1alpha.ResourceAllowance(this); + buildPartialRepeatedFields(result); + if (bitField0_ != 0) { + buildPartial0(result); + } + buildPartialOneofs(result); + onBuilt(); + return result; + } + + private void buildPartialRepeatedFields( + com.google.cloud.batch.v1alpha.ResourceAllowance result) { + if (notificationsBuilder_ == null) { + if (((bitField0_ & 0x00000020) != 0)) { + notifications_ = java.util.Collections.unmodifiableList(notifications_); + bitField0_ = (bitField0_ & ~0x00000020); + } + result.notifications_ = notifications_; + } else { + result.notifications_ = notificationsBuilder_.build(); + } + } + + private void buildPartial0(com.google.cloud.batch.v1alpha.ResourceAllowance result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000002) != 0)) { + result.name_ = name_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.uid_ = uid_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000008) != 0)) { + result.createTime_ = createTimeBuilder_ == null ? createTime_ : createTimeBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000010) != 0)) { + result.labels_ = internalGetLabels(); + result.labels_.makeImmutable(); + } + result.bitField0_ |= to_bitField0_; + } + + private void buildPartialOneofs(com.google.cloud.batch.v1alpha.ResourceAllowance result) { + result.resourceAllowanceCase_ = resourceAllowanceCase_; + result.resourceAllowance_ = this.resourceAllowance_; + if (resourceAllowanceCase_ == 4 && usageResourceAllowanceBuilder_ != null) { + result.resourceAllowance_ = usageResourceAllowanceBuilder_.build(); + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.batch.v1alpha.ResourceAllowance) { + return mergeFrom((com.google.cloud.batch.v1alpha.ResourceAllowance) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.batch.v1alpha.ResourceAllowance other) { + if (other == com.google.cloud.batch.v1alpha.ResourceAllowance.getDefaultInstance()) + return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (!other.getUid().isEmpty()) { + uid_ = other.uid_; + bitField0_ |= 0x00000004; + onChanged(); + } + if (other.hasCreateTime()) { + mergeCreateTime(other.getCreateTime()); + } + internalGetMutableLabels().mergeFrom(other.internalGetLabels()); + bitField0_ |= 0x00000010; + if (notificationsBuilder_ == null) { + if (!other.notifications_.isEmpty()) { + if (notifications_.isEmpty()) { + notifications_ = other.notifications_; + bitField0_ = (bitField0_ & ~0x00000020); + } else { + ensureNotificationsIsMutable(); + notifications_.addAll(other.notifications_); + } + onChanged(); + } + } else { + if (!other.notifications_.isEmpty()) { + if (notificationsBuilder_.isEmpty()) { + notificationsBuilder_.dispose(); + notificationsBuilder_ = null; + notifications_ = other.notifications_; + bitField0_ = (bitField0_ & ~0x00000020); + notificationsBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders + ? getNotificationsFieldBuilder() + : null; + } else { + notificationsBuilder_.addAllMessages(other.notifications_); + } + } + } + switch (other.getResourceAllowanceCase()) { + case USAGE_RESOURCE_ALLOWANCE: + { + mergeUsageResourceAllowance(other.getUsageResourceAllowance()); + break; + } + case RESOURCEALLOWANCE_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 10 + case 18: + { + uid_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000004; + break; + } // case 18 + case 26: + { + input.readMessage(getCreateTimeFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000008; + break; + } // case 26 + case 34: + { + input.readMessage( + getUsageResourceAllowanceFieldBuilder().getBuilder(), extensionRegistry); + resourceAllowanceCase_ = 4; + break; + } // case 34 + case 42: + { + com.google.protobuf.MapEntry labels__ = + input.readMessage( + LabelsDefaultEntryHolder.defaultEntry.getParserForType(), + extensionRegistry); + internalGetMutableLabels() + .getMutableMap() + .put(labels__.getKey(), labels__.getValue()); + bitField0_ |= 0x00000010; + break; + } // case 42 + case 50: + { + com.google.cloud.batch.v1alpha.Notification m = + input.readMessage( + com.google.cloud.batch.v1alpha.Notification.parser(), extensionRegistry); + if (notificationsBuilder_ == null) { + ensureNotificationsIsMutable(); + notifications_.add(m); + } else { + notificationsBuilder_.addMessage(m); + } + break; + } // case 50 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int resourceAllowanceCase_ = 0; + private java.lang.Object resourceAllowance_; + + public ResourceAllowanceCase getResourceAllowanceCase() { + return ResourceAllowanceCase.forNumber(resourceAllowanceCase_); + } + + public Builder clearResourceAllowance() { + resourceAllowanceCase_ = 0; + resourceAllowance_ = null; + onChanged(); + return this; + } + + private int bitField0_; + + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.batch.v1alpha.UsageResourceAllowance, + com.google.cloud.batch.v1alpha.UsageResourceAllowance.Builder, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceOrBuilder> + usageResourceAllowanceBuilder_; + /** + * + * + *
+     * The detail of usage resource allowance.
+     * 
+ * + * .google.cloud.batch.v1alpha.UsageResourceAllowance usage_resource_allowance = 4; + * + * @return Whether the usageResourceAllowance field is set. + */ + @java.lang.Override + public boolean hasUsageResourceAllowance() { + return resourceAllowanceCase_ == 4; + } + /** + * + * + *
+     * The detail of usage resource allowance.
+     * 
+ * + * .google.cloud.batch.v1alpha.UsageResourceAllowance usage_resource_allowance = 4; + * + * @return The usageResourceAllowance. + */ + @java.lang.Override + public com.google.cloud.batch.v1alpha.UsageResourceAllowance getUsageResourceAllowance() { + if (usageResourceAllowanceBuilder_ == null) { + if (resourceAllowanceCase_ == 4) { + return (com.google.cloud.batch.v1alpha.UsageResourceAllowance) resourceAllowance_; + } + return com.google.cloud.batch.v1alpha.UsageResourceAllowance.getDefaultInstance(); + } else { + if (resourceAllowanceCase_ == 4) { + return usageResourceAllowanceBuilder_.getMessage(); + } + return com.google.cloud.batch.v1alpha.UsageResourceAllowance.getDefaultInstance(); + } + } + /** + * + * + *
+     * The detail of usage resource allowance.
+     * 
+ * + * .google.cloud.batch.v1alpha.UsageResourceAllowance usage_resource_allowance = 4; + */ + public Builder setUsageResourceAllowance( + com.google.cloud.batch.v1alpha.UsageResourceAllowance value) { + if (usageResourceAllowanceBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + resourceAllowance_ = value; + onChanged(); + } else { + usageResourceAllowanceBuilder_.setMessage(value); + } + resourceAllowanceCase_ = 4; + return this; + } + /** + * + * + *
+     * The detail of usage resource allowance.
+     * 
+ * + * .google.cloud.batch.v1alpha.UsageResourceAllowance usage_resource_allowance = 4; + */ + public Builder setUsageResourceAllowance( + com.google.cloud.batch.v1alpha.UsageResourceAllowance.Builder builderForValue) { + if (usageResourceAllowanceBuilder_ == null) { + resourceAllowance_ = builderForValue.build(); + onChanged(); + } else { + usageResourceAllowanceBuilder_.setMessage(builderForValue.build()); + } + resourceAllowanceCase_ = 4; + return this; + } + /** + * + * + *
+     * The detail of usage resource allowance.
+     * 
+ * + * .google.cloud.batch.v1alpha.UsageResourceAllowance usage_resource_allowance = 4; + */ + public Builder mergeUsageResourceAllowance( + com.google.cloud.batch.v1alpha.UsageResourceAllowance value) { + if (usageResourceAllowanceBuilder_ == null) { + if (resourceAllowanceCase_ == 4 + && resourceAllowance_ + != com.google.cloud.batch.v1alpha.UsageResourceAllowance.getDefaultInstance()) { + resourceAllowance_ = + com.google.cloud.batch.v1alpha.UsageResourceAllowance.newBuilder( + (com.google.cloud.batch.v1alpha.UsageResourceAllowance) resourceAllowance_) + .mergeFrom(value) + .buildPartial(); + } else { + resourceAllowance_ = value; + } + onChanged(); + } else { + if (resourceAllowanceCase_ == 4) { + usageResourceAllowanceBuilder_.mergeFrom(value); + } else { + usageResourceAllowanceBuilder_.setMessage(value); + } + } + resourceAllowanceCase_ = 4; + return this; + } + /** + * + * + *
+     * The detail of usage resource allowance.
+     * 
+ * + * .google.cloud.batch.v1alpha.UsageResourceAllowance usage_resource_allowance = 4; + */ + public Builder clearUsageResourceAllowance() { + if (usageResourceAllowanceBuilder_ == null) { + if (resourceAllowanceCase_ == 4) { + resourceAllowanceCase_ = 0; + resourceAllowance_ = null; + onChanged(); + } + } else { + if (resourceAllowanceCase_ == 4) { + resourceAllowanceCase_ = 0; + resourceAllowance_ = null; + } + usageResourceAllowanceBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * The detail of usage resource allowance.
+     * 
+ * + * .google.cloud.batch.v1alpha.UsageResourceAllowance usage_resource_allowance = 4; + */ + public com.google.cloud.batch.v1alpha.UsageResourceAllowance.Builder + getUsageResourceAllowanceBuilder() { + return getUsageResourceAllowanceFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The detail of usage resource allowance.
+     * 
+ * + * .google.cloud.batch.v1alpha.UsageResourceAllowance usage_resource_allowance = 4; + */ + @java.lang.Override + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceOrBuilder + getUsageResourceAllowanceOrBuilder() { + if ((resourceAllowanceCase_ == 4) && (usageResourceAllowanceBuilder_ != null)) { + return usageResourceAllowanceBuilder_.getMessageOrBuilder(); + } else { + if (resourceAllowanceCase_ == 4) { + return (com.google.cloud.batch.v1alpha.UsageResourceAllowance) resourceAllowance_; + } + return com.google.cloud.batch.v1alpha.UsageResourceAllowance.getDefaultInstance(); + } + } + /** + * + * + *
+     * The detail of usage resource allowance.
+     * 
+ * + * .google.cloud.batch.v1alpha.UsageResourceAllowance usage_resource_allowance = 4; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.batch.v1alpha.UsageResourceAllowance, + com.google.cloud.batch.v1alpha.UsageResourceAllowance.Builder, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceOrBuilder> + getUsageResourceAllowanceFieldBuilder() { + if (usageResourceAllowanceBuilder_ == null) { + if (!(resourceAllowanceCase_ == 4)) { + resourceAllowance_ = + com.google.cloud.batch.v1alpha.UsageResourceAllowance.getDefaultInstance(); + } + usageResourceAllowanceBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.batch.v1alpha.UsageResourceAllowance, + com.google.cloud.batch.v1alpha.UsageResourceAllowance.Builder, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceOrBuilder>( + (com.google.cloud.batch.v1alpha.UsageResourceAllowance) resourceAllowance_, + getParentForChildren(), + isClean()); + resourceAllowance_ = null; + } + resourceAllowanceCase_ = 4; + onChanged(); + return usageResourceAllowanceBuilder_; + } + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * Identifier. ResourceAllowance name.
+     * For example:
+     * "projects/123456/locations/us-central1/resourceAllowances/resource-allowance-1".
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Identifier. ResourceAllowance name.
+     * For example:
+     * "projects/123456/locations/us-central1/resourceAllowances/resource-allowance-1".
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Identifier. ResourceAllowance name.
+     * For example:
+     * "projects/123456/locations/us-central1/resourceAllowances/resource-allowance-1".
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + name_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Identifier. ResourceAllowance name.
+     * For example:
+     * "projects/123456/locations/us-central1/resourceAllowances/resource-allowance-1".
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * + * @return This builder for chaining. + */ + public Builder clearName() { + name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * + * + *
+     * Identifier. ResourceAllowance name.
+     * For example:
+     * "projects/123456/locations/us-central1/resourceAllowances/resource-allowance-1".
+     * 
+ * + * string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + name_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private java.lang.Object uid_ = ""; + /** + * + * + *
+     * Output only. A system generated unique ID (in UUID4 format) for the
+     * ResourceAllowance.
+     * 
+ * + * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.field_info) = { ... } + * + * + * @return The uid. + */ + public java.lang.String getUid() { + java.lang.Object ref = uid_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + uid_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Output only. A system generated unique ID (in UUID4 format) for the
+     * ResourceAllowance.
+     * 
+ * + * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.field_info) = { ... } + * + * + * @return The bytes for uid. + */ + public com.google.protobuf.ByteString getUidBytes() { + java.lang.Object ref = uid_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + uid_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Output only. A system generated unique ID (in UUID4 format) for the
+     * ResourceAllowance.
+     * 
+ * + * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.field_info) = { ... } + * + * + * @param value The uid to set. + * @return This builder for chaining. + */ + public Builder setUid(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + uid_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. A system generated unique ID (in UUID4 format) for the
+     * ResourceAllowance.
+     * 
+ * + * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.field_info) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearUid() { + uid_ = getDefaultInstance().getUid(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. A system generated unique ID (in UUID4 format) for the
+     * ResourceAllowance.
+     * 
+ * + * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.field_info) = { ... } + * + * + * @param value The bytes for uid to set. + * @return This builder for chaining. + */ + public Builder setUidBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + uid_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + private com.google.protobuf.Timestamp createTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + createTimeBuilder_; + /** + * + * + *
+     * Output only. Time when the ResourceAllowance was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the createTime field is set. + */ + public boolean hasCreateTime() { + return ((bitField0_ & 0x00000008) != 0); + } + /** + * + * + *
+     * Output only. Time when the ResourceAllowance was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The createTime. + */ + public com.google.protobuf.Timestamp getCreateTime() { + if (createTimeBuilder_ == null) { + return createTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : createTime_; + } else { + return createTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. Time when the ResourceAllowance was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setCreateTime(com.google.protobuf.Timestamp value) { + if (createTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + createTime_ = value; + } else { + createTimeBuilder_.setMessage(value); + } + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Time when the ResourceAllowance was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setCreateTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (createTimeBuilder_ == null) { + createTime_ = builderForValue.build(); + } else { + createTimeBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Time when the ResourceAllowance was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeCreateTime(com.google.protobuf.Timestamp value) { + if (createTimeBuilder_ == null) { + if (((bitField0_ & 0x00000008) != 0) + && createTime_ != null + && createTime_ != com.google.protobuf.Timestamp.getDefaultInstance()) { + getCreateTimeBuilder().mergeFrom(value); + } else { + createTime_ = value; + } + } else { + createTimeBuilder_.mergeFrom(value); + } + if (createTime_ != null) { + bitField0_ |= 0x00000008; + onChanged(); + } + return this; + } + /** + * + * + *
+     * Output only. Time when the ResourceAllowance was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearCreateTime() { + bitField0_ = (bitField0_ & ~0x00000008); + createTime_ = null; + if (createTimeBuilder_ != null) { + createTimeBuilder_.dispose(); + createTimeBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Time when the ResourceAllowance was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.Timestamp.Builder getCreateTimeBuilder() { + bitField0_ |= 0x00000008; + onChanged(); + return getCreateTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. Time when the ResourceAllowance was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder() { + if (createTimeBuilder_ != null) { + return createTimeBuilder_.getMessageOrBuilder(); + } else { + return createTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : createTime_; + } + } + /** + * + * + *
+     * Output only. Time when the ResourceAllowance was created.
+     * 
+ * + * + * .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getCreateTimeFieldBuilder() { + if (createTimeBuilder_ == null) { + createTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getCreateTime(), getParentForChildren(), isClean()); + createTime_ = null; + } + return createTimeBuilder_; + } + + private com.google.protobuf.MapField labels_; + + private com.google.protobuf.MapField internalGetLabels() { + if (labels_ == null) { + return com.google.protobuf.MapField.emptyMapField(LabelsDefaultEntryHolder.defaultEntry); + } + return labels_; + } + + private com.google.protobuf.MapField + internalGetMutableLabels() { + if (labels_ == null) { + labels_ = com.google.protobuf.MapField.newMapField(LabelsDefaultEntryHolder.defaultEntry); + } + if (!labels_.isMutable()) { + labels_ = labels_.copy(); + } + bitField0_ |= 0x00000010; + onChanged(); + return labels_; + } + + public int getLabelsCount() { + return internalGetLabels().getMap().size(); + } + /** + * + * + *
+     * Optional. Labels are attributes that can be set and used by both the
+     * user and by Batch. Labels must meet the following constraints:
+     *
+     * * Keys and values can contain only lowercase letters, numeric characters,
+     * underscores, and dashes.
+     * * All characters must use UTF-8 encoding, and international characters are
+     * allowed.
+     * * Keys must start with a lowercase letter or international character.
+     * * Each resource is limited to a maximum of 64 labels.
+     *
+     * Both keys and values are additionally constrained to be <= 128 bytes.
+     * 
+ * + * map<string, string> labels = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + @java.lang.Override + public boolean containsLabels(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetLabels().getMap().containsKey(key); + } + /** Use {@link #getLabelsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map getLabels() { + return getLabelsMap(); + } + /** + * + * + *
+     * Optional. Labels are attributes that can be set and used by both the
+     * user and by Batch. Labels must meet the following constraints:
+     *
+     * * Keys and values can contain only lowercase letters, numeric characters,
+     * underscores, and dashes.
+     * * All characters must use UTF-8 encoding, and international characters are
+     * allowed.
+     * * Keys must start with a lowercase letter or international character.
+     * * Each resource is limited to a maximum of 64 labels.
+     *
+     * Both keys and values are additionally constrained to be <= 128 bytes.
+     * 
+ * + * map<string, string> labels = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + @java.lang.Override + public java.util.Map getLabelsMap() { + return internalGetLabels().getMap(); + } + /** + * + * + *
+     * Optional. Labels are attributes that can be set and used by both the
+     * user and by Batch. Labels must meet the following constraints:
+     *
+     * * Keys and values can contain only lowercase letters, numeric characters,
+     * underscores, and dashes.
+     * * All characters must use UTF-8 encoding, and international characters are
+     * allowed.
+     * * Keys must start with a lowercase letter or international character.
+     * * Each resource is limited to a maximum of 64 labels.
+     *
+     * Both keys and values are additionally constrained to be <= 128 bytes.
+     * 
+ * + * map<string, string> labels = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + @java.lang.Override + public /* nullable */ java.lang.String getLabelsOrDefault( + java.lang.String key, + /* nullable */ + java.lang.String defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetLabels().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+     * Optional. Labels are attributes that can be set and used by both the
+     * user and by Batch. Labels must meet the following constraints:
+     *
+     * * Keys and values can contain only lowercase letters, numeric characters,
+     * underscores, and dashes.
+     * * All characters must use UTF-8 encoding, and international characters are
+     * allowed.
+     * * Keys must start with a lowercase letter or international character.
+     * * Each resource is limited to a maximum of 64 labels.
+     *
+     * Both keys and values are additionally constrained to be <= 128 bytes.
+     * 
+ * + * map<string, string> labels = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + @java.lang.Override + public java.lang.String getLabelsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map map = internalGetLabels().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + public Builder clearLabels() { + bitField0_ = (bitField0_ & ~0x00000010); + internalGetMutableLabels().getMutableMap().clear(); + return this; + } + /** + * + * + *
+     * Optional. Labels are attributes that can be set and used by both the
+     * user and by Batch. Labels must meet the following constraints:
+     *
+     * * Keys and values can contain only lowercase letters, numeric characters,
+     * underscores, and dashes.
+     * * All characters must use UTF-8 encoding, and international characters are
+     * allowed.
+     * * Keys must start with a lowercase letter or international character.
+     * * Each resource is limited to a maximum of 64 labels.
+     *
+     * Both keys and values are additionally constrained to be <= 128 bytes.
+     * 
+ * + * map<string, string> labels = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder removeLabels(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + internalGetMutableLabels().getMutableMap().remove(key); + return this; + } + /** Use alternate mutation accessors instead. */ + @java.lang.Deprecated + public java.util.Map getMutableLabels() { + bitField0_ |= 0x00000010; + return internalGetMutableLabels().getMutableMap(); + } + /** + * + * + *
+     * Optional. Labels are attributes that can be set and used by both the
+     * user and by Batch. Labels must meet the following constraints:
+     *
+     * * Keys and values can contain only lowercase letters, numeric characters,
+     * underscores, and dashes.
+     * * All characters must use UTF-8 encoding, and international characters are
+     * allowed.
+     * * Keys must start with a lowercase letter or international character.
+     * * Each resource is limited to a maximum of 64 labels.
+     *
+     * Both keys and values are additionally constrained to be <= 128 bytes.
+     * 
+ * + * map<string, string> labels = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder putLabels(java.lang.String key, java.lang.String value) { + if (key == null) { + throw new NullPointerException("map key"); + } + if (value == null) { + throw new NullPointerException("map value"); + } + internalGetMutableLabels().getMutableMap().put(key, value); + bitField0_ |= 0x00000010; + return this; + } + /** + * + * + *
+     * Optional. Labels are attributes that can be set and used by both the
+     * user and by Batch. Labels must meet the following constraints:
+     *
+     * * Keys and values can contain only lowercase letters, numeric characters,
+     * underscores, and dashes.
+     * * All characters must use UTF-8 encoding, and international characters are
+     * allowed.
+     * * Keys must start with a lowercase letter or international character.
+     * * Each resource is limited to a maximum of 64 labels.
+     *
+     * Both keys and values are additionally constrained to be <= 128 bytes.
+     * 
+ * + * map<string, string> labels = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + public Builder putAllLabels(java.util.Map values) { + internalGetMutableLabels().getMutableMap().putAll(values); + bitField0_ |= 0x00000010; + return this; + } + + private java.util.List notifications_ = + java.util.Collections.emptyList(); + + private void ensureNotificationsIsMutable() { + if (!((bitField0_ & 0x00000020) != 0)) { + notifications_ = + new java.util.ArrayList(notifications_); + bitField0_ |= 0x00000020; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.batch.v1alpha.Notification, + com.google.cloud.batch.v1alpha.Notification.Builder, + com.google.cloud.batch.v1alpha.NotificationOrBuilder> + notificationsBuilder_; + + /** + * + * + *
+     * Optional. Notification configurations.
+     * 
+ * + * + * repeated .google.cloud.batch.v1alpha.Notification notifications = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public java.util.List getNotificationsList() { + if (notificationsBuilder_ == null) { + return java.util.Collections.unmodifiableList(notifications_); + } else { + return notificationsBuilder_.getMessageList(); + } + } + /** + * + * + *
+     * Optional. Notification configurations.
+     * 
+ * + * + * repeated .google.cloud.batch.v1alpha.Notification notifications = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public int getNotificationsCount() { + if (notificationsBuilder_ == null) { + return notifications_.size(); + } else { + return notificationsBuilder_.getCount(); + } + } + /** + * + * + *
+     * Optional. Notification configurations.
+     * 
+ * + * + * repeated .google.cloud.batch.v1alpha.Notification notifications = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.batch.v1alpha.Notification getNotifications(int index) { + if (notificationsBuilder_ == null) { + return notifications_.get(index); + } else { + return notificationsBuilder_.getMessage(index); + } + } + /** + * + * + *
+     * Optional. Notification configurations.
+     * 
+ * + * + * repeated .google.cloud.batch.v1alpha.Notification notifications = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setNotifications(int index, com.google.cloud.batch.v1alpha.Notification value) { + if (notificationsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureNotificationsIsMutable(); + notifications_.set(index, value); + onChanged(); + } else { + notificationsBuilder_.setMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Optional. Notification configurations.
+     * 
+ * + * + * repeated .google.cloud.batch.v1alpha.Notification notifications = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder setNotifications( + int index, com.google.cloud.batch.v1alpha.Notification.Builder builderForValue) { + if (notificationsBuilder_ == null) { + ensureNotificationsIsMutable(); + notifications_.set(index, builderForValue.build()); + onChanged(); + } else { + notificationsBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Optional. Notification configurations.
+     * 
+ * + * + * repeated .google.cloud.batch.v1alpha.Notification notifications = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder addNotifications(com.google.cloud.batch.v1alpha.Notification value) { + if (notificationsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureNotificationsIsMutable(); + notifications_.add(value); + onChanged(); + } else { + notificationsBuilder_.addMessage(value); + } + return this; + } + /** + * + * + *
+     * Optional. Notification configurations.
+     * 
+ * + * + * repeated .google.cloud.batch.v1alpha.Notification notifications = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder addNotifications(int index, com.google.cloud.batch.v1alpha.Notification value) { + if (notificationsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureNotificationsIsMutable(); + notifications_.add(index, value); + onChanged(); + } else { + notificationsBuilder_.addMessage(index, value); + } + return this; + } + /** + * + * + *
+     * Optional. Notification configurations.
+     * 
+ * + * + * repeated .google.cloud.batch.v1alpha.Notification notifications = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder addNotifications( + com.google.cloud.batch.v1alpha.Notification.Builder builderForValue) { + if (notificationsBuilder_ == null) { + ensureNotificationsIsMutable(); + notifications_.add(builderForValue.build()); + onChanged(); + } else { + notificationsBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Optional. Notification configurations.
+     * 
+ * + * + * repeated .google.cloud.batch.v1alpha.Notification notifications = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder addNotifications( + int index, com.google.cloud.batch.v1alpha.Notification.Builder builderForValue) { + if (notificationsBuilder_ == null) { + ensureNotificationsIsMutable(); + notifications_.add(index, builderForValue.build()); + onChanged(); + } else { + notificationsBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * + * + *
+     * Optional. Notification configurations.
+     * 
+ * + * + * repeated .google.cloud.batch.v1alpha.Notification notifications = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder addAllNotifications( + java.lang.Iterable values) { + if (notificationsBuilder_ == null) { + ensureNotificationsIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll(values, notifications_); + onChanged(); + } else { + notificationsBuilder_.addAllMessages(values); + } + return this; + } + /** + * + * + *
+     * Optional. Notification configurations.
+     * 
+ * + * + * repeated .google.cloud.batch.v1alpha.Notification notifications = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder clearNotifications() { + if (notificationsBuilder_ == null) { + notifications_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000020); + onChanged(); + } else { + notificationsBuilder_.clear(); + } + return this; + } + /** + * + * + *
+     * Optional. Notification configurations.
+     * 
+ * + * + * repeated .google.cloud.batch.v1alpha.Notification notifications = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public Builder removeNotifications(int index) { + if (notificationsBuilder_ == null) { + ensureNotificationsIsMutable(); + notifications_.remove(index); + onChanged(); + } else { + notificationsBuilder_.remove(index); + } + return this; + } + /** + * + * + *
+     * Optional. Notification configurations.
+     * 
+ * + * + * repeated .google.cloud.batch.v1alpha.Notification notifications = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.batch.v1alpha.Notification.Builder getNotificationsBuilder(int index) { + return getNotificationsFieldBuilder().getBuilder(index); + } + /** + * + * + *
+     * Optional. Notification configurations.
+     * 
+ * + * + * repeated .google.cloud.batch.v1alpha.Notification notifications = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.batch.v1alpha.NotificationOrBuilder getNotificationsOrBuilder( + int index) { + if (notificationsBuilder_ == null) { + return notifications_.get(index); + } else { + return notificationsBuilder_.getMessageOrBuilder(index); + } + } + /** + * + * + *
+     * Optional. Notification configurations.
+     * 
+ * + * + * repeated .google.cloud.batch.v1alpha.Notification notifications = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public java.util.List + getNotificationsOrBuilderList() { + if (notificationsBuilder_ != null) { + return notificationsBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(notifications_); + } + } + /** + * + * + *
+     * Optional. Notification configurations.
+     * 
+ * + * + * repeated .google.cloud.batch.v1alpha.Notification notifications = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.batch.v1alpha.Notification.Builder addNotificationsBuilder() { + return getNotificationsFieldBuilder() + .addBuilder(com.google.cloud.batch.v1alpha.Notification.getDefaultInstance()); + } + /** + * + * + *
+     * Optional. Notification configurations.
+     * 
+ * + * + * repeated .google.cloud.batch.v1alpha.Notification notifications = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public com.google.cloud.batch.v1alpha.Notification.Builder addNotificationsBuilder(int index) { + return getNotificationsFieldBuilder() + .addBuilder(index, com.google.cloud.batch.v1alpha.Notification.getDefaultInstance()); + } + /** + * + * + *
+     * Optional. Notification configurations.
+     * 
+ * + * + * repeated .google.cloud.batch.v1alpha.Notification notifications = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + public java.util.List + getNotificationsBuilderList() { + return getNotificationsFieldBuilder().getBuilderList(); + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.batch.v1alpha.Notification, + com.google.cloud.batch.v1alpha.Notification.Builder, + com.google.cloud.batch.v1alpha.NotificationOrBuilder> + getNotificationsFieldBuilder() { + if (notificationsBuilder_ == null) { + notificationsBuilder_ = + new com.google.protobuf.RepeatedFieldBuilderV3< + com.google.cloud.batch.v1alpha.Notification, + com.google.cloud.batch.v1alpha.Notification.Builder, + com.google.cloud.batch.v1alpha.NotificationOrBuilder>( + notifications_, + ((bitField0_ & 0x00000020) != 0), + getParentForChildren(), + isClean()); + notifications_ = null; + } + return notificationsBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.batch.v1alpha.ResourceAllowance) + } + + // @@protoc_insertion_point(class_scope:google.cloud.batch.v1alpha.ResourceAllowance) + private static final com.google.cloud.batch.v1alpha.ResourceAllowance DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.batch.v1alpha.ResourceAllowance(); + } + + public static com.google.cloud.batch.v1alpha.ResourceAllowance getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ResourceAllowance parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.ResourceAllowance getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/ResourceAllowanceName.java b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/ResourceAllowanceName.java new file mode 100644 index 000000000000..14fcc149f041 --- /dev/null +++ b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/ResourceAllowanceName.java @@ -0,0 +1,231 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.batch.v1alpha; + +import com.google.api.pathtemplate.PathTemplate; +import com.google.api.resourcenames.ResourceName; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +@Generated("by gapic-generator-java") +public class ResourceAllowanceName implements ResourceName { + private static final PathTemplate PROJECT_LOCATION_RESOURCE_ALLOWANCE = + PathTemplate.createWithoutUrlEncoding( + "projects/{project}/locations/{location}/resourceAllowances/{resource_allowance}"); + private volatile Map fieldValuesMap; + private final String project; + private final String location; + private final String resourceAllowance; + + @Deprecated + protected ResourceAllowanceName() { + project = null; + location = null; + resourceAllowance = null; + } + + private ResourceAllowanceName(Builder builder) { + project = Preconditions.checkNotNull(builder.getProject()); + location = Preconditions.checkNotNull(builder.getLocation()); + resourceAllowance = Preconditions.checkNotNull(builder.getResourceAllowance()); + } + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getResourceAllowance() { + return resourceAllowance; + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder toBuilder() { + return new Builder(this); + } + + public static ResourceAllowanceName of( + String project, String location, String resourceAllowance) { + return newBuilder() + .setProject(project) + .setLocation(location) + .setResourceAllowance(resourceAllowance) + .build(); + } + + public static String format(String project, String location, String resourceAllowance) { + return newBuilder() + .setProject(project) + .setLocation(location) + .setResourceAllowance(resourceAllowance) + .build() + .toString(); + } + + public static ResourceAllowanceName parse(String formattedString) { + if (formattedString.isEmpty()) { + return null; + } + Map matchMap = + PROJECT_LOCATION_RESOURCE_ALLOWANCE.validatedMatch( + formattedString, "ResourceAllowanceName.parse: formattedString not in valid format"); + return of( + matchMap.get("project"), matchMap.get("location"), matchMap.get("resource_allowance")); + } + + public static List parseList(List formattedStrings) { + List list = new ArrayList<>(formattedStrings.size()); + for (String formattedString : formattedStrings) { + list.add(parse(formattedString)); + } + return list; + } + + public static List toStringList(List values) { + List list = new ArrayList<>(values.size()); + for (ResourceAllowanceName value : values) { + if (value == null) { + list.add(""); + } else { + list.add(value.toString()); + } + } + return list; + } + + public static boolean isParsableFrom(String formattedString) { + return PROJECT_LOCATION_RESOURCE_ALLOWANCE.matches(formattedString); + } + + @Override + public Map getFieldValuesMap() { + if (fieldValuesMap == null) { + synchronized (this) { + if (fieldValuesMap == null) { + ImmutableMap.Builder fieldMapBuilder = ImmutableMap.builder(); + if (project != null) { + fieldMapBuilder.put("project", project); + } + if (location != null) { + fieldMapBuilder.put("location", location); + } + if (resourceAllowance != null) { + fieldMapBuilder.put("resource_allowance", resourceAllowance); + } + fieldValuesMap = fieldMapBuilder.build(); + } + } + } + return fieldValuesMap; + } + + public String getFieldValue(String fieldName) { + return getFieldValuesMap().get(fieldName); + } + + @Override + public String toString() { + return PROJECT_LOCATION_RESOURCE_ALLOWANCE.instantiate( + "project", project, "location", location, "resource_allowance", resourceAllowance); + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o != null && getClass() == o.getClass()) { + ResourceAllowanceName that = ((ResourceAllowanceName) o); + return Objects.equals(this.project, that.project) + && Objects.equals(this.location, that.location) + && Objects.equals(this.resourceAllowance, that.resourceAllowance); + } + return false; + } + + @Override + public int hashCode() { + int h = 1; + h *= 1000003; + h ^= Objects.hashCode(project); + h *= 1000003; + h ^= Objects.hashCode(location); + h *= 1000003; + h ^= Objects.hashCode(resourceAllowance); + return h; + } + + /** + * Builder for projects/{project}/locations/{location}/resourceAllowances/{resource_allowance}. + */ + public static class Builder { + private String project; + private String location; + private String resourceAllowance; + + protected Builder() {} + + public String getProject() { + return project; + } + + public String getLocation() { + return location; + } + + public String getResourceAllowance() { + return resourceAllowance; + } + + public Builder setProject(String project) { + this.project = project; + return this; + } + + public Builder setLocation(String location) { + this.location = location; + return this; + } + + public Builder setResourceAllowance(String resourceAllowance) { + this.resourceAllowance = resourceAllowance; + return this; + } + + private Builder(ResourceAllowanceName resourceAllowanceName) { + this.project = resourceAllowanceName.project; + this.location = resourceAllowanceName.location; + this.resourceAllowance = resourceAllowanceName.resourceAllowance; + } + + public ResourceAllowanceName build() { + return new ResourceAllowanceName(this); + } + } +} diff --git a/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/ResourceAllowanceOrBuilder.java b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/ResourceAllowanceOrBuilder.java new file mode 100644 index 000000000000..62b52a9a2d5a --- /dev/null +++ b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/ResourceAllowanceOrBuilder.java @@ -0,0 +1,332 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/batch/v1alpha/resource_allowance.proto + +// Protobuf Java Version: 3.25.2 +package com.google.cloud.batch.v1alpha; + +public interface ResourceAllowanceOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.batch.v1alpha.ResourceAllowance) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The detail of usage resource allowance.
+   * 
+ * + * .google.cloud.batch.v1alpha.UsageResourceAllowance usage_resource_allowance = 4; + * + * @return Whether the usageResourceAllowance field is set. + */ + boolean hasUsageResourceAllowance(); + /** + * + * + *
+   * The detail of usage resource allowance.
+   * 
+ * + * .google.cloud.batch.v1alpha.UsageResourceAllowance usage_resource_allowance = 4; + * + * @return The usageResourceAllowance. + */ + com.google.cloud.batch.v1alpha.UsageResourceAllowance getUsageResourceAllowance(); + /** + * + * + *
+   * The detail of usage resource allowance.
+   * 
+ * + * .google.cloud.batch.v1alpha.UsageResourceAllowance usage_resource_allowance = 4; + */ + com.google.cloud.batch.v1alpha.UsageResourceAllowanceOrBuilder + getUsageResourceAllowanceOrBuilder(); + + /** + * + * + *
+   * Identifier. ResourceAllowance name.
+   * For example:
+   * "projects/123456/locations/us-central1/resourceAllowances/resource-allowance-1".
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * Identifier. ResourceAllowance name.
+   * For example:
+   * "projects/123456/locations/us-central1/resourceAllowances/resource-allowance-1".
+   * 
+ * + * string name = 1 [(.google.api.field_behavior) = IDENTIFIER]; + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * Output only. A system generated unique ID (in UUID4 format) for the
+   * ResourceAllowance.
+   * 
+ * + * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.field_info) = { ... } + * + * + * @return The uid. + */ + java.lang.String getUid(); + /** + * + * + *
+   * Output only. A system generated unique ID (in UUID4 format) for the
+   * ResourceAllowance.
+   * 
+ * + * + * string uid = 2 [(.google.api.field_behavior) = OUTPUT_ONLY, (.google.api.field_info) = { ... } + * + * + * @return The bytes for uid. + */ + com.google.protobuf.ByteString getUidBytes(); + + /** + * + * + *
+   * Output only. Time when the ResourceAllowance was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the createTime field is set. + */ + boolean hasCreateTime(); + /** + * + * + *
+   * Output only. Time when the ResourceAllowance was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The createTime. + */ + com.google.protobuf.Timestamp getCreateTime(); + /** + * + * + *
+   * Output only. Time when the ResourceAllowance was created.
+   * 
+ * + * .google.protobuf.Timestamp create_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder(); + + /** + * + * + *
+   * Optional. Labels are attributes that can be set and used by both the
+   * user and by Batch. Labels must meet the following constraints:
+   *
+   * * Keys and values can contain only lowercase letters, numeric characters,
+   * underscores, and dashes.
+   * * All characters must use UTF-8 encoding, and international characters are
+   * allowed.
+   * * Keys must start with a lowercase letter or international character.
+   * * Each resource is limited to a maximum of 64 labels.
+   *
+   * Both keys and values are additionally constrained to be <= 128 bytes.
+   * 
+ * + * map<string, string> labels = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + int getLabelsCount(); + /** + * + * + *
+   * Optional. Labels are attributes that can be set and used by both the
+   * user and by Batch. Labels must meet the following constraints:
+   *
+   * * Keys and values can contain only lowercase letters, numeric characters,
+   * underscores, and dashes.
+   * * All characters must use UTF-8 encoding, and international characters are
+   * allowed.
+   * * Keys must start with a lowercase letter or international character.
+   * * Each resource is limited to a maximum of 64 labels.
+   *
+   * Both keys and values are additionally constrained to be <= 128 bytes.
+   * 
+ * + * map<string, string> labels = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + boolean containsLabels(java.lang.String key); + /** Use {@link #getLabelsMap()} instead. */ + @java.lang.Deprecated + java.util.Map getLabels(); + /** + * + * + *
+   * Optional. Labels are attributes that can be set and used by both the
+   * user and by Batch. Labels must meet the following constraints:
+   *
+   * * Keys and values can contain only lowercase letters, numeric characters,
+   * underscores, and dashes.
+   * * All characters must use UTF-8 encoding, and international characters are
+   * allowed.
+   * * Keys must start with a lowercase letter or international character.
+   * * Each resource is limited to a maximum of 64 labels.
+   *
+   * Both keys and values are additionally constrained to be <= 128 bytes.
+   * 
+ * + * map<string, string> labels = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + java.util.Map getLabelsMap(); + /** + * + * + *
+   * Optional. Labels are attributes that can be set and used by both the
+   * user and by Batch. Labels must meet the following constraints:
+   *
+   * * Keys and values can contain only lowercase letters, numeric characters,
+   * underscores, and dashes.
+   * * All characters must use UTF-8 encoding, and international characters are
+   * allowed.
+   * * Keys must start with a lowercase letter or international character.
+   * * Each resource is limited to a maximum of 64 labels.
+   *
+   * Both keys and values are additionally constrained to be <= 128 bytes.
+   * 
+ * + * map<string, string> labels = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + /* nullable */ + java.lang.String getLabelsOrDefault( + java.lang.String key, + /* nullable */ + java.lang.String defaultValue); + /** + * + * + *
+   * Optional. Labels are attributes that can be set and used by both the
+   * user and by Batch. Labels must meet the following constraints:
+   *
+   * * Keys and values can contain only lowercase letters, numeric characters,
+   * underscores, and dashes.
+   * * All characters must use UTF-8 encoding, and international characters are
+   * allowed.
+   * * Keys must start with a lowercase letter or international character.
+   * * Each resource is limited to a maximum of 64 labels.
+   *
+   * Both keys and values are additionally constrained to be <= 128 bytes.
+   * 
+ * + * map<string, string> labels = 5 [(.google.api.field_behavior) = OPTIONAL]; + */ + java.lang.String getLabelsOrThrow(java.lang.String key); + + /** + * + * + *
+   * Optional. Notification configurations.
+   * 
+ * + * + * repeated .google.cloud.batch.v1alpha.Notification notifications = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + java.util.List getNotificationsList(); + /** + * + * + *
+   * Optional. Notification configurations.
+   * 
+ * + * + * repeated .google.cloud.batch.v1alpha.Notification notifications = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.cloud.batch.v1alpha.Notification getNotifications(int index); + /** + * + * + *
+   * Optional. Notification configurations.
+   * 
+ * + * + * repeated .google.cloud.batch.v1alpha.Notification notifications = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + int getNotificationsCount(); + /** + * + * + *
+   * Optional. Notification configurations.
+   * 
+ * + * + * repeated .google.cloud.batch.v1alpha.Notification notifications = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + java.util.List + getNotificationsOrBuilderList(); + /** + * + * + *
+   * Optional. Notification configurations.
+   * 
+ * + * + * repeated .google.cloud.batch.v1alpha.Notification notifications = 6 [(.google.api.field_behavior) = OPTIONAL]; + * + */ + com.google.cloud.batch.v1alpha.NotificationOrBuilder getNotificationsOrBuilder(int index); + + com.google.cloud.batch.v1alpha.ResourceAllowance.ResourceAllowanceCase getResourceAllowanceCase(); +} diff --git a/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/ResourceAllowanceProto.java b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/ResourceAllowanceProto.java index 2abed50ed2a1..b2e83555faa5 100644 --- a/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/ResourceAllowanceProto.java +++ b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/ResourceAllowanceProto.java @@ -28,6 +28,47 @@ public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry r registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry); } + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_batch_v1alpha_ResourceAllowance_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_batch_v1alpha_ResourceAllowance_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_batch_v1alpha_ResourceAllowance_LabelsEntry_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_batch_v1alpha_ResourceAllowance_LabelsEntry_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_batch_v1alpha_UsageResourceAllowance_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_batch_v1alpha_UsageResourceAllowance_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceSpec_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceSpec_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceSpec_Limit_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceSpec_Limit_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceStatus_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceStatus_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceStatus_LimitStatus_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceStatus_LimitStatus_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceStatus_PeriodConsumption_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceStatus_PeriodConsumption_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceStatus_ConsumptionReport_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceStatus_ConsumptionReport_fieldAccessorTable; + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceStatus_ConsumptionReport_LatestPeriodConsumptionsEntry_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceStatus_ConsumptionReport_LatestPeriodConsumptionsEntry_fieldAccessorTable; + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { return descriptor; } @@ -42,13 +83,66 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "le/api/field_info.proto\032\031google/api/reso" + "urce.proto\032-google/cloud/batch/v1alpha/n" + "otification.proto\032\037google/protobuf/times" - + "tamp.proto\032\032google/type/interval.protoB\320" - + "\001\n\036com.google.cloud.batch.v1alphaB\026Resou" - + "rceAllowanceProtoP\001Z4cloud.google.com/go" - + "/batch/apiv1alpha/batchpb;batchpb\242\002\003GCB\252" - + "\002\032Google.Cloud.Batch.V1Alpha\312\002\032Google\\Cl" - + "oud\\Batch\\V1alpha\352\002\035Google::Cloud::Batch" - + "::V1alphab\006proto3" + + "tamp.proto\032\032google/type/interval.proto\"\320" + + "\004\n\021ResourceAllowance\022V\n\030usage_resource_a" + + "llowance\030\004 \001(\01322.google.cloud.batch.v1al" + + "pha.UsageResourceAllowanceH\000\022\021\n\004name\030\001 \001" + + "(\tB\003\340A\010\022\030\n\003uid\030\002 \001(\tB\013\340A\003\342\214\317\327\010\002\010\001\0224\n\013cre" + + "ate_time\030\003 \001(\0132\032.google.protobuf.Timesta" + + "mpB\003\340A\003\022N\n\006labels\030\005 \003(\01329.google.cloud.b" + + "atch.v1alpha.ResourceAllowance.LabelsEnt" + + "ryB\003\340A\001\022D\n\rnotifications\030\006 \003(\0132(.google." + + "cloud.batch.v1alpha.NotificationB\003\340A\001\032-\n" + + "\013LabelsEntry\022\013\n\003key\030\001 \001(\t\022\r\n\005value\030\002 \001(\t" + + ":\0028\001:\244\001\352A\240\001\n&batch.googleapis.com/Resour" + + "ceAllowance\022Oprojects/{project}/location" + + "s/{location}/resourceAllowances/{resourc" + + "e_allowance}*\022resourceAllowances2\021resour" + + "ceAllowanceB\024\n\022resource_allowance\"\262\001\n\026Us" + + "ageResourceAllowance\022I\n\004spec\030\001 \001(\01326.goo" + + "gle.cloud.batch.v1alpha.UsageResourceAll" + + "owanceSpecB\003\340A\002\022M\n\006status\030\002 \001(\01328.google" + + ".cloud.batch.v1alpha.UsageResourceAllowa" + + "nceStatusB\003\340A\003\"\206\002\n\032UsageResourceAllowanc" + + "eSpec\022\021\n\004type\030\001 \001(\tB\003\340A\002\022P\n\005limit\030\002 \001(\0132" + + "<.google.cloud.batch.v1alpha.UsageResour" + + "ceAllowanceSpec.LimitB\003\340A\002\032\202\001\n\005Limit\022J\n\017" + + "calendar_period\030\001 \001(\0162*.google.cloud.bat" + + "ch.v1alpha.CalendarPeriodB\003\340A\001H\000\022\027\n\005limi" + + "t\030\002 \001(\001B\003\340A\002H\001\210\001\001B\n\n\010durationB\010\n\006_limit\"" + + "\272\006\n\034UsageResourceAllowanceStatus\022F\n\005stat" + + "e\030\001 \001(\01622.google.cloud.batch.v1alpha.Res" + + "ourceAllowanceStateB\003\340A\003\022_\n\014limit_status" + + "\030\002 \001(\0132D.google.cloud.batch.v1alpha.Usag" + + "eResourceAllowanceStatus.LimitStatusB\003\340A" + + "\003\022_\n\006report\030\003 \001(\0132J.google.cloud.batch.v" + + "1alpha.UsageResourceAllowanceStatus.Cons" + + "umptionReportB\003\340A\003\032r\n\013LimitStatus\0228\n\024con" + + "sumption_interval\030\001 \001(\0132\025.google.type.In" + + "tervalB\003\340A\003\022\022\n\005limit\030\002 \001(\001B\003\340A\003\022\025\n\010consu" + + "med\030\003 \001(\001B\003\340A\003\032d\n\021PeriodConsumption\0228\n\024c" + + "onsumption_interval\030\001 \001(\0132\025.google.type." + + "IntervalB\003\340A\003\022\025\n\010consumed\030\002 \001(\001B\003\340A\003\032\265\002\n" + + "\021ConsumptionReport\022\221\001\n\032latest_period_con" + + "sumptions\030\001 \003(\0132h.google.cloud.batch.v1a" + + "lpha.UsageResourceAllowanceStatus.Consum" + + "ptionReport.LatestPeriodConsumptionsEntr" + + "yB\003\340A\003\032\213\001\n\035LatestPeriodConsumptionsEntry" + + "\022\013\n\003key\030\001 \001(\t\022Y\n\005value\030\002 \001(\0132J.google.cl" + + "oud.batch.v1alpha.UsageResourceAllowance" + + "Status.PeriodConsumption:\0028\001*f\n\016Calendar" + + "Period\022\037\n\033CALENDAR_PERIOD_UNSPECIFIED\020\000\022" + + "\t\n\005MONTH\020\001\022\013\n\007QUARTER\020\002\022\010\n\004YEAR\020\003\022\010\n\004WEE" + + "K\020\004\022\007\n\003DAY\020\005*\202\001\n\026ResourceAllowanceState\022" + + "(\n$RESOURCE_ALLOWANCE_STATE_UNSPECIFIED\020" + + "\000\022\035\n\031RESOURCE_ALLOWANCE_ACTIVE\020\001\022\037\n\033RESO" + + "URCE_ALLOWANCE_DEPLETED\020\002B\320\001\n\036com.google" + + ".cloud.batch.v1alphaB\026ResourceAllowanceP" + + "rotoP\001Z4cloud.google.com/go/batch/apiv1a" + + "lpha/batchpb;batchpb\242\002\003GCB\252\002\032Google.Clou" + + "d.Batch.V1Alpha\312\002\032Google\\Cloud\\Batch\\V1a" + + "lpha\352\002\035Google::Cloud::Batch::V1alphab\006pr" + + "oto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( @@ -61,6 +155,111 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { com.google.protobuf.TimestampProto.getDescriptor(), com.google.type.IntervalProto.getDescriptor(), }); + internal_static_google_cloud_batch_v1alpha_ResourceAllowance_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_google_cloud_batch_v1alpha_ResourceAllowance_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_batch_v1alpha_ResourceAllowance_descriptor, + new java.lang.String[] { + "UsageResourceAllowance", + "Name", + "Uid", + "CreateTime", + "Labels", + "Notifications", + "ResourceAllowance", + }); + internal_static_google_cloud_batch_v1alpha_ResourceAllowance_LabelsEntry_descriptor = + internal_static_google_cloud_batch_v1alpha_ResourceAllowance_descriptor + .getNestedTypes() + .get(0); + internal_static_google_cloud_batch_v1alpha_ResourceAllowance_LabelsEntry_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_batch_v1alpha_ResourceAllowance_LabelsEntry_descriptor, + new java.lang.String[] { + "Key", "Value", + }); + internal_static_google_cloud_batch_v1alpha_UsageResourceAllowance_descriptor = + getDescriptor().getMessageTypes().get(1); + internal_static_google_cloud_batch_v1alpha_UsageResourceAllowance_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_batch_v1alpha_UsageResourceAllowance_descriptor, + new java.lang.String[] { + "Spec", "Status", + }); + internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceSpec_descriptor = + getDescriptor().getMessageTypes().get(2); + internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceSpec_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceSpec_descriptor, + new java.lang.String[] { + "Type", "Limit", + }); + internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceSpec_Limit_descriptor = + internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceSpec_descriptor + .getNestedTypes() + .get(0); + internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceSpec_Limit_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceSpec_Limit_descriptor, + new java.lang.String[] { + "CalendarPeriod", "Limit", "Duration", + }); + internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceStatus_descriptor = + getDescriptor().getMessageTypes().get(3); + internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceStatus_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceStatus_descriptor, + new java.lang.String[] { + "State", "LimitStatus", "Report", + }); + internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceStatus_LimitStatus_descriptor = + internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceStatus_descriptor + .getNestedTypes() + .get(0); + internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceStatus_LimitStatus_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceStatus_LimitStatus_descriptor, + new java.lang.String[] { + "ConsumptionInterval", "Limit", "Consumed", + }); + internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceStatus_PeriodConsumption_descriptor = + internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceStatus_descriptor + .getNestedTypes() + .get(1); + internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceStatus_PeriodConsumption_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceStatus_PeriodConsumption_descriptor, + new java.lang.String[] { + "ConsumptionInterval", "Consumed", + }); + internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceStatus_ConsumptionReport_descriptor = + internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceStatus_descriptor + .getNestedTypes() + .get(2); + internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceStatus_ConsumptionReport_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceStatus_ConsumptionReport_descriptor, + new java.lang.String[] { + "LatestPeriodConsumptions", + }); + internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceStatus_ConsumptionReport_LatestPeriodConsumptionsEntry_descriptor = + internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceStatus_ConsumptionReport_descriptor + .getNestedTypes() + .get(0); + internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceStatus_ConsumptionReport_LatestPeriodConsumptionsEntry_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceStatus_ConsumptionReport_LatestPeriodConsumptionsEntry_descriptor, + new java.lang.String[] { + "Key", "Value", + }); + com.google.protobuf.ExtensionRegistry registry = + com.google.protobuf.ExtensionRegistry.newInstance(); + registry.add(com.google.api.FieldBehaviorProto.fieldBehavior); + registry.add(com.google.api.FieldInfoProto.fieldInfo); + registry.add(com.google.api.ResourceProto.resource); + com.google.protobuf.Descriptors.FileDescriptor.internalUpdateFileDescriptor( + descriptor, registry); com.google.api.FieldBehaviorProto.getDescriptor(); com.google.api.FieldInfoProto.getDescriptor(); com.google.api.ResourceProto.getDescriptor(); diff --git a/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/ResourceAllowanceState.java b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/ResourceAllowanceState.java new file mode 100644 index 000000000000..a54836d95a16 --- /dev/null +++ b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/ResourceAllowanceState.java @@ -0,0 +1,182 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/batch/v1alpha/resource_allowance.proto + +// Protobuf Java Version: 3.25.2 +package com.google.cloud.batch.v1alpha; + +/** + * + * + *
+ * ResourceAllowance valid state.
+ * 
+ * + * Protobuf enum {@code google.cloud.batch.v1alpha.ResourceAllowanceState} + */ +public enum ResourceAllowanceState implements com.google.protobuf.ProtocolMessageEnum { + /** + * + * + *
+   * Unspecified.
+   * 
+ * + * RESOURCE_ALLOWANCE_STATE_UNSPECIFIED = 0; + */ + RESOURCE_ALLOWANCE_STATE_UNSPECIFIED(0), + /** + * + * + *
+   * ResourceAllowance is active and in use.
+   * 
+ * + * RESOURCE_ALLOWANCE_ACTIVE = 1; + */ + RESOURCE_ALLOWANCE_ACTIVE(1), + /** + * + * + *
+   * ResourceAllowance limit is reached.
+   * 
+ * + * RESOURCE_ALLOWANCE_DEPLETED = 2; + */ + RESOURCE_ALLOWANCE_DEPLETED(2), + UNRECOGNIZED(-1), + ; + + /** + * + * + *
+   * Unspecified.
+   * 
+ * + * RESOURCE_ALLOWANCE_STATE_UNSPECIFIED = 0; + */ + public static final int RESOURCE_ALLOWANCE_STATE_UNSPECIFIED_VALUE = 0; + /** + * + * + *
+   * ResourceAllowance is active and in use.
+   * 
+ * + * RESOURCE_ALLOWANCE_ACTIVE = 1; + */ + public static final int RESOURCE_ALLOWANCE_ACTIVE_VALUE = 1; + /** + * + * + *
+   * ResourceAllowance limit is reached.
+   * 
+ * + * RESOURCE_ALLOWANCE_DEPLETED = 2; + */ + public static final int RESOURCE_ALLOWANCE_DEPLETED_VALUE = 2; + + public final int getNumber() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalArgumentException( + "Can't get the number of an unknown enum value."); + } + return value; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static ResourceAllowanceState valueOf(int value) { + return forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value. + */ + public static ResourceAllowanceState forNumber(int value) { + switch (value) { + case 0: + return RESOURCE_ALLOWANCE_STATE_UNSPECIFIED; + case 1: + return RESOURCE_ALLOWANCE_ACTIVE; + case 2: + return RESOURCE_ALLOWANCE_DEPLETED; + default: + return null; + } + } + + public static com.google.protobuf.Internal.EnumLiteMap + internalGetValueMap() { + return internalValueMap; + } + + private static final com.google.protobuf.Internal.EnumLiteMap + internalValueMap = + new com.google.protobuf.Internal.EnumLiteMap() { + public ResourceAllowanceState findValueByNumber(int number) { + return ResourceAllowanceState.forNumber(number); + } + }; + + public final com.google.protobuf.Descriptors.EnumValueDescriptor getValueDescriptor() { + if (this == UNRECOGNIZED) { + throw new java.lang.IllegalStateException( + "Can't get the descriptor of an unrecognized enum value."); + } + return getDescriptor().getValues().get(ordinal()); + } + + public final com.google.protobuf.Descriptors.EnumDescriptor getDescriptorForType() { + return getDescriptor(); + } + + public static final com.google.protobuf.Descriptors.EnumDescriptor getDescriptor() { + return com.google.cloud.batch.v1alpha.ResourceAllowanceProto.getDescriptor() + .getEnumTypes() + .get(1); + } + + private static final ResourceAllowanceState[] VALUES = values(); + + public static ResourceAllowanceState valueOf( + com.google.protobuf.Descriptors.EnumValueDescriptor desc) { + if (desc.getType() != getDescriptor()) { + throw new java.lang.IllegalArgumentException("EnumValueDescriptor is not for this type."); + } + if (desc.getIndex() == -1) { + return UNRECOGNIZED; + } + return VALUES[desc.getIndex()]; + } + + private final int value; + + private ResourceAllowanceState(int value) { + this.value = value; + } + + // @@protoc_insertion_point(enum_scope:google.cloud.batch.v1alpha.ResourceAllowanceState) +} diff --git a/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/UpdateResourceAllowanceRequest.java b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/UpdateResourceAllowanceRequest.java new file mode 100644 index 000000000000..e849b1dc7a8e --- /dev/null +++ b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/UpdateResourceAllowanceRequest.java @@ -0,0 +1,1435 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/batch/v1alpha/batch.proto + +// Protobuf Java Version: 3.25.2 +package com.google.cloud.batch.v1alpha; + +/** + * + * + *
+ * UpdateResourceAllowance Request.
+ * 
+ * + * Protobuf type {@code google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest} + */ +public final class UpdateResourceAllowanceRequest extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest) + UpdateResourceAllowanceRequestOrBuilder { + private static final long serialVersionUID = 0L; + // Use UpdateResourceAllowanceRequest.newBuilder() to construct. + private UpdateResourceAllowanceRequest( + com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private UpdateResourceAllowanceRequest() { + requestId_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new UpdateResourceAllowanceRequest(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.batch.v1alpha.BatchProto + .internal_static_google_cloud_batch_v1alpha_UpdateResourceAllowanceRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.batch.v1alpha.BatchProto + .internal_static_google_cloud_batch_v1alpha_UpdateResourceAllowanceRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest.class, + com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest.Builder.class); + } + + private int bitField0_; + public static final int RESOURCE_ALLOWANCE_FIELD_NUMBER = 1; + private com.google.cloud.batch.v1alpha.ResourceAllowance resourceAllowance_; + /** + * + * + *
+   * Required. The ResourceAllowance to update.
+   * Update description.
+   * Only fields specified in `update_mask` are updated.
+   * 
+ * + * + * .google.cloud.batch.v1alpha.ResourceAllowance resource_allowance = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the resourceAllowance field is set. + */ + @java.lang.Override + public boolean hasResourceAllowance() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * + * + *
+   * Required. The ResourceAllowance to update.
+   * Update description.
+   * Only fields specified in `update_mask` are updated.
+   * 
+ * + * + * .google.cloud.batch.v1alpha.ResourceAllowance resource_allowance = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The resourceAllowance. + */ + @java.lang.Override + public com.google.cloud.batch.v1alpha.ResourceAllowance getResourceAllowance() { + return resourceAllowance_ == null + ? com.google.cloud.batch.v1alpha.ResourceAllowance.getDefaultInstance() + : resourceAllowance_; + } + /** + * + * + *
+   * Required. The ResourceAllowance to update.
+   * Update description.
+   * Only fields specified in `update_mask` are updated.
+   * 
+ * + * + * .google.cloud.batch.v1alpha.ResourceAllowance resource_allowance = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.batch.v1alpha.ResourceAllowanceOrBuilder getResourceAllowanceOrBuilder() { + return resourceAllowance_ == null + ? com.google.cloud.batch.v1alpha.ResourceAllowance.getDefaultInstance() + : resourceAllowance_; + } + + public static final int UPDATE_MASK_FIELD_NUMBER = 2; + private com.google.protobuf.FieldMask 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.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the updateMask field is set. + */ + @java.lang.Override + public boolean hasUpdateMask() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * + * + *
+   * 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.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The updateMask. + */ + @java.lang.Override + public com.google.protobuf.FieldMask getUpdateMask() { + return updateMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : 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.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { + return updateMask_ == null ? com.google.protobuf.FieldMask.getDefaultInstance() : updateMask_; + } + + public static final int REQUEST_ID_FIELD_NUMBER = 3; + + @SuppressWarnings("serial") + private volatile java.lang.Object requestId_ = ""; + /** + * + * + *
+   * Optional. An optional request ID to identify requests. Specify a unique
+   * request ID so that if you must retry your request, the server will know to
+   * ignore the request if it has already been completed. The server will
+   * guarantee that for at least 60 minutes since the first request.
+   *
+   * For example, consider a situation where you make an initial request and
+   * the request times out. If you make the request again with the same request
+   * ID, the server can check if original operation with the same request ID
+   * was received, and if so, will ignore the second request. This prevents
+   * clients from accidentally creating duplicate commitments.
+   *
+   * The request ID must be a valid UUID with the exception that zero UUID is
+   * not supported (00000000-0000-0000-0000-000000000000).
+   * 
+ * + * + * string request_id = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { ... } + * + * + * @return The requestId. + */ + @java.lang.Override + public java.lang.String getRequestId() { + java.lang.Object ref = requestId_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + requestId_ = s; + return s; + } + } + /** + * + * + *
+   * Optional. An optional request ID to identify requests. Specify a unique
+   * request ID so that if you must retry your request, the server will know to
+   * ignore the request if it has already been completed. The server will
+   * guarantee that for at least 60 minutes since the first request.
+   *
+   * For example, consider a situation where you make an initial request and
+   * the request times out. If you make the request again with the same request
+   * ID, the server can check if original operation with the same request ID
+   * was received, and if so, will ignore the second request. This prevents
+   * clients from accidentally creating duplicate commitments.
+   *
+   * The request ID must be a valid UUID with the exception that zero UUID is
+   * not supported (00000000-0000-0000-0000-000000000000).
+   * 
+ * + * + * string request_id = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { ... } + * + * + * @return The bytes for requestId. + */ + @java.lang.Override + public com.google.protobuf.ByteString getRequestIdBytes() { + java.lang.Object ref = requestId_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + requestId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(1, getResourceAllowance()); + } + if (((bitField0_ & 0x00000002) != 0)) { + output.writeMessage(2, getUpdateMask()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(requestId_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, requestId_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getResourceAllowance()); + } + if (((bitField0_ & 0x00000002) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getUpdateMask()); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(requestId_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, requestId_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest)) { + return super.equals(obj); + } + com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest other = + (com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest) obj; + + if (hasResourceAllowance() != other.hasResourceAllowance()) return false; + if (hasResourceAllowance()) { + if (!getResourceAllowance().equals(other.getResourceAllowance())) return false; + } + if (hasUpdateMask() != other.hasUpdateMask()) return false; + if (hasUpdateMask()) { + if (!getUpdateMask().equals(other.getUpdateMask())) return false; + } + if (!getRequestId().equals(other.getRequestId())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasResourceAllowance()) { + hash = (37 * hash) + RESOURCE_ALLOWANCE_FIELD_NUMBER; + hash = (53 * hash) + getResourceAllowance().hashCode(); + } + if (hasUpdateMask()) { + hash = (37 * hash) + UPDATE_MASK_FIELD_NUMBER; + hash = (53 * hash) + getUpdateMask().hashCode(); + } + hash = (37 * hash) + REQUEST_ID_FIELD_NUMBER; + hash = (53 * hash) + getRequestId().hashCode(); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * UpdateResourceAllowance Request.
+   * 
+ * + * Protobuf type {@code google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest) + com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequestOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.batch.v1alpha.BatchProto + .internal_static_google_cloud_batch_v1alpha_UpdateResourceAllowanceRequest_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.batch.v1alpha.BatchProto + .internal_static_google_cloud_batch_v1alpha_UpdateResourceAllowanceRequest_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest.class, + com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest.Builder.class); + } + + // Construct using com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getResourceAllowanceFieldBuilder(); + getUpdateMaskFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + resourceAllowance_ = null; + if (resourceAllowanceBuilder_ != null) { + resourceAllowanceBuilder_.dispose(); + resourceAllowanceBuilder_ = null; + } + updateMask_ = null; + if (updateMaskBuilder_ != null) { + updateMaskBuilder_.dispose(); + updateMaskBuilder_ = null; + } + requestId_ = ""; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.batch.v1alpha.BatchProto + .internal_static_google_cloud_batch_v1alpha_UpdateResourceAllowanceRequest_descriptor; + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest + getDefaultInstanceForType() { + return com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest build() { + com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest buildPartial() { + com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest result = + new com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0( + com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest result) { + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.resourceAllowance_ = + resourceAllowanceBuilder_ == null + ? resourceAllowance_ + : resourceAllowanceBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.updateMask_ = updateMaskBuilder_ == null ? updateMask_ : updateMaskBuilder_.build(); + to_bitField0_ |= 0x00000002; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.requestId_ = requestId_; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest) { + return mergeFrom((com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest other) { + if (other + == com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest.getDefaultInstance()) + return this; + if (other.hasResourceAllowance()) { + mergeResourceAllowance(other.getResourceAllowance()); + } + if (other.hasUpdateMask()) { + mergeUpdateMask(other.getUpdateMask()); + } + if (!other.getRequestId().isEmpty()) { + requestId_ = other.requestId_; + bitField0_ |= 0x00000004; + onChanged(); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + input.readMessage( + getResourceAllowanceFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + input.readMessage(getUpdateMaskFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: + { + requestId_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private com.google.cloud.batch.v1alpha.ResourceAllowance resourceAllowance_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.batch.v1alpha.ResourceAllowance, + com.google.cloud.batch.v1alpha.ResourceAllowance.Builder, + com.google.cloud.batch.v1alpha.ResourceAllowanceOrBuilder> + resourceAllowanceBuilder_; + /** + * + * + *
+     * Required. The ResourceAllowance to update.
+     * Update description.
+     * Only fields specified in `update_mask` are updated.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.ResourceAllowance resource_allowance = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the resourceAllowance field is set. + */ + public boolean hasResourceAllowance() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * + * + *
+     * Required. The ResourceAllowance to update.
+     * Update description.
+     * Only fields specified in `update_mask` are updated.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.ResourceAllowance resource_allowance = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The resourceAllowance. + */ + public com.google.cloud.batch.v1alpha.ResourceAllowance getResourceAllowance() { + if (resourceAllowanceBuilder_ == null) { + return resourceAllowance_ == null + ? com.google.cloud.batch.v1alpha.ResourceAllowance.getDefaultInstance() + : resourceAllowance_; + } else { + return resourceAllowanceBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. The ResourceAllowance to update.
+     * Update description.
+     * Only fields specified in `update_mask` are updated.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.ResourceAllowance resource_allowance = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setResourceAllowance(com.google.cloud.batch.v1alpha.ResourceAllowance value) { + if (resourceAllowanceBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + resourceAllowance_ = value; + } else { + resourceAllowanceBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The ResourceAllowance to update.
+     * Update description.
+     * Only fields specified in `update_mask` are updated.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.ResourceAllowance resource_allowance = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setResourceAllowance( + com.google.cloud.batch.v1alpha.ResourceAllowance.Builder builderForValue) { + if (resourceAllowanceBuilder_ == null) { + resourceAllowance_ = builderForValue.build(); + } else { + resourceAllowanceBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The ResourceAllowance to update.
+     * Update description.
+     * Only fields specified in `update_mask` are updated.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.ResourceAllowance resource_allowance = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeResourceAllowance(com.google.cloud.batch.v1alpha.ResourceAllowance value) { + if (resourceAllowanceBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0) + && resourceAllowance_ != null + && resourceAllowance_ + != com.google.cloud.batch.v1alpha.ResourceAllowance.getDefaultInstance()) { + getResourceAllowanceBuilder().mergeFrom(value); + } else { + resourceAllowance_ = value; + } + } else { + resourceAllowanceBuilder_.mergeFrom(value); + } + if (resourceAllowance_ != null) { + bitField0_ |= 0x00000001; + onChanged(); + } + return this; + } + /** + * + * + *
+     * Required. The ResourceAllowance to update.
+     * Update description.
+     * Only fields specified in `update_mask` are updated.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.ResourceAllowance resource_allowance = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearResourceAllowance() { + bitField0_ = (bitField0_ & ~0x00000001); + resourceAllowance_ = null; + if (resourceAllowanceBuilder_ != null) { + resourceAllowanceBuilder_.dispose(); + resourceAllowanceBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Required. The ResourceAllowance to update.
+     * Update description.
+     * Only fields specified in `update_mask` are updated.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.ResourceAllowance resource_allowance = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.batch.v1alpha.ResourceAllowance.Builder getResourceAllowanceBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return getResourceAllowanceFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. The ResourceAllowance to update.
+     * Update description.
+     * Only fields specified in `update_mask` are updated.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.ResourceAllowance resource_allowance = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.batch.v1alpha.ResourceAllowanceOrBuilder + getResourceAllowanceOrBuilder() { + if (resourceAllowanceBuilder_ != null) { + return resourceAllowanceBuilder_.getMessageOrBuilder(); + } else { + return resourceAllowance_ == null + ? com.google.cloud.batch.v1alpha.ResourceAllowance.getDefaultInstance() + : resourceAllowance_; + } + } + /** + * + * + *
+     * Required. The ResourceAllowance to update.
+     * Update description.
+     * Only fields specified in `update_mask` are updated.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.ResourceAllowance resource_allowance = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.batch.v1alpha.ResourceAllowance, + com.google.cloud.batch.v1alpha.ResourceAllowance.Builder, + com.google.cloud.batch.v1alpha.ResourceAllowanceOrBuilder> + getResourceAllowanceFieldBuilder() { + if (resourceAllowanceBuilder_ == null) { + resourceAllowanceBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.batch.v1alpha.ResourceAllowance, + com.google.cloud.batch.v1alpha.ResourceAllowance.Builder, + com.google.cloud.batch.v1alpha.ResourceAllowanceOrBuilder>( + getResourceAllowance(), getParentForChildren(), isClean()); + resourceAllowance_ = null; + } + return resourceAllowanceBuilder_; + } + + private com.google.protobuf.FieldMask updateMask_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + updateMaskBuilder_; + /** + * + * + *
+     * 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.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the updateMask field is set. + */ + public boolean hasUpdateMask() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * + * + *
+     * 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.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The updateMask. + */ + public com.google.protobuf.FieldMask getUpdateMask() { + if (updateMaskBuilder_ == null) { + return updateMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : updateMask_; + } else { + return updateMaskBuilder_.getMessage(); + } + } + /** + * + * + *
+     * 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.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setUpdateMask(com.google.protobuf.FieldMask value) { + if (updateMaskBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + updateMask_ = value; + } else { + updateMaskBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * 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.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setUpdateMask(com.google.protobuf.FieldMask.Builder builderForValue) { + if (updateMaskBuilder_ == null) { + updateMask_ = builderForValue.build(); + } else { + updateMaskBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * 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.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeUpdateMask(com.google.protobuf.FieldMask value) { + if (updateMaskBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0) + && updateMask_ != null + && updateMask_ != com.google.protobuf.FieldMask.getDefaultInstance()) { + getUpdateMaskBuilder().mergeFrom(value); + } else { + updateMask_ = value; + } + } else { + updateMaskBuilder_.mergeFrom(value); + } + if (updateMask_ != null) { + bitField0_ |= 0x00000002; + onChanged(); + } + return this; + } + /** + * + * + *
+     * 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.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearUpdateMask() { + bitField0_ = (bitField0_ & ~0x00000002); + updateMask_ = null; + if (updateMaskBuilder_ != null) { + updateMaskBuilder_.dispose(); + updateMaskBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * 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.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.protobuf.FieldMask.Builder getUpdateMaskBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return getUpdateMaskFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * 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.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder() { + if (updateMaskBuilder_ != null) { + return updateMaskBuilder_.getMessageOrBuilder(); + } else { + return updateMask_ == null + ? com.google.protobuf.FieldMask.getDefaultInstance() + : 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.
+     * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder> + getUpdateMaskFieldBuilder() { + if (updateMaskBuilder_ == null) { + updateMaskBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.FieldMask, + com.google.protobuf.FieldMask.Builder, + com.google.protobuf.FieldMaskOrBuilder>( + getUpdateMask(), getParentForChildren(), isClean()); + updateMask_ = null; + } + return updateMaskBuilder_; + } + + private java.lang.Object requestId_ = ""; + /** + * + * + *
+     * Optional. An optional request ID to identify requests. Specify a unique
+     * request ID so that if you must retry your request, the server will know to
+     * ignore the request if it has already been completed. The server will
+     * guarantee that for at least 60 minutes since the first request.
+     *
+     * For example, consider a situation where you make an initial request and
+     * the request times out. If you make the request again with the same request
+     * ID, the server can check if original operation with the same request ID
+     * was received, and if so, will ignore the second request. This prevents
+     * clients from accidentally creating duplicate commitments.
+     *
+     * The request ID must be a valid UUID with the exception that zero UUID is
+     * not supported (00000000-0000-0000-0000-000000000000).
+     * 
+ * + * + * string request_id = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { ... } + * + * + * @return The requestId. + */ + public java.lang.String getRequestId() { + java.lang.Object ref = requestId_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + requestId_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Optional. An optional request ID to identify requests. Specify a unique
+     * request ID so that if you must retry your request, the server will know to
+     * ignore the request if it has already been completed. The server will
+     * guarantee that for at least 60 minutes since the first request.
+     *
+     * For example, consider a situation where you make an initial request and
+     * the request times out. If you make the request again with the same request
+     * ID, the server can check if original operation with the same request ID
+     * was received, and if so, will ignore the second request. This prevents
+     * clients from accidentally creating duplicate commitments.
+     *
+     * The request ID must be a valid UUID with the exception that zero UUID is
+     * not supported (00000000-0000-0000-0000-000000000000).
+     * 
+ * + * + * string request_id = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { ... } + * + * + * @return The bytes for requestId. + */ + public com.google.protobuf.ByteString getRequestIdBytes() { + java.lang.Object ref = requestId_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + requestId_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Optional. An optional request ID to identify requests. Specify a unique
+     * request ID so that if you must retry your request, the server will know to
+     * ignore the request if it has already been completed. The server will
+     * guarantee that for at least 60 minutes since the first request.
+     *
+     * For example, consider a situation where you make an initial request and
+     * the request times out. If you make the request again with the same request
+     * ID, the server can check if original operation with the same request ID
+     * was received, and if so, will ignore the second request. This prevents
+     * clients from accidentally creating duplicate commitments.
+     *
+     * The request ID must be a valid UUID with the exception that zero UUID is
+     * not supported (00000000-0000-0000-0000-000000000000).
+     * 
+ * + * + * string request_id = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { ... } + * + * + * @param value The requestId to set. + * @return This builder for chaining. + */ + public Builder setRequestId(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + requestId_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. An optional request ID to identify requests. Specify a unique
+     * request ID so that if you must retry your request, the server will know to
+     * ignore the request if it has already been completed. The server will
+     * guarantee that for at least 60 minutes since the first request.
+     *
+     * For example, consider a situation where you make an initial request and
+     * the request times out. If you make the request again with the same request
+     * ID, the server can check if original operation with the same request ID
+     * was received, and if so, will ignore the second request. This prevents
+     * clients from accidentally creating duplicate commitments.
+     *
+     * The request ID must be a valid UUID with the exception that zero UUID is
+     * not supported (00000000-0000-0000-0000-000000000000).
+     * 
+ * + * + * string request_id = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { ... } + * + * + * @return This builder for chaining. + */ + public Builder clearRequestId() { + requestId_ = getDefaultInstance().getRequestId(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + /** + * + * + *
+     * Optional. An optional request ID to identify requests. Specify a unique
+     * request ID so that if you must retry your request, the server will know to
+     * ignore the request if it has already been completed. The server will
+     * guarantee that for at least 60 minutes since the first request.
+     *
+     * For example, consider a situation where you make an initial request and
+     * the request times out. If you make the request again with the same request
+     * ID, the server can check if original operation with the same request ID
+     * was received, and if so, will ignore the second request. This prevents
+     * clients from accidentally creating duplicate commitments.
+     *
+     * The request ID must be a valid UUID with the exception that zero UUID is
+     * not supported (00000000-0000-0000-0000-000000000000).
+     * 
+ * + * + * string request_id = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { ... } + * + * + * @param value The bytes for requestId to set. + * @return This builder for chaining. + */ + public Builder setRequestIdBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + requestId_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest) + } + + // @@protoc_insertion_point(class_scope:google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest) + private static final com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest(); + } + + public static com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public UpdateResourceAllowanceRequest parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/UpdateResourceAllowanceRequestOrBuilder.java b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/UpdateResourceAllowanceRequestOrBuilder.java new file mode 100644 index 000000000000..636790c6f410 --- /dev/null +++ b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/UpdateResourceAllowanceRequestOrBuilder.java @@ -0,0 +1,188 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/batch/v1alpha/batch.proto + +// Protobuf Java Version: 3.25.2 +package com.google.cloud.batch.v1alpha; + +public interface UpdateResourceAllowanceRequestOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. The ResourceAllowance to update.
+   * Update description.
+   * Only fields specified in `update_mask` are updated.
+   * 
+ * + * + * .google.cloud.batch.v1alpha.ResourceAllowance resource_allowance = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the resourceAllowance field is set. + */ + boolean hasResourceAllowance(); + /** + * + * + *
+   * Required. The ResourceAllowance to update.
+   * Update description.
+   * Only fields specified in `update_mask` are updated.
+   * 
+ * + * + * .google.cloud.batch.v1alpha.ResourceAllowance resource_allowance = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The resourceAllowance. + */ + com.google.cloud.batch.v1alpha.ResourceAllowance getResourceAllowance(); + /** + * + * + *
+   * Required. The ResourceAllowance to update.
+   * Update description.
+   * Only fields specified in `update_mask` are updated.
+   * 
+ * + * + * .google.cloud.batch.v1alpha.ResourceAllowance resource_allowance = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.batch.v1alpha.ResourceAllowanceOrBuilder getResourceAllowanceOrBuilder(); + + /** + * + * + *
+   * 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.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the updateMask field is set. + */ + boolean hasUpdateMask(); + /** + * + * + *
+   * 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.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The updateMask. + */ + com.google.protobuf.FieldMask getUpdateMask(); + /** + * + * + *
+   * 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.
+   * 
+ * + * .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.protobuf.FieldMaskOrBuilder getUpdateMaskOrBuilder(); + + /** + * + * + *
+   * Optional. An optional request ID to identify requests. Specify a unique
+   * request ID so that if you must retry your request, the server will know to
+   * ignore the request if it has already been completed. The server will
+   * guarantee that for at least 60 minutes since the first request.
+   *
+   * For example, consider a situation where you make an initial request and
+   * the request times out. If you make the request again with the same request
+   * ID, the server can check if original operation with the same request ID
+   * was received, and if so, will ignore the second request. This prevents
+   * clients from accidentally creating duplicate commitments.
+   *
+   * The request ID must be a valid UUID with the exception that zero UUID is
+   * not supported (00000000-0000-0000-0000-000000000000).
+   * 
+ * + * + * string request_id = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { ... } + * + * + * @return The requestId. + */ + java.lang.String getRequestId(); + /** + * + * + *
+   * Optional. An optional request ID to identify requests. Specify a unique
+   * request ID so that if you must retry your request, the server will know to
+   * ignore the request if it has already been completed. The server will
+   * guarantee that for at least 60 minutes since the first request.
+   *
+   * For example, consider a situation where you make an initial request and
+   * the request times out. If you make the request again with the same request
+   * ID, the server can check if original operation with the same request ID
+   * was received, and if so, will ignore the second request. This prevents
+   * clients from accidentally creating duplicate commitments.
+   *
+   * The request ID must be a valid UUID with the exception that zero UUID is
+   * not supported (00000000-0000-0000-0000-000000000000).
+   * 
+ * + * + * string request_id = 3 [(.google.api.field_behavior) = OPTIONAL, (.google.api.field_info) = { ... } + * + * + * @return The bytes for requestId. + */ + com.google.protobuf.ByteString getRequestIdBytes(); +} diff --git a/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/UsageResourceAllowance.java b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/UsageResourceAllowance.java new file mode 100644 index 000000000000..e39f8f6bc226 --- /dev/null +++ b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/UsageResourceAllowance.java @@ -0,0 +1,1044 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/batch/v1alpha/resource_allowance.proto + +// Protobuf Java Version: 3.25.2 +package com.google.cloud.batch.v1alpha; + +/** + * + * + *
+ * UsageResourceAllowance describes the detail of usage resource allowance.
+ * 
+ * + * Protobuf type {@code google.cloud.batch.v1alpha.UsageResourceAllowance} + */ +public final class UsageResourceAllowance extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.batch.v1alpha.UsageResourceAllowance) + UsageResourceAllowanceOrBuilder { + private static final long serialVersionUID = 0L; + // Use UsageResourceAllowance.newBuilder() to construct. + private UsageResourceAllowance(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private UsageResourceAllowance() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new UsageResourceAllowance(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.batch.v1alpha.ResourceAllowanceProto + .internal_static_google_cloud_batch_v1alpha_UsageResourceAllowance_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.batch.v1alpha.ResourceAllowanceProto + .internal_static_google_cloud_batch_v1alpha_UsageResourceAllowance_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.batch.v1alpha.UsageResourceAllowance.class, + com.google.cloud.batch.v1alpha.UsageResourceAllowance.Builder.class); + } + + private int bitField0_; + public static final int SPEC_FIELD_NUMBER = 1; + private com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec spec_; + /** + * + * + *
+   * Required. Spec of a usage ResourceAllowance.
+   * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceSpec spec = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the spec field is set. + */ + @java.lang.Override + public boolean hasSpec() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * + * + *
+   * Required. Spec of a usage ResourceAllowance.
+   * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceSpec spec = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The spec. + */ + @java.lang.Override + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec getSpec() { + return spec_ == null + ? com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.getDefaultInstance() + : spec_; + } + /** + * + * + *
+   * Required. Spec of a usage ResourceAllowance.
+   * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceSpec spec = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpecOrBuilder getSpecOrBuilder() { + return spec_ == null + ? com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.getDefaultInstance() + : spec_; + } + + public static final int STATUS_FIELD_NUMBER = 2; + private com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus status_; + /** + * + * + *
+   * Output only. Status of a usage ResourceAllowance.
+   * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus status = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the status field is set. + */ + @java.lang.Override + public boolean hasStatus() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * + * + *
+   * Output only. Status of a usage ResourceAllowance.
+   * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus status = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The status. + */ + @java.lang.Override + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus getStatus() { + return status_ == null + ? com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.getDefaultInstance() + : status_; + } + /** + * + * + *
+   * Output only. Status of a usage ResourceAllowance.
+   * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus status = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatusOrBuilder getStatusOrBuilder() { + return status_ == null + ? com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.getDefaultInstance() + : status_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(1, getSpec()); + } + if (((bitField0_ & 0x00000002) != 0)) { + output.writeMessage(2, getStatus()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(1, getSpec()); + } + if (((bitField0_ & 0x00000002) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getStatus()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.batch.v1alpha.UsageResourceAllowance)) { + return super.equals(obj); + } + com.google.cloud.batch.v1alpha.UsageResourceAllowance other = + (com.google.cloud.batch.v1alpha.UsageResourceAllowance) obj; + + if (hasSpec() != other.hasSpec()) return false; + if (hasSpec()) { + if (!getSpec().equals(other.getSpec())) return false; + } + if (hasStatus() != other.hasStatus()) return false; + if (hasStatus()) { + if (!getStatus().equals(other.getStatus())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasSpec()) { + hash = (37 * hash) + SPEC_FIELD_NUMBER; + hash = (53 * hash) + getSpec().hashCode(); + } + if (hasStatus()) { + hash = (37 * hash) + STATUS_FIELD_NUMBER; + hash = (53 * hash) + getStatus().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowance parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowance parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowance parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowance parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowance parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowance parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowance parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowance parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowance parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowance parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowance parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowance parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.batch.v1alpha.UsageResourceAllowance prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * UsageResourceAllowance describes the detail of usage resource allowance.
+   * 
+ * + * Protobuf type {@code google.cloud.batch.v1alpha.UsageResourceAllowance} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.batch.v1alpha.UsageResourceAllowance) + com.google.cloud.batch.v1alpha.UsageResourceAllowanceOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.batch.v1alpha.ResourceAllowanceProto + .internal_static_google_cloud_batch_v1alpha_UsageResourceAllowance_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.batch.v1alpha.ResourceAllowanceProto + .internal_static_google_cloud_batch_v1alpha_UsageResourceAllowance_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.batch.v1alpha.UsageResourceAllowance.class, + com.google.cloud.batch.v1alpha.UsageResourceAllowance.Builder.class); + } + + // Construct using com.google.cloud.batch.v1alpha.UsageResourceAllowance.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getSpecFieldBuilder(); + getStatusFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + spec_ = null; + if (specBuilder_ != null) { + specBuilder_.dispose(); + specBuilder_ = null; + } + status_ = null; + if (statusBuilder_ != null) { + statusBuilder_.dispose(); + statusBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.batch.v1alpha.ResourceAllowanceProto + .internal_static_google_cloud_batch_v1alpha_UsageResourceAllowance_descriptor; + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.UsageResourceAllowance getDefaultInstanceForType() { + return com.google.cloud.batch.v1alpha.UsageResourceAllowance.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.UsageResourceAllowance build() { + com.google.cloud.batch.v1alpha.UsageResourceAllowance result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.UsageResourceAllowance buildPartial() { + com.google.cloud.batch.v1alpha.UsageResourceAllowance result = + new com.google.cloud.batch.v1alpha.UsageResourceAllowance(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.cloud.batch.v1alpha.UsageResourceAllowance result) { + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.spec_ = specBuilder_ == null ? spec_ : specBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.status_ = statusBuilder_ == null ? status_ : statusBuilder_.build(); + to_bitField0_ |= 0x00000002; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.batch.v1alpha.UsageResourceAllowance) { + return mergeFrom((com.google.cloud.batch.v1alpha.UsageResourceAllowance) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.batch.v1alpha.UsageResourceAllowance other) { + if (other == com.google.cloud.batch.v1alpha.UsageResourceAllowance.getDefaultInstance()) + return this; + if (other.hasSpec()) { + mergeSpec(other.getSpec()); + } + if (other.hasStatus()) { + mergeStatus(other.getStatus()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + input.readMessage(getSpecFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + input.readMessage(getStatusFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec spec_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Builder, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpecOrBuilder> + specBuilder_; + /** + * + * + *
+     * Required. Spec of a usage ResourceAllowance.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceSpec spec = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the spec field is set. + */ + public boolean hasSpec() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * + * + *
+     * Required. Spec of a usage ResourceAllowance.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceSpec spec = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The spec. + */ + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec getSpec() { + if (specBuilder_ == null) { + return spec_ == null + ? com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.getDefaultInstance() + : spec_; + } else { + return specBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. Spec of a usage ResourceAllowance.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceSpec spec = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setSpec(com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec value) { + if (specBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + spec_ = value; + } else { + specBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Spec of a usage ResourceAllowance.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceSpec spec = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setSpec( + com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Builder builderForValue) { + if (specBuilder_ == null) { + spec_ = builderForValue.build(); + } else { + specBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Spec of a usage ResourceAllowance.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceSpec spec = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeSpec(com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec value) { + if (specBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0) + && spec_ != null + && spec_ + != com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.getDefaultInstance()) { + getSpecBuilder().mergeFrom(value); + } else { + spec_ = value; + } + } else { + specBuilder_.mergeFrom(value); + } + if (spec_ != null) { + bitField0_ |= 0x00000001; + onChanged(); + } + return this; + } + /** + * + * + *
+     * Required. Spec of a usage ResourceAllowance.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceSpec spec = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearSpec() { + bitField0_ = (bitField0_ & ~0x00000001); + spec_ = null; + if (specBuilder_ != null) { + specBuilder_.dispose(); + specBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Spec of a usage ResourceAllowance.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceSpec spec = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Builder getSpecBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return getSpecFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. Spec of a usage ResourceAllowance.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceSpec spec = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpecOrBuilder getSpecOrBuilder() { + if (specBuilder_ != null) { + return specBuilder_.getMessageOrBuilder(); + } else { + return spec_ == null + ? com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.getDefaultInstance() + : spec_; + } + } + /** + * + * + *
+     * Required. Spec of a usage ResourceAllowance.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceSpec spec = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Builder, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpecOrBuilder> + getSpecFieldBuilder() { + if (specBuilder_ == null) { + specBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Builder, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpecOrBuilder>( + getSpec(), getParentForChildren(), isClean()); + spec_ = null; + } + return specBuilder_; + } + + private com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus status_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.Builder, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatusOrBuilder> + statusBuilder_; + /** + * + * + *
+     * Output only. Status of a usage ResourceAllowance.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus status = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the status field is set. + */ + public boolean hasStatus() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * + * + *
+     * Output only. Status of a usage ResourceAllowance.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus status = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The status. + */ + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus getStatus() { + if (statusBuilder_ == null) { + return status_ == null + ? com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.getDefaultInstance() + : status_; + } else { + return statusBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. Status of a usage ResourceAllowance.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus status = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setStatus(com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus value) { + if (statusBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + status_ = value; + } else { + statusBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Status of a usage ResourceAllowance.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus status = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setStatus( + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.Builder builderForValue) { + if (statusBuilder_ == null) { + status_ = builderForValue.build(); + } else { + statusBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Status of a usage ResourceAllowance.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus status = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeStatus(com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus value) { + if (statusBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0) + && status_ != null + && status_ + != com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus + .getDefaultInstance()) { + getStatusBuilder().mergeFrom(value); + } else { + status_ = value; + } + } else { + statusBuilder_.mergeFrom(value); + } + if (status_ != null) { + bitField0_ |= 0x00000002; + onChanged(); + } + return this; + } + /** + * + * + *
+     * Output only. Status of a usage ResourceAllowance.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus status = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearStatus() { + bitField0_ = (bitField0_ & ~0x00000002); + status_ = null; + if (statusBuilder_ != null) { + statusBuilder_.dispose(); + statusBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. Status of a usage ResourceAllowance.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus status = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.Builder getStatusBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return getStatusFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. Status of a usage ResourceAllowance.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus status = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatusOrBuilder + getStatusOrBuilder() { + if (statusBuilder_ != null) { + return statusBuilder_.getMessageOrBuilder(); + } else { + return status_ == null + ? com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.getDefaultInstance() + : status_; + } + } + /** + * + * + *
+     * Output only. Status of a usage ResourceAllowance.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus status = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.Builder, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatusOrBuilder> + getStatusFieldBuilder() { + if (statusBuilder_ == null) { + statusBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.Builder, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatusOrBuilder>( + getStatus(), getParentForChildren(), isClean()); + status_ = null; + } + return statusBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.batch.v1alpha.UsageResourceAllowance) + } + + // @@protoc_insertion_point(class_scope:google.cloud.batch.v1alpha.UsageResourceAllowance) + private static final com.google.cloud.batch.v1alpha.UsageResourceAllowance DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.batch.v1alpha.UsageResourceAllowance(); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowance getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public UsageResourceAllowance parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.UsageResourceAllowance getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/UsageResourceAllowanceOrBuilder.java b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/UsageResourceAllowanceOrBuilder.java new file mode 100644 index 000000000000..e7ee4b0f55b8 --- /dev/null +++ b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/UsageResourceAllowanceOrBuilder.java @@ -0,0 +1,108 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/batch/v1alpha/resource_allowance.proto + +// Protobuf Java Version: 3.25.2 +package com.google.cloud.batch.v1alpha; + +public interface UsageResourceAllowanceOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.batch.v1alpha.UsageResourceAllowance) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Spec of a usage ResourceAllowance.
+   * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceSpec spec = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the spec field is set. + */ + boolean hasSpec(); + /** + * + * + *
+   * Required. Spec of a usage ResourceAllowance.
+   * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceSpec spec = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The spec. + */ + com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec getSpec(); + /** + * + * + *
+   * Required. Spec of a usage ResourceAllowance.
+   * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceSpec spec = 1 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpecOrBuilder getSpecOrBuilder(); + + /** + * + * + *
+   * Output only. Status of a usage ResourceAllowance.
+   * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus status = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the status field is set. + */ + boolean hasStatus(); + /** + * + * + *
+   * Output only. Status of a usage ResourceAllowance.
+   * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus status = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The status. + */ + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus getStatus(); + /** + * + * + *
+   * Output only. Status of a usage ResourceAllowance.
+   * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus status = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatusOrBuilder getStatusOrBuilder(); +} diff --git a/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/UsageResourceAllowanceSpec.java b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/UsageResourceAllowanceSpec.java new file mode 100644 index 000000000000..69d24d5acc47 --- /dev/null +++ b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/UsageResourceAllowanceSpec.java @@ -0,0 +1,1951 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/batch/v1alpha/resource_allowance.proto + +// Protobuf Java Version: 3.25.2 +package com.google.cloud.batch.v1alpha; + +/** + * + * + *
+ * Spec of a usage ResourceAllowance.
+ * 
+ * + * Protobuf type {@code google.cloud.batch.v1alpha.UsageResourceAllowanceSpec} + */ +public final class UsageResourceAllowanceSpec extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.batch.v1alpha.UsageResourceAllowanceSpec) + UsageResourceAllowanceSpecOrBuilder { + private static final long serialVersionUID = 0L; + // Use UsageResourceAllowanceSpec.newBuilder() to construct. + private UsageResourceAllowanceSpec(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private UsageResourceAllowanceSpec() { + type_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new UsageResourceAllowanceSpec(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.batch.v1alpha.ResourceAllowanceProto + .internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceSpec_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.batch.v1alpha.ResourceAllowanceProto + .internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceSpec_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.class, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Builder.class); + } + + public interface LimitOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+     * Optional. A CalendarPeriod represents the abstract concept of a time
+     * period that has a canonical start.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.CalendarPeriod calendar_period = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the calendarPeriod field is set. + */ + boolean hasCalendarPeriod(); + /** + * + * + *
+     * Optional. A CalendarPeriod represents the abstract concept of a time
+     * period that has a canonical start.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.CalendarPeriod calendar_period = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The enum numeric value on the wire for calendarPeriod. + */ + int getCalendarPeriodValue(); + /** + * + * + *
+     * Optional. A CalendarPeriod represents the abstract concept of a time
+     * period that has a canonical start.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.CalendarPeriod calendar_period = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The calendarPeriod. + */ + com.google.cloud.batch.v1alpha.CalendarPeriod getCalendarPeriod(); + + /** + * + * + *
+     * Required. Limit value of a UsageResourceAllowance within its one
+     * duration. Default is 0. For example, you can set `limit` as 10000.0 with
+     * duration of the current month by setting `calendar_period` field as
+     * monthly. That means in your current month, 10000.0 is the cour hour
+     * limitation that your resources are allowed to consume.
+     * 
+ * + * optional double limit = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return Whether the limit field is set. + */ + boolean hasLimit(); + /** + * + * + *
+     * Required. Limit value of a UsageResourceAllowance within its one
+     * duration. Default is 0. For example, you can set `limit` as 10000.0 with
+     * duration of the current month by setting `calendar_period` field as
+     * monthly. That means in your current month, 10000.0 is the cour hour
+     * limitation that your resources are allowed to consume.
+     * 
+ * + * optional double limit = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The limit. + */ + double getLimit(); + + com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit.DurationCase getDurationCase(); + } + /** + * + * + *
+   * UsageResourceAllowance limitation.
+   * 
+ * + * Protobuf type {@code google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit} + */ + public static final class Limit extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit) + LimitOrBuilder { + private static final long serialVersionUID = 0L; + // Use Limit.newBuilder() to construct. + private Limit(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Limit() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Limit(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.batch.v1alpha.ResourceAllowanceProto + .internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceSpec_Limit_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.batch.v1alpha.ResourceAllowanceProto + .internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceSpec_Limit_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit.class, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit.Builder.class); + } + + private int bitField0_; + private int durationCase_ = 0; + + @SuppressWarnings("serial") + private java.lang.Object duration_; + + public enum DurationCase + implements + com.google.protobuf.Internal.EnumLite, + com.google.protobuf.AbstractMessage.InternalOneOfEnum { + CALENDAR_PERIOD(1), + DURATION_NOT_SET(0); + private final int value; + + private DurationCase(int value) { + this.value = value; + } + /** + * @param value The number of the enum to look for. + * @return The enum associated with the given number. + * @deprecated Use {@link #forNumber(int)} instead. + */ + @java.lang.Deprecated + public static DurationCase valueOf(int value) { + return forNumber(value); + } + + public static DurationCase forNumber(int value) { + switch (value) { + case 1: + return CALENDAR_PERIOD; + case 0: + return DURATION_NOT_SET; + default: + return null; + } + } + + public int getNumber() { + return this.value; + } + }; + + public DurationCase getDurationCase() { + return DurationCase.forNumber(durationCase_); + } + + public static final int CALENDAR_PERIOD_FIELD_NUMBER = 1; + /** + * + * + *
+     * Optional. A CalendarPeriod represents the abstract concept of a time
+     * period that has a canonical start.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.CalendarPeriod calendar_period = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the calendarPeriod field is set. + */ + public boolean hasCalendarPeriod() { + return durationCase_ == 1; + } + /** + * + * + *
+     * Optional. A CalendarPeriod represents the abstract concept of a time
+     * period that has a canonical start.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.CalendarPeriod calendar_period = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The enum numeric value on the wire for calendarPeriod. + */ + public int getCalendarPeriodValue() { + if (durationCase_ == 1) { + return (java.lang.Integer) duration_; + } + return 0; + } + /** + * + * + *
+     * Optional. A CalendarPeriod represents the abstract concept of a time
+     * period that has a canonical start.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.CalendarPeriod calendar_period = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The calendarPeriod. + */ + public com.google.cloud.batch.v1alpha.CalendarPeriod getCalendarPeriod() { + if (durationCase_ == 1) { + com.google.cloud.batch.v1alpha.CalendarPeriod result = + com.google.cloud.batch.v1alpha.CalendarPeriod.forNumber((java.lang.Integer) duration_); + return result == null ? com.google.cloud.batch.v1alpha.CalendarPeriod.UNRECOGNIZED : result; + } + return com.google.cloud.batch.v1alpha.CalendarPeriod.CALENDAR_PERIOD_UNSPECIFIED; + } + + public static final int LIMIT_FIELD_NUMBER = 2; + private double limit_ = 0D; + /** + * + * + *
+     * Required. Limit value of a UsageResourceAllowance within its one
+     * duration. Default is 0. For example, you can set `limit` as 10000.0 with
+     * duration of the current month by setting `calendar_period` field as
+     * monthly. That means in your current month, 10000.0 is the cour hour
+     * limitation that your resources are allowed to consume.
+     * 
+ * + * optional double limit = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return Whether the limit field is set. + */ + @java.lang.Override + public boolean hasLimit() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * + * + *
+     * Required. Limit value of a UsageResourceAllowance within its one
+     * duration. Default is 0. For example, you can set `limit` as 10000.0 with
+     * duration of the current month by setting `calendar_period` field as
+     * monthly. That means in your current month, 10000.0 is the cour hour
+     * limitation that your resources are allowed to consume.
+     * 
+ * + * optional double limit = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The limit. + */ + @java.lang.Override + public double getLimit() { + return limit_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (durationCase_ == 1) { + output.writeEnum(1, ((java.lang.Integer) duration_)); + } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeDouble(2, limit_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (durationCase_ == 1) { + size += + com.google.protobuf.CodedOutputStream.computeEnumSize( + 1, ((java.lang.Integer) duration_)); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeDoubleSize(2, limit_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit)) { + return super.equals(obj); + } + com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit other = + (com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit) obj; + + if (hasLimit() != other.hasLimit()) return false; + if (hasLimit()) { + if (java.lang.Double.doubleToLongBits(getLimit()) + != java.lang.Double.doubleToLongBits(other.getLimit())) return false; + } + if (!getDurationCase().equals(other.getDurationCase())) return false; + switch (durationCase_) { + case 1: + if (getCalendarPeriodValue() != other.getCalendarPeriodValue()) return false; + break; + case 0: + default: + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasLimit()) { + hash = (37 * hash) + LIMIT_FIELD_NUMBER; + hash = + (53 * hash) + + com.google.protobuf.Internal.hashLong( + java.lang.Double.doubleToLongBits(getLimit())); + } + switch (durationCase_) { + case 1: + hash = (37 * hash) + CALENDAR_PERIOD_FIELD_NUMBER; + hash = (53 * hash) + getCalendarPeriodValue(); + break; + case 0: + default: + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit + parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+     * UsageResourceAllowance limitation.
+     * 
+ * + * Protobuf type {@code google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit) + com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.LimitOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.batch.v1alpha.ResourceAllowanceProto + .internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceSpec_Limit_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.batch.v1alpha.ResourceAllowanceProto + .internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceSpec_Limit_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit.class, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit.Builder.class); + } + + // Construct using + // com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + limit_ = 0D; + durationCase_ = 0; + duration_ = null; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.batch.v1alpha.ResourceAllowanceProto + .internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceSpec_Limit_descriptor; + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit + getDefaultInstanceForType() { + return com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit build() { + com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit buildPartial() { + com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit result = + new com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + buildPartialOneofs(result); + onBuilt(); + return result; + } + + private void buildPartial0( + com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit result) { + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000002) != 0)) { + result.limit_ = limit_; + to_bitField0_ |= 0x00000001; + } + result.bitField0_ |= to_bitField0_; + } + + private void buildPartialOneofs( + com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit result) { + result.durationCase_ = durationCase_; + result.duration_ = this.duration_; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit) { + return mergeFrom((com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit other) { + if (other + == com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit.getDefaultInstance()) + return this; + if (other.hasLimit()) { + setLimit(other.getLimit()); + } + switch (other.getDurationCase()) { + case CALENDAR_PERIOD: + { + setCalendarPeriodValue(other.getCalendarPeriodValue()); + break; + } + case DURATION_NOT_SET: + { + break; + } + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + int rawValue = input.readEnum(); + durationCase_ = 1; + duration_ = rawValue; + break; + } // case 8 + case 17: + { + limit_ = input.readDouble(); + bitField0_ |= 0x00000002; + break; + } // case 17 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int durationCase_ = 0; + private java.lang.Object duration_; + + public DurationCase getDurationCase() { + return DurationCase.forNumber(durationCase_); + } + + public Builder clearDuration() { + durationCase_ = 0; + duration_ = null; + onChanged(); + return this; + } + + private int bitField0_; + + /** + * + * + *
+       * Optional. A CalendarPeriod represents the abstract concept of a time
+       * period that has a canonical start.
+       * 
+ * + * + * .google.cloud.batch.v1alpha.CalendarPeriod calendar_period = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return Whether the calendarPeriod field is set. + */ + @java.lang.Override + public boolean hasCalendarPeriod() { + return durationCase_ == 1; + } + /** + * + * + *
+       * Optional. A CalendarPeriod represents the abstract concept of a time
+       * period that has a canonical start.
+       * 
+ * + * + * .google.cloud.batch.v1alpha.CalendarPeriod calendar_period = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The enum numeric value on the wire for calendarPeriod. + */ + @java.lang.Override + public int getCalendarPeriodValue() { + if (durationCase_ == 1) { + return ((java.lang.Integer) duration_).intValue(); + } + return 0; + } + /** + * + * + *
+       * Optional. A CalendarPeriod represents the abstract concept of a time
+       * period that has a canonical start.
+       * 
+ * + * + * .google.cloud.batch.v1alpha.CalendarPeriod calendar_period = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param value The enum numeric value on the wire for calendarPeriod to set. + * @return This builder for chaining. + */ + public Builder setCalendarPeriodValue(int value) { + durationCase_ = 1; + duration_ = value; + onChanged(); + return this; + } + /** + * + * + *
+       * Optional. A CalendarPeriod represents the abstract concept of a time
+       * period that has a canonical start.
+       * 
+ * + * + * .google.cloud.batch.v1alpha.CalendarPeriod calendar_period = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return The calendarPeriod. + */ + @java.lang.Override + public com.google.cloud.batch.v1alpha.CalendarPeriod getCalendarPeriod() { + if (durationCase_ == 1) { + com.google.cloud.batch.v1alpha.CalendarPeriod result = + com.google.cloud.batch.v1alpha.CalendarPeriod.forNumber( + (java.lang.Integer) duration_); + return result == null + ? com.google.cloud.batch.v1alpha.CalendarPeriod.UNRECOGNIZED + : result; + } + return com.google.cloud.batch.v1alpha.CalendarPeriod.CALENDAR_PERIOD_UNSPECIFIED; + } + /** + * + * + *
+       * Optional. A CalendarPeriod represents the abstract concept of a time
+       * period that has a canonical start.
+       * 
+ * + * + * .google.cloud.batch.v1alpha.CalendarPeriod calendar_period = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @param value The calendarPeriod to set. + * @return This builder for chaining. + */ + public Builder setCalendarPeriod(com.google.cloud.batch.v1alpha.CalendarPeriod value) { + if (value == null) { + throw new NullPointerException(); + } + durationCase_ = 1; + duration_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+       * Optional. A CalendarPeriod represents the abstract concept of a time
+       * period that has a canonical start.
+       * 
+ * + * + * .google.cloud.batch.v1alpha.CalendarPeriod calendar_period = 1 [(.google.api.field_behavior) = OPTIONAL]; + * + * + * @return This builder for chaining. + */ + public Builder clearCalendarPeriod() { + if (durationCase_ == 1) { + durationCase_ = 0; + duration_ = null; + onChanged(); + } + return this; + } + + private double limit_; + /** + * + * + *
+       * Required. Limit value of a UsageResourceAllowance within its one
+       * duration. Default is 0. For example, you can set `limit` as 10000.0 with
+       * duration of the current month by setting `calendar_period` field as
+       * monthly. That means in your current month, 10000.0 is the cour hour
+       * limitation that your resources are allowed to consume.
+       * 
+ * + * optional double limit = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return Whether the limit field is set. + */ + @java.lang.Override + public boolean hasLimit() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * + * + *
+       * Required. Limit value of a UsageResourceAllowance within its one
+       * duration. Default is 0. For example, you can set `limit` as 10000.0 with
+       * duration of the current month by setting `calendar_period` field as
+       * monthly. That means in your current month, 10000.0 is the cour hour
+       * limitation that your resources are allowed to consume.
+       * 
+ * + * optional double limit = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The limit. + */ + @java.lang.Override + public double getLimit() { + return limit_; + } + /** + * + * + *
+       * Required. Limit value of a UsageResourceAllowance within its one
+       * duration. Default is 0. For example, you can set `limit` as 10000.0 with
+       * duration of the current month by setting `calendar_period` field as
+       * monthly. That means in your current month, 10000.0 is the cour hour
+       * limitation that your resources are allowed to consume.
+       * 
+ * + * optional double limit = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The limit to set. + * @return This builder for chaining. + */ + public Builder setLimit(double value) { + + limit_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+       * Required. Limit value of a UsageResourceAllowance within its one
+       * duration. Default is 0. For example, you can set `limit` as 10000.0 with
+       * duration of the current month by setting `calendar_period` field as
+       * monthly. That means in your current month, 10000.0 is the cour hour
+       * limitation that your resources are allowed to consume.
+       * 
+ * + * optional double limit = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearLimit() { + bitField0_ = (bitField0_ & ~0x00000002); + limit_ = 0D; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit) + } + + // @@protoc_insertion_point(class_scope:google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit) + private static final com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit(); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Limit parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException() + .setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + private int bitField0_; + public static final int TYPE_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object type_ = ""; + /** + * + * + *
+   * Required. Spec type is unique for each usage ResourceAllowance.
+   * Batch now only supports type as "cpu-core-hours" for CPU usage consumption
+   * tracking.
+   * 
+ * + * string type = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The type. + */ + @java.lang.Override + public java.lang.String getType() { + java.lang.Object ref = type_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + type_ = s; + return s; + } + } + /** + * + * + *
+   * Required. Spec type is unique for each usage ResourceAllowance.
+   * Batch now only supports type as "cpu-core-hours" for CPU usage consumption
+   * tracking.
+   * 
+ * + * string type = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for type. + */ + @java.lang.Override + public com.google.protobuf.ByteString getTypeBytes() { + java.lang.Object ref = type_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + type_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int LIMIT_FIELD_NUMBER = 2; + private com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit limit_; + /** + * + * + *
+   * Required. Threshold of a UsageResourceAllowance limiting how many resources
+   * can be consumed for each type.
+   * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit limit = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the limit field is set. + */ + @java.lang.Override + public boolean hasLimit() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * + * + *
+   * Required. Threshold of a UsageResourceAllowance limiting how many resources
+   * can be consumed for each type.
+   * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit limit = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The limit. + */ + @java.lang.Override + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit getLimit() { + return limit_ == null + ? com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit.getDefaultInstance() + : limit_; + } + /** + * + * + *
+   * Required. Threshold of a UsageResourceAllowance limiting how many resources
+   * can be consumed for each type.
+   * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit limit = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + @java.lang.Override + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.LimitOrBuilder + getLimitOrBuilder() { + return limit_ == null + ? com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit.getDefaultInstance() + : limit_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(type_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, type_); + } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(2, getLimit()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(type_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, type_); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getLimit()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec)) { + return super.equals(obj); + } + com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec other = + (com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec) obj; + + if (!getType().equals(other.getType())) return false; + if (hasLimit() != other.hasLimit()) return false; + if (hasLimit()) { + if (!getLimit().equals(other.getLimit())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + TYPE_FIELD_NUMBER; + hash = (53 * hash) + getType().hashCode(); + if (hasLimit()) { + hash = (37 * hash) + LIMIT_FIELD_NUMBER; + hash = (53 * hash) + getLimit().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Spec of a usage ResourceAllowance.
+   * 
+ * + * Protobuf type {@code google.cloud.batch.v1alpha.UsageResourceAllowanceSpec} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.batch.v1alpha.UsageResourceAllowanceSpec) + com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpecOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.batch.v1alpha.ResourceAllowanceProto + .internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceSpec_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.batch.v1alpha.ResourceAllowanceProto + .internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceSpec_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.class, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Builder.class); + } + + // Construct using com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getLimitFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + type_ = ""; + limit_ = null; + if (limitBuilder_ != null) { + limitBuilder_.dispose(); + limitBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.batch.v1alpha.ResourceAllowanceProto + .internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceSpec_descriptor; + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec getDefaultInstanceForType() { + return com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec build() { + com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec buildPartial() { + com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec result = + new com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.type_ = type_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000002) != 0)) { + result.limit_ = limitBuilder_ == null ? limit_ : limitBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec) { + return mergeFrom((com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec other) { + if (other == com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.getDefaultInstance()) + return this; + if (!other.getType().isEmpty()) { + type_ = other.type_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (other.hasLimit()) { + mergeLimit(other.getLimit()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + type_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + input.readMessage(getLimitFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000002; + break; + } // case 18 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object type_ = ""; + /** + * + * + *
+     * Required. Spec type is unique for each usage ResourceAllowance.
+     * Batch now only supports type as "cpu-core-hours" for CPU usage consumption
+     * tracking.
+     * 
+ * + * string type = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The type. + */ + public java.lang.String getType() { + java.lang.Object ref = type_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + type_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * Required. Spec type is unique for each usage ResourceAllowance.
+     * Batch now only supports type as "cpu-core-hours" for CPU usage consumption
+     * tracking.
+     * 
+ * + * string type = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for type. + */ + public com.google.protobuf.ByteString getTypeBytes() { + java.lang.Object ref = type_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + type_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * Required. Spec type is unique for each usage ResourceAllowance.
+     * Batch now only supports type as "cpu-core-hours" for CPU usage consumption
+     * tracking.
+     * 
+ * + * string type = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The type to set. + * @return This builder for chaining. + */ + public Builder setType(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + type_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Spec type is unique for each usage ResourceAllowance.
+     * Batch now only supports type as "cpu-core-hours" for CPU usage consumption
+     * tracking.
+     * 
+ * + * string type = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return This builder for chaining. + */ + public Builder clearType() { + type_ = getDefaultInstance().getType(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Spec type is unique for each usage ResourceAllowance.
+     * Batch now only supports type as "cpu-core-hours" for CPU usage consumption
+     * tracking.
+     * 
+ * + * string type = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @param value The bytes for type to set. + * @return This builder for chaining. + */ + public Builder setTypeBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + type_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit limit_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit.Builder, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.LimitOrBuilder> + limitBuilder_; + /** + * + * + *
+     * Required. Threshold of a UsageResourceAllowance limiting how many resources
+     * can be consumed for each type.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit limit = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the limit field is set. + */ + public boolean hasLimit() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * + * + *
+     * Required. Threshold of a UsageResourceAllowance limiting how many resources
+     * can be consumed for each type.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit limit = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The limit. + */ + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit getLimit() { + if (limitBuilder_ == null) { + return limit_ == null + ? com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit.getDefaultInstance() + : limit_; + } else { + return limitBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Required. Threshold of a UsageResourceAllowance limiting how many resources
+     * can be consumed for each type.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit limit = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setLimit(com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit value) { + if (limitBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + limit_ = value; + } else { + limitBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Threshold of a UsageResourceAllowance limiting how many resources
+     * can be consumed for each type.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit limit = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder setLimit( + com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit.Builder builderForValue) { + if (limitBuilder_ == null) { + limit_ = builderForValue.build(); + } else { + limitBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Threshold of a UsageResourceAllowance limiting how many resources
+     * can be consumed for each type.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit limit = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder mergeLimit( + com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit value) { + if (limitBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0) + && limit_ != null + && limit_ + != com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit + .getDefaultInstance()) { + getLimitBuilder().mergeFrom(value); + } else { + limit_ = value; + } + } else { + limitBuilder_.mergeFrom(value); + } + if (limit_ != null) { + bitField0_ |= 0x00000002; + onChanged(); + } + return this; + } + /** + * + * + *
+     * Required. Threshold of a UsageResourceAllowance limiting how many resources
+     * can be consumed for each type.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit limit = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public Builder clearLimit() { + bitField0_ = (bitField0_ & ~0x00000002); + limit_ = null; + if (limitBuilder_ != null) { + limitBuilder_.dispose(); + limitBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Required. Threshold of a UsageResourceAllowance limiting how many resources
+     * can be consumed for each type.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit limit = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit.Builder + getLimitBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return getLimitFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Required. Threshold of a UsageResourceAllowance limiting how many resources
+     * can be consumed for each type.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit limit = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.LimitOrBuilder + getLimitOrBuilder() { + if (limitBuilder_ != null) { + return limitBuilder_.getMessageOrBuilder(); + } else { + return limit_ == null + ? com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit.getDefaultInstance() + : limit_; + } + } + /** + * + * + *
+     * Required. Threshold of a UsageResourceAllowance limiting how many resources
+     * can be consumed for each type.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit limit = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit.Builder, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.LimitOrBuilder> + getLimitFieldBuilder() { + if (limitBuilder_ == null) { + limitBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit.Builder, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.LimitOrBuilder>( + getLimit(), getParentForChildren(), isClean()); + limit_ = null; + } + return limitBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.batch.v1alpha.UsageResourceAllowanceSpec) + } + + // @@protoc_insertion_point(class_scope:google.cloud.batch.v1alpha.UsageResourceAllowanceSpec) + private static final com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec(); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public UsageResourceAllowanceSpec parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/UsageResourceAllowanceSpecOrBuilder.java b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/UsageResourceAllowanceSpecOrBuilder.java new file mode 100644 index 000000000000..5ba3036e84b8 --- /dev/null +++ b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/UsageResourceAllowanceSpecOrBuilder.java @@ -0,0 +1,99 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/batch/v1alpha/resource_allowance.proto + +// Protobuf Java Version: 3.25.2 +package com.google.cloud.batch.v1alpha; + +public interface UsageResourceAllowanceSpecOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.batch.v1alpha.UsageResourceAllowanceSpec) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Required. Spec type is unique for each usage ResourceAllowance.
+   * Batch now only supports type as "cpu-core-hours" for CPU usage consumption
+   * tracking.
+   * 
+ * + * string type = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The type. + */ + java.lang.String getType(); + /** + * + * + *
+   * Required. Spec type is unique for each usage ResourceAllowance.
+   * Batch now only supports type as "cpu-core-hours" for CPU usage consumption
+   * tracking.
+   * 
+ * + * string type = 1 [(.google.api.field_behavior) = REQUIRED]; + * + * @return The bytes for type. + */ + com.google.protobuf.ByteString getTypeBytes(); + + /** + * + * + *
+   * Required. Threshold of a UsageResourceAllowance limiting how many resources
+   * can be consumed for each type.
+   * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit limit = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return Whether the limit field is set. + */ + boolean hasLimit(); + /** + * + * + *
+   * Required. Threshold of a UsageResourceAllowance limiting how many resources
+   * can be consumed for each type.
+   * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit limit = 2 [(.google.api.field_behavior) = REQUIRED]; + * + * + * @return The limit. + */ + com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit getLimit(); + /** + * + * + *
+   * Required. Threshold of a UsageResourceAllowance limiting how many resources
+   * can be consumed for each type.
+   * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.Limit limit = 2 [(.google.api.field_behavior) = REQUIRED]; + * + */ + com.google.cloud.batch.v1alpha.UsageResourceAllowanceSpec.LimitOrBuilder getLimitOrBuilder(); +} diff --git a/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/UsageResourceAllowanceStatus.java b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/UsageResourceAllowanceStatus.java new file mode 100644 index 000000000000..4673ce769bb5 --- /dev/null +++ b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/UsageResourceAllowanceStatus.java @@ -0,0 +1,4282 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/batch/v1alpha/resource_allowance.proto + +// Protobuf Java Version: 3.25.2 +package com.google.cloud.batch.v1alpha; + +/** + * + * + *
+ * Status of a usage ResourceAllowance.
+ * 
+ * + * Protobuf type {@code google.cloud.batch.v1alpha.UsageResourceAllowanceStatus} + */ +public final class UsageResourceAllowanceStatus extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.batch.v1alpha.UsageResourceAllowanceStatus) + UsageResourceAllowanceStatusOrBuilder { + private static final long serialVersionUID = 0L; + // Use UsageResourceAllowanceStatus.newBuilder() to construct. + private UsageResourceAllowanceStatus(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private UsageResourceAllowanceStatus() { + state_ = 0; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new UsageResourceAllowanceStatus(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.batch.v1alpha.ResourceAllowanceProto + .internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceStatus_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.batch.v1alpha.ResourceAllowanceProto + .internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceStatus_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.class, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.Builder.class); + } + + public interface LimitStatusOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+     * Output only. The consumption interval.
+     * 
+ * + * + * .google.type.Interval consumption_interval = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the consumptionInterval field is set. + */ + boolean hasConsumptionInterval(); + /** + * + * + *
+     * Output only. The consumption interval.
+     * 
+ * + * + * .google.type.Interval consumption_interval = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The consumptionInterval. + */ + com.google.type.Interval getConsumptionInterval(); + /** + * + * + *
+     * Output only. The consumption interval.
+     * 
+ * + * + * .google.type.Interval consumption_interval = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.type.IntervalOrBuilder getConsumptionIntervalOrBuilder(); + + /** + * + * + *
+     * Output only. Limit value of a UsageResourceAllowance within its one
+     * duration.
+     * 
+ * + * double limit = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The limit. + */ + double getLimit(); + + /** + * + * + *
+     * Output only. Accumulated consumption during `consumption_interval`.
+     * 
+ * + * double consumed = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The consumed. + */ + double getConsumed(); + } + /** + * + * + *
+   * UsageResourceAllowanceStatus detail about usage consumption.
+   * 
+ * + * Protobuf type {@code google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus} + */ + public static final class LimitStatus extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus) + LimitStatusOrBuilder { + private static final long serialVersionUID = 0L; + // Use LimitStatus.newBuilder() to construct. + private LimitStatus(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private LimitStatus() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new LimitStatus(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.batch.v1alpha.ResourceAllowanceProto + .internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceStatus_LimitStatus_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.batch.v1alpha.ResourceAllowanceProto + .internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceStatus_LimitStatus_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus.class, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus.Builder + .class); + } + + private int bitField0_; + public static final int CONSUMPTION_INTERVAL_FIELD_NUMBER = 1; + private com.google.type.Interval consumptionInterval_; + /** + * + * + *
+     * Output only. The consumption interval.
+     * 
+ * + * + * .google.type.Interval consumption_interval = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the consumptionInterval field is set. + */ + @java.lang.Override + public boolean hasConsumptionInterval() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * + * + *
+     * Output only. The consumption interval.
+     * 
+ * + * + * .google.type.Interval consumption_interval = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The consumptionInterval. + */ + @java.lang.Override + public com.google.type.Interval getConsumptionInterval() { + return consumptionInterval_ == null + ? com.google.type.Interval.getDefaultInstance() + : consumptionInterval_; + } + /** + * + * + *
+     * Output only. The consumption interval.
+     * 
+ * + * + * .google.type.Interval consumption_interval = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.type.IntervalOrBuilder getConsumptionIntervalOrBuilder() { + return consumptionInterval_ == null + ? com.google.type.Interval.getDefaultInstance() + : consumptionInterval_; + } + + public static final int LIMIT_FIELD_NUMBER = 2; + private double limit_ = 0D; + /** + * + * + *
+     * Output only. Limit value of a UsageResourceAllowance within its one
+     * duration.
+     * 
+ * + * double limit = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The limit. + */ + @java.lang.Override + public double getLimit() { + return limit_; + } + + public static final int CONSUMED_FIELD_NUMBER = 3; + private double consumed_ = 0D; + /** + * + * + *
+     * Output only. Accumulated consumption during `consumption_interval`.
+     * 
+ * + * double consumed = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The consumed. + */ + @java.lang.Override + public double getConsumed() { + return consumed_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(1, getConsumptionInterval()); + } + if (java.lang.Double.doubleToRawLongBits(limit_) != 0) { + output.writeDouble(2, limit_); + } + if (java.lang.Double.doubleToRawLongBits(consumed_) != 0) { + output.writeDouble(3, consumed_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) != 0)) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize(1, getConsumptionInterval()); + } + if (java.lang.Double.doubleToRawLongBits(limit_) != 0) { + size += com.google.protobuf.CodedOutputStream.computeDoubleSize(2, limit_); + } + if (java.lang.Double.doubleToRawLongBits(consumed_) != 0) { + size += com.google.protobuf.CodedOutputStream.computeDoubleSize(3, consumed_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj + instanceof com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus)) { + return super.equals(obj); + } + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus other = + (com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus) obj; + + if (hasConsumptionInterval() != other.hasConsumptionInterval()) return false; + if (hasConsumptionInterval()) { + if (!getConsumptionInterval().equals(other.getConsumptionInterval())) return false; + } + if (java.lang.Double.doubleToLongBits(getLimit()) + != java.lang.Double.doubleToLongBits(other.getLimit())) return false; + if (java.lang.Double.doubleToLongBits(getConsumed()) + != java.lang.Double.doubleToLongBits(other.getConsumed())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasConsumptionInterval()) { + hash = (37 * hash) + CONSUMPTION_INTERVAL_FIELD_NUMBER; + hash = (53 * hash) + getConsumptionInterval().hashCode(); + } + hash = (37 * hash) + LIMIT_FIELD_NUMBER; + hash = + (53 * hash) + + com.google.protobuf.Internal.hashLong( + java.lang.Double.doubleToLongBits(getLimit())); + hash = (37 * hash) + CONSUMED_FIELD_NUMBER; + hash = + (53 * hash) + + com.google.protobuf.Internal.hashLong( + java.lang.Double.doubleToLongBits(getConsumed())); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus parseFrom( + byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus + parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+     * UsageResourceAllowanceStatus detail about usage consumption.
+     * 
+ * + * Protobuf type {@code google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus) + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatusOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.batch.v1alpha.ResourceAllowanceProto + .internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceStatus_LimitStatus_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.batch.v1alpha.ResourceAllowanceProto + .internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceStatus_LimitStatus_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus.class, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus.Builder + .class); + } + + // Construct using + // com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getConsumptionIntervalFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + consumptionInterval_ = null; + if (consumptionIntervalBuilder_ != null) { + consumptionIntervalBuilder_.dispose(); + consumptionIntervalBuilder_ = null; + } + limit_ = 0D; + consumed_ = 0D; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.batch.v1alpha.ResourceAllowanceProto + .internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceStatus_LimitStatus_descriptor; + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus + getDefaultInstanceForType() { + return com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus + .getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus build() { + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus result = + buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus + buildPartial() { + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus result = + new com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0( + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus result) { + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.consumptionInterval_ = + consumptionIntervalBuilder_ == null + ? consumptionInterval_ + : consumptionIntervalBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.limit_ = limit_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.consumed_ = consumed_; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other + instanceof com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus) { + return mergeFrom( + (com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus other) { + if (other + == com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus + .getDefaultInstance()) return this; + if (other.hasConsumptionInterval()) { + mergeConsumptionInterval(other.getConsumptionInterval()); + } + if (other.getLimit() != 0D) { + setLimit(other.getLimit()); + } + if (other.getConsumed() != 0D) { + setConsumed(other.getConsumed()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + input.readMessage( + getConsumptionIntervalFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 17: + { + limit_ = input.readDouble(); + bitField0_ |= 0x00000002; + break; + } // case 17 + case 25: + { + consumed_ = input.readDouble(); + bitField0_ |= 0x00000004; + break; + } // case 25 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private com.google.type.Interval consumptionInterval_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.type.Interval, + com.google.type.Interval.Builder, + com.google.type.IntervalOrBuilder> + consumptionIntervalBuilder_; + /** + * + * + *
+       * Output only. The consumption interval.
+       * 
+ * + * + * .google.type.Interval consumption_interval = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the consumptionInterval field is set. + */ + public boolean hasConsumptionInterval() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * + * + *
+       * Output only. The consumption interval.
+       * 
+ * + * + * .google.type.Interval consumption_interval = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The consumptionInterval. + */ + public com.google.type.Interval getConsumptionInterval() { + if (consumptionIntervalBuilder_ == null) { + return consumptionInterval_ == null + ? com.google.type.Interval.getDefaultInstance() + : consumptionInterval_; + } else { + return consumptionIntervalBuilder_.getMessage(); + } + } + /** + * + * + *
+       * Output only. The consumption interval.
+       * 
+ * + * + * .google.type.Interval consumption_interval = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setConsumptionInterval(com.google.type.Interval value) { + if (consumptionIntervalBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + consumptionInterval_ = value; + } else { + consumptionIntervalBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+       * Output only. The consumption interval.
+       * 
+ * + * + * .google.type.Interval consumption_interval = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setConsumptionInterval(com.google.type.Interval.Builder builderForValue) { + if (consumptionIntervalBuilder_ == null) { + consumptionInterval_ = builderForValue.build(); + } else { + consumptionIntervalBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+       * Output only. The consumption interval.
+       * 
+ * + * + * .google.type.Interval consumption_interval = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeConsumptionInterval(com.google.type.Interval value) { + if (consumptionIntervalBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0) + && consumptionInterval_ != null + && consumptionInterval_ != com.google.type.Interval.getDefaultInstance()) { + getConsumptionIntervalBuilder().mergeFrom(value); + } else { + consumptionInterval_ = value; + } + } else { + consumptionIntervalBuilder_.mergeFrom(value); + } + if (consumptionInterval_ != null) { + bitField0_ |= 0x00000001; + onChanged(); + } + return this; + } + /** + * + * + *
+       * Output only. The consumption interval.
+       * 
+ * + * + * .google.type.Interval consumption_interval = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearConsumptionInterval() { + bitField0_ = (bitField0_ & ~0x00000001); + consumptionInterval_ = null; + if (consumptionIntervalBuilder_ != null) { + consumptionIntervalBuilder_.dispose(); + consumptionIntervalBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+       * Output only. The consumption interval.
+       * 
+ * + * + * .google.type.Interval consumption_interval = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.type.Interval.Builder getConsumptionIntervalBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return getConsumptionIntervalFieldBuilder().getBuilder(); + } + /** + * + * + *
+       * Output only. The consumption interval.
+       * 
+ * + * + * .google.type.Interval consumption_interval = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.type.IntervalOrBuilder getConsumptionIntervalOrBuilder() { + if (consumptionIntervalBuilder_ != null) { + return consumptionIntervalBuilder_.getMessageOrBuilder(); + } else { + return consumptionInterval_ == null + ? com.google.type.Interval.getDefaultInstance() + : consumptionInterval_; + } + } + /** + * + * + *
+       * Output only. The consumption interval.
+       * 
+ * + * + * .google.type.Interval consumption_interval = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.type.Interval, + com.google.type.Interval.Builder, + com.google.type.IntervalOrBuilder> + getConsumptionIntervalFieldBuilder() { + if (consumptionIntervalBuilder_ == null) { + consumptionIntervalBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.type.Interval, + com.google.type.Interval.Builder, + com.google.type.IntervalOrBuilder>( + getConsumptionInterval(), getParentForChildren(), isClean()); + consumptionInterval_ = null; + } + return consumptionIntervalBuilder_; + } + + private double limit_; + /** + * + * + *
+       * Output only. Limit value of a UsageResourceAllowance within its one
+       * duration.
+       * 
+ * + * double limit = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The limit. + */ + @java.lang.Override + public double getLimit() { + return limit_; + } + /** + * + * + *
+       * Output only. Limit value of a UsageResourceAllowance within its one
+       * duration.
+       * 
+ * + * double limit = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The limit to set. + * @return This builder for chaining. + */ + public Builder setLimit(double value) { + + limit_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+       * Output only. Limit value of a UsageResourceAllowance within its one
+       * duration.
+       * 
+ * + * double limit = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearLimit() { + bitField0_ = (bitField0_ & ~0x00000002); + limit_ = 0D; + onChanged(); + return this; + } + + private double consumed_; + /** + * + * + *
+       * Output only. Accumulated consumption during `consumption_interval`.
+       * 
+ * + * double consumed = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The consumed. + */ + @java.lang.Override + public double getConsumed() { + return consumed_; + } + /** + * + * + *
+       * Output only. Accumulated consumption during `consumption_interval`.
+       * 
+ * + * double consumed = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The consumed to set. + * @return This builder for chaining. + */ + public Builder setConsumed(double value) { + + consumed_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+       * Output only. Accumulated consumption during `consumption_interval`.
+       * 
+ * + * double consumed = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearConsumed() { + bitField0_ = (bitField0_ & ~0x00000004); + consumed_ = 0D; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus) + } + + // @@protoc_insertion_point(class_scope:google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus) + private static final com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = + new com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus(); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public LimitStatus parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException() + .setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public interface PeriodConsumptionOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+     * Output only. The consumption interval.
+     * 
+ * + * + * .google.type.Interval consumption_interval = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the consumptionInterval field is set. + */ + boolean hasConsumptionInterval(); + /** + * + * + *
+     * Output only. The consumption interval.
+     * 
+ * + * + * .google.type.Interval consumption_interval = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The consumptionInterval. + */ + com.google.type.Interval getConsumptionInterval(); + /** + * + * + *
+     * Output only. The consumption interval.
+     * 
+ * + * + * .google.type.Interval consumption_interval = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.type.IntervalOrBuilder getConsumptionIntervalOrBuilder(); + + /** + * + * + *
+     * Output only. Accumulated consumption during `consumption_interval`.
+     * 
+ * + * double consumed = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The consumed. + */ + double getConsumed(); + } + /** + * Protobuf type {@code google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption} + */ + public static final class PeriodConsumption extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption) + PeriodConsumptionOrBuilder { + private static final long serialVersionUID = 0L; + // Use PeriodConsumption.newBuilder() to construct. + private PeriodConsumption(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private PeriodConsumption() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new PeriodConsumption(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.batch.v1alpha.ResourceAllowanceProto + .internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceStatus_PeriodConsumption_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.batch.v1alpha.ResourceAllowanceProto + .internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceStatus_PeriodConsumption_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption.class, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption.Builder + .class); + } + + private int bitField0_; + public static final int CONSUMPTION_INTERVAL_FIELD_NUMBER = 1; + private com.google.type.Interval consumptionInterval_; + /** + * + * + *
+     * Output only. The consumption interval.
+     * 
+ * + * + * .google.type.Interval consumption_interval = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the consumptionInterval field is set. + */ + @java.lang.Override + public boolean hasConsumptionInterval() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * + * + *
+     * Output only. The consumption interval.
+     * 
+ * + * + * .google.type.Interval consumption_interval = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The consumptionInterval. + */ + @java.lang.Override + public com.google.type.Interval getConsumptionInterval() { + return consumptionInterval_ == null + ? com.google.type.Interval.getDefaultInstance() + : consumptionInterval_; + } + /** + * + * + *
+     * Output only. The consumption interval.
+     * 
+ * + * + * .google.type.Interval consumption_interval = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.type.IntervalOrBuilder getConsumptionIntervalOrBuilder() { + return consumptionInterval_ == null + ? com.google.type.Interval.getDefaultInstance() + : consumptionInterval_; + } + + public static final int CONSUMED_FIELD_NUMBER = 2; + private double consumed_ = 0D; + /** + * + * + *
+     * Output only. Accumulated consumption during `consumption_interval`.
+     * 
+ * + * double consumed = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The consumed. + */ + @java.lang.Override + public double getConsumed() { + return consumed_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(1, getConsumptionInterval()); + } + if (java.lang.Double.doubleToRawLongBits(consumed_) != 0) { + output.writeDouble(2, consumed_); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) != 0)) { + size += + com.google.protobuf.CodedOutputStream.computeMessageSize(1, getConsumptionInterval()); + } + if (java.lang.Double.doubleToRawLongBits(consumed_) != 0) { + size += com.google.protobuf.CodedOutputStream.computeDoubleSize(2, consumed_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj + instanceof + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption)) { + return super.equals(obj); + } + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption other = + (com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption) obj; + + if (hasConsumptionInterval() != other.hasConsumptionInterval()) return false; + if (hasConsumptionInterval()) { + if (!getConsumptionInterval().equals(other.getConsumptionInterval())) return false; + } + if (java.lang.Double.doubleToLongBits(getConsumed()) + != java.lang.Double.doubleToLongBits(other.getConsumed())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (hasConsumptionInterval()) { + hash = (37 * hash) + CONSUMPTION_INTERVAL_FIELD_NUMBER; + hash = (53 * hash) + getConsumptionInterval().hashCode(); + } + hash = (37 * hash) + CONSUMED_FIELD_NUMBER; + hash = + (53 * hash) + + com.google.protobuf.Internal.hashLong( + java.lang.Double.doubleToLongBits(getConsumed())); + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption + parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption + parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption + parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption + parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption + parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption + parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption + parseFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption + parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption + parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption + parseFrom(com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption + parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code + * google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption) + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumptionOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.batch.v1alpha.ResourceAllowanceProto + .internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceStatus_PeriodConsumption_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.batch.v1alpha.ResourceAllowanceProto + .internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceStatus_PeriodConsumption_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption.class, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption + .Builder.class); + } + + // Construct using + // com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getConsumptionIntervalFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + consumptionInterval_ = null; + if (consumptionIntervalBuilder_ != null) { + consumptionIntervalBuilder_.dispose(); + consumptionIntervalBuilder_ = null; + } + consumed_ = 0D; + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.batch.v1alpha.ResourceAllowanceProto + .internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceStatus_PeriodConsumption_descriptor; + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption + getDefaultInstanceForType() { + return com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption + .getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption build() { + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption result = + buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption + buildPartial() { + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption result = + new com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0( + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption result) { + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.consumptionInterval_ = + consumptionIntervalBuilder_ == null + ? consumptionInterval_ + : consumptionIntervalBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.consumed_ = consumed_; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other + instanceof + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption) { + return mergeFrom( + (com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption) + other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption other) { + if (other + == com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption + .getDefaultInstance()) return this; + if (other.hasConsumptionInterval()) { + mergeConsumptionInterval(other.getConsumptionInterval()); + } + if (other.getConsumed() != 0D) { + setConsumed(other.getConsumed()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + input.readMessage( + getConsumptionIntervalFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 17: + { + consumed_ = input.readDouble(); + bitField0_ |= 0x00000002; + break; + } // case 17 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private com.google.type.Interval consumptionInterval_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.type.Interval, + com.google.type.Interval.Builder, + com.google.type.IntervalOrBuilder> + consumptionIntervalBuilder_; + /** + * + * + *
+       * Output only. The consumption interval.
+       * 
+ * + * + * .google.type.Interval consumption_interval = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the consumptionInterval field is set. + */ + public boolean hasConsumptionInterval() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * + * + *
+       * Output only. The consumption interval.
+       * 
+ * + * + * .google.type.Interval consumption_interval = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The consumptionInterval. + */ + public com.google.type.Interval getConsumptionInterval() { + if (consumptionIntervalBuilder_ == null) { + return consumptionInterval_ == null + ? com.google.type.Interval.getDefaultInstance() + : consumptionInterval_; + } else { + return consumptionIntervalBuilder_.getMessage(); + } + } + /** + * + * + *
+       * Output only. The consumption interval.
+       * 
+ * + * + * .google.type.Interval consumption_interval = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setConsumptionInterval(com.google.type.Interval value) { + if (consumptionIntervalBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + consumptionInterval_ = value; + } else { + consumptionIntervalBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+       * Output only. The consumption interval.
+       * 
+ * + * + * .google.type.Interval consumption_interval = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setConsumptionInterval(com.google.type.Interval.Builder builderForValue) { + if (consumptionIntervalBuilder_ == null) { + consumptionInterval_ = builderForValue.build(); + } else { + consumptionIntervalBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+       * Output only. The consumption interval.
+       * 
+ * + * + * .google.type.Interval consumption_interval = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeConsumptionInterval(com.google.type.Interval value) { + if (consumptionIntervalBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0) + && consumptionInterval_ != null + && consumptionInterval_ != com.google.type.Interval.getDefaultInstance()) { + getConsumptionIntervalBuilder().mergeFrom(value); + } else { + consumptionInterval_ = value; + } + } else { + consumptionIntervalBuilder_.mergeFrom(value); + } + if (consumptionInterval_ != null) { + bitField0_ |= 0x00000001; + onChanged(); + } + return this; + } + /** + * + * + *
+       * Output only. The consumption interval.
+       * 
+ * + * + * .google.type.Interval consumption_interval = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearConsumptionInterval() { + bitField0_ = (bitField0_ & ~0x00000001); + consumptionInterval_ = null; + if (consumptionIntervalBuilder_ != null) { + consumptionIntervalBuilder_.dispose(); + consumptionIntervalBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+       * Output only. The consumption interval.
+       * 
+ * + * + * .google.type.Interval consumption_interval = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.type.Interval.Builder getConsumptionIntervalBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return getConsumptionIntervalFieldBuilder().getBuilder(); + } + /** + * + * + *
+       * Output only. The consumption interval.
+       * 
+ * + * + * .google.type.Interval consumption_interval = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.type.IntervalOrBuilder getConsumptionIntervalOrBuilder() { + if (consumptionIntervalBuilder_ != null) { + return consumptionIntervalBuilder_.getMessageOrBuilder(); + } else { + return consumptionInterval_ == null + ? com.google.type.Interval.getDefaultInstance() + : consumptionInterval_; + } + } + /** + * + * + *
+       * Output only. The consumption interval.
+       * 
+ * + * + * .google.type.Interval consumption_interval = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.type.Interval, + com.google.type.Interval.Builder, + com.google.type.IntervalOrBuilder> + getConsumptionIntervalFieldBuilder() { + if (consumptionIntervalBuilder_ == null) { + consumptionIntervalBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.type.Interval, + com.google.type.Interval.Builder, + com.google.type.IntervalOrBuilder>( + getConsumptionInterval(), getParentForChildren(), isClean()); + consumptionInterval_ = null; + } + return consumptionIntervalBuilder_; + } + + private double consumed_; + /** + * + * + *
+       * Output only. Accumulated consumption during `consumption_interval`.
+       * 
+ * + * double consumed = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return The consumed. + */ + @java.lang.Override + public double getConsumed() { + return consumed_; + } + /** + * + * + *
+       * Output only. Accumulated consumption during `consumption_interval`.
+       * 
+ * + * double consumed = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @param value The consumed to set. + * @return This builder for chaining. + */ + public Builder setConsumed(double value) { + + consumed_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+       * Output only. Accumulated consumption during `consumption_interval`.
+       * 
+ * + * double consumed = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * @return This builder for chaining. + */ + public Builder clearConsumed() { + bitField0_ = (bitField0_ & ~0x00000002); + consumed_ = 0D; + onChanged(); + return this; + } + + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption) + } + + // @@protoc_insertion_point(class_scope:google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption) + private static final com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus + .PeriodConsumption + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = + new com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption(); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public PeriodConsumption parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException() + .setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + public interface ConsumptionReportOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+     * Output only. ResourceAllowance consumptions in the latest calendar
+     * period. Key is the calendar period in string format. Batch currently
+     * supports HOUR, DAY, MONTH and YEAR.
+     * 
+ * + * + * map<string, .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption> latest_period_consumptions = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + int getLatestPeriodConsumptionsCount(); + /** + * + * + *
+     * Output only. ResourceAllowance consumptions in the latest calendar
+     * period. Key is the calendar period in string format. Batch currently
+     * supports HOUR, DAY, MONTH and YEAR.
+     * 
+ * + * + * map<string, .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption> latest_period_consumptions = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + boolean containsLatestPeriodConsumptions(java.lang.String key); + /** Use {@link #getLatestPeriodConsumptionsMap()} instead. */ + @java.lang.Deprecated + java.util.Map< + java.lang.String, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption> + getLatestPeriodConsumptions(); + /** + * + * + *
+     * Output only. ResourceAllowance consumptions in the latest calendar
+     * period. Key is the calendar period in string format. Batch currently
+     * supports HOUR, DAY, MONTH and YEAR.
+     * 
+ * + * + * map<string, .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption> latest_period_consumptions = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + java.util.Map< + java.lang.String, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption> + getLatestPeriodConsumptionsMap(); + /** + * + * + *
+     * Output only. ResourceAllowance consumptions in the latest calendar
+     * period. Key is the calendar period in string format. Batch currently
+     * supports HOUR, DAY, MONTH and YEAR.
+     * 
+ * + * + * map<string, .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption> latest_period_consumptions = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + /* nullable */ + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption + getLatestPeriodConsumptionsOrDefault( + java.lang.String key, + /* nullable */ + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption + defaultValue); + /** + * + * + *
+     * Output only. ResourceAllowance consumptions in the latest calendar
+     * period. Key is the calendar period in string format. Batch currently
+     * supports HOUR, DAY, MONTH and YEAR.
+     * 
+ * + * + * map<string, .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption> latest_period_consumptions = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption + getLatestPeriodConsumptionsOrThrow(java.lang.String key); + } + /** + * + * + *
+   * ConsumptionReport is the report of ResourceAllowance consumptions in a time
+   * period.
+   * 
+ * + * Protobuf type {@code google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport} + */ + public static final class ConsumptionReport extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport) + ConsumptionReportOrBuilder { + private static final long serialVersionUID = 0L; + // Use ConsumptionReport.newBuilder() to construct. + private ConsumptionReport(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private ConsumptionReport() {} + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new ConsumptionReport(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.batch.v1alpha.ResourceAllowanceProto + .internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceStatus_ConsumptionReport_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + @java.lang.Override + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection( + int number) { + switch (number) { + case 1: + return internalGetLatestPeriodConsumptions(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.batch.v1alpha.ResourceAllowanceProto + .internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceStatus_ConsumptionReport_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport.class, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport.Builder + .class); + } + + public static final int LATEST_PERIOD_CONSUMPTIONS_FIELD_NUMBER = 1; + + private static final class LatestPeriodConsumptionsDefaultEntryHolder { + static final com.google.protobuf.MapEntry< + java.lang.String, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption> + defaultEntry = + com.google.protobuf.MapEntry + . + newDefaultInstance( + com.google.cloud.batch.v1alpha.ResourceAllowanceProto + .internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceStatus_ConsumptionReport_LatestPeriodConsumptionsEntry_descriptor, + com.google.protobuf.WireFormat.FieldType.STRING, + "", + com.google.protobuf.WireFormat.FieldType.MESSAGE, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus + .PeriodConsumption.getDefaultInstance()); + } + + @SuppressWarnings("serial") + private com.google.protobuf.MapField< + java.lang.String, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption> + latestPeriodConsumptions_; + + private com.google.protobuf.MapField< + java.lang.String, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption> + internalGetLatestPeriodConsumptions() { + if (latestPeriodConsumptions_ == null) { + return com.google.protobuf.MapField.emptyMapField( + LatestPeriodConsumptionsDefaultEntryHolder.defaultEntry); + } + return latestPeriodConsumptions_; + } + + public int getLatestPeriodConsumptionsCount() { + return internalGetLatestPeriodConsumptions().getMap().size(); + } + /** + * + * + *
+     * Output only. ResourceAllowance consumptions in the latest calendar
+     * period. Key is the calendar period in string format. Batch currently
+     * supports HOUR, DAY, MONTH and YEAR.
+     * 
+ * + * + * map<string, .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption> latest_period_consumptions = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public boolean containsLatestPeriodConsumptions(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetLatestPeriodConsumptions().getMap().containsKey(key); + } + /** Use {@link #getLatestPeriodConsumptionsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map< + java.lang.String, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption> + getLatestPeriodConsumptions() { + return getLatestPeriodConsumptionsMap(); + } + /** + * + * + *
+     * Output only. ResourceAllowance consumptions in the latest calendar
+     * period. Key is the calendar period in string format. Batch currently
+     * supports HOUR, DAY, MONTH and YEAR.
+     * 
+ * + * + * map<string, .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption> latest_period_consumptions = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public java.util.Map< + java.lang.String, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption> + getLatestPeriodConsumptionsMap() { + return internalGetLatestPeriodConsumptions().getMap(); + } + /** + * + * + *
+     * Output only. ResourceAllowance consumptions in the latest calendar
+     * period. Key is the calendar period in string format. Batch currently
+     * supports HOUR, DAY, MONTH and YEAR.
+     * 
+ * + * + * map<string, .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption> latest_period_consumptions = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public /* nullable */ com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus + .PeriodConsumption + getLatestPeriodConsumptionsOrDefault( + java.lang.String key, + /* nullable */ + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption + defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map< + java.lang.String, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption> + map = internalGetLatestPeriodConsumptions().getMap(); + return map.containsKey(key) ? map.get(key) : defaultValue; + } + /** + * + * + *
+     * Output only. ResourceAllowance consumptions in the latest calendar
+     * period. Key is the calendar period in string format. Batch currently
+     * supports HOUR, DAY, MONTH and YEAR.
+     * 
+ * + * + * map<string, .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption> latest_period_consumptions = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption + getLatestPeriodConsumptionsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map< + java.lang.String, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption> + map = internalGetLatestPeriodConsumptions().getMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return map.get(key); + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( + output, + internalGetLatestPeriodConsumptions(), + LatestPeriodConsumptionsDefaultEntryHolder.defaultEntry, + 1); + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (java.util.Map.Entry< + java.lang.String, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption> + entry : internalGetLatestPeriodConsumptions().getMap().entrySet()) { + com.google.protobuf.MapEntry< + java.lang.String, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption> + latestPeriodConsumptions__ = + LatestPeriodConsumptionsDefaultEntryHolder.defaultEntry + .newBuilderForType() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build(); + size += + com.google.protobuf.CodedOutputStream.computeMessageSize(1, latestPeriodConsumptions__); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj + instanceof + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport)) { + return super.equals(obj); + } + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport other = + (com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport) obj; + + if (!internalGetLatestPeriodConsumptions() + .equals(other.internalGetLatestPeriodConsumptions())) return false; + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (!internalGetLatestPeriodConsumptions().getMap().isEmpty()) { + hash = (37 * hash) + LATEST_PERIOD_CONSUMPTIONS_FIELD_NUMBER; + hash = (53 * hash) + internalGetLatestPeriodConsumptions().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport + parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport + parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport + parseFrom(com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport + parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport + parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport + parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport + parseFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport + parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport + parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport + parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport + parseFrom(com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport + parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+     * ConsumptionReport is the report of ResourceAllowance consumptions in a time
+     * period.
+     * 
+ * + * Protobuf type {@code + * google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport} + */ + public static final class Builder + extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport) + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReportOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.batch.v1alpha.ResourceAllowanceProto + .internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceStatus_ConsumptionReport_descriptor; + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMapFieldReflection( + int number) { + switch (number) { + case 1: + return internalGetLatestPeriodConsumptions(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @SuppressWarnings({"rawtypes"}) + protected com.google.protobuf.MapFieldReflectionAccessor internalGetMutableMapFieldReflection( + int number) { + switch (number) { + case 1: + return internalGetMutableLatestPeriodConsumptions(); + default: + throw new RuntimeException("Invalid map field number: " + number); + } + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.batch.v1alpha.ResourceAllowanceProto + .internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceStatus_ConsumptionReport_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport.class, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport + .Builder.class); + } + + // Construct using + // com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport.newBuilder() + private Builder() {} + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + internalGetMutableLatestPeriodConsumptions().clear(); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.batch.v1alpha.ResourceAllowanceProto + .internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceStatus_ConsumptionReport_descriptor; + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport + getDefaultInstanceForType() { + return com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport + .getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport build() { + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport result = + buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport + buildPartial() { + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport result = + new com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0( + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.latestPeriodConsumptions_ = + internalGetLatestPeriodConsumptions() + .build(LatestPeriodConsumptionsDefaultEntryHolder.defaultEntry); + } + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, + java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other + instanceof + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport) { + return mergeFrom( + (com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport) + other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom( + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport other) { + if (other + == com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport + .getDefaultInstance()) return this; + internalGetMutableLatestPeriodConsumptions() + .mergeFrom(other.internalGetLatestPeriodConsumptions()); + bitField0_ |= 0x00000001; + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + com.google.protobuf.MapEntry< + java.lang.String, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus + .PeriodConsumption> + latestPeriodConsumptions__ = + input.readMessage( + LatestPeriodConsumptionsDefaultEntryHolder.defaultEntry + .getParserForType(), + extensionRegistry); + internalGetMutableLatestPeriodConsumptions() + .ensureBuilderMap() + .put( + latestPeriodConsumptions__.getKey(), + latestPeriodConsumptions__.getValue()); + bitField0_ |= 0x00000001; + break; + } // case 10 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private static final class LatestPeriodConsumptionsConverter + implements com.google.protobuf.MapFieldBuilder.Converter< + java.lang.String, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus + .PeriodConsumptionOrBuilder, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption> { + @java.lang.Override + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption build( + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumptionOrBuilder + val) { + if (val + instanceof + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption) { + return (com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption) + val; + } + return ((com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption + .Builder) + val) + .build(); + } + + @java.lang.Override + public com.google.protobuf.MapEntry< + java.lang.String, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption> + defaultEntry() { + return LatestPeriodConsumptionsDefaultEntryHolder.defaultEntry; + } + }; + + private static final LatestPeriodConsumptionsConverter latestPeriodConsumptionsConverter = + new LatestPeriodConsumptionsConverter(); + + private com.google.protobuf.MapFieldBuilder< + java.lang.String, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus + .PeriodConsumptionOrBuilder, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption.Builder> + latestPeriodConsumptions_; + + private com.google.protobuf.MapFieldBuilder< + java.lang.String, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus + .PeriodConsumptionOrBuilder, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption.Builder> + internalGetLatestPeriodConsumptions() { + if (latestPeriodConsumptions_ == null) { + return new com.google.protobuf.MapFieldBuilder<>(latestPeriodConsumptionsConverter); + } + return latestPeriodConsumptions_; + } + + private com.google.protobuf.MapFieldBuilder< + java.lang.String, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus + .PeriodConsumptionOrBuilder, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption.Builder> + internalGetMutableLatestPeriodConsumptions() { + if (latestPeriodConsumptions_ == null) { + latestPeriodConsumptions_ = + new com.google.protobuf.MapFieldBuilder<>(latestPeriodConsumptionsConverter); + } + bitField0_ |= 0x00000001; + onChanged(); + return latestPeriodConsumptions_; + } + + public int getLatestPeriodConsumptionsCount() { + return internalGetLatestPeriodConsumptions().ensureBuilderMap().size(); + } + /** + * + * + *
+       * Output only. ResourceAllowance consumptions in the latest calendar
+       * period. Key is the calendar period in string format. Batch currently
+       * supports HOUR, DAY, MONTH and YEAR.
+       * 
+ * + * + * map<string, .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption> latest_period_consumptions = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public boolean containsLatestPeriodConsumptions(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + return internalGetLatestPeriodConsumptions().ensureBuilderMap().containsKey(key); + } + /** Use {@link #getLatestPeriodConsumptionsMap()} instead. */ + @java.lang.Override + @java.lang.Deprecated + public java.util.Map< + java.lang.String, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption> + getLatestPeriodConsumptions() { + return getLatestPeriodConsumptionsMap(); + } + /** + * + * + *
+       * Output only. ResourceAllowance consumptions in the latest calendar
+       * period. Key is the calendar period in string format. Batch currently
+       * supports HOUR, DAY, MONTH and YEAR.
+       * 
+ * + * + * map<string, .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption> latest_period_consumptions = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public java.util.Map< + java.lang.String, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption> + getLatestPeriodConsumptionsMap() { + return internalGetLatestPeriodConsumptions().getImmutableMap(); + } + /** + * + * + *
+       * Output only. ResourceAllowance consumptions in the latest calendar
+       * period. Key is the calendar period in string format. Batch currently
+       * supports HOUR, DAY, MONTH and YEAR.
+       * 
+ * + * + * map<string, .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption> latest_period_consumptions = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public /* nullable */ com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus + .PeriodConsumption + getLatestPeriodConsumptionsOrDefault( + java.lang.String key, + /* nullable */ + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption + defaultValue) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map< + java.lang.String, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus + .PeriodConsumptionOrBuilder> + map = internalGetMutableLatestPeriodConsumptions().ensureBuilderMap(); + return map.containsKey(key) + ? latestPeriodConsumptionsConverter.build(map.get(key)) + : defaultValue; + } + /** + * + * + *
+       * Output only. ResourceAllowance consumptions in the latest calendar
+       * period. Key is the calendar period in string format. Batch currently
+       * supports HOUR, DAY, MONTH and YEAR.
+       * 
+ * + * + * map<string, .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption> latest_period_consumptions = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption + getLatestPeriodConsumptionsOrThrow(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + java.util.Map< + java.lang.String, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus + .PeriodConsumptionOrBuilder> + map = internalGetMutableLatestPeriodConsumptions().ensureBuilderMap(); + if (!map.containsKey(key)) { + throw new java.lang.IllegalArgumentException(); + } + return latestPeriodConsumptionsConverter.build(map.get(key)); + } + + public Builder clearLatestPeriodConsumptions() { + bitField0_ = (bitField0_ & ~0x00000001); + internalGetMutableLatestPeriodConsumptions().clear(); + return this; + } + /** + * + * + *
+       * Output only. ResourceAllowance consumptions in the latest calendar
+       * period. Key is the calendar period in string format. Batch currently
+       * supports HOUR, DAY, MONTH and YEAR.
+       * 
+ * + * + * map<string, .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption> latest_period_consumptions = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder removeLatestPeriodConsumptions(java.lang.String key) { + if (key == null) { + throw new NullPointerException("map key"); + } + internalGetMutableLatestPeriodConsumptions().ensureBuilderMap().remove(key); + return this; + } + /** Use alternate mutation accessors instead. */ + @java.lang.Deprecated + public java.util.Map< + java.lang.String, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption> + getMutableLatestPeriodConsumptions() { + bitField0_ |= 0x00000001; + return internalGetMutableLatestPeriodConsumptions().ensureMessageMap(); + } + /** + * + * + *
+       * Output only. ResourceAllowance consumptions in the latest calendar
+       * period. Key is the calendar period in string format. Batch currently
+       * supports HOUR, DAY, MONTH and YEAR.
+       * 
+ * + * + * map<string, .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption> latest_period_consumptions = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder putLatestPeriodConsumptions( + java.lang.String key, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption value) { + if (key == null) { + throw new NullPointerException("map key"); + } + if (value == null) { + throw new NullPointerException("map value"); + } + internalGetMutableLatestPeriodConsumptions().ensureBuilderMap().put(key, value); + bitField0_ |= 0x00000001; + return this; + } + /** + * + * + *
+       * Output only. ResourceAllowance consumptions in the latest calendar
+       * period. Key is the calendar period in string format. Batch currently
+       * supports HOUR, DAY, MONTH and YEAR.
+       * 
+ * + * + * map<string, .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption> latest_period_consumptions = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder putAllLatestPeriodConsumptions( + java.util.Map< + java.lang.String, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption> + values) { + for (java.util.Map.Entry< + java.lang.String, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption> + e : values.entrySet()) { + if (e.getKey() == null || e.getValue() == null) { + throw new NullPointerException(); + } + } + internalGetMutableLatestPeriodConsumptions().ensureBuilderMap().putAll(values); + bitField0_ |= 0x00000001; + return this; + } + /** + * + * + *
+       * Output only. ResourceAllowance consumptions in the latest calendar
+       * period. Key is the calendar period in string format. Batch currently
+       * supports HOUR, DAY, MONTH and YEAR.
+       * 
+ * + * + * map<string, .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption> latest_period_consumptions = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption.Builder + putLatestPeriodConsumptionsBuilderIfAbsent(java.lang.String key) { + java.util.Map< + java.lang.String, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus + .PeriodConsumptionOrBuilder> + builderMap = internalGetMutableLatestPeriodConsumptions().ensureBuilderMap(); + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumptionOrBuilder + entry = builderMap.get(key); + if (entry == null) { + entry = + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption + .newBuilder(); + builderMap.put(key, entry); + } + if (entry + instanceof + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption) { + entry = + ((com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption) + entry) + .toBuilder(); + builderMap.put(key, entry); + } + return (com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.PeriodConsumption + .Builder) + entry; + } + + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport) + } + + // @@protoc_insertion_point(class_scope:google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport) + private static final com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus + .ConsumptionReport + DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = + new com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport(); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport + getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public ConsumptionReport parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException() + .setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport + getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + } + + private int bitField0_; + public static final int STATE_FIELD_NUMBER = 1; + private int state_ = 0; + /** + * + * + *
+   * Output only. ResourceAllowance state.
+   * 
+ * + * + * .google.cloud.batch.v1alpha.ResourceAllowanceState state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for state. + */ + @java.lang.Override + public int getStateValue() { + return state_; + } + /** + * + * + *
+   * Output only. ResourceAllowance state.
+   * 
+ * + * + * .google.cloud.batch.v1alpha.ResourceAllowanceState state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The state. + */ + @java.lang.Override + public com.google.cloud.batch.v1alpha.ResourceAllowanceState getState() { + com.google.cloud.batch.v1alpha.ResourceAllowanceState result = + com.google.cloud.batch.v1alpha.ResourceAllowanceState.forNumber(state_); + return result == null + ? com.google.cloud.batch.v1alpha.ResourceAllowanceState.UNRECOGNIZED + : result; + } + + public static final int LIMIT_STATUS_FIELD_NUMBER = 2; + private com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus limitStatus_; + /** + * + * + *
+   * Output only. ResourceAllowance consumption status for usage resources.
+   * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus limit_status = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the limitStatus field is set. + */ + @java.lang.Override + public boolean hasLimitStatus() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * + * + *
+   * Output only. ResourceAllowance consumption status for usage resources.
+   * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus limit_status = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The limitStatus. + */ + @java.lang.Override + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus getLimitStatus() { + return limitStatus_ == null + ? com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus + .getDefaultInstance() + : limitStatus_; + } + /** + * + * + *
+   * Output only. ResourceAllowance consumption status for usage resources.
+   * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus limit_status = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatusOrBuilder + getLimitStatusOrBuilder() { + return limitStatus_ == null + ? com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus + .getDefaultInstance() + : limitStatus_; + } + + public static final int REPORT_FIELD_NUMBER = 3; + private com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport report_; + /** + * + * + *
+   * Output only. The report of ResourceAllowance consumptions in a time period.
+   * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport report = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the report field is set. + */ + @java.lang.Override + public boolean hasReport() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * + * + *
+   * Output only. The report of ResourceAllowance consumptions in a time period.
+   * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport report = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The report. + */ + @java.lang.Override + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport getReport() { + return report_ == null + ? com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport + .getDefaultInstance() + : report_; + } + /** + * + * + *
+   * Output only. The report of ResourceAllowance consumptions in a time period.
+   * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport report = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + @java.lang.Override + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReportOrBuilder + getReportOrBuilder() { + return report_ == null + ? com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport + .getDefaultInstance() + : report_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (state_ + != com.google.cloud.batch.v1alpha.ResourceAllowanceState + .RESOURCE_ALLOWANCE_STATE_UNSPECIFIED + .getNumber()) { + output.writeEnum(1, state_); + } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(2, getLimitStatus()); + } + if (((bitField0_ & 0x00000002) != 0)) { + output.writeMessage(3, getReport()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (state_ + != com.google.cloud.batch.v1alpha.ResourceAllowanceState + .RESOURCE_ALLOWANCE_STATE_UNSPECIFIED + .getNumber()) { + size += com.google.protobuf.CodedOutputStream.computeEnumSize(1, state_); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getLimitStatus()); + } + if (((bitField0_ & 0x00000002) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(3, getReport()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus)) { + return super.equals(obj); + } + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus other = + (com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus) obj; + + if (state_ != other.state_) return false; + if (hasLimitStatus() != other.hasLimitStatus()) return false; + if (hasLimitStatus()) { + if (!getLimitStatus().equals(other.getLimitStatus())) return false; + } + if (hasReport() != other.hasReport()) return false; + if (hasReport()) { + if (!getReport().equals(other.getReport())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + STATE_FIELD_NUMBER; + hash = (53 * hash) + state_; + if (hasLimitStatus()) { + hash = (37 * hash) + LIMIT_STATUS_FIELD_NUMBER; + hash = (53 * hash) + getLimitStatus().hashCode(); + } + if (hasReport()) { + hash = (37 * hash) + REPORT_FIELD_NUMBER; + hash = (53 * hash) + getReport().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus parseFrom( + java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus parseFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder( + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Status of a usage ResourceAllowance.
+   * 
+ * + * Protobuf type {@code google.cloud.batch.v1alpha.UsageResourceAllowanceStatus} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.batch.v1alpha.UsageResourceAllowanceStatus) + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatusOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.batch.v1alpha.ResourceAllowanceProto + .internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceStatus_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.batch.v1alpha.ResourceAllowanceProto + .internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceStatus_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.class, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.Builder.class); + } + + // Construct using com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getLimitStatusFieldBuilder(); + getReportFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + state_ = 0; + limitStatus_ = null; + if (limitStatusBuilder_ != null) { + limitStatusBuilder_.dispose(); + limitStatusBuilder_ = null; + } + report_ = null; + if (reportBuilder_ != null) { + reportBuilder_.dispose(); + reportBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.batch.v1alpha.ResourceAllowanceProto + .internal_static_google_cloud_batch_v1alpha_UsageResourceAllowanceStatus_descriptor; + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus getDefaultInstanceForType() { + return com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus build() { + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus buildPartial() { + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus result = + new com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.state_ = state_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000002) != 0)) { + result.limitStatus_ = + limitStatusBuilder_ == null ? limitStatus_ : limitStatusBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.report_ = reportBuilder_ == null ? report_ : reportBuilder_.build(); + to_bitField0_ |= 0x00000002; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus) { + return mergeFrom((com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus other) { + if (other == com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.getDefaultInstance()) + return this; + if (other.state_ != 0) { + setStateValue(other.getStateValue()); + } + if (other.hasLimitStatus()) { + mergeLimitStatus(other.getLimitStatus()); + } + if (other.hasReport()) { + mergeReport(other.getReport()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 8: + { + state_ = input.readEnum(); + bitField0_ |= 0x00000001; + break; + } // case 8 + case 18: + { + input.readMessage(getLimitStatusFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: + { + input.readMessage(getReportFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000004; + break; + } // case 26 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private int state_ = 0; + /** + * + * + *
+     * Output only. ResourceAllowance state.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.ResourceAllowanceState state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for state. + */ + @java.lang.Override + public int getStateValue() { + return state_; + } + /** + * + * + *
+     * Output only. ResourceAllowance state.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.ResourceAllowanceState state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The enum numeric value on the wire for state to set. + * @return This builder for chaining. + */ + public Builder setStateValue(int value) { + state_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. ResourceAllowance state.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.ResourceAllowanceState state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The state. + */ + @java.lang.Override + public com.google.cloud.batch.v1alpha.ResourceAllowanceState getState() { + com.google.cloud.batch.v1alpha.ResourceAllowanceState result = + com.google.cloud.batch.v1alpha.ResourceAllowanceState.forNumber(state_); + return result == null + ? com.google.cloud.batch.v1alpha.ResourceAllowanceState.UNRECOGNIZED + : result; + } + /** + * + * + *
+     * Output only. ResourceAllowance state.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.ResourceAllowanceState state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @param value The state to set. + * @return This builder for chaining. + */ + public Builder setState(com.google.cloud.batch.v1alpha.ResourceAllowanceState value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + state_ = value.getNumber(); + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. ResourceAllowance state.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.ResourceAllowanceState state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return This builder for chaining. + */ + public Builder clearState() { + bitField0_ = (bitField0_ & ~0x00000001); + state_ = 0; + onChanged(); + return this; + } + + private com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus limitStatus_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus.Builder, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatusOrBuilder> + limitStatusBuilder_; + /** + * + * + *
+     * Output only. ResourceAllowance consumption status for usage resources.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus limit_status = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the limitStatus field is set. + */ + public boolean hasLimitStatus() { + return ((bitField0_ & 0x00000002) != 0); + } + /** + * + * + *
+     * Output only. ResourceAllowance consumption status for usage resources.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus limit_status = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The limitStatus. + */ + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus + getLimitStatus() { + if (limitStatusBuilder_ == null) { + return limitStatus_ == null + ? com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus + .getDefaultInstance() + : limitStatus_; + } else { + return limitStatusBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. ResourceAllowance consumption status for usage resources.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus limit_status = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setLimitStatus( + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus value) { + if (limitStatusBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + limitStatus_ = value; + } else { + limitStatusBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. ResourceAllowance consumption status for usage resources.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus limit_status = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setLimitStatus( + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus.Builder + builderForValue) { + if (limitStatusBuilder_ == null) { + limitStatus_ = builderForValue.build(); + } else { + limitStatusBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. ResourceAllowance consumption status for usage resources.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus limit_status = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeLimitStatus( + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus value) { + if (limitStatusBuilder_ == null) { + if (((bitField0_ & 0x00000002) != 0) + && limitStatus_ != null + && limitStatus_ + != com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus + .getDefaultInstance()) { + getLimitStatusBuilder().mergeFrom(value); + } else { + limitStatus_ = value; + } + } else { + limitStatusBuilder_.mergeFrom(value); + } + if (limitStatus_ != null) { + bitField0_ |= 0x00000002; + onChanged(); + } + return this; + } + /** + * + * + *
+     * Output only. ResourceAllowance consumption status for usage resources.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus limit_status = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearLimitStatus() { + bitField0_ = (bitField0_ & ~0x00000002); + limitStatus_ = null; + if (limitStatusBuilder_ != null) { + limitStatusBuilder_.dispose(); + limitStatusBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. ResourceAllowance consumption status for usage resources.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus limit_status = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus.Builder + getLimitStatusBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return getLimitStatusFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. ResourceAllowance consumption status for usage resources.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus limit_status = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatusOrBuilder + getLimitStatusOrBuilder() { + if (limitStatusBuilder_ != null) { + return limitStatusBuilder_.getMessageOrBuilder(); + } else { + return limitStatus_ == null + ? com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus + .getDefaultInstance() + : limitStatus_; + } + } + /** + * + * + *
+     * Output only. ResourceAllowance consumption status for usage resources.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus limit_status = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus.Builder, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatusOrBuilder> + getLimitStatusFieldBuilder() { + if (limitStatusBuilder_ == null) { + limitStatusBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus.Builder, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatusOrBuilder>( + getLimitStatus(), getParentForChildren(), isClean()); + limitStatus_ = null; + } + return limitStatusBuilder_; + } + + private com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport report_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport.Builder, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReportOrBuilder> + reportBuilder_; + /** + * + * + *
+     * Output only. The report of ResourceAllowance consumptions in a time period.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport report = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the report field is set. + */ + public boolean hasReport() { + return ((bitField0_ & 0x00000004) != 0); + } + /** + * + * + *
+     * Output only. The report of ResourceAllowance consumptions in a time period.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport report = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The report. + */ + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport + getReport() { + if (reportBuilder_ == null) { + return report_ == null + ? com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport + .getDefaultInstance() + : report_; + } else { + return reportBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Output only. The report of ResourceAllowance consumptions in a time period.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport report = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setReport( + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport value) { + if (reportBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + report_ = value; + } else { + reportBuilder_.setMessage(value); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The report of ResourceAllowance consumptions in a time period.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport report = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder setReport( + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport.Builder + builderForValue) { + if (reportBuilder_ == null) { + report_ = builderForValue.build(); + } else { + reportBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The report of ResourceAllowance consumptions in a time period.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport report = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder mergeReport( + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport value) { + if (reportBuilder_ == null) { + if (((bitField0_ & 0x00000004) != 0) + && report_ != null + && report_ + != com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport + .getDefaultInstance()) { + getReportBuilder().mergeFrom(value); + } else { + report_ = value; + } + } else { + reportBuilder_.mergeFrom(value); + } + if (report_ != null) { + bitField0_ |= 0x00000004; + onChanged(); + } + return this; + } + /** + * + * + *
+     * Output only. The report of ResourceAllowance consumptions in a time period.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport report = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public Builder clearReport() { + bitField0_ = (bitField0_ & ~0x00000004); + report_ = null; + if (reportBuilder_ != null) { + reportBuilder_.dispose(); + reportBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Output only. The report of ResourceAllowance consumptions in a time period.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport report = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport.Builder + getReportBuilder() { + bitField0_ |= 0x00000004; + onChanged(); + return getReportFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Output only. The report of ResourceAllowance consumptions in a time period.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport report = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReportOrBuilder + getReportOrBuilder() { + if (reportBuilder_ != null) { + return reportBuilder_.getMessageOrBuilder(); + } else { + return report_ == null + ? com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport + .getDefaultInstance() + : report_; + } + } + /** + * + * + *
+     * Output only. The report of ResourceAllowance consumptions in a time period.
+     * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport report = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport.Builder, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReportOrBuilder> + getReportFieldBuilder() { + if (reportBuilder_ == null) { + reportBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport + .Builder, + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus + .ConsumptionReportOrBuilder>(getReport(), getParentForChildren(), isClean()); + report_ = null; + } + return reportBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.batch.v1alpha.UsageResourceAllowanceStatus) + } + + // @@protoc_insertion_point(class_scope:google.cloud.batch.v1alpha.UsageResourceAllowanceStatus) + private static final com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus(); + } + + public static com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public UsageResourceAllowanceStatus parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/UsageResourceAllowanceStatusOrBuilder.java b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/UsageResourceAllowanceStatusOrBuilder.java new file mode 100644 index 000000000000..9096caf310dc --- /dev/null +++ b/java-batch/proto-google-cloud-batch-v1alpha/src/main/java/com/google/cloud/batch/v1alpha/UsageResourceAllowanceStatusOrBuilder.java @@ -0,0 +1,139 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/batch/v1alpha/resource_allowance.proto + +// Protobuf Java Version: 3.25.2 +package com.google.cloud.batch.v1alpha; + +public interface UsageResourceAllowanceStatusOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.batch.v1alpha.UsageResourceAllowanceStatus) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * Output only. ResourceAllowance state.
+   * 
+ * + * + * .google.cloud.batch.v1alpha.ResourceAllowanceState state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The enum numeric value on the wire for state. + */ + int getStateValue(); + /** + * + * + *
+   * Output only. ResourceAllowance state.
+   * 
+ * + * + * .google.cloud.batch.v1alpha.ResourceAllowanceState state = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The state. + */ + com.google.cloud.batch.v1alpha.ResourceAllowanceState getState(); + + /** + * + * + *
+   * Output only. ResourceAllowance consumption status for usage resources.
+   * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus limit_status = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the limitStatus field is set. + */ + boolean hasLimitStatus(); + /** + * + * + *
+   * Output only. ResourceAllowance consumption status for usage resources.
+   * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus limit_status = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The limitStatus. + */ + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus getLimitStatus(); + /** + * + * + *
+   * Output only. ResourceAllowance consumption status for usage resources.
+   * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatus limit_status = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.LimitStatusOrBuilder + getLimitStatusOrBuilder(); + + /** + * + * + *
+   * Output only. The report of ResourceAllowance consumptions in a time period.
+   * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport report = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return Whether the report field is set. + */ + boolean hasReport(); + /** + * + * + *
+   * Output only. The report of ResourceAllowance consumptions in a time period.
+   * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport report = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + * + * @return The report. + */ + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport getReport(); + /** + * + * + *
+   * Output only. The report of ResourceAllowance consumptions in a time period.
+   * 
+ * + * + * .google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReport report = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * + */ + com.google.cloud.batch.v1alpha.UsageResourceAllowanceStatus.ConsumptionReportOrBuilder + getReportOrBuilder(); +} diff --git a/java-batch/proto-google-cloud-batch-v1alpha/src/main/proto/google/cloud/batch/v1alpha/batch.proto b/java-batch/proto-google-cloud-batch-v1alpha/src/main/proto/google/cloud/batch/v1alpha/batch.proto index 05d0dff3045b..76c68190a632 100644 --- a/java-batch/proto-google-cloud-batch-v1alpha/src/main/proto/google/cloud/batch/v1alpha/batch.proto +++ b/java-batch/proto-google-cloud-batch-v1alpha/src/main/proto/google/cloud/batch/v1alpha/batch.proto @@ -22,9 +22,11 @@ import "google/api/field_behavior.proto"; import "google/api/field_info.proto"; import "google/api/resource.proto"; import "google/cloud/batch/v1alpha/job.proto"; +import "google/cloud/batch/v1alpha/resource_allowance.proto"; import "google/cloud/batch/v1alpha/task.proto"; import "google/longrunning/operations.proto"; import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; option csharp_namespace = "Google.Cloud.Batch.V1Alpha"; @@ -96,6 +98,58 @@ service BatchService { }; option (google.api.method_signature) = "parent"; } + + // Create a Resource Allowance. + rpc CreateResourceAllowance(CreateResourceAllowanceRequest) + returns (ResourceAllowance) { + option (google.api.http) = { + post: "/v1alpha/{parent=projects/*/locations/*}/resourceAllowances" + body: "resource_allowance" + }; + option (google.api.method_signature) = + "parent,resource_allowance,resource_allowance_id"; + } + + // Get a ResourceAllowance specified by its resource name. + rpc GetResourceAllowance(GetResourceAllowanceRequest) + returns (ResourceAllowance) { + option (google.api.http) = { + get: "/v1alpha/{name=projects/*/locations/*/resourceAllowances/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Delete a ResourceAllowance. + rpc DeleteResourceAllowance(DeleteResourceAllowanceRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1alpha/{name=projects/*/locations/*/resourceAllowances/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "google.cloud.batch.v1alpha.OperationMetadata" + }; + } + + // List all ResourceAllowances for a project within a region. + rpc ListResourceAllowances(ListResourceAllowancesRequest) + returns (ListResourceAllowancesResponse) { + option (google.api.http) = { + get: "/v1alpha/{parent=projects/*/locations/*}/resourceAllowances" + }; + option (google.api.method_signature) = "parent"; + } + + // Update a Resource Allowance. + rpc UpdateResourceAllowance(UpdateResourceAllowanceRequest) + returns (ResourceAllowance) { + option (google.api.http) = { + patch: "/v1alpha/{resource_allowance.name=projects/*/locations/*/resourceAllowances/*}" + body: "resource_allowance" + }; + option (google.api.method_signature) = "resource_allowance,update_mask"; + } } // CreateJob Request. @@ -247,6 +301,163 @@ message GetTaskRequest { ]; } +// CreateResourceAllowance Request. +message CreateResourceAllowanceRequest { + // Required. The parent resource name where the ResourceAllowance will be + // created. Pattern: "projects/{project}/locations/{location}" + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "batch.googleapis.com/ResourceAllowance" + } + ]; + + // 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}". + string resource_allowance_id = 2; + + // Required. The ResourceAllowance to create. + ResourceAllowance resource_allowance = 3 + [(google.api.field_behavior) = REQUIRED]; + + // Optional. An optional request ID to identify requests. Specify a unique + // request ID so that if you must retry your request, the server will know to + // ignore the request if it has already been completed. The server will + // guarantee that for at least 60 minutes since the first request. + // + // For example, consider a situation where you make an initial request and + // the request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 4 [ + (google.api.field_info).format = UUID4, + (google.api.field_behavior) = OPTIONAL + ]; +} + +// GetResourceAllowance Request. +message GetResourceAllowanceRequest { + // Required. ResourceAllowance name. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "batch.googleapis.com/ResourceAllowance" + } + ]; +} + +// DeleteResourceAllowance Request. +message DeleteResourceAllowanceRequest { + // Required. ResourceAllowance name. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "batch.googleapis.com/ResourceAllowance" + } + ]; + + // Optional. Reason for this deletion. + string reason = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. An optional request ID to identify requests. Specify a unique + // request ID so that if you must retry your request, the server will know to + // ignore the request if it has already been completed. The server will + // guarantee that for at least 60 minutes after the first request. + // + // For example, consider a situation where you make an initial request and + // the request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 4 [ + (google.api.field_info).format = UUID4, + (google.api.field_behavior) = OPTIONAL + ]; +} + +// ListResourceAllowances Request. +message ListResourceAllowancesRequest { + // Required. Parent path. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "batch.googleapis.com/ResourceAllowance" + } + ]; + + // Optional. Page size. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Page token. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// ListResourceAllowances Response. +message ListResourceAllowancesResponse { + // ResourceAllowances. + repeated ResourceAllowance resource_allowances = 1; + + // Next page token. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// UpdateResourceAllowance Request. +message UpdateResourceAllowanceRequest { + // Required. The ResourceAllowance to update. + // Update description. + // Only fields specified in `update_mask` are updated. + ResourceAllowance resource_allowance = 1 + [(google.api.field_behavior) = REQUIRED]; + + // 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. + google.protobuf.FieldMask update_mask = 2 + [(google.api.field_behavior) = REQUIRED]; + + // Optional. An optional request ID to identify requests. Specify a unique + // request ID so that if you must retry your request, the server will know to + // ignore the request if it has already been completed. The server will + // guarantee that for at least 60 minutes since the first request. + // + // For example, consider a situation where you make an initial request and + // the request times out. If you make the request again with the same request + // ID, the server can check if original operation with the same request ID + // was received, and if so, will ignore the second request. This prevents + // clients from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 3 [ + (google.api.field_info).format = UUID4, + (google.api.field_behavior) = OPTIONAL + ]; +} + // Represents the metadata of the long-running operation. message OperationMetadata { // Output only. The time the operation was created. diff --git a/java-batch/proto-google-cloud-batch-v1alpha/src/main/proto/google/cloud/batch/v1alpha/notification.proto b/java-batch/proto-google-cloud-batch-v1alpha/src/main/proto/google/cloud/batch/v1alpha/notification.proto index c8ad1b675af5..6432d6aade0f 100644 --- a/java-batch/proto-google-cloud-batch-v1alpha/src/main/proto/google/cloud/batch/v1alpha/notification.proto +++ b/java-batch/proto-google-cloud-batch-v1alpha/src/main/proto/google/cloud/batch/v1alpha/notification.proto @@ -26,3 +26,13 @@ option java_package = "com.google.cloud.batch.v1alpha"; option objc_class_prefix = "GCB"; option php_namespace = "Google\\Cloud\\Batch\\V1alpha"; option ruby_package = "Google::Cloud::Batch::V1alpha"; + +// Notification on resource state change. +message Notification { + // Required. The Pub/Sub topic where notifications like the resource allowance + // state changes will be published. The topic must exist in the same project + // as the job and billings will be charged to this project. If not specified, + // no Pub/Sub messages will be sent. Topic format: + // `projects/{project}/topics/{topic}`. + string pubsub_topic = 1 [(google.api.field_behavior) = REQUIRED]; +} diff --git a/java-batch/proto-google-cloud-batch-v1alpha/src/main/proto/google/cloud/batch/v1alpha/resource_allowance.proto b/java-batch/proto-google-cloud-batch-v1alpha/src/main/proto/google/cloud/batch/v1alpha/resource_allowance.proto index 606b799a6e61..78a18a7caac8 100644 --- a/java-batch/proto-google-cloud-batch-v1alpha/src/main/proto/google/cloud/batch/v1alpha/resource_allowance.proto +++ b/java-batch/proto-google-cloud-batch-v1alpha/src/main/proto/google/cloud/batch/v1alpha/resource_allowance.proto @@ -31,3 +31,173 @@ option java_package = "com.google.cloud.batch.v1alpha"; option objc_class_prefix = "GCB"; option php_namespace = "Google\\Cloud\\Batch\\V1alpha"; option ruby_package = "Google::Cloud::Batch::V1alpha"; + +// A `CalendarPeriod` represents the abstract concept of a time period that +// has a canonical start. All calendar times begin at 12 AM US and Canadian +// Pacific Time (UTC-8). +enum CalendarPeriod { + // Unspecified. + CALENDAR_PERIOD_UNSPECIFIED = 0; + + // The month starts on the first date of the month and resets at the beginning + // of each month. + MONTH = 1; + + // The quarter starts on dates January 1, April 1, July 1, and October 1 of + // each year and resets at the beginning of the next quarter. + QUARTER = 2; + + // The year starts on January 1 and resets at the beginning of the next year. + YEAR = 3; + + // The week period starts and resets every Monday. + WEEK = 4; + + // The day starts at 12:00am. + DAY = 5; +} + +// ResourceAllowance valid state. +enum ResourceAllowanceState { + // Unspecified. + RESOURCE_ALLOWANCE_STATE_UNSPECIFIED = 0; + + // ResourceAllowance is active and in use. + RESOURCE_ALLOWANCE_ACTIVE = 1; + + // ResourceAllowance limit is reached. + RESOURCE_ALLOWANCE_DEPLETED = 2; +} + +// The Resource Allowance description for Cloud Batch. +message ResourceAllowance { + option (google.api.resource) = { + type: "batch.googleapis.com/ResourceAllowance" + pattern: "projects/{project}/locations/{location}/resourceAllowances/{resource_allowance}" + plural: "resourceAllowances" + singular: "resourceAllowance" + }; + + // ResourceAllowance detail. + oneof resource_allowance { + // The detail of usage resource allowance. + UsageResourceAllowance usage_resource_allowance = 4; + } + + // Identifier. ResourceAllowance name. + // For example: + // "projects/123456/locations/us-central1/resourceAllowances/resource-allowance-1". + string name = 1 [(google.api.field_behavior) = IDENTIFIER]; + + // Output only. A system generated unique ID (in UUID4 format) for the + // ResourceAllowance. + string uid = 2 [ + (google.api.field_info).format = UUID4, + (google.api.field_behavior) = OUTPUT_ONLY + ]; + + // Output only. Time when the ResourceAllowance was created. + google.protobuf.Timestamp create_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Labels are attributes that can be set and used by both the + // user and by Batch. Labels must meet the following constraints: + // + // * Keys and values can contain only lowercase letters, numeric characters, + // underscores, and dashes. + // * All characters must use UTF-8 encoding, and international characters are + // allowed. + // * Keys must start with a lowercase letter or international character. + // * Each resource is limited to a maximum of 64 labels. + // + // Both keys and values are additionally constrained to be <= 128 bytes. + map labels = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Notification configurations. + repeated Notification notifications = 6 + [(google.api.field_behavior) = OPTIONAL]; +} + +// UsageResourceAllowance describes the detail of usage resource allowance. +message UsageResourceAllowance { + // Required. Spec of a usage ResourceAllowance. + UsageResourceAllowanceSpec spec = 1 [(google.api.field_behavior) = REQUIRED]; + + // Output only. Status of a usage ResourceAllowance. + UsageResourceAllowanceStatus status = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Spec of a usage ResourceAllowance. +message UsageResourceAllowanceSpec { + // UsageResourceAllowance limitation. + message Limit { + oneof duration { + // Optional. A CalendarPeriod represents the abstract concept of a time + // period that has a canonical start. + CalendarPeriod calendar_period = 1 + [(google.api.field_behavior) = OPTIONAL]; + } + + // Required. Limit value of a UsageResourceAllowance within its one + // duration. Default is 0. For example, you can set `limit` as 10000.0 with + // duration of the current month by setting `calendar_period` field as + // monthly. That means in your current month, 10000.0 is the cour hour + // limitation that your resources are allowed to consume. + optional double limit = 2 [(google.api.field_behavior) = REQUIRED]; + } + + // Required. Spec type is unique for each usage ResourceAllowance. + // Batch now only supports type as "cpu-core-hours" for CPU usage consumption + // tracking. + string type = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Threshold of a UsageResourceAllowance limiting how many resources + // can be consumed for each type. + Limit limit = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Status of a usage ResourceAllowance. +message UsageResourceAllowanceStatus { + // UsageResourceAllowanceStatus detail about usage consumption. + message LimitStatus { + // Output only. The consumption interval. + google.type.Interval consumption_interval = 1 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Limit value of a UsageResourceAllowance within its one + // duration. + double limit = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Accumulated consumption during `consumption_interval`. + double consumed = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + } + + message PeriodConsumption { + // Output only. The consumption interval. + google.type.Interval consumption_interval = 1 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Accumulated consumption during `consumption_interval`. + double consumed = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + } + + // ConsumptionReport is the report of ResourceAllowance consumptions in a time + // period. + message ConsumptionReport { + // Output only. ResourceAllowance consumptions in the latest calendar + // period. Key is the calendar period in string format. Batch currently + // supports HOUR, DAY, MONTH and YEAR. + map latest_period_consumptions = 1 + [(google.api.field_behavior) = OUTPUT_ONLY]; + } + + // Output only. ResourceAllowance state. + ResourceAllowanceState state = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. ResourceAllowance consumption status for usage resources. + LimitStatus limit_status = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The report of ResourceAllowance consumptions in a time period. + ConsumptionReport report = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/createresourceallowance/AsyncCreateResourceAllowance.java b/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/createresourceallowance/AsyncCreateResourceAllowance.java new file mode 100644 index 000000000000..25c352e953c7 --- /dev/null +++ b/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/createresourceallowance/AsyncCreateResourceAllowance.java @@ -0,0 +1,53 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.batch.v1alpha.samples; + +// [START batch_v1alpha_generated_BatchService_CreateResourceAllowance_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.batch.v1alpha.BatchServiceClient; +import com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest; +import com.google.cloud.batch.v1alpha.LocationName; +import com.google.cloud.batch.v1alpha.ResourceAllowance; + +public class AsyncCreateResourceAllowance { + + public static void main(String[] args) throws Exception { + asyncCreateResourceAllowance(); + } + + public static void asyncCreateResourceAllowance() throws Exception { + // 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.createResourceAllowanceCallable().futureCall(request); + // Do something. + ResourceAllowance response = future.get(); + } + } +} +// [END batch_v1alpha_generated_BatchService_CreateResourceAllowance_async] diff --git a/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/createresourceallowance/SyncCreateResourceAllowance.java b/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/createresourceallowance/SyncCreateResourceAllowance.java new file mode 100644 index 000000000000..e15bdaf591ae --- /dev/null +++ b/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/createresourceallowance/SyncCreateResourceAllowance.java @@ -0,0 +1,49 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.batch.v1alpha.samples; + +// [START batch_v1alpha_generated_BatchService_CreateResourceAllowance_sync] +import com.google.cloud.batch.v1alpha.BatchServiceClient; +import com.google.cloud.batch.v1alpha.CreateResourceAllowanceRequest; +import com.google.cloud.batch.v1alpha.LocationName; +import com.google.cloud.batch.v1alpha.ResourceAllowance; + +public class SyncCreateResourceAllowance { + + public static void main(String[] args) throws Exception { + syncCreateResourceAllowance(); + } + + public static void syncCreateResourceAllowance() throws Exception { + // 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(); + ResourceAllowance response = batchServiceClient.createResourceAllowance(request); + } + } +} +// [END batch_v1alpha_generated_BatchService_CreateResourceAllowance_sync] diff --git a/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/createresourceallowance/SyncCreateResourceAllowanceLocationnameResourceallowanceString.java b/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/createresourceallowance/SyncCreateResourceAllowanceLocationnameResourceallowanceString.java new file mode 100644 index 000000000000..50defa62b50f --- /dev/null +++ b/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/createresourceallowance/SyncCreateResourceAllowanceLocationnameResourceallowanceString.java @@ -0,0 +1,47 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.batch.v1alpha.samples; + +// [START batch_v1alpha_generated_BatchService_CreateResourceAllowance_LocationnameResourceallowanceString_sync] +import com.google.cloud.batch.v1alpha.BatchServiceClient; +import com.google.cloud.batch.v1alpha.LocationName; +import com.google.cloud.batch.v1alpha.ResourceAllowance; + +public class SyncCreateResourceAllowanceLocationnameResourceallowanceString { + + public static void main(String[] args) throws Exception { + syncCreateResourceAllowanceLocationnameResourceallowanceString(); + } + + public static void syncCreateResourceAllowanceLocationnameResourceallowanceString() + throws Exception { + // 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]"); + ResourceAllowance resourceAllowance = ResourceAllowance.newBuilder().build(); + String resourceAllowanceId = "resourceAllowanceId-786470299"; + ResourceAllowance response = + batchServiceClient.createResourceAllowance( + parent, resourceAllowance, resourceAllowanceId); + } + } +} +// [END batch_v1alpha_generated_BatchService_CreateResourceAllowance_LocationnameResourceallowanceString_sync] diff --git a/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/createresourceallowance/SyncCreateResourceAllowanceStringResourceallowanceString.java b/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/createresourceallowance/SyncCreateResourceAllowanceStringResourceallowanceString.java new file mode 100644 index 000000000000..ac223f71e292 --- /dev/null +++ b/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/createresourceallowance/SyncCreateResourceAllowanceStringResourceallowanceString.java @@ -0,0 +1,46 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.batch.v1alpha.samples; + +// [START batch_v1alpha_generated_BatchService_CreateResourceAllowance_StringResourceallowanceString_sync] +import com.google.cloud.batch.v1alpha.BatchServiceClient; +import com.google.cloud.batch.v1alpha.LocationName; +import com.google.cloud.batch.v1alpha.ResourceAllowance; + +public class SyncCreateResourceAllowanceStringResourceallowanceString { + + public static void main(String[] args) throws Exception { + syncCreateResourceAllowanceStringResourceallowanceString(); + } + + public static void syncCreateResourceAllowanceStringResourceallowanceString() throws Exception { + // 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(); + ResourceAllowance resourceAllowance = ResourceAllowance.newBuilder().build(); + String resourceAllowanceId = "resourceAllowanceId-786470299"; + ResourceAllowance response = + batchServiceClient.createResourceAllowance( + parent, resourceAllowance, resourceAllowanceId); + } + } +} +// [END batch_v1alpha_generated_BatchService_CreateResourceAllowance_StringResourceallowanceString_sync] diff --git a/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/deleteresourceallowance/AsyncDeleteResourceAllowance.java b/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/deleteresourceallowance/AsyncDeleteResourceAllowance.java new file mode 100644 index 000000000000..25a934c0408c --- /dev/null +++ b/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/deleteresourceallowance/AsyncDeleteResourceAllowance.java @@ -0,0 +1,54 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.batch.v1alpha.samples; + +// [START batch_v1alpha_generated_BatchService_DeleteResourceAllowance_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.batch.v1alpha.BatchServiceClient; +import com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest; +import com.google.cloud.batch.v1alpha.ResourceAllowanceName; +import com.google.longrunning.Operation; + +public class AsyncDeleteResourceAllowance { + + public static void main(String[] args) throws Exception { + asyncDeleteResourceAllowance(); + } + + public static void asyncDeleteResourceAllowance() throws Exception { + // 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(); + } + } +} +// [END batch_v1alpha_generated_BatchService_DeleteResourceAllowance_async] diff --git a/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/deleteresourceallowance/AsyncDeleteResourceAllowanceLRO.java b/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/deleteresourceallowance/AsyncDeleteResourceAllowanceLRO.java new file mode 100644 index 000000000000..01182f0073a4 --- /dev/null +++ b/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/deleteresourceallowance/AsyncDeleteResourceAllowanceLRO.java @@ -0,0 +1,55 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.batch.v1alpha.samples; + +// [START batch_v1alpha_generated_BatchService_DeleteResourceAllowance_LRO_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.batch.v1alpha.BatchServiceClient; +import com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest; +import com.google.cloud.batch.v1alpha.OperationMetadata; +import com.google.cloud.batch.v1alpha.ResourceAllowanceName; +import com.google.protobuf.Empty; + +public class AsyncDeleteResourceAllowanceLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteResourceAllowanceLRO(); + } + + public static void asyncDeleteResourceAllowanceLRO() throws Exception { + // 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(); + } + } +} +// [END batch_v1alpha_generated_BatchService_DeleteResourceAllowance_LRO_async] diff --git a/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/deleteresourceallowance/SyncDeleteResourceAllowance.java b/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/deleteresourceallowance/SyncDeleteResourceAllowance.java new file mode 100644 index 000000000000..b9e19a4e6743 --- /dev/null +++ b/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/deleteresourceallowance/SyncDeleteResourceAllowance.java @@ -0,0 +1,50 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.batch.v1alpha.samples; + +// [START batch_v1alpha_generated_BatchService_DeleteResourceAllowance_sync] +import com.google.cloud.batch.v1alpha.BatchServiceClient; +import com.google.cloud.batch.v1alpha.DeleteResourceAllowanceRequest; +import com.google.cloud.batch.v1alpha.ResourceAllowanceName; +import com.google.protobuf.Empty; + +public class SyncDeleteResourceAllowance { + + public static void main(String[] args) throws Exception { + syncDeleteResourceAllowance(); + } + + public static void syncDeleteResourceAllowance() throws Exception { + // 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(); + } + } +} +// [END batch_v1alpha_generated_BatchService_DeleteResourceAllowance_sync] diff --git a/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/deleteresourceallowance/SyncDeleteResourceAllowanceResourceallowancename.java b/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/deleteresourceallowance/SyncDeleteResourceAllowanceResourceallowancename.java new file mode 100644 index 000000000000..eaab0d2e4e03 --- /dev/null +++ b/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/deleteresourceallowance/SyncDeleteResourceAllowanceResourceallowancename.java @@ -0,0 +1,43 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.batch.v1alpha.samples; + +// [START batch_v1alpha_generated_BatchService_DeleteResourceAllowance_Resourceallowancename_sync] +import com.google.cloud.batch.v1alpha.BatchServiceClient; +import com.google.cloud.batch.v1alpha.ResourceAllowanceName; +import com.google.protobuf.Empty; + +public class SyncDeleteResourceAllowanceResourceallowancename { + + public static void main(String[] args) throws Exception { + syncDeleteResourceAllowanceResourceallowancename(); + } + + public static void syncDeleteResourceAllowanceResourceallowancename() throws Exception { + // 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(); + } + } +} +// [END batch_v1alpha_generated_BatchService_DeleteResourceAllowance_Resourceallowancename_sync] diff --git a/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/deleteresourceallowance/SyncDeleteResourceAllowanceString.java b/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/deleteresourceallowance/SyncDeleteResourceAllowanceString.java new file mode 100644 index 000000000000..747fc9814c04 --- /dev/null +++ b/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/deleteresourceallowance/SyncDeleteResourceAllowanceString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.batch.v1alpha.samples; + +// [START batch_v1alpha_generated_BatchService_DeleteResourceAllowance_String_sync] +import com.google.cloud.batch.v1alpha.BatchServiceClient; +import com.google.cloud.batch.v1alpha.ResourceAllowanceName; +import com.google.protobuf.Empty; + +public class SyncDeleteResourceAllowanceString { + + public static void main(String[] args) throws Exception { + syncDeleteResourceAllowanceString(); + } + + public static void syncDeleteResourceAllowanceString() throws Exception { + // 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(); + } + } +} +// [END batch_v1alpha_generated_BatchService_DeleteResourceAllowance_String_sync] diff --git a/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/getresourceallowance/AsyncGetResourceAllowance.java b/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/getresourceallowance/AsyncGetResourceAllowance.java new file mode 100644 index 000000000000..36e494dc5aff --- /dev/null +++ b/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/getresourceallowance/AsyncGetResourceAllowance.java @@ -0,0 +1,52 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.batch.v1alpha.samples; + +// [START batch_v1alpha_generated_BatchService_GetResourceAllowance_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.batch.v1alpha.BatchServiceClient; +import com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest; +import com.google.cloud.batch.v1alpha.ResourceAllowance; +import com.google.cloud.batch.v1alpha.ResourceAllowanceName; + +public class AsyncGetResourceAllowance { + + public static void main(String[] args) throws Exception { + asyncGetResourceAllowance(); + } + + public static void asyncGetResourceAllowance() throws Exception { + // 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(); + } + } +} +// [END batch_v1alpha_generated_BatchService_GetResourceAllowance_async] diff --git a/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/getresourceallowance/SyncGetResourceAllowance.java b/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/getresourceallowance/SyncGetResourceAllowance.java new file mode 100644 index 000000000000..2b632ad1cff9 --- /dev/null +++ b/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/getresourceallowance/SyncGetResourceAllowance.java @@ -0,0 +1,48 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.batch.v1alpha.samples; + +// [START batch_v1alpha_generated_BatchService_GetResourceAllowance_sync] +import com.google.cloud.batch.v1alpha.BatchServiceClient; +import com.google.cloud.batch.v1alpha.GetResourceAllowanceRequest; +import com.google.cloud.batch.v1alpha.ResourceAllowance; +import com.google.cloud.batch.v1alpha.ResourceAllowanceName; + +public class SyncGetResourceAllowance { + + public static void main(String[] args) throws Exception { + syncGetResourceAllowance(); + } + + public static void syncGetResourceAllowance() throws Exception { + // 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); + } + } +} +// [END batch_v1alpha_generated_BatchService_GetResourceAllowance_sync] diff --git a/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/getresourceallowance/SyncGetResourceAllowanceResourceallowancename.java b/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/getresourceallowance/SyncGetResourceAllowanceResourceallowancename.java new file mode 100644 index 000000000000..c07d5e41eb40 --- /dev/null +++ b/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/getresourceallowance/SyncGetResourceAllowanceResourceallowancename.java @@ -0,0 +1,43 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.batch.v1alpha.samples; + +// [START batch_v1alpha_generated_BatchService_GetResourceAllowance_Resourceallowancename_sync] +import com.google.cloud.batch.v1alpha.BatchServiceClient; +import com.google.cloud.batch.v1alpha.ResourceAllowance; +import com.google.cloud.batch.v1alpha.ResourceAllowanceName; + +public class SyncGetResourceAllowanceResourceallowancename { + + public static void main(String[] args) throws Exception { + syncGetResourceAllowanceResourceallowancename(); + } + + public static void syncGetResourceAllowanceResourceallowancename() throws Exception { + // 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]"); + ResourceAllowance response = batchServiceClient.getResourceAllowance(name); + } + } +} +// [END batch_v1alpha_generated_BatchService_GetResourceAllowance_Resourceallowancename_sync] diff --git a/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/getresourceallowance/SyncGetResourceAllowanceString.java b/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/getresourceallowance/SyncGetResourceAllowanceString.java new file mode 100644 index 000000000000..f4168d29416e --- /dev/null +++ b/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/getresourceallowance/SyncGetResourceAllowanceString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.batch.v1alpha.samples; + +// [START batch_v1alpha_generated_BatchService_GetResourceAllowance_String_sync] +import com.google.cloud.batch.v1alpha.BatchServiceClient; +import com.google.cloud.batch.v1alpha.ResourceAllowance; +import com.google.cloud.batch.v1alpha.ResourceAllowanceName; + +public class SyncGetResourceAllowanceString { + + public static void main(String[] args) throws Exception { + syncGetResourceAllowanceString(); + } + + public static void syncGetResourceAllowanceString() throws Exception { + // 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(); + ResourceAllowance response = batchServiceClient.getResourceAllowance(name); + } + } +} +// [END batch_v1alpha_generated_BatchService_GetResourceAllowance_String_sync] diff --git a/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/listresourceallowances/AsyncListResourceAllowances.java b/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/listresourceallowances/AsyncListResourceAllowances.java new file mode 100644 index 000000000000..0f8a5c1ca338 --- /dev/null +++ b/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/listresourceallowances/AsyncListResourceAllowances.java @@ -0,0 +1,54 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.batch.v1alpha.samples; + +// [START batch_v1alpha_generated_BatchService_ListResourceAllowances_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.batch.v1alpha.BatchServiceClient; +import com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest; +import com.google.cloud.batch.v1alpha.LocationName; +import com.google.cloud.batch.v1alpha.ResourceAllowance; + +public class AsyncListResourceAllowances { + + public static void main(String[] args) throws Exception { + asyncListResourceAllowances(); + } + + public static void asyncListResourceAllowances() throws Exception { + // 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); + } + } + } +} +// [END batch_v1alpha_generated_BatchService_ListResourceAllowances_async] diff --git a/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/listresourceallowances/AsyncListResourceAllowancesPaged.java b/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/listresourceallowances/AsyncListResourceAllowancesPaged.java new file mode 100644 index 000000000000..16d2659e5441 --- /dev/null +++ b/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/listresourceallowances/AsyncListResourceAllowancesPaged.java @@ -0,0 +1,62 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.batch.v1alpha.samples; + +// [START batch_v1alpha_generated_BatchService_ListResourceAllowances_Paged_async] +import com.google.cloud.batch.v1alpha.BatchServiceClient; +import com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest; +import com.google.cloud.batch.v1alpha.ListResourceAllowancesResponse; +import com.google.cloud.batch.v1alpha.LocationName; +import com.google.cloud.batch.v1alpha.ResourceAllowance; +import com.google.common.base.Strings; + +public class AsyncListResourceAllowancesPaged { + + public static void main(String[] args) throws Exception { + asyncListResourceAllowancesPaged(); + } + + public static void asyncListResourceAllowancesPaged() throws Exception { + // 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; + } + } + } + } +} +// [END batch_v1alpha_generated_BatchService_ListResourceAllowances_Paged_async] diff --git a/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/listresourceallowances/SyncListResourceAllowances.java b/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/listresourceallowances/SyncListResourceAllowances.java new file mode 100644 index 000000000000..27993f14b8c7 --- /dev/null +++ b/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/listresourceallowances/SyncListResourceAllowances.java @@ -0,0 +1,51 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.batch.v1alpha.samples; + +// [START batch_v1alpha_generated_BatchService_ListResourceAllowances_sync] +import com.google.cloud.batch.v1alpha.BatchServiceClient; +import com.google.cloud.batch.v1alpha.ListResourceAllowancesRequest; +import com.google.cloud.batch.v1alpha.LocationName; +import com.google.cloud.batch.v1alpha.ResourceAllowance; + +public class SyncListResourceAllowances { + + public static void main(String[] args) throws Exception { + syncListResourceAllowances(); + } + + public static void syncListResourceAllowances() throws Exception { + // 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); + } + } + } +} +// [END batch_v1alpha_generated_BatchService_ListResourceAllowances_sync] diff --git a/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/listresourceallowances/SyncListResourceAllowancesLocationname.java b/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/listresourceallowances/SyncListResourceAllowancesLocationname.java new file mode 100644 index 000000000000..85c01f779f4c --- /dev/null +++ b/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/listresourceallowances/SyncListResourceAllowancesLocationname.java @@ -0,0 +1,45 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.batch.v1alpha.samples; + +// [START batch_v1alpha_generated_BatchService_ListResourceAllowances_Locationname_sync] +import com.google.cloud.batch.v1alpha.BatchServiceClient; +import com.google.cloud.batch.v1alpha.LocationName; +import com.google.cloud.batch.v1alpha.ResourceAllowance; + +public class SyncListResourceAllowancesLocationname { + + public static void main(String[] args) throws Exception { + syncListResourceAllowancesLocationname(); + } + + public static void syncListResourceAllowancesLocationname() throws Exception { + // 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); + } + } + } +} +// [END batch_v1alpha_generated_BatchService_ListResourceAllowances_Locationname_sync] diff --git a/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/listresourceallowances/SyncListResourceAllowancesString.java b/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/listresourceallowances/SyncListResourceAllowancesString.java new file mode 100644 index 000000000000..a20a10eb5af2 --- /dev/null +++ b/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/listresourceallowances/SyncListResourceAllowancesString.java @@ -0,0 +1,45 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.batch.v1alpha.samples; + +// [START batch_v1alpha_generated_BatchService_ListResourceAllowances_String_sync] +import com.google.cloud.batch.v1alpha.BatchServiceClient; +import com.google.cloud.batch.v1alpha.LocationName; +import com.google.cloud.batch.v1alpha.ResourceAllowance; + +public class SyncListResourceAllowancesString { + + public static void main(String[] args) throws Exception { + syncListResourceAllowancesString(); + } + + public static void syncListResourceAllowancesString() throws Exception { + // 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); + } + } + } +} +// [END batch_v1alpha_generated_BatchService_ListResourceAllowances_String_sync] diff --git a/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/updateresourceallowance/AsyncUpdateResourceAllowance.java b/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/updateresourceallowance/AsyncUpdateResourceAllowance.java new file mode 100644 index 000000000000..b1fab9fa214e --- /dev/null +++ b/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/updateresourceallowance/AsyncUpdateResourceAllowance.java @@ -0,0 +1,52 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.batch.v1alpha.samples; + +// [START batch_v1alpha_generated_BatchService_UpdateResourceAllowance_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.batch.v1alpha.BatchServiceClient; +import com.google.cloud.batch.v1alpha.ResourceAllowance; +import com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateResourceAllowance { + + public static void main(String[] args) throws Exception { + asyncUpdateResourceAllowance(); + } + + public static void asyncUpdateResourceAllowance() throws Exception { + // 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(); + } + } +} +// [END batch_v1alpha_generated_BatchService_UpdateResourceAllowance_async] diff --git a/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/updateresourceallowance/SyncUpdateResourceAllowance.java b/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/updateresourceallowance/SyncUpdateResourceAllowance.java new file mode 100644 index 000000000000..a31d857d5e6f --- /dev/null +++ b/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/updateresourceallowance/SyncUpdateResourceAllowance.java @@ -0,0 +1,48 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.batch.v1alpha.samples; + +// [START batch_v1alpha_generated_BatchService_UpdateResourceAllowance_sync] +import com.google.cloud.batch.v1alpha.BatchServiceClient; +import com.google.cloud.batch.v1alpha.ResourceAllowance; +import com.google.cloud.batch.v1alpha.UpdateResourceAllowanceRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateResourceAllowance { + + public static void main(String[] args) throws Exception { + syncUpdateResourceAllowance(); + } + + public static void syncUpdateResourceAllowance() throws Exception { + // 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); + } + } +} +// [END batch_v1alpha_generated_BatchService_UpdateResourceAllowance_sync] diff --git a/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/updateresourceallowance/SyncUpdateResourceAllowanceResourceallowanceFieldmask.java b/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/updateresourceallowance/SyncUpdateResourceAllowanceResourceallowanceFieldmask.java new file mode 100644 index 000000000000..29d83623d526 --- /dev/null +++ b/java-batch/samples/snippets/generated/com/google/cloud/batch/v1alpha/batchservice/updateresourceallowance/SyncUpdateResourceAllowanceResourceallowanceFieldmask.java @@ -0,0 +1,44 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.batch.v1alpha.samples; + +// [START batch_v1alpha_generated_BatchService_UpdateResourceAllowance_ResourceallowanceFieldmask_sync] +import com.google.cloud.batch.v1alpha.BatchServiceClient; +import com.google.cloud.batch.v1alpha.ResourceAllowance; +import com.google.protobuf.FieldMask; + +public class SyncUpdateResourceAllowanceResourceallowanceFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateResourceAllowanceResourceallowanceFieldmask(); + } + + public static void syncUpdateResourceAllowanceResourceallowanceFieldmask() throws Exception { + // 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); + } + } +} +// [END batch_v1alpha_generated_BatchService_UpdateResourceAllowance_ResourceallowanceFieldmask_sync] diff --git a/java-securitycenter/google-cloud-securitycenter/src/main/resources/META-INF/native-image/com.google.cloud.securitycenter.v1/reflect-config.json b/java-securitycenter/google-cloud-securitycenter/src/main/resources/META-INF/native-image/com.google.cloud.securitycenter.v1/reflect-config.json index 6e3e08b9bb98..c810de10cea0 100644 --- a/java-securitycenter/google-cloud-securitycenter/src/main/resources/META-INF/native-image/com.google.cloud.securitycenter.v1/reflect-config.json +++ b/java-securitycenter/google-cloud-securitycenter/src/main/resources/META-INF/native-image/com.google.cloud.securitycenter.v1/reflect-config.json @@ -2375,6 +2375,24 @@ "allDeclaredClasses": true, "allPublicClasses": true }, + { + "name": "com.google.cloud.securitycenter.v1.Notebook", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, + { + "name": "com.google.cloud.securitycenter.v1.Notebook$Builder", + "queryAllDeclaredConstructors": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredClasses": true, + "allPublicClasses": true + }, { "name": "com.google.cloud.securitycenter.v1.NotificationConfig", "queryAllDeclaredConstructors": true, diff --git a/java-securitycenter/google-cloud-securitycenter/src/test/java/com/google/cloud/securitycenter/v1/SecurityCenterClientHttpJsonTest.java b/java-securitycenter/google-cloud-securitycenter/src/test/java/com/google/cloud/securitycenter/v1/SecurityCenterClientHttpJsonTest.java index 6e21025e0a7e..49a733e8d325 100644 --- a/java-securitycenter/google-cloud-securitycenter/src/test/java/com/google/cloud/securitycenter/v1/SecurityCenterClientHttpJsonTest.java +++ b/java-securitycenter/google-cloud-securitycenter/src/test/java/com/google/cloud/securitycenter/v1/SecurityCenterClientHttpJsonTest.java @@ -462,6 +462,7 @@ public void createFindingTest() throws Exception { .setSecurityPosture(SecurityPosture.newBuilder().build()) .addAllLogEntries(new ArrayList()) .addAllLoadBalancers(new ArrayList()) + .setNotebook(Notebook.newBuilder().build()) .build(); mockService.addResponse(expectedResponse); @@ -552,6 +553,7 @@ public void createFindingTest2() throws Exception { .setSecurityPosture(SecurityPosture.newBuilder().build()) .addAllLogEntries(new ArrayList()) .addAllLoadBalancers(new ArrayList()) + .setNotebook(Notebook.newBuilder().build()) .build(); mockService.addResponse(expectedResponse); @@ -3929,6 +3931,7 @@ public void setFindingStateTest() throws Exception { .setSecurityPosture(SecurityPosture.newBuilder().build()) .addAllLogEntries(new ArrayList()) .addAllLoadBalancers(new ArrayList()) + .setNotebook(Notebook.newBuilder().build()) .build(); mockService.addResponse(expectedResponse); @@ -4021,6 +4024,7 @@ public void setFindingStateTest2() throws Exception { .setSecurityPosture(SecurityPosture.newBuilder().build()) .addAllLogEntries(new ArrayList()) .addAllLoadBalancers(new ArrayList()) + .setNotebook(Notebook.newBuilder().build()) .build(); mockService.addResponse(expectedResponse); @@ -4111,6 +4115,7 @@ public void setMuteTest() throws Exception { .setSecurityPosture(SecurityPosture.newBuilder().build()) .addAllLogEntries(new ArrayList()) .addAllLoadBalancers(new ArrayList()) + .setNotebook(Notebook.newBuilder().build()) .build(); mockService.addResponse(expectedResponse); @@ -4201,6 +4206,7 @@ public void setMuteTest2() throws Exception { .setSecurityPosture(SecurityPosture.newBuilder().build()) .addAllLogEntries(new ArrayList()) .addAllLoadBalancers(new ArrayList()) + .setNotebook(Notebook.newBuilder().build()) .build(); mockService.addResponse(expectedResponse); @@ -4612,6 +4618,7 @@ public void updateFindingTest() throws Exception { .setSecurityPosture(SecurityPosture.newBuilder().build()) .addAllLogEntries(new ArrayList()) .addAllLoadBalancers(new ArrayList()) + .setNotebook(Notebook.newBuilder().build()) .build(); mockService.addResponse(expectedResponse); @@ -4660,6 +4667,7 @@ public void updateFindingTest() throws Exception { .setSecurityPosture(SecurityPosture.newBuilder().build()) .addAllLogEntries(new ArrayList()) .addAllLoadBalancers(new ArrayList()) + .setNotebook(Notebook.newBuilder().build()) .build(); Finding actualResponse = client.updateFinding(finding); @@ -4733,6 +4741,7 @@ public void updateFindingExceptionTest() throws Exception { .setSecurityPosture(SecurityPosture.newBuilder().build()) .addAllLogEntries(new ArrayList()) .addAllLoadBalancers(new ArrayList()) + .setNotebook(Notebook.newBuilder().build()) .build(); client.updateFinding(finding); Assert.fail("No exception raised"); diff --git a/java-securitycenter/google-cloud-securitycenter/src/test/java/com/google/cloud/securitycenter/v1/SecurityCenterClientTest.java b/java-securitycenter/google-cloud-securitycenter/src/test/java/com/google/cloud/securitycenter/v1/SecurityCenterClientTest.java index 1e5ccaf75513..7fa414beb755 100644 --- a/java-securitycenter/google-cloud-securitycenter/src/test/java/com/google/cloud/securitycenter/v1/SecurityCenterClientTest.java +++ b/java-securitycenter/google-cloud-securitycenter/src/test/java/com/google/cloud/securitycenter/v1/SecurityCenterClientTest.java @@ -449,6 +449,7 @@ public void createFindingTest() throws Exception { .setSecurityPosture(SecurityPosture.newBuilder().build()) .addAllLogEntries(new ArrayList()) .addAllLoadBalancers(new ArrayList()) + .setNotebook(Notebook.newBuilder().build()) .build(); mockSecurityCenter.addResponse(expectedResponse); @@ -535,6 +536,7 @@ public void createFindingTest2() throws Exception { .setSecurityPosture(SecurityPosture.newBuilder().build()) .addAllLogEntries(new ArrayList()) .addAllLoadBalancers(new ArrayList()) + .setNotebook(Notebook.newBuilder().build()) .build(); mockSecurityCenter.addResponse(expectedResponse); @@ -3606,6 +3608,7 @@ public void setFindingStateTest() throws Exception { .setSecurityPosture(SecurityPosture.newBuilder().build()) .addAllLogEntries(new ArrayList()) .addAllLoadBalancers(new ArrayList()) + .setNotebook(Notebook.newBuilder().build()) .build(); mockSecurityCenter.addResponse(expectedResponse); @@ -3694,6 +3697,7 @@ public void setFindingStateTest2() throws Exception { .setSecurityPosture(SecurityPosture.newBuilder().build()) .addAllLogEntries(new ArrayList()) .addAllLoadBalancers(new ArrayList()) + .setNotebook(Notebook.newBuilder().build()) .build(); mockSecurityCenter.addResponse(expectedResponse); @@ -3780,6 +3784,7 @@ public void setMuteTest() throws Exception { .setSecurityPosture(SecurityPosture.newBuilder().build()) .addAllLogEntries(new ArrayList()) .addAllLoadBalancers(new ArrayList()) + .setNotebook(Notebook.newBuilder().build()) .build(); mockSecurityCenter.addResponse(expectedResponse); @@ -3865,6 +3870,7 @@ public void setMuteTest2() throws Exception { .setSecurityPosture(SecurityPosture.newBuilder().build()) .addAllLogEntries(new ArrayList()) .addAllLoadBalancers(new ArrayList()) + .setNotebook(Notebook.newBuilder().build()) .build(); mockSecurityCenter.addResponse(expectedResponse); @@ -4216,6 +4222,7 @@ public void updateFindingTest() throws Exception { .setSecurityPosture(SecurityPosture.newBuilder().build()) .addAllLogEntries(new ArrayList()) .addAllLoadBalancers(new ArrayList()) + .setNotebook(Notebook.newBuilder().build()) .build(); mockSecurityCenter.addResponse(expectedResponse); diff --git a/java-securitycenter/proto-google-cloud-securitycenter-v1/src/main/java/com/google/cloud/securitycenter/v1/Finding.java b/java-securitycenter/proto-google-cloud-securitycenter-v1/src/main/java/com/google/cloud/securitycenter/v1/Finding.java index 3f59536a25a3..ed87a855abcf 100644 --- a/java-securitycenter/proto-google-cloud-securitycenter-v1/src/main/java/com/google/cloud/securitycenter/v1/Finding.java +++ b/java-securitycenter/proto-google-cloud-securitycenter-v1/src/main/java/com/google/cloud/securitycenter/v1/Finding.java @@ -3748,6 +3748,56 @@ public com.google.cloud.securitycenter.v1.LoadBalancerOrBuilder getLoadBalancers return loadBalancers_.get(index); } + public static final int NOTEBOOK_FIELD_NUMBER = 63; + private com.google.cloud.securitycenter.v1.Notebook notebook_; + /** + * + * + *
+   * Notebook associated with the finding.
+   * 
+ * + * .google.cloud.securitycenter.v1.Notebook notebook = 63; + * + * @return Whether the notebook field is set. + */ + @java.lang.Override + public boolean hasNotebook() { + return ((bitField0_ & 0x00020000) != 0); + } + /** + * + * + *
+   * Notebook associated with the finding.
+   * 
+ * + * .google.cloud.securitycenter.v1.Notebook notebook = 63; + * + * @return The notebook. + */ + @java.lang.Override + public com.google.cloud.securitycenter.v1.Notebook getNotebook() { + return notebook_ == null + ? com.google.cloud.securitycenter.v1.Notebook.getDefaultInstance() + : notebook_; + } + /** + * + * + *
+   * Notebook associated with the finding.
+   * 
+ * + * .google.cloud.securitycenter.v1.Notebook notebook = 63; + */ + @java.lang.Override + public com.google.cloud.securitycenter.v1.NotebookOrBuilder getNotebookOrBuilder() { + return notebook_ == null + ? com.google.cloud.securitycenter.v1.Notebook.getDefaultInstance() + : notebook_; + } + private byte memoizedIsInitialized = -1; @java.lang.Override @@ -3894,6 +3944,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io for (int i = 0; i < loadBalancers_.size(); i++) { output.writeMessage(58, loadBalancers_.get(i)); } + if (((bitField0_ & 0x00020000) != 0)) { + output.writeMessage(63, getNotebook()); + } getUnknownFields().writeTo(output); } @@ -4065,6 +4118,9 @@ public int getSerializedSize() { for (int i = 0; i < loadBalancers_.size(); i++) { size += com.google.protobuf.CodedOutputStream.computeMessageSize(58, loadBalancers_.get(i)); } + if (((bitField0_ & 0x00020000) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(63, getNotebook()); + } size += getUnknownFields().getSerializedSize(); memoizedSize = size; return size; @@ -4176,6 +4232,10 @@ public boolean equals(final java.lang.Object obj) { } if (!getLogEntriesList().equals(other.getLogEntriesList())) return false; if (!getLoadBalancersList().equals(other.getLoadBalancersList())) return false; + if (hasNotebook() != other.hasNotebook()) return false; + if (hasNotebook()) { + if (!getNotebook().equals(other.getNotebook())) return false; + } if (!getUnknownFields().equals(other.getUnknownFields())) return false; return true; } @@ -4333,6 +4393,10 @@ public int hashCode() { hash = (37 * hash) + LOAD_BALANCERS_FIELD_NUMBER; hash = (53 * hash) + getLoadBalancersList().hashCode(); } + if (hasNotebook()) { + hash = (37 * hash) + NOTEBOOK_FIELD_NUMBER; + hash = (53 * hash) + getNotebook().hashCode(); + } hash = (29 * hash) + getUnknownFields().hashCode(); memoizedHashCode = hash; return hash; @@ -4535,6 +4599,7 @@ private void maybeForceBuilderInitialization() { getSecurityPostureFieldBuilder(); getLogEntriesFieldBuilder(); getLoadBalancersFieldBuilder(); + getNotebookFieldBuilder(); } } @@ -4709,6 +4774,11 @@ public Builder clear() { loadBalancersBuilder_.clear(); } bitField1_ = (bitField1_ & ~0x00000800); + notebook_ = null; + if (notebookBuilder_ != null) { + notebookBuilder_.dispose(); + notebookBuilder_ = null; + } return this; } @@ -4981,6 +5051,10 @@ private void buildPartial1(com.google.cloud.securitycenter.v1.Finding result) { securityPostureBuilder_ == null ? securityPosture_ : securityPostureBuilder_.build(); to_bitField0_ |= 0x00010000; } + if (((from_bitField1_ & 0x00001000) != 0)) { + result.notebook_ = notebookBuilder_ == null ? notebook_ : notebookBuilder_.build(); + to_bitField0_ |= 0x00020000; + } result.bitField0_ |= to_bitField0_; } @@ -5396,6 +5470,9 @@ public Builder mergeFrom(com.google.cloud.securitycenter.v1.Finding other) { } } } + if (other.hasNotebook()) { + mergeNotebook(other.getNotebook()); + } this.mergeUnknownFields(other.getUnknownFields()); onChanged(); return this; @@ -5776,6 +5853,12 @@ public Builder mergeFrom( } break; } // case 466 + case 506: + { + input.readMessage(getNotebookFieldBuilder().getBuilder(), extensionRegistry); + bitField1_ |= 0x00001000; + break; + } // case 506 default: { if (!super.parseUnknownField(input, extensionRegistry, tag)) { @@ -14956,6 +15039,192 @@ public com.google.cloud.securitycenter.v1.LoadBalancer.Builder addLoadBalancersB return loadBalancersBuilder_; } + private com.google.cloud.securitycenter.v1.Notebook notebook_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.securitycenter.v1.Notebook, + com.google.cloud.securitycenter.v1.Notebook.Builder, + com.google.cloud.securitycenter.v1.NotebookOrBuilder> + notebookBuilder_; + /** + * + * + *
+     * Notebook associated with the finding.
+     * 
+ * + * .google.cloud.securitycenter.v1.Notebook notebook = 63; + * + * @return Whether the notebook field is set. + */ + public boolean hasNotebook() { + return ((bitField1_ & 0x00001000) != 0); + } + /** + * + * + *
+     * Notebook associated with the finding.
+     * 
+ * + * .google.cloud.securitycenter.v1.Notebook notebook = 63; + * + * @return The notebook. + */ + public com.google.cloud.securitycenter.v1.Notebook getNotebook() { + if (notebookBuilder_ == null) { + return notebook_ == null + ? com.google.cloud.securitycenter.v1.Notebook.getDefaultInstance() + : notebook_; + } else { + return notebookBuilder_.getMessage(); + } + } + /** + * + * + *
+     * Notebook associated with the finding.
+     * 
+ * + * .google.cloud.securitycenter.v1.Notebook notebook = 63; + */ + public Builder setNotebook(com.google.cloud.securitycenter.v1.Notebook value) { + if (notebookBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + notebook_ = value; + } else { + notebookBuilder_.setMessage(value); + } + bitField1_ |= 0x00001000; + onChanged(); + return this; + } + /** + * + * + *
+     * Notebook associated with the finding.
+     * 
+ * + * .google.cloud.securitycenter.v1.Notebook notebook = 63; + */ + public Builder setNotebook( + com.google.cloud.securitycenter.v1.Notebook.Builder builderForValue) { + if (notebookBuilder_ == null) { + notebook_ = builderForValue.build(); + } else { + notebookBuilder_.setMessage(builderForValue.build()); + } + bitField1_ |= 0x00001000; + onChanged(); + return this; + } + /** + * + * + *
+     * Notebook associated with the finding.
+     * 
+ * + * .google.cloud.securitycenter.v1.Notebook notebook = 63; + */ + public Builder mergeNotebook(com.google.cloud.securitycenter.v1.Notebook value) { + if (notebookBuilder_ == null) { + if (((bitField1_ & 0x00001000) != 0) + && notebook_ != null + && notebook_ != com.google.cloud.securitycenter.v1.Notebook.getDefaultInstance()) { + getNotebookBuilder().mergeFrom(value); + } else { + notebook_ = value; + } + } else { + notebookBuilder_.mergeFrom(value); + } + if (notebook_ != null) { + bitField1_ |= 0x00001000; + onChanged(); + } + return this; + } + /** + * + * + *
+     * Notebook associated with the finding.
+     * 
+ * + * .google.cloud.securitycenter.v1.Notebook notebook = 63; + */ + public Builder clearNotebook() { + bitField1_ = (bitField1_ & ~0x00001000); + notebook_ = null; + if (notebookBuilder_ != null) { + notebookBuilder_.dispose(); + notebookBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * Notebook associated with the finding.
+     * 
+ * + * .google.cloud.securitycenter.v1.Notebook notebook = 63; + */ + public com.google.cloud.securitycenter.v1.Notebook.Builder getNotebookBuilder() { + bitField1_ |= 0x00001000; + onChanged(); + return getNotebookFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * Notebook associated with the finding.
+     * 
+ * + * .google.cloud.securitycenter.v1.Notebook notebook = 63; + */ + public com.google.cloud.securitycenter.v1.NotebookOrBuilder getNotebookOrBuilder() { + if (notebookBuilder_ != null) { + return notebookBuilder_.getMessageOrBuilder(); + } else { + return notebook_ == null + ? com.google.cloud.securitycenter.v1.Notebook.getDefaultInstance() + : notebook_; + } + } + /** + * + * + *
+     * Notebook associated with the finding.
+     * 
+ * + * .google.cloud.securitycenter.v1.Notebook notebook = 63; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.securitycenter.v1.Notebook, + com.google.cloud.securitycenter.v1.Notebook.Builder, + com.google.cloud.securitycenter.v1.NotebookOrBuilder> + getNotebookFieldBuilder() { + if (notebookBuilder_ == null) { + notebookBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.cloud.securitycenter.v1.Notebook, + com.google.cloud.securitycenter.v1.Notebook.Builder, + com.google.cloud.securitycenter.v1.NotebookOrBuilder>( + getNotebook(), getParentForChildren(), isClean()); + notebook_ = null; + } + return notebookBuilder_; + } + @java.lang.Override public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); diff --git a/java-securitycenter/proto-google-cloud-securitycenter-v1/src/main/java/com/google/cloud/securitycenter/v1/FindingOrBuilder.java b/java-securitycenter/proto-google-cloud-securitycenter-v1/src/main/java/com/google/cloud/securitycenter/v1/FindingOrBuilder.java index de0905153d00..a2703cd070b5 100644 --- a/java-securitycenter/proto-google-cloud-securitycenter-v1/src/main/java/com/google/cloud/securitycenter/v1/FindingOrBuilder.java +++ b/java-securitycenter/proto-google-cloud-securitycenter-v1/src/main/java/com/google/cloud/securitycenter/v1/FindingOrBuilder.java @@ -1897,4 +1897,39 @@ com.google.cloud.securitycenter.v1.ContactDetails getContactsOrDefault( * repeated .google.cloud.securitycenter.v1.LoadBalancer load_balancers = 58; */ com.google.cloud.securitycenter.v1.LoadBalancerOrBuilder getLoadBalancersOrBuilder(int index); + + /** + * + * + *
+   * Notebook associated with the finding.
+   * 
+ * + * .google.cloud.securitycenter.v1.Notebook notebook = 63; + * + * @return Whether the notebook field is set. + */ + boolean hasNotebook(); + /** + * + * + *
+   * Notebook associated with the finding.
+   * 
+ * + * .google.cloud.securitycenter.v1.Notebook notebook = 63; + * + * @return The notebook. + */ + com.google.cloud.securitycenter.v1.Notebook getNotebook(); + /** + * + * + *
+   * Notebook associated with the finding.
+   * 
+ * + * .google.cloud.securitycenter.v1.Notebook notebook = 63; + */ + com.google.cloud.securitycenter.v1.NotebookOrBuilder getNotebookOrBuilder(); } diff --git a/java-securitycenter/proto-google-cloud-securitycenter-v1/src/main/java/com/google/cloud/securitycenter/v1/FindingOuterClass.java b/java-securitycenter/proto-google-cloud-securitycenter-v1/src/main/java/com/google/cloud/securitycenter/v1/FindingOuterClass.java index f1126cd5a827..604a8c6c94ff 100644 --- a/java-securitycenter/proto-google-cloud-securitycenter-v1/src/main/java/com/google/cloud/securitycenter/v1/FindingOuterClass.java +++ b/java-securitycenter/proto-google-cloud-securitycenter-v1/src/main/java/com/google/cloud/securitycenter/v1/FindingOuterClass.java @@ -82,104 +82,107 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "/v1/load_balancer.proto\032.google/cloud/se" + "curitycenter/v1/log_entry.proto\0321google/" + "cloud/securitycenter/v1/mitre_attack.pro" - + "to\032/google/cloud/securitycenter/v1/org_p" - + "olicy.proto\032,google/cloud/securitycenter" - + "/v1/process.proto\0323google/cloud/security" - + "center/v1/security_marks.proto\0325google/c" - + "loud/securitycenter/v1/security_posture." - + "proto\0322google/cloud/securitycenter/v1/vu" - + "lnerability.proto\032\034google/protobuf/struc" - + "t.proto\032\037google/protobuf/timestamp.proto" - + "\"\242\032\n\007Finding\022\014\n\004name\030\001 \001(\t\022\016\n\006parent\030\002 \001" - + "(\t\022\025\n\rresource_name\030\003 \001(\t\022<\n\005state\030\004 \001(\016" - + "2-.google.cloud.securitycenter.v1.Findin" - + "g.State\022\020\n\010category\030\005 \001(\t\022\024\n\014external_ur" - + "i\030\006 \001(\t\022X\n\021source_properties\030\007 \003(\0132=.goo" - + "gle.cloud.securitycenter.v1.Finding.Sour" - + "cePropertiesEntry\022J\n\016security_marks\030\010 \001(" - + "\0132-.google.cloud.securitycenter.v1.Secur" - + "ityMarksB\003\340A\003\022.\n\nevent_time\030\t \001(\0132\032.goog" - + "le.protobuf.Timestamp\022/\n\013create_time\030\n \001" - + "(\0132\032.google.protobuf.Timestamp\022B\n\010severi" - + "ty\030\014 \001(\01620.google.cloud.securitycenter.v" - + "1.Finding.Severity\022\026\n\016canonical_name\030\016 \001" - + "(\t\022:\n\004mute\030\017 \001(\0162,.google.cloud.security" - + "center.v1.Finding.Mute\022K\n\rfinding_class\030" - + "\021 \001(\01624.google.cloud.securitycenter.v1.F" - + "inding.FindingClass\022<\n\tindicator\030\022 \001(\0132)" - + ".google.cloud.securitycenter.v1.Indicato" - + "r\022D\n\rvulnerability\030\024 \001(\0132-.google.cloud." - + "securitycenter.v1.Vulnerability\0229\n\020mute_" - + "update_time\030\025 \001(\0132\032.google.protobuf.Time" - + "stampB\003\340A\003\022[\n\020external_systems\030\026 \003(\0132<.g" - + "oogle.cloud.securitycenter.v1.Finding.Ex" - + "ternalSystemsEntryB\003\340A\003\022A\n\014mitre_attack\030" - + "\031 \001(\0132+.google.cloud.securitycenter.v1.M" - + "itreAttack\0226\n\006access\030\032 \001(\0132&.google.clou" - + "d.securitycenter.v1.Access\022?\n\013connection" - + "s\030\037 \003(\0132*.google.cloud.securitycenter.v1" - + ".Connection\022\026\n\016mute_initiator\030\034 \001(\t\022:\n\tp" - + "rocesses\030\036 \003(\0132\'.google.cloud.securityce" - + "nter.v1.Process\022L\n\010contacts\030! \003(\01325.goog" - + "le.cloud.securitycenter.v1.Finding.Conta" - + "ctsEntryB\003\340A\003\022?\n\013compliances\030\" \003(\0132*.goo" - + "gle.cloud.securitycenter.v1.Compliance\022 " - + "\n\023parent_display_name\030$ \001(\tB\003\340A\003\022\023\n\013desc" - + "ription\030% \001(\t\022B\n\014exfiltration\030& \001(\0132,.go" - + "ogle.cloud.securitycenter.v1.Exfiltratio" - + "n\022@\n\014iam_bindings\030\' \003(\0132*.google.cloud.s" - + "ecuritycenter.v1.IamBinding\022\022\n\nnext_step" - + "s\030( \001(\t\022\023\n\013module_name\030) \001(\t\022=\n\ncontaine" - + "rs\030* \003(\0132).google.cloud.securitycenter.v" - + "1.Container\022>\n\nkubernetes\030+ \001(\0132*.google" - + ".cloud.securitycenter.v1.Kubernetes\022:\n\010d" - + "atabase\030, \001(\0132(.google.cloud.securitycen" - + "ter.v1.Database\0223\n\005files\030. \003(\0132$.google." - + "cloud.securitycenter.v1.File\022P\n\024cloud_dl" - + "p_inspection\0300 \001(\01322.google.cloud.securi" - + "tycenter.v1.CloudDlpInspection\022S\n\026cloud_" - + "dlp_data_profile\0301 \001(\01323.google.cloud.se" - + "curitycenter.v1.CloudDlpDataProfile\022E\n\016k" - + "ernel_rootkit\0302 \001(\0132-.google.cloud.secur" - + "itycenter.v1.KernelRootkit\022?\n\014org_polici" - + "es\0303 \003(\0132).google.cloud.securitycenter.v" - + "1.OrgPolicy\022@\n\013application\0305 \001(\0132+.googl" - + "e.cloud.securitycenter.v1.Application\022X\n" - + "\030backup_disaster_recovery\0307 \001(\01326.google" - + ".cloud.securitycenter.v1.BackupDisasterR" - + "ecovery\022I\n\020security_posture\0308 \001(\0132/.goog" - + "le.cloud.securitycenter.v1.SecurityPostu" - + "re\022=\n\013log_entries\0309 \003(\0132(.google.cloud.s" - + "ecuritycenter.v1.LogEntry\022D\n\016load_balanc" - + "ers\030: \003(\0132,.google.cloud.securitycenter." - + "v1.LoadBalancer\032O\n\025SourcePropertiesEntry" - + "\022\013\n\003key\030\001 \001(\t\022%\n\005value\030\002 \001(\0132\026.google.pr" - + "otobuf.Value:\0028\001\032f\n\024ExternalSystemsEntry" - + "\022\013\n\003key\030\001 \001(\t\022=\n\005value\030\002 \001(\0132..google.cl" - + "oud.securitycenter.v1.ExternalSystem:\0028\001" - + "\032_\n\rContactsEntry\022\013\n\003key\030\001 \001(\t\022=\n\005value\030" - + "\002 \001(\0132..google.cloud.securitycenter.v1.C" - + "ontactDetails:\0028\001\"8\n\005State\022\025\n\021STATE_UNSP" - + "ECIFIED\020\000\022\n\n\006ACTIVE\020\001\022\014\n\010INACTIVE\020\002\"Q\n\010S" - + "everity\022\030\n\024SEVERITY_UNSPECIFIED\020\000\022\014\n\010CRI" - + "TICAL\020\001\022\010\n\004HIGH\020\002\022\n\n\006MEDIUM\020\003\022\007\n\003LOW\020\004\"C" - + "\n\004Mute\022\024\n\020MUTE_UNSPECIFIED\020\000\022\t\n\005MUTED\020\001\022" - + "\013\n\007UNMUTED\020\002\022\r\n\tUNDEFINED\020\004\"\231\001\n\014FindingC" - + "lass\022\035\n\031FINDING_CLASS_UNSPECIFIED\020\000\022\n\n\006T" - + "HREAT\020\001\022\021\n\rVULNERABILITY\020\002\022\024\n\020MISCONFIGU" - + "RATION\020\003\022\017\n\013OBSERVATION\020\004\022\r\n\tSCC_ERROR\020\005" - + "\022\025\n\021POSTURE_VIOLATION\020\006:\333\001\352A\327\001\n%security" - + "center.googleapis.com/Finding\022@organizat" - + "ions/{organization}/sources/{source}/fin" - + "dings/{finding}\0224folders/{folder}/source" - + "s/{source}/findings/{finding}\0226projects/" - + "{project}/sources/{source}/findings/{fin" - + "ding}B\330\001\n\"com.google.cloud.securitycente" - + "r.v1P\001ZJcloud.google.com/go/securitycent" - + "er/apiv1/securitycenterpb;securitycenter" - + "pb\252\002\036Google.Cloud.SecurityCenter.V1\312\002\036Go" - + "ogle\\Cloud\\SecurityCenter\\V1\352\002!Google::C" - + "loud::SecurityCenter::V1b\006proto3" + + "to\032-google/cloud/securitycenter/v1/noteb" + + "ook.proto\032/google/cloud/securitycenter/v" + + "1/org_policy.proto\032,google/cloud/securit" + + "ycenter/v1/process.proto\0323google/cloud/s" + + "ecuritycenter/v1/security_marks.proto\0325g" + + "oogle/cloud/securitycenter/v1/security_p" + + "osture.proto\0322google/cloud/securitycente" + + "r/v1/vulnerability.proto\032\034google/protobu" + + "f/struct.proto\032\037google/protobuf/timestam" + + "p.proto\"\336\032\n\007Finding\022\014\n\004name\030\001 \001(\t\022\016\n\006par" + + "ent\030\002 \001(\t\022\025\n\rresource_name\030\003 \001(\t\022<\n\005stat" + + "e\030\004 \001(\0162-.google.cloud.securitycenter.v1" + + ".Finding.State\022\020\n\010category\030\005 \001(\t\022\024\n\014exte" + + "rnal_uri\030\006 \001(\t\022X\n\021source_properties\030\007 \003(" + + "\0132=.google.cloud.securitycenter.v1.Findi" + + "ng.SourcePropertiesEntry\022J\n\016security_mar" + + "ks\030\010 \001(\0132-.google.cloud.securitycenter.v" + + "1.SecurityMarksB\003\340A\003\022.\n\nevent_time\030\t \001(\013" + + "2\032.google.protobuf.Timestamp\022/\n\013create_t" + + "ime\030\n \001(\0132\032.google.protobuf.Timestamp\022B\n" + + "\010severity\030\014 \001(\01620.google.cloud.securityc" + + "enter.v1.Finding.Severity\022\026\n\016canonical_n" + + "ame\030\016 \001(\t\022:\n\004mute\030\017 \001(\0162,.google.cloud.s" + + "ecuritycenter.v1.Finding.Mute\022K\n\rfinding" + + "_class\030\021 \001(\01624.google.cloud.securitycent" + + "er.v1.Finding.FindingClass\022<\n\tindicator\030" + + "\022 \001(\0132).google.cloud.securitycenter.v1.I" + + "ndicator\022D\n\rvulnerability\030\024 \001(\0132-.google" + + ".cloud.securitycenter.v1.Vulnerability\0229" + + "\n\020mute_update_time\030\025 \001(\0132\032.google.protob" + + "uf.TimestampB\003\340A\003\022[\n\020external_systems\030\026 " + + "\003(\0132<.google.cloud.securitycenter.v1.Fin" + + "ding.ExternalSystemsEntryB\003\340A\003\022A\n\014mitre_" + + "attack\030\031 \001(\0132+.google.cloud.securitycent" + + "er.v1.MitreAttack\0226\n\006access\030\032 \001(\0132&.goog" + + "le.cloud.securitycenter.v1.Access\022?\n\013con" + + "nections\030\037 \003(\0132*.google.cloud.securityce" + + "nter.v1.Connection\022\026\n\016mute_initiator\030\034 \001" + + "(\t\022:\n\tprocesses\030\036 \003(\0132\'.google.cloud.sec" + + "uritycenter.v1.Process\022L\n\010contacts\030! \003(\013" + + "25.google.cloud.securitycenter.v1.Findin" + + "g.ContactsEntryB\003\340A\003\022?\n\013compliances\030\" \003(" + + "\0132*.google.cloud.securitycenter.v1.Compl" + + "iance\022 \n\023parent_display_name\030$ \001(\tB\003\340A\003\022" + + "\023\n\013description\030% \001(\t\022B\n\014exfiltration\030& \001" + + "(\0132,.google.cloud.securitycenter.v1.Exfi" + + "ltration\022@\n\014iam_bindings\030\' \003(\0132*.google." + + "cloud.securitycenter.v1.IamBinding\022\022\n\nne" + + "xt_steps\030( \001(\t\022\023\n\013module_name\030) \001(\t\022=\n\nc" + + "ontainers\030* \003(\0132).google.cloud.securityc" + + "enter.v1.Container\022>\n\nkubernetes\030+ \001(\0132*" + + ".google.cloud.securitycenter.v1.Kubernet" + + "es\022:\n\010database\030, \001(\0132(.google.cloud.secu" + + "ritycenter.v1.Database\0223\n\005files\030. \003(\0132$." + + "google.cloud.securitycenter.v1.File\022P\n\024c" + + "loud_dlp_inspection\0300 \001(\01322.google.cloud" + + ".securitycenter.v1.CloudDlpInspection\022S\n" + + "\026cloud_dlp_data_profile\0301 \001(\01323.google.c" + + "loud.securitycenter.v1.CloudDlpDataProfi" + + "le\022E\n\016kernel_rootkit\0302 \001(\0132-.google.clou" + + "d.securitycenter.v1.KernelRootkit\022?\n\014org" + + "_policies\0303 \003(\0132).google.cloud.securityc" + + "enter.v1.OrgPolicy\022@\n\013application\0305 \001(\0132" + + "+.google.cloud.securitycenter.v1.Applica" + + "tion\022X\n\030backup_disaster_recovery\0307 \001(\01326" + + ".google.cloud.securitycenter.v1.BackupDi" + + "sasterRecovery\022I\n\020security_posture\0308 \001(\013" + + "2/.google.cloud.securitycenter.v1.Securi" + + "tyPosture\022=\n\013log_entries\0309 \003(\0132(.google." + + "cloud.securitycenter.v1.LogEntry\022D\n\016load" + + "_balancers\030: \003(\0132,.google.cloud.security" + + "center.v1.LoadBalancer\022:\n\010notebook\030? \001(\013" + + "2(.google.cloud.securitycenter.v1.Notebo" + + "ok\032O\n\025SourcePropertiesEntry\022\013\n\003key\030\001 \001(\t" + + "\022%\n\005value\030\002 \001(\0132\026.google.protobuf.Value:" + + "\0028\001\032f\n\024ExternalSystemsEntry\022\013\n\003key\030\001 \001(\t" + + "\022=\n\005value\030\002 \001(\0132..google.cloud.securityc" + + "enter.v1.ExternalSystem:\0028\001\032_\n\rContactsE" + + "ntry\022\013\n\003key\030\001 \001(\t\022=\n\005value\030\002 \001(\0132..googl" + + "e.cloud.securitycenter.v1.ContactDetails" + + ":\0028\001\"8\n\005State\022\025\n\021STATE_UNSPECIFIED\020\000\022\n\n\006" + + "ACTIVE\020\001\022\014\n\010INACTIVE\020\002\"Q\n\010Severity\022\030\n\024SE" + + "VERITY_UNSPECIFIED\020\000\022\014\n\010CRITICAL\020\001\022\010\n\004HI" + + "GH\020\002\022\n\n\006MEDIUM\020\003\022\007\n\003LOW\020\004\"C\n\004Mute\022\024\n\020MUT" + + "E_UNSPECIFIED\020\000\022\t\n\005MUTED\020\001\022\013\n\007UNMUTED\020\002\022" + + "\r\n\tUNDEFINED\020\004\"\231\001\n\014FindingClass\022\035\n\031FINDI" + + "NG_CLASS_UNSPECIFIED\020\000\022\n\n\006THREAT\020\001\022\021\n\rVU" + + "LNERABILITY\020\002\022\024\n\020MISCONFIGURATION\020\003\022\017\n\013O" + + "BSERVATION\020\004\022\r\n\tSCC_ERROR\020\005\022\025\n\021POSTURE_V" + + "IOLATION\020\006:\333\001\352A\327\001\n%securitycenter.google" + + "apis.com/Finding\022@organizations/{organiz" + + "ation}/sources/{source}/findings/{findin" + + "g}\0224folders/{folder}/sources/{source}/fi" + + "ndings/{finding}\0226projects/{project}/sou" + + "rces/{source}/findings/{finding}B\330\001\n\"com" + + ".google.cloud.securitycenter.v1P\001ZJcloud" + + ".google.com/go/securitycenter/apiv1/secu" + + "ritycenterpb;securitycenterpb\252\002\036Google.C" + + "loud.SecurityCenter.V1\312\002\036Google\\Cloud\\Se" + + "curityCenter\\V1\352\002!Google::Cloud::Securit" + + "yCenter::V1b\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( @@ -207,6 +210,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { com.google.cloud.securitycenter.v1.LoadBalancerProto.getDescriptor(), com.google.cloud.securitycenter.v1.LogEntryProto.getDescriptor(), com.google.cloud.securitycenter.v1.MitreAttackProto.getDescriptor(), + com.google.cloud.securitycenter.v1.NotebookProto.getDescriptor(), com.google.cloud.securitycenter.v1.OrgPolicyProto.getDescriptor(), com.google.cloud.securitycenter.v1.ProcessProto.getDescriptor(), com.google.cloud.securitycenter.v1.SecurityMarksOuterClass.getDescriptor(), @@ -265,6 +269,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { "SecurityPosture", "LogEntries", "LoadBalancers", + "Notebook", }); internal_static_google_cloud_securitycenter_v1_Finding_SourcePropertiesEntry_descriptor = internal_static_google_cloud_securitycenter_v1_Finding_descriptor.getNestedTypes().get(0); @@ -318,6 +323,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { com.google.cloud.securitycenter.v1.LoadBalancerProto.getDescriptor(); com.google.cloud.securitycenter.v1.LogEntryProto.getDescriptor(); com.google.cloud.securitycenter.v1.MitreAttackProto.getDescriptor(); + com.google.cloud.securitycenter.v1.NotebookProto.getDescriptor(); com.google.cloud.securitycenter.v1.OrgPolicyProto.getDescriptor(); com.google.cloud.securitycenter.v1.ProcessProto.getDescriptor(); com.google.cloud.securitycenter.v1.SecurityMarksOuterClass.getDescriptor(); diff --git a/java-securitycenter/proto-google-cloud-securitycenter-v1/src/main/java/com/google/cloud/securitycenter/v1/Notebook.java b/java-securitycenter/proto-google-cloud-securitycenter-v1/src/main/java/com/google/cloud/securitycenter/v1/Notebook.java new file mode 100644 index 000000000000..14c5a19eb54a --- /dev/null +++ b/java-securitycenter/proto-google-cloud-securitycenter-v1/src/main/java/com/google/cloud/securitycenter/v1/Notebook.java @@ -0,0 +1,1275 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/securitycenter/v1/notebook.proto + +// Protobuf Java Version: 3.25.2 +package com.google.cloud.securitycenter.v1; + +/** + * + * + *
+ * Represents a Jupyter notebook IPYNB file, such as a [Colab Enterprise
+ * notebook](https://cloud.google.com/colab/docs/introduction) file, that is
+ * associated with a finding.
+ * 
+ * + * Protobuf type {@code google.cloud.securitycenter.v1.Notebook} + */ +public final class Notebook extends com.google.protobuf.GeneratedMessageV3 + implements + // @@protoc_insertion_point(message_implements:google.cloud.securitycenter.v1.Notebook) + NotebookOrBuilder { + private static final long serialVersionUID = 0L; + // Use Notebook.newBuilder() to construct. + private Notebook(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + + private Notebook() { + name_ = ""; + service_ = ""; + lastAuthor_ = ""; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance(UnusedPrivateParameter unused) { + return new Notebook(); + } + + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.securitycenter.v1.NotebookProto + .internal_static_google_cloud_securitycenter_v1_Notebook_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.securitycenter.v1.NotebookProto + .internal_static_google_cloud_securitycenter_v1_Notebook_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.securitycenter.v1.Notebook.class, + com.google.cloud.securitycenter.v1.Notebook.Builder.class); + } + + private int bitField0_; + public static final int NAME_FIELD_NUMBER = 1; + + @SuppressWarnings("serial") + private volatile java.lang.Object name_ = ""; + /** + * + * + *
+   * The name of the notebook.
+   * 
+ * + * string name = 1; + * + * @return The name. + */ + @java.lang.Override + public java.lang.String getName() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } + } + /** + * + * + *
+   * The name of the notebook.
+   * 
+ * + * string name = 1; + * + * @return The bytes for name. + */ + @java.lang.Override + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int SERVICE_FIELD_NUMBER = 2; + + @SuppressWarnings("serial") + private volatile java.lang.Object service_ = ""; + /** + * + * + *
+   * The source notebook service, for example, "Colab Enterprise".
+   * 
+ * + * string service = 2; + * + * @return The service. + */ + @java.lang.Override + public java.lang.String getService() { + java.lang.Object ref = service_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + service_ = s; + return s; + } + } + /** + * + * + *
+   * The source notebook service, for example, "Colab Enterprise".
+   * 
+ * + * string service = 2; + * + * @return The bytes for service. + */ + @java.lang.Override + public com.google.protobuf.ByteString getServiceBytes() { + java.lang.Object ref = service_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + service_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int LAST_AUTHOR_FIELD_NUMBER = 3; + + @SuppressWarnings("serial") + private volatile java.lang.Object lastAuthor_ = ""; + /** + * + * + *
+   * The user ID of the latest author to modify the notebook.
+   * 
+ * + * string last_author = 3; + * + * @return The lastAuthor. + */ + @java.lang.Override + public java.lang.String getLastAuthor() { + java.lang.Object ref = lastAuthor_; + if (ref instanceof java.lang.String) { + return (java.lang.String) ref; + } else { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + lastAuthor_ = s; + return s; + } + } + /** + * + * + *
+   * The user ID of the latest author to modify the notebook.
+   * 
+ * + * string last_author = 3; + * + * @return The bytes for lastAuthor. + */ + @java.lang.Override + public com.google.protobuf.ByteString getLastAuthorBytes() { + java.lang.Object ref = lastAuthor_; + if (ref instanceof java.lang.String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + lastAuthor_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + public static final int NOTEBOOK_UPDATE_TIME_FIELD_NUMBER = 4; + private com.google.protobuf.Timestamp notebookUpdateTime_; + /** + * + * + *
+   * The most recent time the notebook was updated.
+   * 
+ * + * .google.protobuf.Timestamp notebook_update_time = 4; + * + * @return Whether the notebookUpdateTime field is set. + */ + @java.lang.Override + public boolean hasNotebookUpdateTime() { + return ((bitField0_ & 0x00000001) != 0); + } + /** + * + * + *
+   * The most recent time the notebook was updated.
+   * 
+ * + * .google.protobuf.Timestamp notebook_update_time = 4; + * + * @return The notebookUpdateTime. + */ + @java.lang.Override + public com.google.protobuf.Timestamp getNotebookUpdateTime() { + return notebookUpdateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : notebookUpdateTime_; + } + /** + * + * + *
+   * The most recent time the notebook was updated.
+   * 
+ * + * .google.protobuf.Timestamp notebook_update_time = 4; + */ + @java.lang.Override + public com.google.protobuf.TimestampOrBuilder getNotebookUpdateTimeOrBuilder() { + return notebookUpdateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : notebookUpdateTime_; + } + + private byte memoizedIsInitialized = -1; + + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 1, name_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(service_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 2, service_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(lastAuthor_)) { + com.google.protobuf.GeneratedMessageV3.writeString(output, 3, lastAuthor_); + } + if (((bitField0_ & 0x00000001) != 0)) { + output.writeMessage(4, getNotebookUpdateTime()); + } + getUnknownFields().writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(name_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, name_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(service_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, service_); + } + if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(lastAuthor_)) { + size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, lastAuthor_); + } + if (((bitField0_ & 0x00000001) != 0)) { + size += com.google.protobuf.CodedOutputStream.computeMessageSize(4, getNotebookUpdateTime()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof com.google.cloud.securitycenter.v1.Notebook)) { + return super.equals(obj); + } + com.google.cloud.securitycenter.v1.Notebook other = + (com.google.cloud.securitycenter.v1.Notebook) obj; + + if (!getName().equals(other.getName())) return false; + if (!getService().equals(other.getService())) return false; + if (!getLastAuthor().equals(other.getLastAuthor())) return false; + if (hasNotebookUpdateTime() != other.hasNotebookUpdateTime()) return false; + if (hasNotebookUpdateTime()) { + if (!getNotebookUpdateTime().equals(other.getNotebookUpdateTime())) return false; + } + if (!getUnknownFields().equals(other.getUnknownFields())) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + NAME_FIELD_NUMBER; + hash = (53 * hash) + getName().hashCode(); + hash = (37 * hash) + SERVICE_FIELD_NUMBER; + hash = (53 * hash) + getService().hashCode(); + hash = (37 * hash) + LAST_AUTHOR_FIELD_NUMBER; + hash = (53 * hash) + getLastAuthor().hashCode(); + if (hasNotebookUpdateTime()) { + hash = (37 * hash) + NOTEBOOK_UPDATE_TIME_FIELD_NUMBER; + hash = (53 * hash) + getNotebookUpdateTime().hashCode(); + } + hash = (29 * hash) + getUnknownFields().hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static com.google.cloud.securitycenter.v1.Notebook parseFrom(java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.securitycenter.v1.Notebook parseFrom( + java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.securitycenter.v1.Notebook parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.securitycenter.v1.Notebook parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.securitycenter.v1.Notebook parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + + public static com.google.cloud.securitycenter.v1.Notebook parseFrom( + byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + + public static com.google.cloud.securitycenter.v1.Notebook parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.securitycenter.v1.Notebook parseFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.securitycenter.v1.Notebook parseDelimitedFrom( + java.io.InputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); + } + + public static com.google.cloud.securitycenter.v1.Notebook parseDelimitedFrom( + java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( + PARSER, input, extensionRegistry); + } + + public static com.google.cloud.securitycenter.v1.Notebook parseFrom( + com.google.protobuf.CodedInputStream input) throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); + } + + public static com.google.cloud.securitycenter.v1.Notebook parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3.parseWithIOException( + PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { + return newBuilder(); + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(com.google.cloud.securitycenter.v1.Notebook prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * + * + *
+   * Represents a Jupyter notebook IPYNB file, such as a [Colab Enterprise
+   * notebook](https://cloud.google.com/colab/docs/introduction) file, that is
+   * associated with a finding.
+   * 
+ * + * Protobuf type {@code google.cloud.securitycenter.v1.Notebook} + */ + public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder + implements + // @@protoc_insertion_point(builder_implements:google.cloud.securitycenter.v1.Notebook) + com.google.cloud.securitycenter.v1.NotebookOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { + return com.google.cloud.securitycenter.v1.NotebookProto + .internal_static_google_cloud_securitycenter_v1_Notebook_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return com.google.cloud.securitycenter.v1.NotebookProto + .internal_static_google_cloud_securitycenter_v1_Notebook_fieldAccessorTable + .ensureFieldAccessorsInitialized( + com.google.cloud.securitycenter.v1.Notebook.class, + com.google.cloud.securitycenter.v1.Notebook.Builder.class); + } + + // Construct using com.google.cloud.securitycenter.v1.Notebook.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) { + getNotebookUpdateTimeFieldBuilder(); + } + } + + @java.lang.Override + public Builder clear() { + super.clear(); + bitField0_ = 0; + name_ = ""; + service_ = ""; + lastAuthor_ = ""; + notebookUpdateTime_ = null; + if (notebookUpdateTimeBuilder_ != null) { + notebookUpdateTimeBuilder_.dispose(); + notebookUpdateTimeBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { + return com.google.cloud.securitycenter.v1.NotebookProto + .internal_static_google_cloud_securitycenter_v1_Notebook_descriptor; + } + + @java.lang.Override + public com.google.cloud.securitycenter.v1.Notebook getDefaultInstanceForType() { + return com.google.cloud.securitycenter.v1.Notebook.getDefaultInstance(); + } + + @java.lang.Override + public com.google.cloud.securitycenter.v1.Notebook build() { + com.google.cloud.securitycenter.v1.Notebook result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public com.google.cloud.securitycenter.v1.Notebook buildPartial() { + com.google.cloud.securitycenter.v1.Notebook result = + new com.google.cloud.securitycenter.v1.Notebook(this); + if (bitField0_ != 0) { + buildPartial0(result); + } + onBuilt(); + return result; + } + + private void buildPartial0(com.google.cloud.securitycenter.v1.Notebook result) { + int from_bitField0_ = bitField0_; + if (((from_bitField0_ & 0x00000001) != 0)) { + result.name_ = name_; + } + if (((from_bitField0_ & 0x00000002) != 0)) { + result.service_ = service_; + } + if (((from_bitField0_ & 0x00000004) != 0)) { + result.lastAuthor_ = lastAuthor_; + } + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000008) != 0)) { + result.notebookUpdateTime_ = + notebookUpdateTimeBuilder_ == null + ? notebookUpdateTime_ + : notebookUpdateTimeBuilder_.build(); + to_bitField0_ |= 0x00000001; + } + result.bitField0_ |= to_bitField0_; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.setField(field, value); + } + + @java.lang.Override + public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + + @java.lang.Override + public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { + return super.addRepeatedField(field, value); + } + + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof com.google.cloud.securitycenter.v1.Notebook) { + return mergeFrom((com.google.cloud.securitycenter.v1.Notebook) other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(com.google.cloud.securitycenter.v1.Notebook other) { + if (other == com.google.cloud.securitycenter.v1.Notebook.getDefaultInstance()) return this; + if (!other.getName().isEmpty()) { + name_ = other.name_; + bitField0_ |= 0x00000001; + onChanged(); + } + if (!other.getService().isEmpty()) { + service_ = other.service_; + bitField0_ |= 0x00000002; + onChanged(); + } + if (!other.getLastAuthor().isEmpty()) { + lastAuthor_ = other.lastAuthor_; + bitField0_ |= 0x00000004; + onChanged(); + } + if (other.hasNotebookUpdateTime()) { + mergeNotebookUpdateTime(other.getNotebookUpdateTime()); + } + this.mergeUnknownFields(other.getUnknownFields()); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 10: + { + name_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000001; + break; + } // case 10 + case 18: + { + service_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000002; + break; + } // case 18 + case 26: + { + lastAuthor_ = input.readStringRequireUtf8(); + bitField0_ |= 0x00000004; + break; + } // case 26 + case 34: + { + input.readMessage( + getNotebookUpdateTimeFieldBuilder().getBuilder(), extensionRegistry); + bitField0_ |= 0x00000008; + break; + } // case 34 + default: + { + if (!super.parseUnknownField(input, extensionRegistry, tag)) { + done = true; // was an endgroup tag + } + break; + } // default: + } // switch (tag) + } // while (!done) + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.unwrapIOException(); + } finally { + onChanged(); + } // finally + return this; + } + + private int bitField0_; + + private java.lang.Object name_ = ""; + /** + * + * + *
+     * The name of the notebook.
+     * 
+ * + * string name = 1; + * + * @return The name. + */ + public java.lang.String getName() { + java.lang.Object ref = name_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + name_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The name of the notebook.
+     * 
+ * + * string name = 1; + * + * @return The bytes for name. + */ + public com.google.protobuf.ByteString getNameBytes() { + java.lang.Object ref = name_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + name_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The name of the notebook.
+     * 
+ * + * string name = 1; + * + * @param value The name to set. + * @return This builder for chaining. + */ + public Builder setName(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + /** + * + * + *
+     * The name of the notebook.
+     * 
+ * + * string name = 1; + * + * @return This builder for chaining. + */ + public Builder clearName() { + name_ = getDefaultInstance().getName(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + return this; + } + /** + * + * + *
+     * The name of the notebook.
+     * 
+ * + * string name = 1; + * + * @param value The bytes for name to set. + * @return This builder for chaining. + */ + public Builder setNameBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + name_ = value; + bitField0_ |= 0x00000001; + onChanged(); + return this; + } + + private java.lang.Object service_ = ""; + /** + * + * + *
+     * The source notebook service, for example, "Colab Enterprise".
+     * 
+ * + * string service = 2; + * + * @return The service. + */ + public java.lang.String getService() { + java.lang.Object ref = service_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + service_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The source notebook service, for example, "Colab Enterprise".
+     * 
+ * + * string service = 2; + * + * @return The bytes for service. + */ + public com.google.protobuf.ByteString getServiceBytes() { + java.lang.Object ref = service_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + service_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The source notebook service, for example, "Colab Enterprise".
+     * 
+ * + * string service = 2; + * + * @param value The service to set. + * @return This builder for chaining. + */ + public Builder setService(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + service_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + /** + * + * + *
+     * The source notebook service, for example, "Colab Enterprise".
+     * 
+ * + * string service = 2; + * + * @return This builder for chaining. + */ + public Builder clearService() { + service_ = getDefaultInstance().getService(); + bitField0_ = (bitField0_ & ~0x00000002); + onChanged(); + return this; + } + /** + * + * + *
+     * The source notebook service, for example, "Colab Enterprise".
+     * 
+ * + * string service = 2; + * + * @param value The bytes for service to set. + * @return This builder for chaining. + */ + public Builder setServiceBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + service_ = value; + bitField0_ |= 0x00000002; + onChanged(); + return this; + } + + private java.lang.Object lastAuthor_ = ""; + /** + * + * + *
+     * The user ID of the latest author to modify the notebook.
+     * 
+ * + * string last_author = 3; + * + * @return The lastAuthor. + */ + public java.lang.String getLastAuthor() { + java.lang.Object ref = lastAuthor_; + if (!(ref instanceof java.lang.String)) { + com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; + java.lang.String s = bs.toStringUtf8(); + lastAuthor_ = s; + return s; + } else { + return (java.lang.String) ref; + } + } + /** + * + * + *
+     * The user ID of the latest author to modify the notebook.
+     * 
+ * + * string last_author = 3; + * + * @return The bytes for lastAuthor. + */ + public com.google.protobuf.ByteString getLastAuthorBytes() { + java.lang.Object ref = lastAuthor_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); + lastAuthor_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + /** + * + * + *
+     * The user ID of the latest author to modify the notebook.
+     * 
+ * + * string last_author = 3; + * + * @param value The lastAuthor to set. + * @return This builder for chaining. + */ + public Builder setLastAuthor(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + lastAuthor_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + /** + * + * + *
+     * The user ID of the latest author to modify the notebook.
+     * 
+ * + * string last_author = 3; + * + * @return This builder for chaining. + */ + public Builder clearLastAuthor() { + lastAuthor_ = getDefaultInstance().getLastAuthor(); + bitField0_ = (bitField0_ & ~0x00000004); + onChanged(); + return this; + } + /** + * + * + *
+     * The user ID of the latest author to modify the notebook.
+     * 
+ * + * string last_author = 3; + * + * @param value The bytes for lastAuthor to set. + * @return This builder for chaining. + */ + public Builder setLastAuthorBytes(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + checkByteStringIsUtf8(value); + lastAuthor_ = value; + bitField0_ |= 0x00000004; + onChanged(); + return this; + } + + private com.google.protobuf.Timestamp notebookUpdateTime_; + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + notebookUpdateTimeBuilder_; + /** + * + * + *
+     * The most recent time the notebook was updated.
+     * 
+ * + * .google.protobuf.Timestamp notebook_update_time = 4; + * + * @return Whether the notebookUpdateTime field is set. + */ + public boolean hasNotebookUpdateTime() { + return ((bitField0_ & 0x00000008) != 0); + } + /** + * + * + *
+     * The most recent time the notebook was updated.
+     * 
+ * + * .google.protobuf.Timestamp notebook_update_time = 4; + * + * @return The notebookUpdateTime. + */ + public com.google.protobuf.Timestamp getNotebookUpdateTime() { + if (notebookUpdateTimeBuilder_ == null) { + return notebookUpdateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : notebookUpdateTime_; + } else { + return notebookUpdateTimeBuilder_.getMessage(); + } + } + /** + * + * + *
+     * The most recent time the notebook was updated.
+     * 
+ * + * .google.protobuf.Timestamp notebook_update_time = 4; + */ + public Builder setNotebookUpdateTime(com.google.protobuf.Timestamp value) { + if (notebookUpdateTimeBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + notebookUpdateTime_ = value; + } else { + notebookUpdateTimeBuilder_.setMessage(value); + } + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + * + * + *
+     * The most recent time the notebook was updated.
+     * 
+ * + * .google.protobuf.Timestamp notebook_update_time = 4; + */ + public Builder setNotebookUpdateTime(com.google.protobuf.Timestamp.Builder builderForValue) { + if (notebookUpdateTimeBuilder_ == null) { + notebookUpdateTime_ = builderForValue.build(); + } else { + notebookUpdateTimeBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000008; + onChanged(); + return this; + } + /** + * + * + *
+     * The most recent time the notebook was updated.
+     * 
+ * + * .google.protobuf.Timestamp notebook_update_time = 4; + */ + public Builder mergeNotebookUpdateTime(com.google.protobuf.Timestamp value) { + if (notebookUpdateTimeBuilder_ == null) { + if (((bitField0_ & 0x00000008) != 0) + && notebookUpdateTime_ != null + && notebookUpdateTime_ != com.google.protobuf.Timestamp.getDefaultInstance()) { + getNotebookUpdateTimeBuilder().mergeFrom(value); + } else { + notebookUpdateTime_ = value; + } + } else { + notebookUpdateTimeBuilder_.mergeFrom(value); + } + if (notebookUpdateTime_ != null) { + bitField0_ |= 0x00000008; + onChanged(); + } + return this; + } + /** + * + * + *
+     * The most recent time the notebook was updated.
+     * 
+ * + * .google.protobuf.Timestamp notebook_update_time = 4; + */ + public Builder clearNotebookUpdateTime() { + bitField0_ = (bitField0_ & ~0x00000008); + notebookUpdateTime_ = null; + if (notebookUpdateTimeBuilder_ != null) { + notebookUpdateTimeBuilder_.dispose(); + notebookUpdateTimeBuilder_ = null; + } + onChanged(); + return this; + } + /** + * + * + *
+     * The most recent time the notebook was updated.
+     * 
+ * + * .google.protobuf.Timestamp notebook_update_time = 4; + */ + public com.google.protobuf.Timestamp.Builder getNotebookUpdateTimeBuilder() { + bitField0_ |= 0x00000008; + onChanged(); + return getNotebookUpdateTimeFieldBuilder().getBuilder(); + } + /** + * + * + *
+     * The most recent time the notebook was updated.
+     * 
+ * + * .google.protobuf.Timestamp notebook_update_time = 4; + */ + public com.google.protobuf.TimestampOrBuilder getNotebookUpdateTimeOrBuilder() { + if (notebookUpdateTimeBuilder_ != null) { + return notebookUpdateTimeBuilder_.getMessageOrBuilder(); + } else { + return notebookUpdateTime_ == null + ? com.google.protobuf.Timestamp.getDefaultInstance() + : notebookUpdateTime_; + } + } + /** + * + * + *
+     * The most recent time the notebook was updated.
+     * 
+ * + * .google.protobuf.Timestamp notebook_update_time = 4; + */ + private com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder> + getNotebookUpdateTimeFieldBuilder() { + if (notebookUpdateTimeBuilder_ == null) { + notebookUpdateTimeBuilder_ = + new com.google.protobuf.SingleFieldBuilderV3< + com.google.protobuf.Timestamp, + com.google.protobuf.Timestamp.Builder, + com.google.protobuf.TimestampOrBuilder>( + getNotebookUpdateTime(), getParentForChildren(), isClean()); + notebookUpdateTime_ = null; + } + return notebookUpdateTimeBuilder_; + } + + @java.lang.Override + public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + // @@protoc_insertion_point(builder_scope:google.cloud.securitycenter.v1.Notebook) + } + + // @@protoc_insertion_point(class_scope:google.cloud.securitycenter.v1.Notebook) + private static final com.google.cloud.securitycenter.v1.Notebook DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new com.google.cloud.securitycenter.v1.Notebook(); + } + + public static com.google.cloud.securitycenter.v1.Notebook getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser PARSER = + new com.google.protobuf.AbstractParser() { + @java.lang.Override + public Notebook parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + Builder builder = newBuilder(); + try { + builder.mergeFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(builder.buildPartial()); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException(e) + .setUnfinishedMessage(builder.buildPartial()); + } + return builder.buildPartial(); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public com.google.cloud.securitycenter.v1.Notebook getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } +} diff --git a/java-securitycenter/proto-google-cloud-securitycenter-v1/src/main/java/com/google/cloud/securitycenter/v1/NotebookOrBuilder.java b/java-securitycenter/proto-google-cloud-securitycenter-v1/src/main/java/com/google/cloud/securitycenter/v1/NotebookOrBuilder.java new file mode 100644 index 000000000000..09a262f8bd83 --- /dev/null +++ b/java-securitycenter/proto-google-cloud-securitycenter-v1/src/main/java/com/google/cloud/securitycenter/v1/NotebookOrBuilder.java @@ -0,0 +1,136 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/securitycenter/v1/notebook.proto + +// Protobuf Java Version: 3.25.2 +package com.google.cloud.securitycenter.v1; + +public interface NotebookOrBuilder + extends + // @@protoc_insertion_point(interface_extends:google.cloud.securitycenter.v1.Notebook) + com.google.protobuf.MessageOrBuilder { + + /** + * + * + *
+   * The name of the notebook.
+   * 
+ * + * string name = 1; + * + * @return The name. + */ + java.lang.String getName(); + /** + * + * + *
+   * The name of the notebook.
+   * 
+ * + * string name = 1; + * + * @return The bytes for name. + */ + com.google.protobuf.ByteString getNameBytes(); + + /** + * + * + *
+   * The source notebook service, for example, "Colab Enterprise".
+   * 
+ * + * string service = 2; + * + * @return The service. + */ + java.lang.String getService(); + /** + * + * + *
+   * The source notebook service, for example, "Colab Enterprise".
+   * 
+ * + * string service = 2; + * + * @return The bytes for service. + */ + com.google.protobuf.ByteString getServiceBytes(); + + /** + * + * + *
+   * The user ID of the latest author to modify the notebook.
+   * 
+ * + * string last_author = 3; + * + * @return The lastAuthor. + */ + java.lang.String getLastAuthor(); + /** + * + * + *
+   * The user ID of the latest author to modify the notebook.
+   * 
+ * + * string last_author = 3; + * + * @return The bytes for lastAuthor. + */ + com.google.protobuf.ByteString getLastAuthorBytes(); + + /** + * + * + *
+   * The most recent time the notebook was updated.
+   * 
+ * + * .google.protobuf.Timestamp notebook_update_time = 4; + * + * @return Whether the notebookUpdateTime field is set. + */ + boolean hasNotebookUpdateTime(); + /** + * + * + *
+   * The most recent time the notebook was updated.
+   * 
+ * + * .google.protobuf.Timestamp notebook_update_time = 4; + * + * @return The notebookUpdateTime. + */ + com.google.protobuf.Timestamp getNotebookUpdateTime(); + /** + * + * + *
+   * The most recent time the notebook was updated.
+   * 
+ * + * .google.protobuf.Timestamp notebook_update_time = 4; + */ + com.google.protobuf.TimestampOrBuilder getNotebookUpdateTimeOrBuilder(); +} diff --git a/java-securitycenter/proto-google-cloud-securitycenter-v1/src/main/java/com/google/cloud/securitycenter/v1/NotebookProto.java b/java-securitycenter/proto-google-cloud-securitycenter-v1/src/main/java/com/google/cloud/securitycenter/v1/NotebookProto.java new file mode 100644 index 000000000000..067b4b57a86f --- /dev/null +++ b/java-securitycenter/proto-google-cloud-securitycenter-v1/src/main/java/com/google/cloud/securitycenter/v1/NotebookProto.java @@ -0,0 +1,75 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: google/cloud/securitycenter/v1/notebook.proto + +// Protobuf Java Version: 3.25.2 +package com.google.cloud.securitycenter.v1; + +public final class NotebookProto { + private NotebookProto() {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) {} + + public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry); + } + + static final com.google.protobuf.Descriptors.Descriptor + internal_static_google_cloud_securitycenter_v1_Notebook_descriptor; + static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_google_cloud_securitycenter_v1_Notebook_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + return descriptor; + } + + private static com.google.protobuf.Descriptors.FileDescriptor descriptor; + + static { + java.lang.String[] descriptorData = { + "\n-google/cloud/securitycenter/v1/noteboo" + + "k.proto\022\036google.cloud.securitycenter.v1\032" + + "\037google/protobuf/timestamp.proto\"x\n\010Note" + + "book\022\014\n\004name\030\001 \001(\t\022\017\n\007service\030\002 \001(\t\022\023\n\013l" + + "ast_author\030\003 \001(\t\0228\n\024notebook_update_time" + + "\030\004 \001(\0132\032.google.protobuf.TimestampB\347\001\n\"c" + + "om.google.cloud.securitycenter.v1B\rNoteb" + + "ookProtoP\001ZJcloud.google.com/go/security" + + "center/apiv1/securitycenterpb;securityce" + + "nterpb\252\002\036Google.Cloud.SecurityCenter.V1\312" + + "\002\036Google\\Cloud\\SecurityCenter\\V1\352\002!Googl" + + "e::Cloud::SecurityCenter::V1b\006proto3" + }; + descriptor = + com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( + descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + com.google.protobuf.TimestampProto.getDescriptor(), + }); + internal_static_google_cloud_securitycenter_v1_Notebook_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_google_cloud_securitycenter_v1_Notebook_fieldAccessorTable = + new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_google_cloud_securitycenter_v1_Notebook_descriptor, + new java.lang.String[] { + "Name", "Service", "LastAuthor", "NotebookUpdateTime", + }); + com.google.protobuf.TimestampProto.getDescriptor(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/java-securitycenter/proto-google-cloud-securitycenter-v1/src/main/proto/google/cloud/securitycenter/v1/finding.proto b/java-securitycenter/proto-google-cloud-securitycenter-v1/src/main/proto/google/cloud/securitycenter/v1/finding.proto index c79a1e319663..a1dc60f9b68a 100644 --- a/java-securitycenter/proto-google-cloud-securitycenter-v1/src/main/proto/google/cloud/securitycenter/v1/finding.proto +++ b/java-securitycenter/proto-google-cloud-securitycenter-v1/src/main/proto/google/cloud/securitycenter/v1/finding.proto @@ -38,6 +38,7 @@ import "google/cloud/securitycenter/v1/kubernetes.proto"; import "google/cloud/securitycenter/v1/load_balancer.proto"; import "google/cloud/securitycenter/v1/log_entry.proto"; import "google/cloud/securitycenter/v1/mitre_attack.proto"; +import "google/cloud/securitycenter/v1/notebook.proto"; import "google/cloud/securitycenter/v1/org_policy.proto"; import "google/cloud/securitycenter/v1/process.proto"; import "google/cloud/securitycenter/v1/security_marks.proto"; @@ -387,4 +388,7 @@ message Finding { // The load balancers associated with the finding. repeated LoadBalancer load_balancers = 58; + + // Notebook associated with the finding. + Notebook notebook = 63; } diff --git a/java-securitycenter/proto-google-cloud-securitycenter-v1/src/main/proto/google/cloud/securitycenter/v1/notebook.proto b/java-securitycenter/proto-google-cloud-securitycenter-v1/src/main/proto/google/cloud/securitycenter/v1/notebook.proto new file mode 100644 index 000000000000..d554ef9054a4 --- /dev/null +++ b/java-securitycenter/proto-google-cloud-securitycenter-v1/src/main/proto/google/cloud/securitycenter/v1/notebook.proto @@ -0,0 +1,44 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.securitycenter.v1; + +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.SecurityCenter.V1"; +option go_package = "cloud.google.com/go/securitycenter/apiv1/securitycenterpb;securitycenterpb"; +option java_multiple_files = true; +option java_outer_classname = "NotebookProto"; +option java_package = "com.google.cloud.securitycenter.v1"; +option php_namespace = "Google\\Cloud\\SecurityCenter\\V1"; +option ruby_package = "Google::Cloud::SecurityCenter::V1"; + +// Represents a Jupyter notebook IPYNB file, such as a [Colab Enterprise +// notebook](https://cloud.google.com/colab/docs/introduction) file, that is +// associated with a finding. +message Notebook { + // The name of the notebook. + string name = 1; + + // The source notebook service, for example, "Colab Enterprise". + string service = 2; + + // The user ID of the latest author to modify the notebook. + string last_author = 3; + + // The most recent time the notebook was updated. + google.protobuf.Timestamp notebook_update_time = 4; +}