All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.google.cloud.bigquery.reservation.v1.ReservationServiceClient Maven / Gradle / Ivy

/*
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.google.cloud.bigquery.reservation.v1;

import com.google.api.core.ApiFuture;
import com.google.api.core.ApiFutures;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.paging.AbstractFixedSizeCollection;
import com.google.api.gax.paging.AbstractPage;
import com.google.api.gax.paging.AbstractPagedListResponse;
import com.google.api.gax.rpc.PageContext;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.cloud.bigquery.reservation.v1.stub.ReservationServiceStub;
import com.google.cloud.bigquery.reservation.v1.stub.ReservationServiceStubSettings;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.protobuf.Empty;
import com.google.protobuf.FieldMask;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.TimeUnit;
import javax.annotation.Generated;

// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
 * Service Description: This API allows users to manage their BigQuery reservations.
 *
 * 

A reservation provides computational resource guarantees, in the form of * [slots](https://cloud.google.com/bigquery/docs/slots), to users. A slot is a unit of * computational power in BigQuery, and serves as the basic unit of parallelism. In a scan of a * multi-partitioned table, a single slot operates on a single partition of the table. A reservation * resource exists as a child resource of the admin project and location, e.g.: * `projects/myproject/locations/US/reservations/reservationName`. * *

A capacity commitment is a way to purchase compute capacity for BigQuery jobs (in the form of * slots) with some committed period of usage. A capacity commitment resource exists as a child * resource of the admin project and location, e.g.: * `projects/myproject/locations/US/capacityCommitments/id`. * *

This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * *

{@code
 * // This snippet has been automatically generated 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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
 *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
 *   Reservation reservation = Reservation.newBuilder().build();
 *   String reservationId = "reservationId1116965383";
 *   Reservation response =
 *       reservationServiceClient.createReservation(parent, reservation, reservationId);
 * }
 * }
* *

Note: close() needs to be called on the ReservationServiceClient object to clean up resources * such as threads. In the example above, try-with-resources is used, which automatically calls * close(). * *

The surface of this class includes several types of Java methods for each of the API's * methods: * *

    *
  1. A "flattened" method. With this type of method, the fields of the request type have been * converted into function parameters. It may be the case that not all fields are available as * parameters, and not every API method will have a flattened method entry point. *
  2. A "request object" method. This type of method only takes one parameter, a request object, * which must be constructed before the call. Not every API method will have a request object * method. *
  3. A "callable" method. This type of method takes no parameters and returns an immutable API * callable object, which can be used to initiate calls to the service. *
* *

See the individual methods for example code. * *

Many parameters require resource names to be formatted in a particular way. To assist with * these names, this class includes a format method for each type of name, and additionally a parse * method to extract the individual identifiers contained within names that are returned. * *

This class can be customized by passing in a custom instance of ReservationServiceSettings to * create(). For example: * *

To customize credentials: * *

{@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
 * ReservationServiceSettings reservationServiceSettings =
 *     ReservationServiceSettings.newBuilder()
 *         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
 *         .build();
 * ReservationServiceClient reservationServiceClient =
 *     ReservationServiceClient.create(reservationServiceSettings);
 * }
* *

To customize the endpoint: * *

{@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
 * ReservationServiceSettings reservationServiceSettings =
 *     ReservationServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
 * ReservationServiceClient reservationServiceClient =
 *     ReservationServiceClient.create(reservationServiceSettings);
 * }
* *

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over * the wire: * *

{@code
 * // This snippet has been automatically generated 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
 * ReservationServiceSettings reservationServiceSettings =
 *     ReservationServiceSettings.newHttpJsonBuilder().build();
 * ReservationServiceClient reservationServiceClient =
 *     ReservationServiceClient.create(reservationServiceSettings);
 * }
* *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ @Generated("by gapic-generator-java") public class ReservationServiceClient implements BackgroundResource { private final ReservationServiceSettings settings; private final ReservationServiceStub stub; /** Constructs an instance of ReservationServiceClient with default settings. */ public static final ReservationServiceClient create() throws IOException { return create(ReservationServiceSettings.newBuilder().build()); } /** * Constructs an instance of ReservationServiceClient, using the given settings. The channels are * created based on the settings passed in, or defaults for any settings that are not set. */ public static final ReservationServiceClient create(ReservationServiceSettings settings) throws IOException { return new ReservationServiceClient(settings); } /** * Constructs an instance of ReservationServiceClient, using the given stub for making calls. This * is for advanced usage - prefer using create(ReservationServiceSettings). */ public static final ReservationServiceClient create(ReservationServiceStub stub) { return new ReservationServiceClient(stub); } /** * Constructs an instance of ReservationServiceClient, using the given settings. This is protected * so that it is easy to make a subclass, but otherwise, the static factory methods should be * preferred. */ protected ReservationServiceClient(ReservationServiceSettings settings) throws IOException { this.settings = settings; this.stub = ((ReservationServiceStubSettings) settings.getStubSettings()).createStub(); } protected ReservationServiceClient(ReservationServiceStub stub) { this.settings = null; this.stub = stub; } public final ReservationServiceSettings getSettings() { return settings; } public ReservationServiceStub getStub() { return stub; } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new reservation resource. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   *   Reservation reservation = Reservation.newBuilder().build();
   *   String reservationId = "reservationId1116965383";
   *   Reservation response =
   *       reservationServiceClient.createReservation(parent, reservation, reservationId);
   * }
   * }
* * @param parent Required. Project, location. E.g., `projects/myproject/locations/US` * @param reservation Definition of the new reservation to create. * @param reservationId The reservation ID. It must only contain lower case alphanumeric * characters or dashes. It must start with a letter and must not end with a dash. Its maximum * length is 64 characters. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Reservation createReservation( LocationName parent, Reservation reservation, String reservationId) { CreateReservationRequest request = CreateReservationRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setReservation(reservation) .setReservationId(reservationId) .build(); return createReservation(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new reservation resource. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   *   Reservation reservation = Reservation.newBuilder().build();
   *   String reservationId = "reservationId1116965383";
   *   Reservation response =
   *       reservationServiceClient.createReservation(parent, reservation, reservationId);
   * }
   * }
* * @param parent Required. Project, location. E.g., `projects/myproject/locations/US` * @param reservation Definition of the new reservation to create. * @param reservationId The reservation ID. It must only contain lower case alphanumeric * characters or dashes. It must start with a letter and must not end with a dash. Its maximum * length is 64 characters. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Reservation createReservation( String parent, Reservation reservation, String reservationId) { CreateReservationRequest request = CreateReservationRequest.newBuilder() .setParent(parent) .setReservation(reservation) .setReservationId(reservationId) .build(); return createReservation(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new reservation resource. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   CreateReservationRequest request =
   *       CreateReservationRequest.newBuilder()
   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
   *           .setReservationId("reservationId1116965383")
   *           .setReservation(Reservation.newBuilder().build())
   *           .build();
   *   Reservation response = reservationServiceClient.createReservation(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 Reservation createReservation(CreateReservationRequest request) { return createReservationCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new reservation resource. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   CreateReservationRequest request =
   *       CreateReservationRequest.newBuilder()
   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
   *           .setReservationId("reservationId1116965383")
   *           .setReservation(Reservation.newBuilder().build())
   *           .build();
   *   ApiFuture future =
   *       reservationServiceClient.createReservationCallable().futureCall(request);
   *   // Do something.
   *   Reservation response = future.get();
   * }
   * }
*/ public final UnaryCallable createReservationCallable() { return stub.createReservationCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists all the reservations for the project in the specified 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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   *   for (Reservation element : reservationServiceClient.listReservations(parent).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
* * @param parent Required. The parent resource name containing project and location, e.g.: * `projects/myproject/locations/US` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListReservationsPagedResponse listReservations(LocationName parent) { ListReservationsRequest request = ListReservationsRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .build(); return listReservations(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists all the reservations for the project in the specified 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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   *   for (Reservation element : reservationServiceClient.listReservations(parent).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
* * @param parent Required. The parent resource name containing project and location, e.g.: * `projects/myproject/locations/US` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListReservationsPagedResponse listReservations(String parent) { ListReservationsRequest request = ListReservationsRequest.newBuilder().setParent(parent).build(); return listReservations(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists all the reservations for the project in the specified 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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   ListReservationsRequest request =
   *       ListReservationsRequest.newBuilder()
   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   for (Reservation element : reservationServiceClient.listReservations(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 ListReservationsPagedResponse listReservations(ListReservationsRequest request) { return listReservationsPagedCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists all the reservations for the project in the specified 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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   ListReservationsRequest request =
   *       ListReservationsRequest.newBuilder()
   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   ApiFuture future =
   *       reservationServiceClient.listReservationsPagedCallable().futureCall(request);
   *   // Do something.
   *   for (Reservation element : future.get().iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
*/ public final UnaryCallable listReservationsPagedCallable() { return stub.listReservationsPagedCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists all the reservations for the project in the specified 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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   ListReservationsRequest request =
   *       ListReservationsRequest.newBuilder()
   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   while (true) {
   *     ListReservationsResponse response =
   *         reservationServiceClient.listReservationsCallable().call(request);
   *     for (Reservation element : response.getReservationsList()) {
   *       // doThingsWith(element);
   *     }
   *     String nextPageToken = response.getNextPageToken();
   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
   *       request = request.toBuilder().setPageToken(nextPageToken).build();
   *     } else {
   *       break;
   *     }
   *   }
   * }
   * }
*/ public final UnaryCallable listReservationsCallable() { return stub.listReservationsCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns information about the reservation. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   ReservationName name = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]");
   *   Reservation response = reservationServiceClient.getReservation(name);
   * }
   * }
* * @param name Required. Resource name of the reservation to retrieve. E.g., * `projects/myproject/locations/US/reservations/team1-prod` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Reservation getReservation(ReservationName name) { GetReservationRequest request = GetReservationRequest.newBuilder().setName(name == null ? null : name.toString()).build(); return getReservation(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns information about the reservation. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   String name = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString();
   *   Reservation response = reservationServiceClient.getReservation(name);
   * }
   * }
* * @param name Required. Resource name of the reservation to retrieve. E.g., * `projects/myproject/locations/US/reservations/team1-prod` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Reservation getReservation(String name) { GetReservationRequest request = GetReservationRequest.newBuilder().setName(name).build(); return getReservation(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns information about the reservation. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   GetReservationRequest request =
   *       GetReservationRequest.newBuilder()
   *           .setName(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString())
   *           .build();
   *   Reservation response = reservationServiceClient.getReservation(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 Reservation getReservation(GetReservationRequest request) { return getReservationCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns information about the reservation. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   GetReservationRequest request =
   *       GetReservationRequest.newBuilder()
   *           .setName(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString())
   *           .build();
   *   ApiFuture future =
   *       reservationServiceClient.getReservationCallable().futureCall(request);
   *   // Do something.
   *   Reservation response = future.get();
   * }
   * }
*/ public final UnaryCallable getReservationCallable() { return stub.getReservationCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a reservation. Returns `google.rpc.Code.FAILED_PRECONDITION` when reservation has * assignments. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   ReservationName name = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]");
   *   reservationServiceClient.deleteReservation(name);
   * }
   * }
* * @param name Required. Resource name of the reservation to retrieve. E.g., * `projects/myproject/locations/US/reservations/team1-prod` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final void deleteReservation(ReservationName name) { DeleteReservationRequest request = DeleteReservationRequest.newBuilder() .setName(name == null ? null : name.toString()) .build(); deleteReservation(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a reservation. Returns `google.rpc.Code.FAILED_PRECONDITION` when reservation has * assignments. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   String name = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString();
   *   reservationServiceClient.deleteReservation(name);
   * }
   * }
* * @param name Required. Resource name of the reservation to retrieve. E.g., * `projects/myproject/locations/US/reservations/team1-prod` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final void deleteReservation(String name) { DeleteReservationRequest request = DeleteReservationRequest.newBuilder().setName(name).build(); deleteReservation(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a reservation. Returns `google.rpc.Code.FAILED_PRECONDITION` when reservation has * assignments. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   DeleteReservationRequest request =
   *       DeleteReservationRequest.newBuilder()
   *           .setName(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString())
   *           .build();
   *   reservationServiceClient.deleteReservation(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 void deleteReservation(DeleteReservationRequest request) { deleteReservationCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a reservation. Returns `google.rpc.Code.FAILED_PRECONDITION` when reservation has * assignments. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   DeleteReservationRequest request =
   *       DeleteReservationRequest.newBuilder()
   *           .setName(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString())
   *           .build();
   *   ApiFuture future =
   *       reservationServiceClient.deleteReservationCallable().futureCall(request);
   *   // Do something.
   *   future.get();
   * }
   * }
*/ public final UnaryCallable deleteReservationCallable() { return stub.deleteReservationCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates an existing reservation resource. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   Reservation reservation = Reservation.newBuilder().build();
   *   FieldMask updateMask = FieldMask.newBuilder().build();
   *   Reservation response = reservationServiceClient.updateReservation(reservation, updateMask);
   * }
   * }
* * @param reservation Content of the reservation to update. * @param updateMask Standard field mask for the set of fields to be updated. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Reservation updateReservation(Reservation reservation, FieldMask updateMask) { UpdateReservationRequest request = UpdateReservationRequest.newBuilder() .setReservation(reservation) .setUpdateMask(updateMask) .build(); return updateReservation(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates an existing reservation resource. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   UpdateReservationRequest request =
   *       UpdateReservationRequest.newBuilder()
   *           .setReservation(Reservation.newBuilder().build())
   *           .setUpdateMask(FieldMask.newBuilder().build())
   *           .build();
   *   Reservation response = reservationServiceClient.updateReservation(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 Reservation updateReservation(UpdateReservationRequest request) { return updateReservationCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates an existing reservation resource. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   UpdateReservationRequest request =
   *       UpdateReservationRequest.newBuilder()
   *           .setReservation(Reservation.newBuilder().build())
   *           .setUpdateMask(FieldMask.newBuilder().build())
   *           .build();
   *   ApiFuture future =
   *       reservationServiceClient.updateReservationCallable().futureCall(request);
   *   // Do something.
   *   Reservation response = future.get();
   * }
   * }
*/ public final UnaryCallable updateReservationCallable() { return stub.updateReservationCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new capacity commitment resource. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   *   CapacityCommitment capacityCommitment = CapacityCommitment.newBuilder().build();
   *   CapacityCommitment response =
   *       reservationServiceClient.createCapacityCommitment(parent, capacityCommitment);
   * }
   * }
* * @param parent Required. Resource name of the parent reservation. E.g., * `projects/myproject/locations/US` * @param capacityCommitment Content of the capacity commitment to create. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final CapacityCommitment createCapacityCommitment( LocationName parent, CapacityCommitment capacityCommitment) { CreateCapacityCommitmentRequest request = CreateCapacityCommitmentRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setCapacityCommitment(capacityCommitment) .build(); return createCapacityCommitment(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new capacity commitment resource. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   *   CapacityCommitment capacityCommitment = CapacityCommitment.newBuilder().build();
   *   CapacityCommitment response =
   *       reservationServiceClient.createCapacityCommitment(parent, capacityCommitment);
   * }
   * }
* * @param parent Required. Resource name of the parent reservation. E.g., * `projects/myproject/locations/US` * @param capacityCommitment Content of the capacity commitment to create. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final CapacityCommitment createCapacityCommitment( String parent, CapacityCommitment capacityCommitment) { CreateCapacityCommitmentRequest request = CreateCapacityCommitmentRequest.newBuilder() .setParent(parent) .setCapacityCommitment(capacityCommitment) .build(); return createCapacityCommitment(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new capacity commitment resource. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   CreateCapacityCommitmentRequest request =
   *       CreateCapacityCommitmentRequest.newBuilder()
   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
   *           .setCapacityCommitment(CapacityCommitment.newBuilder().build())
   *           .setEnforceSingleAdminProjectPerOrg(true)
   *           .setCapacityCommitmentId("capacityCommitmentId1185645802")
   *           .build();
   *   CapacityCommitment response = reservationServiceClient.createCapacityCommitment(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 CapacityCommitment createCapacityCommitment( CreateCapacityCommitmentRequest request) { return createCapacityCommitmentCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates a new capacity commitment resource. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   CreateCapacityCommitmentRequest request =
   *       CreateCapacityCommitmentRequest.newBuilder()
   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
   *           .setCapacityCommitment(CapacityCommitment.newBuilder().build())
   *           .setEnforceSingleAdminProjectPerOrg(true)
   *           .setCapacityCommitmentId("capacityCommitmentId1185645802")
   *           .build();
   *   ApiFuture future =
   *       reservationServiceClient.createCapacityCommitmentCallable().futureCall(request);
   *   // Do something.
   *   CapacityCommitment response = future.get();
   * }
   * }
*/ public final UnaryCallable createCapacityCommitmentCallable() { return stub.createCapacityCommitmentCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists all the capacity commitments for the admin project. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   *   for (CapacityCommitment element :
   *       reservationServiceClient.listCapacityCommitments(parent).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
* * @param parent Required. Resource name of the parent reservation. E.g., * `projects/myproject/locations/US` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListCapacityCommitmentsPagedResponse listCapacityCommitments(LocationName parent) { ListCapacityCommitmentsRequest request = ListCapacityCommitmentsRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .build(); return listCapacityCommitments(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists all the capacity commitments for the admin project. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   *   for (CapacityCommitment element :
   *       reservationServiceClient.listCapacityCommitments(parent).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
* * @param parent Required. Resource name of the parent reservation. E.g., * `projects/myproject/locations/US` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListCapacityCommitmentsPagedResponse listCapacityCommitments(String parent) { ListCapacityCommitmentsRequest request = ListCapacityCommitmentsRequest.newBuilder().setParent(parent).build(); return listCapacityCommitments(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists all the capacity commitments for the admin project. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   ListCapacityCommitmentsRequest request =
   *       ListCapacityCommitmentsRequest.newBuilder()
   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   for (CapacityCommitment element :
   *       reservationServiceClient.listCapacityCommitments(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 ListCapacityCommitmentsPagedResponse listCapacityCommitments( ListCapacityCommitmentsRequest request) { return listCapacityCommitmentsPagedCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists all the capacity commitments for the admin project. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   ListCapacityCommitmentsRequest request =
   *       ListCapacityCommitmentsRequest.newBuilder()
   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   ApiFuture future =
   *       reservationServiceClient.listCapacityCommitmentsPagedCallable().futureCall(request);
   *   // Do something.
   *   for (CapacityCommitment element : future.get().iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
*/ public final UnaryCallable listCapacityCommitmentsPagedCallable() { return stub.listCapacityCommitmentsPagedCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists all the capacity commitments for the admin project. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   ListCapacityCommitmentsRequest request =
   *       ListCapacityCommitmentsRequest.newBuilder()
   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   while (true) {
   *     ListCapacityCommitmentsResponse response =
   *         reservationServiceClient.listCapacityCommitmentsCallable().call(request);
   *     for (CapacityCommitment element : response.getCapacityCommitmentsList()) {
   *       // doThingsWith(element);
   *     }
   *     String nextPageToken = response.getNextPageToken();
   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
   *       request = request.toBuilder().setPageToken(nextPageToken).build();
   *     } else {
   *       break;
   *     }
   *   }
   * }
   * }
*/ public final UnaryCallable listCapacityCommitmentsCallable() { return stub.listCapacityCommitmentsCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns information about the capacity commitment. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   CapacityCommitmentName name =
   *       CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]");
   *   CapacityCommitment response = reservationServiceClient.getCapacityCommitment(name);
   * }
   * }
* * @param name Required. Resource name of the capacity commitment to retrieve. E.g., * `projects/myproject/locations/US/capacityCommitments/123` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final CapacityCommitment getCapacityCommitment(CapacityCommitmentName name) { GetCapacityCommitmentRequest request = GetCapacityCommitmentRequest.newBuilder() .setName(name == null ? null : name.toString()) .build(); return getCapacityCommitment(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns information about the capacity commitment. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   String name =
   *       CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]").toString();
   *   CapacityCommitment response = reservationServiceClient.getCapacityCommitment(name);
   * }
   * }
* * @param name Required. Resource name of the capacity commitment to retrieve. E.g., * `projects/myproject/locations/US/capacityCommitments/123` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final CapacityCommitment getCapacityCommitment(String name) { GetCapacityCommitmentRequest request = GetCapacityCommitmentRequest.newBuilder().setName(name).build(); return getCapacityCommitment(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns information about the capacity commitment. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   GetCapacityCommitmentRequest request =
   *       GetCapacityCommitmentRequest.newBuilder()
   *           .setName(
   *               CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]")
   *                   .toString())
   *           .build();
   *   CapacityCommitment response = reservationServiceClient.getCapacityCommitment(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 CapacityCommitment getCapacityCommitment(GetCapacityCommitmentRequest request) { return getCapacityCommitmentCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Returns information about the capacity commitment. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   GetCapacityCommitmentRequest request =
   *       GetCapacityCommitmentRequest.newBuilder()
   *           .setName(
   *               CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]")
   *                   .toString())
   *           .build();
   *   ApiFuture future =
   *       reservationServiceClient.getCapacityCommitmentCallable().futureCall(request);
   *   // Do something.
   *   CapacityCommitment response = future.get();
   * }
   * }
*/ public final UnaryCallable getCapacityCommitmentCallable() { return stub.getCapacityCommitmentCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a capacity commitment. Attempting to delete capacity commitment before its * commitment_end_time will fail with the error code `google.rpc.Code.FAILED_PRECONDITION`. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   CapacityCommitmentName name =
   *       CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]");
   *   reservationServiceClient.deleteCapacityCommitment(name);
   * }
   * }
* * @param name Required. Resource name of the capacity commitment to delete. E.g., * `projects/myproject/locations/US/capacityCommitments/123` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final void deleteCapacityCommitment(CapacityCommitmentName name) { DeleteCapacityCommitmentRequest request = DeleteCapacityCommitmentRequest.newBuilder() .setName(name == null ? null : name.toString()) .build(); deleteCapacityCommitment(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a capacity commitment. Attempting to delete capacity commitment before its * commitment_end_time will fail with the error code `google.rpc.Code.FAILED_PRECONDITION`. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   String name =
   *       CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]").toString();
   *   reservationServiceClient.deleteCapacityCommitment(name);
   * }
   * }
* * @param name Required. Resource name of the capacity commitment to delete. E.g., * `projects/myproject/locations/US/capacityCommitments/123` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final void deleteCapacityCommitment(String name) { DeleteCapacityCommitmentRequest request = DeleteCapacityCommitmentRequest.newBuilder().setName(name).build(); deleteCapacityCommitment(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a capacity commitment. Attempting to delete capacity commitment before its * commitment_end_time will fail with the error code `google.rpc.Code.FAILED_PRECONDITION`. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   DeleteCapacityCommitmentRequest request =
   *       DeleteCapacityCommitmentRequest.newBuilder()
   *           .setName(
   *               CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]")
   *                   .toString())
   *           .setForce(true)
   *           .build();
   *   reservationServiceClient.deleteCapacityCommitment(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 void deleteCapacityCommitment(DeleteCapacityCommitmentRequest request) { deleteCapacityCommitmentCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a capacity commitment. Attempting to delete capacity commitment before its * commitment_end_time will fail with the error code `google.rpc.Code.FAILED_PRECONDITION`. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   DeleteCapacityCommitmentRequest request =
   *       DeleteCapacityCommitmentRequest.newBuilder()
   *           .setName(
   *               CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]")
   *                   .toString())
   *           .setForce(true)
   *           .build();
   *   ApiFuture future =
   *       reservationServiceClient.deleteCapacityCommitmentCallable().futureCall(request);
   *   // Do something.
   *   future.get();
   * }
   * }
*/ public final UnaryCallable deleteCapacityCommitmentCallable() { return stub.deleteCapacityCommitmentCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates an existing capacity commitment. * *

Only `plan` and `renewal_plan` fields can be updated. * *

Plan can only be changed to a plan of a longer commitment period. Attempting to change to a * plan with shorter commitment period will fail with the error code * `google.rpc.Code.FAILED_PRECONDITION`. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   CapacityCommitment capacityCommitment = CapacityCommitment.newBuilder().build();
   *   FieldMask updateMask = FieldMask.newBuilder().build();
   *   CapacityCommitment response =
   *       reservationServiceClient.updateCapacityCommitment(capacityCommitment, updateMask);
   * }
   * }
* * @param capacityCommitment Content of the capacity commitment to update. * @param updateMask Standard field mask for the set of fields to be updated. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final CapacityCommitment updateCapacityCommitment( CapacityCommitment capacityCommitment, FieldMask updateMask) { UpdateCapacityCommitmentRequest request = UpdateCapacityCommitmentRequest.newBuilder() .setCapacityCommitment(capacityCommitment) .setUpdateMask(updateMask) .build(); return updateCapacityCommitment(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates an existing capacity commitment. * *

Only `plan` and `renewal_plan` fields can be updated. * *

Plan can only be changed to a plan of a longer commitment period. Attempting to change to a * plan with shorter commitment period will fail with the error code * `google.rpc.Code.FAILED_PRECONDITION`. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   UpdateCapacityCommitmentRequest request =
   *       UpdateCapacityCommitmentRequest.newBuilder()
   *           .setCapacityCommitment(CapacityCommitment.newBuilder().build())
   *           .setUpdateMask(FieldMask.newBuilder().build())
   *           .build();
   *   CapacityCommitment response = reservationServiceClient.updateCapacityCommitment(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 CapacityCommitment updateCapacityCommitment( UpdateCapacityCommitmentRequest request) { return updateCapacityCommitmentCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates an existing capacity commitment. * *

Only `plan` and `renewal_plan` fields can be updated. * *

Plan can only be changed to a plan of a longer commitment period. Attempting to change to a * plan with shorter commitment period will fail with the error code * `google.rpc.Code.FAILED_PRECONDITION`. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   UpdateCapacityCommitmentRequest request =
   *       UpdateCapacityCommitmentRequest.newBuilder()
   *           .setCapacityCommitment(CapacityCommitment.newBuilder().build())
   *           .setUpdateMask(FieldMask.newBuilder().build())
   *           .build();
   *   ApiFuture future =
   *       reservationServiceClient.updateCapacityCommitmentCallable().futureCall(request);
   *   // Do something.
   *   CapacityCommitment response = future.get();
   * }
   * }
*/ public final UnaryCallable updateCapacityCommitmentCallable() { return stub.updateCapacityCommitmentCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Splits capacity commitment to two commitments of the same plan and `commitment_end_time`. * *

A common use case is to enable downgrading commitments. * *

For example, in order to downgrade from 10000 slots to 8000, you might split a 10000 * capacity commitment into commitments of 2000 and 8000. Then, you delete the first one after the * commitment end time passes. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   CapacityCommitmentName name =
   *       CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]");
   *   long slotCount = -191518834;
   *   SplitCapacityCommitmentResponse response =
   *       reservationServiceClient.splitCapacityCommitment(name, slotCount);
   * }
   * }
* * @param name Required. The resource name e.g.,: * `projects/myproject/locations/US/capacityCommitments/123` * @param slotCount Number of slots in the capacity commitment after the split. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final SplitCapacityCommitmentResponse splitCapacityCommitment( CapacityCommitmentName name, long slotCount) { SplitCapacityCommitmentRequest request = SplitCapacityCommitmentRequest.newBuilder() .setName(name == null ? null : name.toString()) .setSlotCount(slotCount) .build(); return splitCapacityCommitment(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Splits capacity commitment to two commitments of the same plan and `commitment_end_time`. * *

A common use case is to enable downgrading commitments. * *

For example, in order to downgrade from 10000 slots to 8000, you might split a 10000 * capacity commitment into commitments of 2000 and 8000. Then, you delete the first one after the * commitment end time passes. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   String name =
   *       CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]").toString();
   *   long slotCount = -191518834;
   *   SplitCapacityCommitmentResponse response =
   *       reservationServiceClient.splitCapacityCommitment(name, slotCount);
   * }
   * }
* * @param name Required. The resource name e.g.,: * `projects/myproject/locations/US/capacityCommitments/123` * @param slotCount Number of slots in the capacity commitment after the split. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final SplitCapacityCommitmentResponse splitCapacityCommitment( String name, long slotCount) { SplitCapacityCommitmentRequest request = SplitCapacityCommitmentRequest.newBuilder().setName(name).setSlotCount(slotCount).build(); return splitCapacityCommitment(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Splits capacity commitment to two commitments of the same plan and `commitment_end_time`. * *

A common use case is to enable downgrading commitments. * *

For example, in order to downgrade from 10000 slots to 8000, you might split a 10000 * capacity commitment into commitments of 2000 and 8000. Then, you delete the first one after the * commitment end time passes. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   SplitCapacityCommitmentRequest request =
   *       SplitCapacityCommitmentRequest.newBuilder()
   *           .setName(
   *               CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]")
   *                   .toString())
   *           .setSlotCount(-191518834)
   *           .build();
   *   SplitCapacityCommitmentResponse response =
   *       reservationServiceClient.splitCapacityCommitment(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 SplitCapacityCommitmentResponse splitCapacityCommitment( SplitCapacityCommitmentRequest request) { return splitCapacityCommitmentCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Splits capacity commitment to two commitments of the same plan and `commitment_end_time`. * *

A common use case is to enable downgrading commitments. * *

For example, in order to downgrade from 10000 slots to 8000, you might split a 10000 * capacity commitment into commitments of 2000 and 8000. Then, you delete the first one after the * commitment end time passes. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   SplitCapacityCommitmentRequest request =
   *       SplitCapacityCommitmentRequest.newBuilder()
   *           .setName(
   *               CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]")
   *                   .toString())
   *           .setSlotCount(-191518834)
   *           .build();
   *   ApiFuture future =
   *       reservationServiceClient.splitCapacityCommitmentCallable().futureCall(request);
   *   // Do something.
   *   SplitCapacityCommitmentResponse response = future.get();
   * }
   * }
*/ public final UnaryCallable splitCapacityCommitmentCallable() { return stub.splitCapacityCommitmentCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Merges capacity commitments of the same plan into a single commitment. * *

The resulting capacity commitment has the greater commitment_end_time out of the * to-be-merged capacity commitments. * *

Attempting to merge capacity commitments of different plan will fail with the error code * `google.rpc.Code.FAILED_PRECONDITION`. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   *   List capacityCommitmentIds = new ArrayList<>();
   *   CapacityCommitment response =
   *       reservationServiceClient.mergeCapacityCommitments(parent, capacityCommitmentIds);
   * }
   * }
* * @param parent Parent resource that identifies admin project and location e.g., * `projects/myproject/locations/us` * @param capacityCommitmentIds Ids of capacity commitments to merge. These capacity commitments * must exist under admin project and location specified in the parent. ID is the last portion * of capacity commitment name e.g., 'abc' for * projects/myproject/locations/US/capacityCommitments/abc * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final CapacityCommitment mergeCapacityCommitments( LocationName parent, List capacityCommitmentIds) { MergeCapacityCommitmentsRequest request = MergeCapacityCommitmentsRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .addAllCapacityCommitmentIds(capacityCommitmentIds) .build(); return mergeCapacityCommitments(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Merges capacity commitments of the same plan into a single commitment. * *

The resulting capacity commitment has the greater commitment_end_time out of the * to-be-merged capacity commitments. * *

Attempting to merge capacity commitments of different plan will fail with the error code * `google.rpc.Code.FAILED_PRECONDITION`. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   *   List capacityCommitmentIds = new ArrayList<>();
   *   CapacityCommitment response =
   *       reservationServiceClient.mergeCapacityCommitments(parent, capacityCommitmentIds);
   * }
   * }
* * @param parent Parent resource that identifies admin project and location e.g., * `projects/myproject/locations/us` * @param capacityCommitmentIds Ids of capacity commitments to merge. These capacity commitments * must exist under admin project and location specified in the parent. ID is the last portion * of capacity commitment name e.g., 'abc' for * projects/myproject/locations/US/capacityCommitments/abc * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final CapacityCommitment mergeCapacityCommitments( String parent, List capacityCommitmentIds) { MergeCapacityCommitmentsRequest request = MergeCapacityCommitmentsRequest.newBuilder() .setParent(parent) .addAllCapacityCommitmentIds(capacityCommitmentIds) .build(); return mergeCapacityCommitments(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Merges capacity commitments of the same plan into a single commitment. * *

The resulting capacity commitment has the greater commitment_end_time out of the * to-be-merged capacity commitments. * *

Attempting to merge capacity commitments of different plan will fail with the error code * `google.rpc.Code.FAILED_PRECONDITION`. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   MergeCapacityCommitmentsRequest request =
   *       MergeCapacityCommitmentsRequest.newBuilder()
   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
   *           .addAllCapacityCommitmentIds(new ArrayList())
   *           .build();
   *   CapacityCommitment response = reservationServiceClient.mergeCapacityCommitments(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 CapacityCommitment mergeCapacityCommitments( MergeCapacityCommitmentsRequest request) { return mergeCapacityCommitmentsCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Merges capacity commitments of the same plan into a single commitment. * *

The resulting capacity commitment has the greater commitment_end_time out of the * to-be-merged capacity commitments. * *

Attempting to merge capacity commitments of different plan will fail with the error code * `google.rpc.Code.FAILED_PRECONDITION`. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   MergeCapacityCommitmentsRequest request =
   *       MergeCapacityCommitmentsRequest.newBuilder()
   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
   *           .addAllCapacityCommitmentIds(new ArrayList())
   *           .build();
   *   ApiFuture future =
   *       reservationServiceClient.mergeCapacityCommitmentsCallable().futureCall(request);
   *   // Do something.
   *   CapacityCommitment response = future.get();
   * }
   * }
*/ public final UnaryCallable mergeCapacityCommitmentsCallable() { return stub.mergeCapacityCommitmentsCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an assignment object which allows the given project to submit jobs of a certain type * using slots from the specified reservation. * *

Currently a resource (project, folder, organization) can only have one assignment per each * (job_type, location) combination, and that reservation will be used for all jobs of the * matching type. * *

Different assignments can be created on different levels of the projects, folders or * organization hierarchy. During query execution, the assignment is looked up at the project, * folder and organization levels in that order. The first assignment found is applied to the * query. * *

When creating assignments, it does not matter if other assignments exist at higher levels. * *

Example: * *

    *
  • The organization `organizationA` contains two projects, `project1` and `project2`. *
  • Assignments for all three entities (`organizationA`, `project1`, and `project2`) could * all be created and mapped to the same or different reservations. *
* *

"None" assignments represent an absence of the assignment. Projects assigned to None use * on-demand pricing. To create a "None" assignment, use "none" as a reservation_id in the parent. * Example parent: `projects/myproject/locations/US/reservations/none`. * *

Returns `google.rpc.Code.PERMISSION_DENIED` if user does not have 'bigquery.admin' * permissions on the project using the reservation and the project that owns this reservation. * *

Returns `google.rpc.Code.INVALID_ARGUMENT` when location of the assignment does not match * location of the reservation. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   ReservationName parent = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]");
   *   Assignment assignment = Assignment.newBuilder().build();
   *   Assignment response = reservationServiceClient.createAssignment(parent, assignment);
   * }
   * }
* * @param parent Required. The parent resource name of the assignment E.g. * `projects/myproject/locations/US/reservations/team1-prod` * @param assignment Assignment resource to create. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Assignment createAssignment(ReservationName parent, Assignment assignment) { CreateAssignmentRequest request = CreateAssignmentRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setAssignment(assignment) .build(); return createAssignment(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an assignment object which allows the given project to submit jobs of a certain type * using slots from the specified reservation. * *

Currently a resource (project, folder, organization) can only have one assignment per each * (job_type, location) combination, and that reservation will be used for all jobs of the * matching type. * *

Different assignments can be created on different levels of the projects, folders or * organization hierarchy. During query execution, the assignment is looked up at the project, * folder and organization levels in that order. The first assignment found is applied to the * query. * *

When creating assignments, it does not matter if other assignments exist at higher levels. * *

Example: * *

    *
  • The organization `organizationA` contains two projects, `project1` and `project2`. *
  • Assignments for all three entities (`organizationA`, `project1`, and `project2`) could * all be created and mapped to the same or different reservations. *
* *

"None" assignments represent an absence of the assignment. Projects assigned to None use * on-demand pricing. To create a "None" assignment, use "none" as a reservation_id in the parent. * Example parent: `projects/myproject/locations/US/reservations/none`. * *

Returns `google.rpc.Code.PERMISSION_DENIED` if user does not have 'bigquery.admin' * permissions on the project using the reservation and the project that owns this reservation. * *

Returns `google.rpc.Code.INVALID_ARGUMENT` when location of the assignment does not match * location of the reservation. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   String parent = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString();
   *   Assignment assignment = Assignment.newBuilder().build();
   *   Assignment response = reservationServiceClient.createAssignment(parent, assignment);
   * }
   * }
* * @param parent Required. The parent resource name of the assignment E.g. * `projects/myproject/locations/US/reservations/team1-prod` * @param assignment Assignment resource to create. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Assignment createAssignment(String parent, Assignment assignment) { CreateAssignmentRequest request = CreateAssignmentRequest.newBuilder().setParent(parent).setAssignment(assignment).build(); return createAssignment(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an assignment object which allows the given project to submit jobs of a certain type * using slots from the specified reservation. * *

Currently a resource (project, folder, organization) can only have one assignment per each * (job_type, location) combination, and that reservation will be used for all jobs of the * matching type. * *

Different assignments can be created on different levels of the projects, folders or * organization hierarchy. During query execution, the assignment is looked up at the project, * folder and organization levels in that order. The first assignment found is applied to the * query. * *

When creating assignments, it does not matter if other assignments exist at higher levels. * *

Example: * *

    *
  • The organization `organizationA` contains two projects, `project1` and `project2`. *
  • Assignments for all three entities (`organizationA`, `project1`, and `project2`) could * all be created and mapped to the same or different reservations. *
* *

"None" assignments represent an absence of the assignment. Projects assigned to None use * on-demand pricing. To create a "None" assignment, use "none" as a reservation_id in the parent. * Example parent: `projects/myproject/locations/US/reservations/none`. * *

Returns `google.rpc.Code.PERMISSION_DENIED` if user does not have 'bigquery.admin' * permissions on the project using the reservation and the project that owns this reservation. * *

Returns `google.rpc.Code.INVALID_ARGUMENT` when location of the assignment does not match * location of the reservation. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   CreateAssignmentRequest request =
   *       CreateAssignmentRequest.newBuilder()
   *           .setParent(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString())
   *           .setAssignment(Assignment.newBuilder().build())
   *           .setAssignmentId("assignmentId-1603989304")
   *           .build();
   *   Assignment response = reservationServiceClient.createAssignment(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 Assignment createAssignment(CreateAssignmentRequest request) { return createAssignmentCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Creates an assignment object which allows the given project to submit jobs of a certain type * using slots from the specified reservation. * *

Currently a resource (project, folder, organization) can only have one assignment per each * (job_type, location) combination, and that reservation will be used for all jobs of the * matching type. * *

Different assignments can be created on different levels of the projects, folders or * organization hierarchy. During query execution, the assignment is looked up at the project, * folder and organization levels in that order. The first assignment found is applied to the * query. * *

When creating assignments, it does not matter if other assignments exist at higher levels. * *

Example: * *

    *
  • The organization `organizationA` contains two projects, `project1` and `project2`. *
  • Assignments for all three entities (`organizationA`, `project1`, and `project2`) could * all be created and mapped to the same or different reservations. *
* *

"None" assignments represent an absence of the assignment. Projects assigned to None use * on-demand pricing. To create a "None" assignment, use "none" as a reservation_id in the parent. * Example parent: `projects/myproject/locations/US/reservations/none`. * *

Returns `google.rpc.Code.PERMISSION_DENIED` if user does not have 'bigquery.admin' * permissions on the project using the reservation and the project that owns this reservation. * *

Returns `google.rpc.Code.INVALID_ARGUMENT` when location of the assignment does not match * location of the reservation. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   CreateAssignmentRequest request =
   *       CreateAssignmentRequest.newBuilder()
   *           .setParent(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString())
   *           .setAssignment(Assignment.newBuilder().build())
   *           .setAssignmentId("assignmentId-1603989304")
   *           .build();
   *   ApiFuture future =
   *       reservationServiceClient.createAssignmentCallable().futureCall(request);
   *   // Do something.
   *   Assignment response = future.get();
   * }
   * }
*/ public final UnaryCallable createAssignmentCallable() { return stub.createAssignmentCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists assignments. * *

Only explicitly created assignments will be returned. * *

Example: * *

    *
  • Organization `organizationA` contains two projects, `project1` and `project2`. *
  • Reservation `res1` exists and was created previously. *
  • CreateAssignment was used previously to define the following associations between * entities and reservations: `<organizationA, res1>` and `<project1, res1>` *
* *

In this example, ListAssignments will just return the above two assignments for reservation * `res1`, and no expansion/merge will happen. * *

The wildcard "-" can be used for reservations in the request. In that case all assignments * belongs to the specified project and location will be listed. * *

**Note** "-" cannot be used for projects nor locations. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   ReservationName parent = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]");
   *   for (Assignment element : reservationServiceClient.listAssignments(parent).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
* * @param parent Required. The parent resource name e.g.: *

`projects/myproject/locations/US/reservations/team1-prod` *

Or: *

`projects/myproject/locations/US/reservations/-` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListAssignmentsPagedResponse listAssignments(ReservationName parent) { ListAssignmentsRequest request = ListAssignmentsRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .build(); return listAssignments(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists assignments. * *

Only explicitly created assignments will be returned. * *

Example: * *

    *
  • Organization `organizationA` contains two projects, `project1` and `project2`. *
  • Reservation `res1` exists and was created previously. *
  • CreateAssignment was used previously to define the following associations between * entities and reservations: `<organizationA, res1>` and `<project1, res1>` *
* *

In this example, ListAssignments will just return the above two assignments for reservation * `res1`, and no expansion/merge will happen. * *

The wildcard "-" can be used for reservations in the request. In that case all assignments * belongs to the specified project and location will be listed. * *

**Note** "-" cannot be used for projects nor locations. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   String parent = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString();
   *   for (Assignment element : reservationServiceClient.listAssignments(parent).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
* * @param parent Required. The parent resource name e.g.: *

`projects/myproject/locations/US/reservations/team1-prod` *

Or: *

`projects/myproject/locations/US/reservations/-` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListAssignmentsPagedResponse listAssignments(String parent) { ListAssignmentsRequest request = ListAssignmentsRequest.newBuilder().setParent(parent).build(); return listAssignments(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists assignments. * *

Only explicitly created assignments will be returned. * *

Example: * *

    *
  • Organization `organizationA` contains two projects, `project1` and `project2`. *
  • Reservation `res1` exists and was created previously. *
  • CreateAssignment was used previously to define the following associations between * entities and reservations: `<organizationA, res1>` and `<project1, res1>` *
* *

In this example, ListAssignments will just return the above two assignments for reservation * `res1`, and no expansion/merge will happen. * *

The wildcard "-" can be used for reservations in the request. In that case all assignments * belongs to the specified project and location will be listed. * *

**Note** "-" cannot be used for projects nor locations. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   ListAssignmentsRequest request =
   *       ListAssignmentsRequest.newBuilder()
   *           .setParent(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   for (Assignment element : reservationServiceClient.listAssignments(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 ListAssignmentsPagedResponse listAssignments(ListAssignmentsRequest request) { return listAssignmentsPagedCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists assignments. * *

Only explicitly created assignments will be returned. * *

Example: * *

    *
  • Organization `organizationA` contains two projects, `project1` and `project2`. *
  • Reservation `res1` exists and was created previously. *
  • CreateAssignment was used previously to define the following associations between * entities and reservations: `<organizationA, res1>` and `<project1, res1>` *
* *

In this example, ListAssignments will just return the above two assignments for reservation * `res1`, and no expansion/merge will happen. * *

The wildcard "-" can be used for reservations in the request. In that case all assignments * belongs to the specified project and location will be listed. * *

**Note** "-" cannot be used for projects nor locations. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   ListAssignmentsRequest request =
   *       ListAssignmentsRequest.newBuilder()
   *           .setParent(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   ApiFuture future =
   *       reservationServiceClient.listAssignmentsPagedCallable().futureCall(request);
   *   // Do something.
   *   for (Assignment element : future.get().iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
*/ public final UnaryCallable listAssignmentsPagedCallable() { return stub.listAssignmentsPagedCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Lists assignments. * *

Only explicitly created assignments will be returned. * *

Example: * *

    *
  • Organization `organizationA` contains two projects, `project1` and `project2`. *
  • Reservation `res1` exists and was created previously. *
  • CreateAssignment was used previously to define the following associations between * entities and reservations: `<organizationA, res1>` and `<project1, res1>` *
* *

In this example, ListAssignments will just return the above two assignments for reservation * `res1`, and no expansion/merge will happen. * *

The wildcard "-" can be used for reservations in the request. In that case all assignments * belongs to the specified project and location will be listed. * *

**Note** "-" cannot be used for projects nor locations. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   ListAssignmentsRequest request =
   *       ListAssignmentsRequest.newBuilder()
   *           .setParent(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString())
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   while (true) {
   *     ListAssignmentsResponse response =
   *         reservationServiceClient.listAssignmentsCallable().call(request);
   *     for (Assignment element : response.getAssignmentsList()) {
   *       // doThingsWith(element);
   *     }
   *     String nextPageToken = response.getNextPageToken();
   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
   *       request = request.toBuilder().setPageToken(nextPageToken).build();
   *     } else {
   *       break;
   *     }
   *   }
   * }
   * }
*/ public final UnaryCallable listAssignmentsCallable() { return stub.listAssignmentsCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a assignment. No expansion will happen. * *

Example: * *

    *
  • Organization `organizationA` contains two projects, `project1` and `project2`. *
  • Reservation `res1` exists and was created previously. *
  • CreateAssignment was used previously to define the following associations between * entities and reservations: `<organizationA, res1>` and `<project1, res1>` *
* *

In this example, deletion of the `<organizationA, res1>` assignment won't affect the * other assignment `<project1, res1>`. After said deletion, queries from `project1` will * still use `res1` while queries from `project2` will switch to use on-demand mode. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   AssignmentName name =
   *       AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]");
   *   reservationServiceClient.deleteAssignment(name);
   * }
   * }
* * @param name Required. Name of the resource, e.g. * `projects/myproject/locations/US/reservations/team1-prod/assignments/123` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final void deleteAssignment(AssignmentName name) { DeleteAssignmentRequest request = DeleteAssignmentRequest.newBuilder().setName(name == null ? null : name.toString()).build(); deleteAssignment(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a assignment. No expansion will happen. * *

Example: * *

    *
  • Organization `organizationA` contains two projects, `project1` and `project2`. *
  • Reservation `res1` exists and was created previously. *
  • CreateAssignment was used previously to define the following associations between * entities and reservations: `<organizationA, res1>` and `<project1, res1>` *
* *

In this example, deletion of the `<organizationA, res1>` assignment won't affect the * other assignment `<project1, res1>`. After said deletion, queries from `project1` will * still use `res1` while queries from `project2` will switch to use on-demand mode. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   String name =
   *       AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]").toString();
   *   reservationServiceClient.deleteAssignment(name);
   * }
   * }
* * @param name Required. Name of the resource, e.g. * `projects/myproject/locations/US/reservations/team1-prod/assignments/123` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final void deleteAssignment(String name) { DeleteAssignmentRequest request = DeleteAssignmentRequest.newBuilder().setName(name).build(); deleteAssignment(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a assignment. No expansion will happen. * *

Example: * *

    *
  • Organization `organizationA` contains two projects, `project1` and `project2`. *
  • Reservation `res1` exists and was created previously. *
  • CreateAssignment was used previously to define the following associations between * entities and reservations: `<organizationA, res1>` and `<project1, res1>` *
* *

In this example, deletion of the `<organizationA, res1>` assignment won't affect the * other assignment `<project1, res1>`. After said deletion, queries from `project1` will * still use `res1` while queries from `project2` will switch to use on-demand mode. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   DeleteAssignmentRequest request =
   *       DeleteAssignmentRequest.newBuilder()
   *           .setName(
   *               AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]")
   *                   .toString())
   *           .build();
   *   reservationServiceClient.deleteAssignment(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 void deleteAssignment(DeleteAssignmentRequest request) { deleteAssignmentCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deletes a assignment. No expansion will happen. * *

Example: * *

    *
  • Organization `organizationA` contains two projects, `project1` and `project2`. *
  • Reservation `res1` exists and was created previously. *
  • CreateAssignment was used previously to define the following associations between * entities and reservations: `<organizationA, res1>` and `<project1, res1>` *
* *

In this example, deletion of the `<organizationA, res1>` assignment won't affect the * other assignment `<project1, res1>`. After said deletion, queries from `project1` will * still use `res1` while queries from `project2` will switch to use on-demand mode. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   DeleteAssignmentRequest request =
   *       DeleteAssignmentRequest.newBuilder()
   *           .setName(
   *               AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]")
   *                   .toString())
   *           .build();
   *   ApiFuture future =
   *       reservationServiceClient.deleteAssignmentCallable().futureCall(request);
   *   // Do something.
   *   future.get();
   * }
   * }
*/ public final UnaryCallable deleteAssignmentCallable() { return stub.deleteAssignmentCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deprecated: Looks up assignments for a specified resource for a particular region. If the * request is about a project: * *

1. Assignments created on the project will be returned if they exist. 2. Otherwise * assignments created on the closest ancestor will be returned. 3. Assignments for different * JobTypes will all be returned. * *

The same logic applies if the request is about a folder. * *

If the request is about an organization, then assignments created on the organization will * be returned (organization doesn't have ancestors). * *

Comparing to ListAssignments, there are some behavior differences: * *

1. permission on the assignee will be verified in this API. 2. Hierarchy lookup * (project->folder->organization) happens in this API. 3. Parent here is * `projects/*/locations/*`, instead of * `projects/*/locations/*reservations/*`. * *

**Note** "-" cannot be used for projects nor locations. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   *   String query = "query107944136";
   *   for (Assignment element :
   *       reservationServiceClient.searchAssignments(parent, query).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
* * @param parent Required. The resource name of the admin project(containing project and * location), e.g.: `projects/myproject/locations/US`. * @param query Please specify resource name as assignee in the query. *

Examples: *

    *
  • `assignee=projects/myproject` *
  • `assignee=folders/123` *
  • `assignee=organizations/456` *
* * @throws com.google.api.gax.rpc.ApiException if the remote call fails * @deprecated This method is deprecated and will be removed in the next major version update. */ @Deprecated public final SearchAssignmentsPagedResponse searchAssignments(LocationName parent, String query) { SearchAssignmentsRequest request = SearchAssignmentsRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setQuery(query) .build(); return searchAssignments(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deprecated: Looks up assignments for a specified resource for a particular region. If the * request is about a project: * *

1. Assignments created on the project will be returned if they exist. 2. Otherwise * assignments created on the closest ancestor will be returned. 3. Assignments for different * JobTypes will all be returned. * *

The same logic applies if the request is about a folder. * *

If the request is about an organization, then assignments created on the organization will * be returned (organization doesn't have ancestors). * *

Comparing to ListAssignments, there are some behavior differences: * *

1. permission on the assignee will be verified in this API. 2. Hierarchy lookup * (project->folder->organization) happens in this API. 3. Parent here is * `projects/*/locations/*`, instead of * `projects/*/locations/*reservations/*`. * *

**Note** "-" cannot be used for projects nor locations. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   *   String query = "query107944136";
   *   for (Assignment element :
   *       reservationServiceClient.searchAssignments(parent, query).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
* * @param parent Required. The resource name of the admin project(containing project and * location), e.g.: `projects/myproject/locations/US`. * @param query Please specify resource name as assignee in the query. *

Examples: *

    *
  • `assignee=projects/myproject` *
  • `assignee=folders/123` *
  • `assignee=organizations/456` *
* * @throws com.google.api.gax.rpc.ApiException if the remote call fails * @deprecated This method is deprecated and will be removed in the next major version update. */ @Deprecated public final SearchAssignmentsPagedResponse searchAssignments(String parent, String query) { SearchAssignmentsRequest request = SearchAssignmentsRequest.newBuilder().setParent(parent).setQuery(query).build(); return searchAssignments(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deprecated: Looks up assignments for a specified resource for a particular region. If the * request is about a project: * *

1. Assignments created on the project will be returned if they exist. 2. Otherwise * assignments created on the closest ancestor will be returned. 3. Assignments for different * JobTypes will all be returned. * *

The same logic applies if the request is about a folder. * *

If the request is about an organization, then assignments created on the organization will * be returned (organization doesn't have ancestors). * *

Comparing to ListAssignments, there are some behavior differences: * *

1. permission on the assignee will be verified in this API. 2. Hierarchy lookup * (project->folder->organization) happens in this API. 3. Parent here is * `projects/*/locations/*`, instead of * `projects/*/locations/*reservations/*`. * *

**Note** "-" cannot be used for projects nor locations. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   SearchAssignmentsRequest request =
   *       SearchAssignmentsRequest.newBuilder()
   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
   *           .setQuery("query107944136")
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   for (Assignment element : reservationServiceClient.searchAssignments(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 * @deprecated This method is deprecated and will be removed in the next major version update. */ @Deprecated public final SearchAssignmentsPagedResponse searchAssignments(SearchAssignmentsRequest request) { return searchAssignmentsPagedCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deprecated: Looks up assignments for a specified resource for a particular region. If the * request is about a project: * *

1. Assignments created on the project will be returned if they exist. 2. Otherwise * assignments created on the closest ancestor will be returned. 3. Assignments for different * JobTypes will all be returned. * *

The same logic applies if the request is about a folder. * *

If the request is about an organization, then assignments created on the organization will * be returned (organization doesn't have ancestors). * *

Comparing to ListAssignments, there are some behavior differences: * *

1. permission on the assignee will be verified in this API. 2. Hierarchy lookup * (project->folder->organization) happens in this API. 3. Parent here is * `projects/*/locations/*`, instead of * `projects/*/locations/*reservations/*`. * *

**Note** "-" cannot be used for projects nor locations. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   SearchAssignmentsRequest request =
   *       SearchAssignmentsRequest.newBuilder()
   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
   *           .setQuery("query107944136")
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   ApiFuture future =
   *       reservationServiceClient.searchAssignmentsPagedCallable().futureCall(request);
   *   // Do something.
   *   for (Assignment element : future.get().iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
* * @deprecated This method is deprecated and will be removed in the next major version update. */ @Deprecated public final UnaryCallable searchAssignmentsPagedCallable() { return stub.searchAssignmentsPagedCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Deprecated: Looks up assignments for a specified resource for a particular region. If the * request is about a project: * *

1. Assignments created on the project will be returned if they exist. 2. Otherwise * assignments created on the closest ancestor will be returned. 3. Assignments for different * JobTypes will all be returned. * *

The same logic applies if the request is about a folder. * *

If the request is about an organization, then assignments created on the organization will * be returned (organization doesn't have ancestors). * *

Comparing to ListAssignments, there are some behavior differences: * *

1. permission on the assignee will be verified in this API. 2. Hierarchy lookup * (project->folder->organization) happens in this API. 3. Parent here is * `projects/*/locations/*`, instead of * `projects/*/locations/*reservations/*`. * *

**Note** "-" cannot be used for projects nor locations. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   SearchAssignmentsRequest request =
   *       SearchAssignmentsRequest.newBuilder()
   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
   *           .setQuery("query107944136")
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   while (true) {
   *     SearchAssignmentsResponse response =
   *         reservationServiceClient.searchAssignmentsCallable().call(request);
   *     for (Assignment element : response.getAssignmentsList()) {
   *       // doThingsWith(element);
   *     }
   *     String nextPageToken = response.getNextPageToken();
   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
   *       request = request.toBuilder().setPageToken(nextPageToken).build();
   *     } else {
   *       break;
   *     }
   *   }
   * }
   * }
* * @deprecated This method is deprecated and will be removed in the next major version update. */ @Deprecated public final UnaryCallable searchAssignmentsCallable() { return stub.searchAssignmentsCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Looks up assignments for a specified resource for a particular region. If the request is about * a project: * *

1. Assignments created on the project will be returned if they exist. 2. Otherwise * assignments created on the closest ancestor will be returned. 3. Assignments for different * JobTypes will all be returned. * *

The same logic applies if the request is about a folder. * *

If the request is about an organization, then assignments created on the organization will * be returned (organization doesn't have ancestors). * *

Comparing to ListAssignments, there are some behavior differences: * *

1. permission on the assignee will be verified in this API. 2. Hierarchy lookup * (project->folder->organization) happens in this API. 3. Parent here is * `projects/*/locations/*`, instead of * `projects/*/locations/*reservations/*`. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   *   String query = "query107944136";
   *   for (Assignment element :
   *       reservationServiceClient.searchAllAssignments(parent, query).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
* * @param parent Required. The resource name with location (project name could be the wildcard * '-'), e.g.: `projects/-/locations/US`. * @param query Please specify resource name as assignee in the query. *

Examples: *

    *
  • `assignee=projects/myproject` *
  • `assignee=folders/123` *
  • `assignee=organizations/456` *
* * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final SearchAllAssignmentsPagedResponse searchAllAssignments( LocationName parent, String query) { SearchAllAssignmentsRequest request = SearchAllAssignmentsRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setQuery(query) .build(); return searchAllAssignments(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Looks up assignments for a specified resource for a particular region. If the request is about * a project: * *

1. Assignments created on the project will be returned if they exist. 2. Otherwise * assignments created on the closest ancestor will be returned. 3. Assignments for different * JobTypes will all be returned. * *

The same logic applies if the request is about a folder. * *

If the request is about an organization, then assignments created on the organization will * be returned (organization doesn't have ancestors). * *

Comparing to ListAssignments, there are some behavior differences: * *

1. permission on the assignee will be verified in this API. 2. Hierarchy lookup * (project->folder->organization) happens in this API. 3. Parent here is * `projects/*/locations/*`, instead of * `projects/*/locations/*reservations/*`. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   *   String query = "query107944136";
   *   for (Assignment element :
   *       reservationServiceClient.searchAllAssignments(parent, query).iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
* * @param parent Required. The resource name with location (project name could be the wildcard * '-'), e.g.: `projects/-/locations/US`. * @param query Please specify resource name as assignee in the query. *

Examples: *

    *
  • `assignee=projects/myproject` *
  • `assignee=folders/123` *
  • `assignee=organizations/456` *
* * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final SearchAllAssignmentsPagedResponse searchAllAssignments(String parent, String query) { SearchAllAssignmentsRequest request = SearchAllAssignmentsRequest.newBuilder().setParent(parent).setQuery(query).build(); return searchAllAssignments(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Looks up assignments for a specified resource for a particular region. If the request is about * a project: * *

1. Assignments created on the project will be returned if they exist. 2. Otherwise * assignments created on the closest ancestor will be returned. 3. Assignments for different * JobTypes will all be returned. * *

The same logic applies if the request is about a folder. * *

If the request is about an organization, then assignments created on the organization will * be returned (organization doesn't have ancestors). * *

Comparing to ListAssignments, there are some behavior differences: * *

1. permission on the assignee will be verified in this API. 2. Hierarchy lookup * (project->folder->organization) happens in this API. 3. Parent here is * `projects/*/locations/*`, instead of * `projects/*/locations/*reservations/*`. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   SearchAllAssignmentsRequest request =
   *       SearchAllAssignmentsRequest.newBuilder()
   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
   *           .setQuery("query107944136")
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   for (Assignment element :
   *       reservationServiceClient.searchAllAssignments(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 SearchAllAssignmentsPagedResponse searchAllAssignments( SearchAllAssignmentsRequest request) { return searchAllAssignmentsPagedCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Looks up assignments for a specified resource for a particular region. If the request is about * a project: * *

1. Assignments created on the project will be returned if they exist. 2. Otherwise * assignments created on the closest ancestor will be returned. 3. Assignments for different * JobTypes will all be returned. * *

The same logic applies if the request is about a folder. * *

If the request is about an organization, then assignments created on the organization will * be returned (organization doesn't have ancestors). * *

Comparing to ListAssignments, there are some behavior differences: * *

1. permission on the assignee will be verified in this API. 2. Hierarchy lookup * (project->folder->organization) happens in this API. 3. Parent here is * `projects/*/locations/*`, instead of * `projects/*/locations/*reservations/*`. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   SearchAllAssignmentsRequest request =
   *       SearchAllAssignmentsRequest.newBuilder()
   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
   *           .setQuery("query107944136")
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   ApiFuture future =
   *       reservationServiceClient.searchAllAssignmentsPagedCallable().futureCall(request);
   *   // Do something.
   *   for (Assignment element : future.get().iterateAll()) {
   *     // doThingsWith(element);
   *   }
   * }
   * }
*/ public final UnaryCallable searchAllAssignmentsPagedCallable() { return stub.searchAllAssignmentsPagedCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Looks up assignments for a specified resource for a particular region. If the request is about * a project: * *

1. Assignments created on the project will be returned if they exist. 2. Otherwise * assignments created on the closest ancestor will be returned. 3. Assignments for different * JobTypes will all be returned. * *

The same logic applies if the request is about a folder. * *

If the request is about an organization, then assignments created on the organization will * be returned (organization doesn't have ancestors). * *

Comparing to ListAssignments, there are some behavior differences: * *

1. permission on the assignee will be verified in this API. 2. Hierarchy lookup * (project->folder->organization) happens in this API. 3. Parent here is * `projects/*/locations/*`, instead of * `projects/*/locations/*reservations/*`. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   SearchAllAssignmentsRequest request =
   *       SearchAllAssignmentsRequest.newBuilder()
   *           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
   *           .setQuery("query107944136")
   *           .setPageSize(883849137)
   *           .setPageToken("pageToken873572522")
   *           .build();
   *   while (true) {
   *     SearchAllAssignmentsResponse response =
   *         reservationServiceClient.searchAllAssignmentsCallable().call(request);
   *     for (Assignment element : response.getAssignmentsList()) {
   *       // doThingsWith(element);
   *     }
   *     String nextPageToken = response.getNextPageToken();
   *     if (!Strings.isNullOrEmpty(nextPageToken)) {
   *       request = request.toBuilder().setPageToken(nextPageToken).build();
   *     } else {
   *       break;
   *     }
   *   }
   * }
   * }
*/ public final UnaryCallable searchAllAssignmentsCallable() { return stub.searchAllAssignmentsCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Moves an assignment under a new reservation. * *

This differs from removing an existing assignment and recreating a new one by providing a * transactional change that ensures an assignee always has an associated reservation. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   AssignmentName name =
   *       AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]");
   *   ReservationName destinationId =
   *       ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]");
   *   Assignment response = reservationServiceClient.moveAssignment(name, destinationId);
   * }
   * }
* * @param name Required. The resource name of the assignment, e.g. * `projects/myproject/locations/US/reservations/team1-prod/assignments/123` * @param destinationId The new reservation ID, e.g.: * `projects/myotherproject/locations/US/reservations/team2-prod` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Assignment moveAssignment(AssignmentName name, ReservationName destinationId) { MoveAssignmentRequest request = MoveAssignmentRequest.newBuilder() .setName(name == null ? null : name.toString()) .setDestinationId(destinationId == null ? null : destinationId.toString()) .build(); return moveAssignment(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Moves an assignment under a new reservation. * *

This differs from removing an existing assignment and recreating a new one by providing a * transactional change that ensures an assignee always has an associated reservation. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   AssignmentName name =
   *       AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]");
   *   String destinationId =
   *       ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString();
   *   Assignment response = reservationServiceClient.moveAssignment(name, destinationId);
   * }
   * }
* * @param name Required. The resource name of the assignment, e.g. * `projects/myproject/locations/US/reservations/team1-prod/assignments/123` * @param destinationId The new reservation ID, e.g.: * `projects/myotherproject/locations/US/reservations/team2-prod` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Assignment moveAssignment(AssignmentName name, String destinationId) { MoveAssignmentRequest request = MoveAssignmentRequest.newBuilder() .setName(name == null ? null : name.toString()) .setDestinationId(destinationId) .build(); return moveAssignment(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Moves an assignment under a new reservation. * *

This differs from removing an existing assignment and recreating a new one by providing a * transactional change that ensures an assignee always has an associated reservation. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   String name =
   *       AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]").toString();
   *   ReservationName destinationId =
   *       ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]");
   *   Assignment response = reservationServiceClient.moveAssignment(name, destinationId);
   * }
   * }
* * @param name Required. The resource name of the assignment, e.g. * `projects/myproject/locations/US/reservations/team1-prod/assignments/123` * @param destinationId The new reservation ID, e.g.: * `projects/myotherproject/locations/US/reservations/team2-prod` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Assignment moveAssignment(String name, ReservationName destinationId) { MoveAssignmentRequest request = MoveAssignmentRequest.newBuilder() .setName(name) .setDestinationId(destinationId == null ? null : destinationId.toString()) .build(); return moveAssignment(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Moves an assignment under a new reservation. * *

This differs from removing an existing assignment and recreating a new one by providing a * transactional change that ensures an assignee always has an associated reservation. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   String name =
   *       AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]").toString();
   *   String destinationId =
   *       ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString();
   *   Assignment response = reservationServiceClient.moveAssignment(name, destinationId);
   * }
   * }
* * @param name Required. The resource name of the assignment, e.g. * `projects/myproject/locations/US/reservations/team1-prod/assignments/123` * @param destinationId The new reservation ID, e.g.: * `projects/myotherproject/locations/US/reservations/team2-prod` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Assignment moveAssignment(String name, String destinationId) { MoveAssignmentRequest request = MoveAssignmentRequest.newBuilder().setName(name).setDestinationId(destinationId).build(); return moveAssignment(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Moves an assignment under a new reservation. * *

This differs from removing an existing assignment and recreating a new one by providing a * transactional change that ensures an assignee always has an associated reservation. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   MoveAssignmentRequest request =
   *       MoveAssignmentRequest.newBuilder()
   *           .setName(
   *               AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]")
   *                   .toString())
   *           .setDestinationId(
   *               ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString())
   *           .setAssignmentId("assignmentId-1603989304")
   *           .build();
   *   Assignment response = reservationServiceClient.moveAssignment(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 Assignment moveAssignment(MoveAssignmentRequest request) { return moveAssignmentCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Moves an assignment under a new reservation. * *

This differs from removing an existing assignment and recreating a new one by providing a * transactional change that ensures an assignee always has an associated reservation. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   MoveAssignmentRequest request =
   *       MoveAssignmentRequest.newBuilder()
   *           .setName(
   *               AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]")
   *                   .toString())
   *           .setDestinationId(
   *               ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString())
   *           .setAssignmentId("assignmentId-1603989304")
   *           .build();
   *   ApiFuture future =
   *       reservationServiceClient.moveAssignmentCallable().futureCall(request);
   *   // Do something.
   *   Assignment response = future.get();
   * }
   * }
*/ public final UnaryCallable moveAssignmentCallable() { return stub.moveAssignmentCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates an existing assignment. * *

Only the `priority` field can be updated. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   Assignment assignment = Assignment.newBuilder().build();
   *   FieldMask updateMask = FieldMask.newBuilder().build();
   *   Assignment response = reservationServiceClient.updateAssignment(assignment, updateMask);
   * }
   * }
* * @param assignment Content of the assignment to update. * @param updateMask Standard field mask for the set of fields to be updated. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Assignment updateAssignment(Assignment assignment, FieldMask updateMask) { UpdateAssignmentRequest request = UpdateAssignmentRequest.newBuilder() .setAssignment(assignment) .setUpdateMask(updateMask) .build(); return updateAssignment(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates an existing assignment. * *

Only the `priority` field can be updated. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   UpdateAssignmentRequest request =
   *       UpdateAssignmentRequest.newBuilder()
   *           .setAssignment(Assignment.newBuilder().build())
   *           .setUpdateMask(FieldMask.newBuilder().build())
   *           .build();
   *   Assignment response = reservationServiceClient.updateAssignment(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 Assignment updateAssignment(UpdateAssignmentRequest request) { return updateAssignmentCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates an existing assignment. * *

Only the `priority` field can be updated. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   UpdateAssignmentRequest request =
   *       UpdateAssignmentRequest.newBuilder()
   *           .setAssignment(Assignment.newBuilder().build())
   *           .setUpdateMask(FieldMask.newBuilder().build())
   *           .build();
   *   ApiFuture future =
   *       reservationServiceClient.updateAssignmentCallable().futureCall(request);
   *   // Do something.
   *   Assignment response = future.get();
   * }
   * }
*/ public final UnaryCallable updateAssignmentCallable() { return stub.updateAssignmentCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves a BI reservation. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   BiReservationName name = BiReservationName.of("[PROJECT]", "[LOCATION]");
   *   BiReservation response = reservationServiceClient.getBiReservation(name);
   * }
   * }
* * @param name Required. Name of the requested reservation, for example: * `projects/{project_id}/locations/{location_id}/biReservation` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final BiReservation getBiReservation(BiReservationName name) { GetBiReservationRequest request = GetBiReservationRequest.newBuilder().setName(name == null ? null : name.toString()).build(); return getBiReservation(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves a BI reservation. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   String name = BiReservationName.of("[PROJECT]", "[LOCATION]").toString();
   *   BiReservation response = reservationServiceClient.getBiReservation(name);
   * }
   * }
* * @param name Required. Name of the requested reservation, for example: * `projects/{project_id}/locations/{location_id}/biReservation` * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final BiReservation getBiReservation(String name) { GetBiReservationRequest request = GetBiReservationRequest.newBuilder().setName(name).build(); return getBiReservation(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves a BI reservation. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   GetBiReservationRequest request =
   *       GetBiReservationRequest.newBuilder()
   *           .setName(BiReservationName.of("[PROJECT]", "[LOCATION]").toString())
   *           .build();
   *   BiReservation response = reservationServiceClient.getBiReservation(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 BiReservation getBiReservation(GetBiReservationRequest request) { return getBiReservationCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Retrieves a BI reservation. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   GetBiReservationRequest request =
   *       GetBiReservationRequest.newBuilder()
   *           .setName(BiReservationName.of("[PROJECT]", "[LOCATION]").toString())
   *           .build();
   *   ApiFuture future =
   *       reservationServiceClient.getBiReservationCallable().futureCall(request);
   *   // Do something.
   *   BiReservation response = future.get();
   * }
   * }
*/ public final UnaryCallable getBiReservationCallable() { return stub.getBiReservationCallable(); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates a BI reservation. * *

Only fields specified in the `field_mask` are updated. * *

A singleton BI reservation always exists with default size 0. In order to reserve BI * capacity it needs to be updated to an amount greater than 0. In order to release BI capacity * reservation size must be set to 0. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   BiReservation biReservation = BiReservation.newBuilder().build();
   *   FieldMask updateMask = FieldMask.newBuilder().build();
   *   BiReservation response =
   *       reservationServiceClient.updateBiReservation(biReservation, updateMask);
   * }
   * }
* * @param biReservation A reservation to update. * @param updateMask A list of fields to be updated in this request. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final BiReservation updateBiReservation( BiReservation biReservation, FieldMask updateMask) { UpdateBiReservationRequest request = UpdateBiReservationRequest.newBuilder() .setBiReservation(biReservation) .setUpdateMask(updateMask) .build(); return updateBiReservation(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates a BI reservation. * *

Only fields specified in the `field_mask` are updated. * *

A singleton BI reservation always exists with default size 0. In order to reserve BI * capacity it needs to be updated to an amount greater than 0. In order to release BI capacity * reservation size must be set to 0. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   UpdateBiReservationRequest request =
   *       UpdateBiReservationRequest.newBuilder()
   *           .setBiReservation(BiReservation.newBuilder().build())
   *           .setUpdateMask(FieldMask.newBuilder().build())
   *           .build();
   *   BiReservation response = reservationServiceClient.updateBiReservation(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 BiReservation updateBiReservation(UpdateBiReservationRequest request) { return updateBiReservationCallable().call(request); } // AUTO-GENERATED DOCUMENTATION AND METHOD. /** * Updates a BI reservation. * *

Only fields specified in the `field_mask` are updated. * *

A singleton BI reservation always exists with default size 0. In order to reserve BI * capacity it needs to be updated to an amount greater than 0. In order to release BI capacity * reservation size must be set to 0. * *

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 (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) {
   *   UpdateBiReservationRequest request =
   *       UpdateBiReservationRequest.newBuilder()
   *           .setBiReservation(BiReservation.newBuilder().build())
   *           .setUpdateMask(FieldMask.newBuilder().build())
   *           .build();
   *   ApiFuture future =
   *       reservationServiceClient.updateBiReservationCallable().futureCall(request);
   *   // Do something.
   *   BiReservation response = future.get();
   * }
   * }
*/ public final UnaryCallable updateBiReservationCallable() { return stub.updateBiReservationCallable(); } @Override public final void close() { stub.close(); } @Override public void shutdown() { stub.shutdown(); } @Override public boolean isShutdown() { return stub.isShutdown(); } @Override public boolean isTerminated() { return stub.isTerminated(); } @Override public void shutdownNow() { stub.shutdownNow(); } @Override public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { return stub.awaitTermination(duration, unit); } public static class ListReservationsPagedResponse extends AbstractPagedListResponse< ListReservationsRequest, ListReservationsResponse, Reservation, ListReservationsPage, ListReservationsFixedSizeCollection> { public static ApiFuture createAsync( PageContext context, ApiFuture futureResponse) { ApiFuture futurePage = ListReservationsPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, input -> new ListReservationsPagedResponse(input), MoreExecutors.directExecutor()); } private ListReservationsPagedResponse(ListReservationsPage page) { super(page, ListReservationsFixedSizeCollection.createEmptyCollection()); } } public static class ListReservationsPage extends AbstractPage< ListReservationsRequest, ListReservationsResponse, Reservation, ListReservationsPage> { private ListReservationsPage( PageContext context, ListReservationsResponse response) { super(context, response); } private static ListReservationsPage createEmptyPage() { return new ListReservationsPage(null, null); } @Override protected ListReservationsPage createPage( PageContext context, ListReservationsResponse response) { return new ListReservationsPage(context, response); } @Override public ApiFuture createPageAsync( PageContext context, ApiFuture futureResponse) { return super.createPageAsync(context, futureResponse); } } public static class ListReservationsFixedSizeCollection extends AbstractFixedSizeCollection< ListReservationsRequest, ListReservationsResponse, Reservation, ListReservationsPage, ListReservationsFixedSizeCollection> { private ListReservationsFixedSizeCollection( List pages, int collectionSize) { super(pages, collectionSize); } private static ListReservationsFixedSizeCollection createEmptyCollection() { return new ListReservationsFixedSizeCollection(null, 0); } @Override protected ListReservationsFixedSizeCollection createCollection( List pages, int collectionSize) { return new ListReservationsFixedSizeCollection(pages, collectionSize); } } public static class ListCapacityCommitmentsPagedResponse extends AbstractPagedListResponse< ListCapacityCommitmentsRequest, ListCapacityCommitmentsResponse, CapacityCommitment, ListCapacityCommitmentsPage, ListCapacityCommitmentsFixedSizeCollection> { public static ApiFuture createAsync( PageContext< ListCapacityCommitmentsRequest, ListCapacityCommitmentsResponse, CapacityCommitment> context, ApiFuture futureResponse) { ApiFuture futurePage = ListCapacityCommitmentsPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, input -> new ListCapacityCommitmentsPagedResponse(input), MoreExecutors.directExecutor()); } private ListCapacityCommitmentsPagedResponse(ListCapacityCommitmentsPage page) { super(page, ListCapacityCommitmentsFixedSizeCollection.createEmptyCollection()); } } public static class ListCapacityCommitmentsPage extends AbstractPage< ListCapacityCommitmentsRequest, ListCapacityCommitmentsResponse, CapacityCommitment, ListCapacityCommitmentsPage> { private ListCapacityCommitmentsPage( PageContext< ListCapacityCommitmentsRequest, ListCapacityCommitmentsResponse, CapacityCommitment> context, ListCapacityCommitmentsResponse response) { super(context, response); } private static ListCapacityCommitmentsPage createEmptyPage() { return new ListCapacityCommitmentsPage(null, null); } @Override protected ListCapacityCommitmentsPage createPage( PageContext< ListCapacityCommitmentsRequest, ListCapacityCommitmentsResponse, CapacityCommitment> context, ListCapacityCommitmentsResponse response) { return new ListCapacityCommitmentsPage(context, response); } @Override public ApiFuture createPageAsync( PageContext< ListCapacityCommitmentsRequest, ListCapacityCommitmentsResponse, CapacityCommitment> context, ApiFuture futureResponse) { return super.createPageAsync(context, futureResponse); } } public static class ListCapacityCommitmentsFixedSizeCollection extends AbstractFixedSizeCollection< ListCapacityCommitmentsRequest, ListCapacityCommitmentsResponse, CapacityCommitment, ListCapacityCommitmentsPage, ListCapacityCommitmentsFixedSizeCollection> { private ListCapacityCommitmentsFixedSizeCollection( List pages, int collectionSize) { super(pages, collectionSize); } private static ListCapacityCommitmentsFixedSizeCollection createEmptyCollection() { return new ListCapacityCommitmentsFixedSizeCollection(null, 0); } @Override protected ListCapacityCommitmentsFixedSizeCollection createCollection( List pages, int collectionSize) { return new ListCapacityCommitmentsFixedSizeCollection(pages, collectionSize); } } public static class ListAssignmentsPagedResponse extends AbstractPagedListResponse< ListAssignmentsRequest, ListAssignmentsResponse, Assignment, ListAssignmentsPage, ListAssignmentsFixedSizeCollection> { public static ApiFuture createAsync( PageContext context, ApiFuture futureResponse) { ApiFuture futurePage = ListAssignmentsPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, input -> new ListAssignmentsPagedResponse(input), MoreExecutors.directExecutor()); } private ListAssignmentsPagedResponse(ListAssignmentsPage page) { super(page, ListAssignmentsFixedSizeCollection.createEmptyCollection()); } } public static class ListAssignmentsPage extends AbstractPage< ListAssignmentsRequest, ListAssignmentsResponse, Assignment, ListAssignmentsPage> { private ListAssignmentsPage( PageContext context, ListAssignmentsResponse response) { super(context, response); } private static ListAssignmentsPage createEmptyPage() { return new ListAssignmentsPage(null, null); } @Override protected ListAssignmentsPage createPage( PageContext context, ListAssignmentsResponse response) { return new ListAssignmentsPage(context, response); } @Override public ApiFuture createPageAsync( PageContext context, ApiFuture futureResponse) { return super.createPageAsync(context, futureResponse); } } public static class ListAssignmentsFixedSizeCollection extends AbstractFixedSizeCollection< ListAssignmentsRequest, ListAssignmentsResponse, Assignment, ListAssignmentsPage, ListAssignmentsFixedSizeCollection> { private ListAssignmentsFixedSizeCollection( List pages, int collectionSize) { super(pages, collectionSize); } private static ListAssignmentsFixedSizeCollection createEmptyCollection() { return new ListAssignmentsFixedSizeCollection(null, 0); } @Override protected ListAssignmentsFixedSizeCollection createCollection( List pages, int collectionSize) { return new ListAssignmentsFixedSizeCollection(pages, collectionSize); } } public static class SearchAssignmentsPagedResponse extends AbstractPagedListResponse< SearchAssignmentsRequest, SearchAssignmentsResponse, Assignment, SearchAssignmentsPage, SearchAssignmentsFixedSizeCollection> { public static ApiFuture createAsync( PageContext context, ApiFuture futureResponse) { ApiFuture futurePage = SearchAssignmentsPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, input -> new SearchAssignmentsPagedResponse(input), MoreExecutors.directExecutor()); } private SearchAssignmentsPagedResponse(SearchAssignmentsPage page) { super(page, SearchAssignmentsFixedSizeCollection.createEmptyCollection()); } } public static class SearchAssignmentsPage extends AbstractPage< SearchAssignmentsRequest, SearchAssignmentsResponse, Assignment, SearchAssignmentsPage> { private SearchAssignmentsPage( PageContext context, SearchAssignmentsResponse response) { super(context, response); } private static SearchAssignmentsPage createEmptyPage() { return new SearchAssignmentsPage(null, null); } @Override protected SearchAssignmentsPage createPage( PageContext context, SearchAssignmentsResponse response) { return new SearchAssignmentsPage(context, response); } @Override public ApiFuture createPageAsync( PageContext context, ApiFuture futureResponse) { return super.createPageAsync(context, futureResponse); } } public static class SearchAssignmentsFixedSizeCollection extends AbstractFixedSizeCollection< SearchAssignmentsRequest, SearchAssignmentsResponse, Assignment, SearchAssignmentsPage, SearchAssignmentsFixedSizeCollection> { private SearchAssignmentsFixedSizeCollection( List pages, int collectionSize) { super(pages, collectionSize); } private static SearchAssignmentsFixedSizeCollection createEmptyCollection() { return new SearchAssignmentsFixedSizeCollection(null, 0); } @Override protected SearchAssignmentsFixedSizeCollection createCollection( List pages, int collectionSize) { return new SearchAssignmentsFixedSizeCollection(pages, collectionSize); } } public static class SearchAllAssignmentsPagedResponse extends AbstractPagedListResponse< SearchAllAssignmentsRequest, SearchAllAssignmentsResponse, Assignment, SearchAllAssignmentsPage, SearchAllAssignmentsFixedSizeCollection> { public static ApiFuture createAsync( PageContext context, ApiFuture futureResponse) { ApiFuture futurePage = SearchAllAssignmentsPage.createEmptyPage().createPageAsync(context, futureResponse); return ApiFutures.transform( futurePage, input -> new SearchAllAssignmentsPagedResponse(input), MoreExecutors.directExecutor()); } private SearchAllAssignmentsPagedResponse(SearchAllAssignmentsPage page) { super(page, SearchAllAssignmentsFixedSizeCollection.createEmptyCollection()); } } public static class SearchAllAssignmentsPage extends AbstractPage< SearchAllAssignmentsRequest, SearchAllAssignmentsResponse, Assignment, SearchAllAssignmentsPage> { private SearchAllAssignmentsPage( PageContext context, SearchAllAssignmentsResponse response) { super(context, response); } private static SearchAllAssignmentsPage createEmptyPage() { return new SearchAllAssignmentsPage(null, null); } @Override protected SearchAllAssignmentsPage createPage( PageContext context, SearchAllAssignmentsResponse response) { return new SearchAllAssignmentsPage(context, response); } @Override public ApiFuture createPageAsync( PageContext context, ApiFuture futureResponse) { return super.createPageAsync(context, futureResponse); } } public static class SearchAllAssignmentsFixedSizeCollection extends AbstractFixedSizeCollection< SearchAllAssignmentsRequest, SearchAllAssignmentsResponse, Assignment, SearchAllAssignmentsPage, SearchAllAssignmentsFixedSizeCollection> { private SearchAllAssignmentsFixedSizeCollection( List pages, int collectionSize) { super(pages, collectionSize); } private static SearchAllAssignmentsFixedSizeCollection createEmptyCollection() { return new SearchAllAssignmentsFixedSizeCollection(null, 0); } @Override protected SearchAllAssignmentsFixedSizeCollection createCollection( List pages, int collectionSize) { return new SearchAllAssignmentsFixedSizeCollection(pages, collectionSize); } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy