Class ReservationServiceClient

java.lang.Object
com.google.cloud.bigquery.reservation.v1.ReservationServiceClient
All Implemented Interfaces:
BackgroundResource, AutoCloseable

@Generated("by gapic-generator-java") public class ReservationServiceClient extends Object implements BackgroundResource
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:


 // 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().

Methods
Method Description Method Variants

CreateReservation

Creates a new reservation resource.

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

  • createReservation(CreateReservationRequest request)

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

  • createReservation(LocationName parent, Reservation reservation, String reservationId)

  • createReservation(String parent, Reservation reservation, String reservationId)

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

  • createReservationCallable()

ListReservations

Lists all the reservations for the project in the specified location.

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

  • listReservations(ListReservationsRequest request)

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

  • listReservations(LocationName parent)

  • listReservations(String parent)

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

  • listReservationsPagedCallable()

  • listReservationsCallable()

GetReservation

Returns information about the reservation.

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

  • getReservation(GetReservationRequest request)

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

  • getReservation(ReservationName name)

  • getReservation(String name)

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

  • getReservationCallable()

DeleteReservation

Deletes a reservation. Returns `google.rpc.Code.FAILED_PRECONDITION` when reservation has assignments.

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

  • deleteReservation(DeleteReservationRequest request)

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

  • deleteReservation(ReservationName name)

  • deleteReservation(String name)

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

  • deleteReservationCallable()

UpdateReservation

Updates an existing reservation resource.

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

  • updateReservation(UpdateReservationRequest request)

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

  • updateReservation(Reservation reservation, FieldMask updateMask)

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

  • updateReservationCallable()

FailoverReservation

Fail over a reservation to the secondary location. The operation should be done in the current secondary location, which will be promoted to the new primary location for the reservation. Attempting to failover a reservation in the current primary location will fail with the error code `google.rpc.Code.FAILED_PRECONDITION`.

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

  • failoverReservation(FailoverReservationRequest request)

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

  • failoverReservationCallable()

CreateCapacityCommitment

Creates a new capacity commitment resource.

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

  • createCapacityCommitment(CreateCapacityCommitmentRequest request)

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

  • createCapacityCommitment(LocationName parent, CapacityCommitment capacityCommitment)

  • createCapacityCommitment(String parent, CapacityCommitment capacityCommitment)

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

  • createCapacityCommitmentCallable()

ListCapacityCommitments

Lists all the capacity commitments for the admin project.

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

  • listCapacityCommitments(ListCapacityCommitmentsRequest request)

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

  • listCapacityCommitments(LocationName parent)

  • listCapacityCommitments(String parent)

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

  • listCapacityCommitmentsPagedCallable()

  • listCapacityCommitmentsCallable()

GetCapacityCommitment

Returns information about the capacity commitment.

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

  • getCapacityCommitment(GetCapacityCommitmentRequest request)

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

  • getCapacityCommitment(CapacityCommitmentName name)

  • getCapacityCommitment(String name)

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

  • getCapacityCommitmentCallable()

DeleteCapacityCommitment

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`.

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

  • deleteCapacityCommitment(DeleteCapacityCommitmentRequest request)

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

  • deleteCapacityCommitment(CapacityCommitmentName name)

  • deleteCapacityCommitment(String name)

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

  • deleteCapacityCommitmentCallable()

UpdateCapacityCommitment

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`.

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

  • updateCapacityCommitment(UpdateCapacityCommitmentRequest request)

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

  • updateCapacityCommitment(CapacityCommitment capacityCommitment, FieldMask updateMask)

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

  • updateCapacityCommitmentCallable()

SplitCapacityCommitment

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.

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

  • splitCapacityCommitment(SplitCapacityCommitmentRequest request)

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

  • splitCapacityCommitment(CapacityCommitmentName name, long slotCount)

  • splitCapacityCommitment(String name, long slotCount)

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

  • splitCapacityCommitmentCallable()

MergeCapacityCommitments

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`.

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

  • mergeCapacityCommitments(MergeCapacityCommitmentsRequest request)

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

  • mergeCapacityCommitments(LocationName parent, List<String> capacityCommitmentIds)

  • mergeCapacityCommitments(String parent, List<String> capacityCommitmentIds)

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

  • mergeCapacityCommitmentsCallable()

CreateAssignment

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.

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

  • createAssignment(CreateAssignmentRequest request)

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

  • createAssignment(ReservationName parent, Assignment assignment)

  • createAssignment(String parent, Assignment assignment)

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

  • createAssignmentCallable()

ListAssignments

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.

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

  • listAssignments(ListAssignmentsRequest request)

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

  • listAssignments(ReservationName parent)

  • listAssignments(String parent)

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

  • listAssignmentsPagedCallable()

  • listAssignmentsCallable()

DeleteAssignment

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.

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

  • deleteAssignment(DeleteAssignmentRequest request)

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

  • deleteAssignment(AssignmentName name)

  • deleteAssignment(String name)

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

  • deleteAssignmentCallable()

SearchAssignments

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.

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

  • searchAssignments(SearchAssignmentsRequest request)

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

  • searchAssignments(LocationName parent, String query)

  • searchAssignments(String parent, String query)

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

  • searchAssignmentsPagedCallable()

  • searchAssignmentsCallable()

SearchAllAssignments

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/*`.

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

  • searchAllAssignments(SearchAllAssignmentsRequest request)

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

  • searchAllAssignments(LocationName parent, String query)

  • searchAllAssignments(String parent, String query)

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

  • searchAllAssignmentsPagedCallable()

  • searchAllAssignmentsCallable()

MoveAssignment

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.

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

  • moveAssignment(MoveAssignmentRequest request)

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

  • moveAssignment(AssignmentName name, ReservationName destinationId)

  • moveAssignment(AssignmentName name, String destinationId)

  • moveAssignment(String name, ReservationName destinationId)

  • moveAssignment(String name, String destinationId)

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

  • moveAssignmentCallable()

UpdateAssignment

Updates an existing assignment.

Only the `priority` field can be updated.

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

  • updateAssignment(UpdateAssignmentRequest request)

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

  • updateAssignment(Assignment assignment, FieldMask updateMask)

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

  • updateAssignmentCallable()

GetBiReservation

Retrieves a BI reservation.

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

  • getBiReservation(GetBiReservationRequest request)

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

  • getBiReservation(BiReservationName name)

  • getBiReservation(String name)

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

  • getBiReservationCallable()

UpdateBiReservation

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.

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

  • updateBiReservation(UpdateBiReservationRequest request)

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

  • updateBiReservation(BiReservation biReservation, FieldMask updateMask)

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

  • updateBiReservationCallable()

GetIamPolicy

Gets the access control policy for a resource. May return:

  • A`NOT_FOUND` error if the resource doesn't exist or you don't have the permission to view it.
  • An empty policy if the resource exists but doesn't have a set policy.

Supported resources are: - Reservations - ReservationAssignments

To call this method, you must have the following Google IAM permissions:

- `bigqueryreservation.reservations.getIamPolicy` to get policies on reservations.

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

  • getIamPolicy(GetIamPolicyRequest request)

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

  • getIamPolicy(ResourceName resource)

  • getIamPolicy(String resource)

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

  • getIamPolicyCallable()

SetIamPolicy

Sets an access control policy for a resource. Replaces any existing policy.

Supported resources are: - Reservations

To call this method, you must have the following Google IAM permissions:

- `bigqueryreservation.reservations.setIamPolicy` to set policies on reservations.

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

  • setIamPolicy(SetIamPolicyRequest request)

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

  • setIamPolicy(ResourceName resource, Policy policy)

  • setIamPolicy(String resource, Policy policy)

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

  • setIamPolicyCallable()

TestIamPermissions

Gets your permissions on a resource. Returns an empty set of permissions if the resource doesn't exist.

Supported resources are: - Reservations

No Google IAM permissions are required to call this method.

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

  • testIamPermissions(TestIamPermissionsRequest request)

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

  • testIamPermissionsCallable()

CreateReservationGroup

Creates a new reservation group.

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

  • createReservationGroup(CreateReservationGroupRequest request)

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

  • createReservationGroupCallable()

GetReservationGroup

Returns information about the reservation group.

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

  • getReservationGroup(GetReservationGroupRequest request)

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

  • getReservationGroup(ReservationGroupName name)

  • getReservationGroup(String name)

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

  • getReservationGroupCallable()

DeleteReservationGroup

Deletes a reservation. Returns `google.rpc.Code.FAILED_PRECONDITION` when reservation has assignments.

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

  • deleteReservationGroup(DeleteReservationGroupRequest request)

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

  • deleteReservationGroup(ReservationGroupName name)

  • deleteReservationGroup(String name)

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

  • deleteReservationGroupCallable()

ListReservationGroups

Lists all the reservation groups for the project in the specified location.

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

  • listReservationGroups(ListReservationGroupsRequest request)

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

  • listReservationGroups(LocationName parent)

  • listReservationGroups(String parent)

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

  • listReservationGroupsPagedCallable()

  • listReservationGroupsCallable()

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:


 // 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:


 // 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:


 // 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.

  • Constructor Details

    • ReservationServiceClient

      protected ReservationServiceClient(ReservationServiceSettings settings) throws IOException
      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.
      Throws:
      IOException
    • ReservationServiceClient

      protected ReservationServiceClient(ReservationServiceStub stub)
  • Method Details

    • create

      public static final ReservationServiceClient create() throws IOException
      Constructs an instance of ReservationServiceClient with default settings.
      Throws:
      IOException
    • create

      public static final ReservationServiceClient create(ReservationServiceSettings settings) throws IOException
      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.
      Throws:
      IOException
    • create

      public static final ReservationServiceClient create(ReservationServiceStub stub)
      Constructs an instance of ReservationServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(ReservationServiceSettings).
    • getSettings

      public final ReservationServiceSettings getSettings()
    • getStub

      public ReservationServiceStub getStub()
    • createReservation

      public final Reservation createReservation(LocationName parent, Reservation reservation, String reservationId)
      Creates a new reservation resource.

      Sample 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);
       }
       
      Parameters:
      parent - Required. Project, location. E.g., `projects/myproject/locations/US`
      reservation - Definition of the new reservation to create.
      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:
      ApiException - if the remote call fails
    • createReservation

      public final Reservation createReservation(String parent, Reservation reservation, String reservationId)
      Creates a new reservation resource.

      Sample 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);
       }
       
      Parameters:
      parent - Required. Project, location. E.g., `projects/myproject/locations/US`
      reservation - Definition of the new reservation to create.
      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:
      ApiException - if the remote call fails
    • createReservation

      public final Reservation createReservation(CreateReservationRequest request)
      Creates a new reservation resource.

      Sample 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);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • createReservationCallable

      public final UnaryCallable<CreateReservationRequest,Reservation> createReservationCallable()
      Creates a new reservation resource.

      Sample 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<Reservation> future =
             reservationServiceClient.createReservationCallable().futureCall(request);
         // Do something.
         Reservation response = future.get();
       }
       
    • listReservations

      Lists all the reservations for the project in the specified location.

      Sample 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);
         }
       }
       
      Parameters:
      parent - Required. The parent resource name containing project and location, e.g.: `projects/myproject/locations/US`
      Throws:
      ApiException - if the remote call fails
    • listReservations

      public final ReservationServiceClient.ListReservationsPagedResponse listReservations(String parent)
      Lists all the reservations for the project in the specified location.

      Sample 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);
         }
       }
       
      Parameters:
      parent - Required. The parent resource name containing project and location, e.g.: `projects/myproject/locations/US`
      Throws:
      ApiException - if the remote call fails
    • listReservations

      Lists all the reservations for the project in the specified location.

      Sample 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);
         }
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • listReservationsPagedCallable

      Lists all the reservations for the project in the specified location.

      Sample 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<Reservation> future =
             reservationServiceClient.listReservationsPagedCallable().futureCall(request);
         // Do something.
         for (Reservation element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • listReservationsCallable

      public final UnaryCallable<ListReservationsRequest,ListReservationsResponse> listReservationsCallable()
      Lists all the reservations for the project in the specified location.

      Sample 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;
           }
         }
       }
       
    • getReservation

      public final Reservation getReservation(ReservationName name)
      Returns information about the reservation.

      Sample 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);
       }
       
      Parameters:
      name - Required. Resource name of the reservation to retrieve. E.g., `projects/myproject/locations/US/reservations/team1-prod`
      Throws:
      ApiException - if the remote call fails
    • getReservation

      public final Reservation getReservation(String name)
      Returns information about the reservation.

      Sample 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);
       }
       
      Parameters:
      name - Required. Resource name of the reservation to retrieve. E.g., `projects/myproject/locations/US/reservations/team1-prod`
      Throws:
      ApiException - if the remote call fails
    • getReservation

      public final Reservation getReservation(GetReservationRequest request)
      Returns information about the reservation.

      Sample 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);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • getReservationCallable

      public final UnaryCallable<GetReservationRequest,Reservation> getReservationCallable()
      Returns information about the reservation.

      Sample 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<Reservation> future =
             reservationServiceClient.getReservationCallable().futureCall(request);
         // Do something.
         Reservation response = future.get();
       }
       
    • deleteReservation

      public final void deleteReservation(ReservationName name)
      Deletes a reservation. Returns `google.rpc.Code.FAILED_PRECONDITION` when reservation has assignments.

      Sample 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);
       }
       
      Parameters:
      name - Required. Resource name of the reservation to retrieve. E.g., `projects/myproject/locations/US/reservations/team1-prod`
      Throws:
      ApiException - if the remote call fails
    • deleteReservation

      public final void deleteReservation(String name)
      Deletes a reservation. Returns `google.rpc.Code.FAILED_PRECONDITION` when reservation has assignments.

      Sample 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);
       }
       
      Parameters:
      name - Required. Resource name of the reservation to retrieve. E.g., `projects/myproject/locations/US/reservations/team1-prod`
      Throws:
      ApiException - if the remote call fails
    • deleteReservation

      public final void deleteReservation(DeleteReservationRequest request)
      Deletes a reservation. Returns `google.rpc.Code.FAILED_PRECONDITION` when reservation has assignments.

      Sample 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);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • deleteReservationCallable

      public final UnaryCallable<DeleteReservationRequest,com.google.protobuf.Empty> deleteReservationCallable()
      Deletes a reservation. Returns `google.rpc.Code.FAILED_PRECONDITION` when reservation has assignments.

      Sample 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<Empty> future =
             reservationServiceClient.deleteReservationCallable().futureCall(request);
         // Do something.
         future.get();
       }
       
    • updateReservation

      public final Reservation updateReservation(Reservation reservation, com.google.protobuf.FieldMask updateMask)
      Updates an existing reservation resource.

      Sample 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);
       }
       
      Parameters:
      reservation - Content of the reservation to update.
      updateMask - Standard field mask for the set of fields to be updated.
      Throws:
      ApiException - if the remote call fails
    • updateReservation

      public final Reservation updateReservation(UpdateReservationRequest request)
      Updates an existing reservation resource.

      Sample 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);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • updateReservationCallable

      public final UnaryCallable<UpdateReservationRequest,Reservation> updateReservationCallable()
      Updates an existing reservation resource.

      Sample 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<Reservation> future =
             reservationServiceClient.updateReservationCallable().futureCall(request);
         // Do something.
         Reservation response = future.get();
       }
       
    • failoverReservation

      public final Reservation failoverReservation(FailoverReservationRequest request)
      Fail over a reservation to the secondary location. The operation should be done in the current secondary location, which will be promoted to the new primary location for the reservation. Attempting to failover a reservation in the current primary location will fail with the error code `google.rpc.Code.FAILED_PRECONDITION`.

      Sample 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()) {
         FailoverReservationRequest request =
             FailoverReservationRequest.newBuilder()
                 .setName(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString())
                 .setFailoverMode(FailoverMode.forNumber(0))
                 .build();
         Reservation response = reservationServiceClient.failoverReservation(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • failoverReservationCallable

      public final UnaryCallable<FailoverReservationRequest,Reservation> failoverReservationCallable()
      Fail over a reservation to the secondary location. The operation should be done in the current secondary location, which will be promoted to the new primary location for the reservation. Attempting to failover a reservation in the current primary location will fail with the error code `google.rpc.Code.FAILED_PRECONDITION`.

      Sample 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()) {
         FailoverReservationRequest request =
             FailoverReservationRequest.newBuilder()
                 .setName(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString())
                 .setFailoverMode(FailoverMode.forNumber(0))
                 .build();
         ApiFuture<Reservation> future =
             reservationServiceClient.failoverReservationCallable().futureCall(request);
         // Do something.
         Reservation response = future.get();
       }
       
    • createCapacityCommitment

      public final CapacityCommitment createCapacityCommitment(LocationName parent, CapacityCommitment capacityCommitment)
      Creates a new capacity commitment resource.

      Sample 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);
       }
       
      Parameters:
      parent - Required. Resource name of the parent reservation. E.g., `projects/myproject/locations/US`
      capacityCommitment - Content of the capacity commitment to create.
      Throws:
      ApiException - if the remote call fails
    • createCapacityCommitment

      public final CapacityCommitment createCapacityCommitment(String parent, CapacityCommitment capacityCommitment)
      Creates a new capacity commitment resource.

      Sample 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);
       }
       
      Parameters:
      parent - Required. Resource name of the parent reservation. E.g., `projects/myproject/locations/US`
      capacityCommitment - Content of the capacity commitment to create.
      Throws:
      ApiException - if the remote call fails
    • createCapacityCommitment

      public final CapacityCommitment createCapacityCommitment(CreateCapacityCommitmentRequest request)
      Creates a new capacity commitment resource.

      Sample 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);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • createCapacityCommitmentCallable

      public final UnaryCallable<CreateCapacityCommitmentRequest,CapacityCommitment> createCapacityCommitmentCallable()
      Creates a new capacity commitment resource.

      Sample 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<CapacityCommitment> future =
             reservationServiceClient.createCapacityCommitmentCallable().futureCall(request);
         // Do something.
         CapacityCommitment response = future.get();
       }
       
    • listCapacityCommitments

      public final ReservationServiceClient.ListCapacityCommitmentsPagedResponse listCapacityCommitments(LocationName parent)
      Lists all the capacity commitments for the admin project.

      Sample 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);
         }
       }
       
      Parameters:
      parent - Required. Resource name of the parent reservation. E.g., `projects/myproject/locations/US`
      Throws:
      ApiException - if the remote call fails
    • listCapacityCommitments

      public final ReservationServiceClient.ListCapacityCommitmentsPagedResponse listCapacityCommitments(String parent)
      Lists all the capacity commitments for the admin project.

      Sample 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);
         }
       }
       
      Parameters:
      parent - Required. Resource name of the parent reservation. E.g., `projects/myproject/locations/US`
      Throws:
      ApiException - if the remote call fails
    • listCapacityCommitments

      Lists all the capacity commitments for the admin project.

      Sample 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);
         }
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • listCapacityCommitmentsPagedCallable

      Lists all the capacity commitments for the admin project.

      Sample 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<CapacityCommitment> future =
             reservationServiceClient.listCapacityCommitmentsPagedCallable().futureCall(request);
         // Do something.
         for (CapacityCommitment element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • listCapacityCommitmentsCallable

      public final UnaryCallable<ListCapacityCommitmentsRequest,ListCapacityCommitmentsResponse> listCapacityCommitmentsCallable()
      Lists all the capacity commitments for the admin project.

      Sample 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;
           }
         }
       }
       
    • getCapacityCommitment

      public final CapacityCommitment getCapacityCommitment(CapacityCommitmentName name)
      Returns information about the capacity commitment.

      Sample 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);
       }
       
      Parameters:
      name - Required. Resource name of the capacity commitment to retrieve. E.g., `projects/myproject/locations/US/capacityCommitments/123`
      Throws:
      ApiException - if the remote call fails
    • getCapacityCommitment

      public final CapacityCommitment getCapacityCommitment(String name)
      Returns information about the capacity commitment.

      Sample 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);
       }
       
      Parameters:
      name - Required. Resource name of the capacity commitment to retrieve. E.g., `projects/myproject/locations/US/capacityCommitments/123`
      Throws:
      ApiException - if the remote call fails
    • getCapacityCommitment

      public final CapacityCommitment getCapacityCommitment(GetCapacityCommitmentRequest request)
      Returns information about the capacity commitment.

      Sample 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);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • getCapacityCommitmentCallable

      public final UnaryCallable<GetCapacityCommitmentRequest,CapacityCommitment> getCapacityCommitmentCallable()
      Returns information about the capacity commitment.

      Sample 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<CapacityCommitment> future =
             reservationServiceClient.getCapacityCommitmentCallable().futureCall(request);
         // Do something.
         CapacityCommitment response = future.get();
       }
       
    • deleteCapacityCommitment

      public final void deleteCapacityCommitment(CapacityCommitmentName name)
      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:

      
       // 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);
       }
       
      Parameters:
      name - Required. Resource name of the capacity commitment to delete. E.g., `projects/myproject/locations/US/capacityCommitments/123`
      Throws:
      ApiException - if the remote call fails
    • deleteCapacityCommitment

      public final void deleteCapacityCommitment(String name)
      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:

      
       // 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);
       }
       
      Parameters:
      name - Required. Resource name of the capacity commitment to delete. E.g., `projects/myproject/locations/US/capacityCommitments/123`
      Throws:
      ApiException - if the remote call fails
    • deleteCapacityCommitment

      public final void deleteCapacityCommitment(DeleteCapacityCommitmentRequest request)
      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:

      
       // 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);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • deleteCapacityCommitmentCallable

      public final UnaryCallable<DeleteCapacityCommitmentRequest,com.google.protobuf.Empty> deleteCapacityCommitmentCallable()
      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:

      
       // 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<Empty> future =
             reservationServiceClient.deleteCapacityCommitmentCallable().futureCall(request);
         // Do something.
         future.get();
       }
       
    • updateCapacityCommitment

      public final CapacityCommitment updateCapacityCommitment(CapacityCommitment capacityCommitment, com.google.protobuf.FieldMask updateMask)
      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:

      
       // 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);
       }
       
      Parameters:
      capacityCommitment - Content of the capacity commitment to update.
      updateMask - Standard field mask for the set of fields to be updated.
      Throws:
      ApiException - if the remote call fails
    • updateCapacityCommitment

      public final CapacityCommitment updateCapacityCommitment(UpdateCapacityCommitmentRequest request)
      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:

      
       // 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);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • updateCapacityCommitmentCallable

      public final UnaryCallable<UpdateCapacityCommitmentRequest,CapacityCommitment> updateCapacityCommitmentCallable()
      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:

      
       // 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<CapacityCommitment> future =
             reservationServiceClient.updateCapacityCommitmentCallable().futureCall(request);
         // Do something.
         CapacityCommitment response = future.get();
       }
       
    • splitCapacityCommitment

      public final SplitCapacityCommitmentResponse splitCapacityCommitment(CapacityCommitmentName name, long slotCount)
      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:

      
       // 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);
       }
       
      Parameters:
      name - Required. The resource name e.g.,: `projects/myproject/locations/US/capacityCommitments/123`
      slotCount - Number of slots in the capacity commitment after the split.
      Throws:
      ApiException - if the remote call fails
    • splitCapacityCommitment

      public final SplitCapacityCommitmentResponse splitCapacityCommitment(String name, long slotCount)
      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:

      
       // 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);
       }
       
      Parameters:
      name - Required. The resource name e.g.,: `projects/myproject/locations/US/capacityCommitments/123`
      slotCount - Number of slots in the capacity commitment after the split.
      Throws:
      ApiException - if the remote call fails
    • splitCapacityCommitment

      public final SplitCapacityCommitmentResponse splitCapacityCommitment(SplitCapacityCommitmentRequest request)
      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:

      
       // 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);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • splitCapacityCommitmentCallable

      public final UnaryCallable<SplitCapacityCommitmentRequest,SplitCapacityCommitmentResponse> splitCapacityCommitmentCallable()
      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:

      
       // 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<SplitCapacityCommitmentResponse> future =
             reservationServiceClient.splitCapacityCommitmentCallable().futureCall(request);
         // Do something.
         SplitCapacityCommitmentResponse response = future.get();
       }
       
    • mergeCapacityCommitments

      public final CapacityCommitment mergeCapacityCommitments(LocationName parent, List<String> capacityCommitmentIds)
      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:

      
       // 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<String> capacityCommitmentIds = new ArrayList<>();
         CapacityCommitment response =
             reservationServiceClient.mergeCapacityCommitments(parent, capacityCommitmentIds);
       }
       
      Parameters:
      parent - Parent resource that identifies admin project and location e.g., `projects/myproject/locations/us`
      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:
      ApiException - if the remote call fails
    • mergeCapacityCommitments

      public final CapacityCommitment mergeCapacityCommitments(String parent, List<String> capacityCommitmentIds)
      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:

      
       // 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<String> capacityCommitmentIds = new ArrayList<>();
         CapacityCommitment response =
             reservationServiceClient.mergeCapacityCommitments(parent, capacityCommitmentIds);
       }
       
      Parameters:
      parent - Parent resource that identifies admin project and location e.g., `projects/myproject/locations/us`
      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:
      ApiException - if the remote call fails
    • mergeCapacityCommitments

      public final CapacityCommitment mergeCapacityCommitments(MergeCapacityCommitmentsRequest request)
      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:

      
       // 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<String>())
                 .setCapacityCommitmentId("capacityCommitmentId1185645802")
                 .build();
         CapacityCommitment response = reservationServiceClient.mergeCapacityCommitments(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • mergeCapacityCommitmentsCallable

      public final UnaryCallable<MergeCapacityCommitmentsRequest,CapacityCommitment> mergeCapacityCommitmentsCallable()
      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:

      
       // 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<String>())
                 .setCapacityCommitmentId("capacityCommitmentId1185645802")
                 .build();
         ApiFuture<CapacityCommitment> future =
             reservationServiceClient.mergeCapacityCommitmentsCallable().futureCall(request);
         // Do something.
         CapacityCommitment response = future.get();
       }
       
    • createAssignment

      public final Assignment createAssignment(ReservationName parent, Assignment assignment)
      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:

      
       // 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);
       }
       
      Parameters:
      parent - Required. The parent resource name of the assignment E.g. `projects/myproject/locations/US/reservations/team1-prod`
      assignment - Assignment resource to create.
      Throws:
      ApiException - if the remote call fails
    • createAssignment

      public final Assignment createAssignment(String parent, Assignment assignment)
      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:

      
       // 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);
       }
       
      Parameters:
      parent - Required. The parent resource name of the assignment E.g. `projects/myproject/locations/US/reservations/team1-prod`
      assignment - Assignment resource to create.
      Throws:
      ApiException - if the remote call fails
    • createAssignment

      public final Assignment createAssignment(CreateAssignmentRequest request)
      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:

      
       // 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);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • createAssignmentCallable

      public final UnaryCallable<CreateAssignmentRequest,Assignment> createAssignmentCallable()
      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:

      
       // 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<Assignment> future =
             reservationServiceClient.createAssignmentCallable().futureCall(request);
         // Do something.
         Assignment response = future.get();
       }
       
    • listAssignments

      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:

      
       // 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);
         }
       }
       
      Parameters:
      parent - Required. The parent resource name e.g.:

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

      Or:

      `projects/myproject/locations/US/reservations/-`

      Throws:
      ApiException - if the remote call fails
    • listAssignments

      public final ReservationServiceClient.ListAssignmentsPagedResponse listAssignments(String parent)
      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:

      
       // 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);
         }
       }
       
      Parameters:
      parent - Required. The parent resource name e.g.:

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

      Or:

      `projects/myproject/locations/US/reservations/-`

      Throws:
      ApiException - if the remote call fails
    • listAssignments

      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:

      
       // 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);
         }
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • listAssignmentsPagedCallable

      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:

      
       // 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<Assignment> future =
             reservationServiceClient.listAssignmentsPagedCallable().futureCall(request);
         // Do something.
         for (Assignment element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • listAssignmentsCallable

      public final UnaryCallable<ListAssignmentsRequest,ListAssignmentsResponse> listAssignmentsCallable()
      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:

      
       // 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;
           }
         }
       }
       
    • deleteAssignment

      public final void deleteAssignment(AssignmentName name)
      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:

      
       // 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);
       }
       
      Parameters:
      name - Required. Name of the resource, e.g. `projects/myproject/locations/US/reservations/team1-prod/assignments/123`
      Throws:
      ApiException - if the remote call fails
    • deleteAssignment

      public final void deleteAssignment(String name)
      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:

      
       // 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);
       }
       
      Parameters:
      name - Required. Name of the resource, e.g. `projects/myproject/locations/US/reservations/team1-prod/assignments/123`
      Throws:
      ApiException - if the remote call fails
    • deleteAssignment

      public final void deleteAssignment(DeleteAssignmentRequest request)
      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:

      
       // 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);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • deleteAssignmentCallable

      public final UnaryCallable<DeleteAssignmentRequest,com.google.protobuf.Empty> deleteAssignmentCallable()
      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:

      
       // 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<Empty> future =
             reservationServiceClient.deleteAssignmentCallable().futureCall(request);
         // Do something.
         future.get();
       }
       
    • searchAssignments

      Deprecated.
      This method is deprecated and will be removed in the next major version update.
      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:

      
       // 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);
         }
       }
       
      Parameters:
      parent - Required. The resource name of the admin project(containing project and location), e.g.: `projects/myproject/locations/US`.
      query - Please specify resource name as assignee in the query.

      Examples:

      • `assignee=projects/myproject`
      • `assignee=folders/123`
      • `assignee=organizations/456`
      Throws:
      ApiException - if the remote call fails
    • searchAssignments

      @Deprecated public final ReservationServiceClient.SearchAssignmentsPagedResponse searchAssignments(String parent, String query)
      Deprecated.
      This method is deprecated and will be removed in the next major version update.
      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:

      
       // 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);
         }
       }
       
      Parameters:
      parent - Required. The resource name of the admin project(containing project and location), e.g.: `projects/myproject/locations/US`.
      query - Please specify resource name as assignee in the query.

      Examples:

      • `assignee=projects/myproject`
      • `assignee=folders/123`
      • `assignee=organizations/456`
      Throws:
      ApiException - if the remote call fails
    • searchAssignments

      Deprecated.
      This method is deprecated and will be removed in the next major version update.
      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:

      
       // 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);
         }
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • searchAssignmentsPagedCallable

      Deprecated.
      This method is deprecated and will be removed in the next major version update.
      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:

      
       // 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<Assignment> future =
             reservationServiceClient.searchAssignmentsPagedCallable().futureCall(request);
         // Do something.
         for (Assignment element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • searchAssignmentsCallable

      Deprecated.
      This method is deprecated and will be removed in the next major version update.
      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:

      
       // 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;
           }
         }
       }
       
    • searchAllAssignments

      public final ReservationServiceClient.SearchAllAssignmentsPagedResponse searchAllAssignments(LocationName parent, String query)
      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:

      
       // 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);
         }
       }
       
      Parameters:
      parent - Required. The resource name with location (project name could be the wildcard '-'), e.g.: `projects/-/locations/US`.
      query - Please specify resource name as assignee in the query.

      Examples:

      • `assignee=projects/myproject`
      • `assignee=folders/123`
      • `assignee=organizations/456`
      Throws:
      ApiException - if the remote call fails
    • searchAllAssignments

      public final ReservationServiceClient.SearchAllAssignmentsPagedResponse searchAllAssignments(String parent, String query)
      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:

      
       // 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);
         }
       }
       
      Parameters:
      parent - Required. The resource name with location (project name could be the wildcard '-'), e.g.: `projects/-/locations/US`.
      query - Please specify resource name as assignee in the query.

      Examples:

      • `assignee=projects/myproject`
      • `assignee=folders/123`
      • `assignee=organizations/456`
      Throws:
      ApiException - if the remote call fails
    • searchAllAssignments

      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:

      
       // 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);
         }
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • searchAllAssignmentsPagedCallable

      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:

      
       // 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<Assignment> future =
             reservationServiceClient.searchAllAssignmentsPagedCallable().futureCall(request);
         // Do something.
         for (Assignment element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • searchAllAssignmentsCallable

      public final UnaryCallable<SearchAllAssignmentsRequest,SearchAllAssignmentsResponse> searchAllAssignmentsCallable()
      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:

      
       // 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;
           }
         }
       }
       
    • moveAssignment

      public final Assignment moveAssignment(AssignmentName name, ReservationName destinationId)
      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:

      
       // 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);
       }
       
      Parameters:
      name - Required. The resource name of the assignment, e.g. `projects/myproject/locations/US/reservations/team1-prod/assignments/123`
      destinationId - The new reservation ID, e.g.: `projects/myotherproject/locations/US/reservations/team2-prod`
      Throws:
      ApiException - if the remote call fails
    • moveAssignment

      public final Assignment moveAssignment(AssignmentName name, String destinationId)
      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:

      
       // 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);
       }
       
      Parameters:
      name - Required. The resource name of the assignment, e.g. `projects/myproject/locations/US/reservations/team1-prod/assignments/123`
      destinationId - The new reservation ID, e.g.: `projects/myotherproject/locations/US/reservations/team2-prod`
      Throws:
      ApiException - if the remote call fails
    • moveAssignment

      public final Assignment moveAssignment(String name, ReservationName destinationId)
      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:

      
       // 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);
       }
       
      Parameters:
      name - Required. The resource name of the assignment, e.g. `projects/myproject/locations/US/reservations/team1-prod/assignments/123`
      destinationId - The new reservation ID, e.g.: `projects/myotherproject/locations/US/reservations/team2-prod`
      Throws:
      ApiException - if the remote call fails
    • moveAssignment

      public final Assignment moveAssignment(String name, String destinationId)
      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:

      
       // 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);
       }
       
      Parameters:
      name - Required. The resource name of the assignment, e.g. `projects/myproject/locations/US/reservations/team1-prod/assignments/123`
      destinationId - The new reservation ID, e.g.: `projects/myotherproject/locations/US/reservations/team2-prod`
      Throws:
      ApiException - if the remote call fails
    • moveAssignment

      public final Assignment moveAssignment(MoveAssignmentRequest request)
      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:

      
       // 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);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • moveAssignmentCallable

      public final UnaryCallable<MoveAssignmentRequest,Assignment> moveAssignmentCallable()
      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:

      
       // 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<Assignment> future =
             reservationServiceClient.moveAssignmentCallable().futureCall(request);
         // Do something.
         Assignment response = future.get();
       }
       
    • updateAssignment

      public final Assignment updateAssignment(Assignment assignment, com.google.protobuf.FieldMask updateMask)
      Updates an existing assignment.

      Only the `priority` field can be updated.

      Sample 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);
       }
       
      Parameters:
      assignment - Content of the assignment to update.
      updateMask - Standard field mask for the set of fields to be updated.
      Throws:
      ApiException - if the remote call fails
    • updateAssignment

      public final Assignment updateAssignment(UpdateAssignmentRequest request)
      Updates an existing assignment.

      Only the `priority` field can be updated.

      Sample 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);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • updateAssignmentCallable

      public final UnaryCallable<UpdateAssignmentRequest,Assignment> updateAssignmentCallable()
      Updates an existing assignment.

      Only the `priority` field can be updated.

      Sample 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<Assignment> future =
             reservationServiceClient.updateAssignmentCallable().futureCall(request);
         // Do something.
         Assignment response = future.get();
       }
       
    • getBiReservation

      public final BiReservation getBiReservation(BiReservationName name)
      Retrieves a BI reservation.

      Sample 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);
       }
       
      Parameters:
      name - Required. Name of the requested reservation, for example: `projects/{project_id}/locations/{location_id}/biReservation`
      Throws:
      ApiException - if the remote call fails
    • getBiReservation

      public final BiReservation getBiReservation(String name)
      Retrieves a BI reservation.

      Sample 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);
       }
       
      Parameters:
      name - Required. Name of the requested reservation, for example: `projects/{project_id}/locations/{location_id}/biReservation`
      Throws:
      ApiException - if the remote call fails
    • getBiReservation

      public final BiReservation getBiReservation(GetBiReservationRequest request)
      Retrieves a BI reservation.

      Sample 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);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • getBiReservationCallable

      public final UnaryCallable<GetBiReservationRequest,BiReservation> getBiReservationCallable()
      Retrieves a BI reservation.

      Sample 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<BiReservation> future =
             reservationServiceClient.getBiReservationCallable().futureCall(request);
         // Do something.
         BiReservation response = future.get();
       }
       
    • updateBiReservation

      public final BiReservation updateBiReservation(BiReservation biReservation, com.google.protobuf.FieldMask updateMask)
      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:

      
       // 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);
       }
       
      Parameters:
      biReservation - A reservation to update.
      updateMask - A list of fields to be updated in this request.
      Throws:
      ApiException - if the remote call fails
    • updateBiReservation

      public final BiReservation updateBiReservation(UpdateBiReservationRequest request)
      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:

      
       // 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);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • updateBiReservationCallable

      public final UnaryCallable<UpdateBiReservationRequest,BiReservation> updateBiReservationCallable()
      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:

      
       // 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<BiReservation> future =
             reservationServiceClient.updateBiReservationCallable().futureCall(request);
         // Do something.
         BiReservation response = future.get();
       }
       
    • getIamPolicy

      public final com.google.iam.v1.Policy getIamPolicy(ResourceName resource)
      Gets the access control policy for a resource. May return:
      • A`NOT_FOUND` error if the resource doesn't exist or you don't have the permission to view it.
      • An empty policy if the resource exists but doesn't have a set policy.

      Supported resources are: - Reservations - ReservationAssignments

      To call this method, you must have the following Google IAM permissions:

      - `bigqueryreservation.reservations.getIamPolicy` to get policies on reservations.

      Sample 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()) {
         ResourceName resource =
             AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]");
         Policy response = reservationServiceClient.getIamPolicy(resource);
       }
       
      Parameters:
      resource - REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.
      Throws:
      ApiException - if the remote call fails
    • getIamPolicy

      public final com.google.iam.v1.Policy getIamPolicy(String resource)
      Gets the access control policy for a resource. May return:
      • A`NOT_FOUND` error if the resource doesn't exist or you don't have the permission to view it.
      • An empty policy if the resource exists but doesn't have a set policy.

      Supported resources are: - Reservations - ReservationAssignments

      To call this method, you must have the following Google IAM permissions:

      - `bigqueryreservation.reservations.getIamPolicy` to get policies on reservations.

      Sample 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 resource =
             AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]").toString();
         Policy response = reservationServiceClient.getIamPolicy(resource);
       }
       
      Parameters:
      resource - REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.
      Throws:
      ApiException - if the remote call fails
    • getIamPolicy

      public final com.google.iam.v1.Policy getIamPolicy(com.google.iam.v1.GetIamPolicyRequest request)
      Gets the access control policy for a resource. May return:
      • A`NOT_FOUND` error if the resource doesn't exist or you don't have the permission to view it.
      • An empty policy if the resource exists but doesn't have a set policy.

      Supported resources are: - Reservations - ReservationAssignments

      To call this method, you must have the following Google IAM permissions:

      - `bigqueryreservation.reservations.getIamPolicy` to get policies on reservations.

      Sample 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()) {
         GetIamPolicyRequest request =
             GetIamPolicyRequest.newBuilder()
                 .setResource(
                     AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]")
                         .toString())
                 .setOptions(GetPolicyOptions.newBuilder().build())
                 .build();
         Policy response = reservationServiceClient.getIamPolicy(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • getIamPolicyCallable

      public final UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy> getIamPolicyCallable()
      Gets the access control policy for a resource. May return:
      • A`NOT_FOUND` error if the resource doesn't exist or you don't have the permission to view it.
      • An empty policy if the resource exists but doesn't have a set policy.

      Supported resources are: - Reservations - ReservationAssignments

      To call this method, you must have the following Google IAM permissions:

      - `bigqueryreservation.reservations.getIamPolicy` to get policies on reservations.

      Sample 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()) {
         GetIamPolicyRequest request =
             GetIamPolicyRequest.newBuilder()
                 .setResource(
                     AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]")
                         .toString())
                 .setOptions(GetPolicyOptions.newBuilder().build())
                 .build();
         ApiFuture<Policy> future =
             reservationServiceClient.getIamPolicyCallable().futureCall(request);
         // Do something.
         Policy response = future.get();
       }
       
    • setIamPolicy

      public final com.google.iam.v1.Policy setIamPolicy(ResourceName resource, com.google.iam.v1.Policy policy)
      Sets an access control policy for a resource. Replaces any existing policy.

      Supported resources are: - Reservations

      To call this method, you must have the following Google IAM permissions:

      - `bigqueryreservation.reservations.setIamPolicy` to set policies on reservations.

      Sample 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()) {
         ResourceName resource =
             AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]");
         Policy policy = Policy.newBuilder().build();
         Policy response = reservationServiceClient.setIamPolicy(resource, policy);
       }
       
      Parameters:
      resource - REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.
      policy - REQUIRED: The complete policy to be applied to the `resource`. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them.
      Throws:
      ApiException - if the remote call fails
    • setIamPolicy

      public final com.google.iam.v1.Policy setIamPolicy(String resource, com.google.iam.v1.Policy policy)
      Sets an access control policy for a resource. Replaces any existing policy.

      Supported resources are: - Reservations

      To call this method, you must have the following Google IAM permissions:

      - `bigqueryreservation.reservations.setIamPolicy` to set policies on reservations.

      Sample 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 resource =
             AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]").toString();
         Policy policy = Policy.newBuilder().build();
         Policy response = reservationServiceClient.setIamPolicy(resource, policy);
       }
       
      Parameters:
      resource - REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.
      policy - REQUIRED: The complete policy to be applied to the `resource`. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them.
      Throws:
      ApiException - if the remote call fails
    • setIamPolicy

      public final com.google.iam.v1.Policy setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request)
      Sets an access control policy for a resource. Replaces any existing policy.

      Supported resources are: - Reservations

      To call this method, you must have the following Google IAM permissions:

      - `bigqueryreservation.reservations.setIamPolicy` to set policies on reservations.

      Sample 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()) {
         SetIamPolicyRequest request =
             SetIamPolicyRequest.newBuilder()
                 .setResource(
                     AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]")
                         .toString())
                 .setPolicy(Policy.newBuilder().build())
                 .setUpdateMask(FieldMask.newBuilder().build())
                 .build();
         Policy response = reservationServiceClient.setIamPolicy(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • setIamPolicyCallable

      public final UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy> setIamPolicyCallable()
      Sets an access control policy for a resource. Replaces any existing policy.

      Supported resources are: - Reservations

      To call this method, you must have the following Google IAM permissions:

      - `bigqueryreservation.reservations.setIamPolicy` to set policies on reservations.

      Sample 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()) {
         SetIamPolicyRequest request =
             SetIamPolicyRequest.newBuilder()
                 .setResource(
                     AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]")
                         .toString())
                 .setPolicy(Policy.newBuilder().build())
                 .setUpdateMask(FieldMask.newBuilder().build())
                 .build();
         ApiFuture<Policy> future =
             reservationServiceClient.setIamPolicyCallable().futureCall(request);
         // Do something.
         Policy response = future.get();
       }
       
    • testIamPermissions

      public final com.google.iam.v1.TestIamPermissionsResponse testIamPermissions(com.google.iam.v1.TestIamPermissionsRequest request)
      Gets your permissions on a resource. Returns an empty set of permissions if the resource doesn't exist.

      Supported resources are: - Reservations

      No Google IAM permissions are required to call this method.

      Sample 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()) {
         TestIamPermissionsRequest request =
             TestIamPermissionsRequest.newBuilder()
                 .setResource(
                     AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]")
                         .toString())
                 .addAllPermissions(new ArrayList<String>())
                 .build();
         TestIamPermissionsResponse response = reservationServiceClient.testIamPermissions(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • testIamPermissionsCallable

      public final UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse> testIamPermissionsCallable()
      Gets your permissions on a resource. Returns an empty set of permissions if the resource doesn't exist.

      Supported resources are: - Reservations

      No Google IAM permissions are required to call this method.

      Sample 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()) {
         TestIamPermissionsRequest request =
             TestIamPermissionsRequest.newBuilder()
                 .setResource(
                     AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]")
                         .toString())
                 .addAllPermissions(new ArrayList<String>())
                 .build();
         ApiFuture<TestIamPermissionsResponse> future =
             reservationServiceClient.testIamPermissionsCallable().futureCall(request);
         // Do something.
         TestIamPermissionsResponse response = future.get();
       }
       
    • createReservationGroup

      public final ReservationGroup createReservationGroup(CreateReservationGroupRequest request)
      Creates a new reservation group.

      Sample 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()) {
         CreateReservationGroupRequest request =
             CreateReservationGroupRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setReservationGroupId("reservationGroupId-1636887922")
                 .setReservationGroup(ReservationGroup.newBuilder().build())
                 .build();
         ReservationGroup response = reservationServiceClient.createReservationGroup(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • createReservationGroupCallable

      public final UnaryCallable<CreateReservationGroupRequest,ReservationGroup> createReservationGroupCallable()
      Creates a new reservation group.

      Sample 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()) {
         CreateReservationGroupRequest request =
             CreateReservationGroupRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setReservationGroupId("reservationGroupId-1636887922")
                 .setReservationGroup(ReservationGroup.newBuilder().build())
                 .build();
         ApiFuture<ReservationGroup> future =
             reservationServiceClient.createReservationGroupCallable().futureCall(request);
         // Do something.
         ReservationGroup response = future.get();
       }
       
    • getReservationGroup

      public final ReservationGroup getReservationGroup(ReservationGroupName name)
      Returns information about the reservation group.

      Sample 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()) {
         ReservationGroupName name =
             ReservationGroupName.of("[PROJECT]", "[LOCATION]", "[RESERVATION_GROUP]");
         ReservationGroup response = reservationServiceClient.getReservationGroup(name);
       }
       
      Parameters:
      name - Required. Resource name of the reservation group to retrieve. E.g., `projects/myproject/locations/US/reservationGroups/team1-prod`
      Throws:
      ApiException - if the remote call fails
    • getReservationGroup

      public final ReservationGroup getReservationGroup(String name)
      Returns information about the reservation group.

      Sample 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 =
             ReservationGroupName.of("[PROJECT]", "[LOCATION]", "[RESERVATION_GROUP]").toString();
         ReservationGroup response = reservationServiceClient.getReservationGroup(name);
       }
       
      Parameters:
      name - Required. Resource name of the reservation group to retrieve. E.g., `projects/myproject/locations/US/reservationGroups/team1-prod`
      Throws:
      ApiException - if the remote call fails
    • getReservationGroup

      public final ReservationGroup getReservationGroup(GetReservationGroupRequest request)
      Returns information about the reservation group.

      Sample 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()) {
         GetReservationGroupRequest request =
             GetReservationGroupRequest.newBuilder()
                 .setName(
                     ReservationGroupName.of("[PROJECT]", "[LOCATION]", "[RESERVATION_GROUP]")
                         .toString())
                 .build();
         ReservationGroup response = reservationServiceClient.getReservationGroup(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • getReservationGroupCallable

      public final UnaryCallable<GetReservationGroupRequest,ReservationGroup> getReservationGroupCallable()
      Returns information about the reservation group.

      Sample 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()) {
         GetReservationGroupRequest request =
             GetReservationGroupRequest.newBuilder()
                 .setName(
                     ReservationGroupName.of("[PROJECT]", "[LOCATION]", "[RESERVATION_GROUP]")
                         .toString())
                 .build();
         ApiFuture<ReservationGroup> future =
             reservationServiceClient.getReservationGroupCallable().futureCall(request);
         // Do something.
         ReservationGroup response = future.get();
       }
       
    • deleteReservationGroup

      public final void deleteReservationGroup(ReservationGroupName name)
      Deletes a reservation. Returns `google.rpc.Code.FAILED_PRECONDITION` when reservation has assignments.

      Sample 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()) {
         ReservationGroupName name =
             ReservationGroupName.of("[PROJECT]", "[LOCATION]", "[RESERVATION_GROUP]");
         reservationServiceClient.deleteReservationGroup(name);
       }
       
      Parameters:
      name - Required. Resource name of the reservation group to retrieve. E.g., `projects/myproject/locations/US/reservationGroups/team1-prod`
      Throws:
      ApiException - if the remote call fails
    • deleteReservationGroup

      public final void deleteReservationGroup(String name)
      Deletes a reservation. Returns `google.rpc.Code.FAILED_PRECONDITION` when reservation has assignments.

      Sample 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 =
             ReservationGroupName.of("[PROJECT]", "[LOCATION]", "[RESERVATION_GROUP]").toString();
         reservationServiceClient.deleteReservationGroup(name);
       }
       
      Parameters:
      name - Required. Resource name of the reservation group to retrieve. E.g., `projects/myproject/locations/US/reservationGroups/team1-prod`
      Throws:
      ApiException - if the remote call fails
    • deleteReservationGroup

      public final void deleteReservationGroup(DeleteReservationGroupRequest request)
      Deletes a reservation. Returns `google.rpc.Code.FAILED_PRECONDITION` when reservation has assignments.

      Sample 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()) {
         DeleteReservationGroupRequest request =
             DeleteReservationGroupRequest.newBuilder()
                 .setName(
                     ReservationGroupName.of("[PROJECT]", "[LOCATION]", "[RESERVATION_GROUP]")
                         .toString())
                 .build();
         reservationServiceClient.deleteReservationGroup(request);
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • deleteReservationGroupCallable

      public final UnaryCallable<DeleteReservationGroupRequest,com.google.protobuf.Empty> deleteReservationGroupCallable()
      Deletes a reservation. Returns `google.rpc.Code.FAILED_PRECONDITION` when reservation has assignments.

      Sample 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()) {
         DeleteReservationGroupRequest request =
             DeleteReservationGroupRequest.newBuilder()
                 .setName(
                     ReservationGroupName.of("[PROJECT]", "[LOCATION]", "[RESERVATION_GROUP]")
                         .toString())
                 .build();
         ApiFuture<Empty> future =
             reservationServiceClient.deleteReservationGroupCallable().futureCall(request);
         // Do something.
         future.get();
       }
       
    • listReservationGroups

      Lists all the reservation groups for the project in the specified location.

      Sample 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 (ReservationGroup element :
             reservationServiceClient.listReservationGroups(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The parent resource name containing project and location, e.g.: `projects/myproject/locations/US`
      Throws:
      ApiException - if the remote call fails
    • listReservationGroups

      public final ReservationServiceClient.ListReservationGroupsPagedResponse listReservationGroups(String parent)
      Lists all the reservation groups for the project in the specified location.

      Sample 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 (ReservationGroup element :
             reservationServiceClient.listReservationGroups(parent).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      parent - Required. The parent resource name containing project and location, e.g.: `projects/myproject/locations/US`
      Throws:
      ApiException - if the remote call fails
    • listReservationGroups

      Lists all the reservation groups for the project in the specified location.

      Sample 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()) {
         ListReservationGroupsRequest request =
             ListReservationGroupsRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         for (ReservationGroup element :
             reservationServiceClient.listReservationGroups(request).iterateAll()) {
           // doThingsWith(element);
         }
       }
       
      Parameters:
      request - The request object containing all of the parameters for the API call.
      Throws:
      ApiException - if the remote call fails
    • listReservationGroupsPagedCallable

      Lists all the reservation groups for the project in the specified location.

      Sample 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()) {
         ListReservationGroupsRequest request =
             ListReservationGroupsRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         ApiFuture<ReservationGroup> future =
             reservationServiceClient.listReservationGroupsPagedCallable().futureCall(request);
         // Do something.
         for (ReservationGroup element : future.get().iterateAll()) {
           // doThingsWith(element);
         }
       }
       
    • listReservationGroupsCallable

      public final UnaryCallable<ListReservationGroupsRequest,ListReservationGroupsResponse> listReservationGroupsCallable()
      Lists all the reservation groups for the project in the specified location.

      Sample 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()) {
         ListReservationGroupsRequest request =
             ListReservationGroupsRequest.newBuilder()
                 .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
                 .setPageSize(883849137)
                 .setPageToken("pageToken873572522")
                 .build();
         while (true) {
           ListReservationGroupsResponse response =
               reservationServiceClient.listReservationGroupsCallable().call(request);
           for (ReservationGroup element : response.getReservationGroupsList()) {
             // doThingsWith(element);
           }
           String nextPageToken = response.getNextPageToken();
           if (!Strings.isNullOrEmpty(nextPageToken)) {
             request = request.toBuilder().setPageToken(nextPageToken).build();
           } else {
             break;
           }
         }
       }
       
    • close

      public final void close()
      Specified by:
      close in interface AutoCloseable
    • shutdown

      public void shutdown()
      Specified by:
      shutdown in interface BackgroundResource
    • isShutdown

      public boolean isShutdown()
      Specified by:
      isShutdown in interface BackgroundResource
    • isTerminated

      public boolean isTerminated()
      Specified by:
      isTerminated in interface BackgroundResource
    • shutdownNow

      public void shutdownNow()
      Specified by:
      shutdownNow in interface BackgroundResource
    • awaitTermination

      public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
      Specified by:
      awaitTermination in interface BackgroundResource
      Throws:
      InterruptedException