Class ReservationServiceClient
- java.lang.Object
-
- com.google.cloud.bigquery.reservation.v1.ReservationServiceClient
-
- All Implemented Interfaces:
com.google.api.gax.core.BackgroundResource
,AutoCloseable
@Generated("by gapic-generator-java") public class ReservationServiceClient extends Object implements com.google.api.gax.core.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().
The surface of this class includes several types of Java methods for each of the API's methods:
- A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
- A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
- A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.
See the individual methods for example code.
Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.
This class can be customized by passing in a custom instance of ReservationServiceSettings to create(). For example:
To customize credentials:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require 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.
-
-
Nested Class Summary
-
Constructor Summary
Constructors Modifier Constructor Description protected
ReservationServiceClient(ReservationServiceSettings settings)
Constructs an instance of ReservationServiceClient, using the given settings.protected
ReservationServiceClient(ReservationServiceStub stub)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
awaitTermination(long duration, TimeUnit unit)
void
close()
static ReservationServiceClient
create()
Constructs an instance of ReservationServiceClient with default settings.static ReservationServiceClient
create(ReservationServiceSettings settings)
Constructs an instance of ReservationServiceClient, using the given settings.static ReservationServiceClient
create(ReservationServiceStub stub)
Constructs an instance of ReservationServiceClient, using the given stub for making calls.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.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.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.com.google.api.gax.rpc.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.CapacityCommitment
createCapacityCommitment(CreateCapacityCommitmentRequest request)
Creates a new capacity commitment resource.CapacityCommitment
createCapacityCommitment(LocationName parent, CapacityCommitment capacityCommitment)
Creates a new capacity commitment resource.CapacityCommitment
createCapacityCommitment(String parent, CapacityCommitment capacityCommitment)
Creates a new capacity commitment resource.com.google.api.gax.rpc.UnaryCallable<CreateCapacityCommitmentRequest,CapacityCommitment>
createCapacityCommitmentCallable()
Creates a new capacity commitment resource.Reservation
createReservation(CreateReservationRequest request)
Creates a new reservation resource.Reservation
createReservation(LocationName parent, Reservation reservation, String reservationId)
Creates a new reservation resource.Reservation
createReservation(String parent, Reservation reservation, String reservationId)
Creates a new reservation resource.com.google.api.gax.rpc.UnaryCallable<CreateReservationRequest,Reservation>
createReservationCallable()
Creates a new reservation resource.void
deleteAssignment(AssignmentName name)
Deletes a assignment.void
deleteAssignment(DeleteAssignmentRequest request)
Deletes a assignment.void
deleteAssignment(String name)
Deletes a assignment.com.google.api.gax.rpc.UnaryCallable<DeleteAssignmentRequest,com.google.protobuf.Empty>
deleteAssignmentCallable()
Deletes a assignment.void
deleteCapacityCommitment(CapacityCommitmentName name)
Deletes a capacity commitment.void
deleteCapacityCommitment(DeleteCapacityCommitmentRequest request)
Deletes a capacity commitment.void
deleteCapacityCommitment(String name)
Deletes a capacity commitment.com.google.api.gax.rpc.UnaryCallable<DeleteCapacityCommitmentRequest,com.google.protobuf.Empty>
deleteCapacityCommitmentCallable()
Deletes a capacity commitment.void
deleteReservation(DeleteReservationRequest request)
Deletes a reservation.void
deleteReservation(ReservationName name)
Deletes a reservation.void
deleteReservation(String name)
Deletes a reservation.com.google.api.gax.rpc.UnaryCallable<DeleteReservationRequest,com.google.protobuf.Empty>
deleteReservationCallable()
Deletes a reservation.BiReservation
getBiReservation(BiReservationName name)
Retrieves a BI reservation.BiReservation
getBiReservation(GetBiReservationRequest request)
Retrieves a BI reservation.BiReservation
getBiReservation(String name)
Retrieves a BI reservation.com.google.api.gax.rpc.UnaryCallable<GetBiReservationRequest,BiReservation>
getBiReservationCallable()
Retrieves a BI reservation.CapacityCommitment
getCapacityCommitment(CapacityCommitmentName name)
Returns information about the capacity commitment.CapacityCommitment
getCapacityCommitment(GetCapacityCommitmentRequest request)
Returns information about the capacity commitment.CapacityCommitment
getCapacityCommitment(String name)
Returns information about the capacity commitment.com.google.api.gax.rpc.UnaryCallable<GetCapacityCommitmentRequest,CapacityCommitment>
getCapacityCommitmentCallable()
Returns information about the capacity commitment.Reservation
getReservation(GetReservationRequest request)
Returns information about the reservation.Reservation
getReservation(ReservationName name)
Returns information about the reservation.Reservation
getReservation(String name)
Returns information about the reservation.com.google.api.gax.rpc.UnaryCallable<GetReservationRequest,Reservation>
getReservationCallable()
Returns information about the reservation.ReservationServiceSettings
getSettings()
ReservationServiceStub
getStub()
boolean
isShutdown()
boolean
isTerminated()
ReservationServiceClient.ListAssignmentsPagedResponse
listAssignments(ListAssignmentsRequest request)
Lists assignments.ReservationServiceClient.ListAssignmentsPagedResponse
listAssignments(ReservationName parent)
Lists assignments.ReservationServiceClient.ListAssignmentsPagedResponse
listAssignments(String parent)
Lists assignments.com.google.api.gax.rpc.UnaryCallable<ListAssignmentsRequest,ListAssignmentsResponse>
listAssignmentsCallable()
Lists assignments.com.google.api.gax.rpc.UnaryCallable<ListAssignmentsRequest,ReservationServiceClient.ListAssignmentsPagedResponse>
listAssignmentsPagedCallable()
Lists assignments.ReservationServiceClient.ListCapacityCommitmentsPagedResponse
listCapacityCommitments(ListCapacityCommitmentsRequest request)
Lists all the capacity commitments for the admin project.ReservationServiceClient.ListCapacityCommitmentsPagedResponse
listCapacityCommitments(LocationName parent)
Lists all the capacity commitments for the admin project.ReservationServiceClient.ListCapacityCommitmentsPagedResponse
listCapacityCommitments(String parent)
Lists all the capacity commitments for the admin project.com.google.api.gax.rpc.UnaryCallable<ListCapacityCommitmentsRequest,ListCapacityCommitmentsResponse>
listCapacityCommitmentsCallable()
Lists all the capacity commitments for the admin project.com.google.api.gax.rpc.UnaryCallable<ListCapacityCommitmentsRequest,ReservationServiceClient.ListCapacityCommitmentsPagedResponse>
listCapacityCommitmentsPagedCallable()
Lists all the capacity commitments for the admin project.ReservationServiceClient.ListReservationsPagedResponse
listReservations(ListReservationsRequest request)
Lists all the reservations for the project in the specified location.ReservationServiceClient.ListReservationsPagedResponse
listReservations(LocationName parent)
Lists all the reservations for the project in the specified location.ReservationServiceClient.ListReservationsPagedResponse
listReservations(String parent)
Lists all the reservations for the project in the specified location.com.google.api.gax.rpc.UnaryCallable<ListReservationsRequest,ListReservationsResponse>
listReservationsCallable()
Lists all the reservations for the project in the specified location.com.google.api.gax.rpc.UnaryCallable<ListReservationsRequest,ReservationServiceClient.ListReservationsPagedResponse>
listReservationsPagedCallable()
Lists all the reservations for the project in the specified location.CapacityCommitment
mergeCapacityCommitments(LocationName parent, List<String> capacityCommitmentIds)
Merges capacity commitments of the same plan into a single commitment.CapacityCommitment
mergeCapacityCommitments(MergeCapacityCommitmentsRequest request)
Merges capacity commitments of the same plan into a single commitment.CapacityCommitment
mergeCapacityCommitments(String parent, List<String> capacityCommitmentIds)
Merges capacity commitments of the same plan into a single commitment.com.google.api.gax.rpc.UnaryCallable<MergeCapacityCommitmentsRequest,CapacityCommitment>
mergeCapacityCommitmentsCallable()
Merges capacity commitments of the same plan into a single commitment.Assignment
moveAssignment(AssignmentName name, ReservationName destinationId)
Moves an assignment under a new reservation.Assignment
moveAssignment(AssignmentName name, String destinationId)
Moves an assignment under a new reservation.Assignment
moveAssignment(MoveAssignmentRequest request)
Moves an assignment under a new reservation.Assignment
moveAssignment(String name, ReservationName destinationId)
Moves an assignment under a new reservation.Assignment
moveAssignment(String name, String destinationId)
Moves an assignment under a new reservation.com.google.api.gax.rpc.UnaryCallable<MoveAssignmentRequest,Assignment>
moveAssignmentCallable()
Moves an assignment under a new reservation.ReservationServiceClient.SearchAllAssignmentsPagedResponse
searchAllAssignments(LocationName parent, String query)
Looks up assignments for a specified resource for a particular region.ReservationServiceClient.SearchAllAssignmentsPagedResponse
searchAllAssignments(SearchAllAssignmentsRequest request)
Looks up assignments for a specified resource for a particular region.ReservationServiceClient.SearchAllAssignmentsPagedResponse
searchAllAssignments(String parent, String query)
Looks up assignments for a specified resource for a particular region.com.google.api.gax.rpc.UnaryCallable<SearchAllAssignmentsRequest,SearchAllAssignmentsResponse>
searchAllAssignmentsCallable()
Looks up assignments for a specified resource for a particular region.com.google.api.gax.rpc.UnaryCallable<SearchAllAssignmentsRequest,ReservationServiceClient.SearchAllAssignmentsPagedResponse>
searchAllAssignmentsPagedCallable()
Looks up assignments for a specified resource for a particular region.ReservationServiceClient.SearchAssignmentsPagedResponse
searchAssignments(LocationName parent, String query)
Deprecated.This method is deprecated and will be removed in the next major version update.ReservationServiceClient.SearchAssignmentsPagedResponse
searchAssignments(SearchAssignmentsRequest request)
Deprecated.This method is deprecated and will be removed in the next major version update.ReservationServiceClient.SearchAssignmentsPagedResponse
searchAssignments(String parent, String query)
Deprecated.This method is deprecated and will be removed in the next major version update.com.google.api.gax.rpc.UnaryCallable<SearchAssignmentsRequest,SearchAssignmentsResponse>
searchAssignmentsCallable()
Deprecated.This method is deprecated and will be removed in the next major version update.com.google.api.gax.rpc.UnaryCallable<SearchAssignmentsRequest,ReservationServiceClient.SearchAssignmentsPagedResponse>
searchAssignmentsPagedCallable()
Deprecated.This method is deprecated and will be removed in the next major version update.void
shutdown()
void
shutdownNow()
SplitCapacityCommitmentResponse
splitCapacityCommitment(CapacityCommitmentName name, long slotCount)
Splits capacity commitment to two commitments of the same plan and `commitment_end_time`.SplitCapacityCommitmentResponse
splitCapacityCommitment(SplitCapacityCommitmentRequest request)
Splits capacity commitment to two commitments of the same plan and `commitment_end_time`.SplitCapacityCommitmentResponse
splitCapacityCommitment(String name, long slotCount)
Splits capacity commitment to two commitments of the same plan and `commitment_end_time`.com.google.api.gax.rpc.UnaryCallable<SplitCapacityCommitmentRequest,SplitCapacityCommitmentResponse>
splitCapacityCommitmentCallable()
Splits capacity commitment to two commitments of the same plan and `commitment_end_time`.Assignment
updateAssignment(Assignment assignment, com.google.protobuf.FieldMask updateMask)
Updates an existing assignment.Assignment
updateAssignment(UpdateAssignmentRequest request)
Updates an existing assignment.com.google.api.gax.rpc.UnaryCallable<UpdateAssignmentRequest,Assignment>
updateAssignmentCallable()
Updates an existing assignment.BiReservation
updateBiReservation(BiReservation biReservation, com.google.protobuf.FieldMask updateMask)
Updates a BI reservation.BiReservation
updateBiReservation(UpdateBiReservationRequest request)
Updates a BI reservation.com.google.api.gax.rpc.UnaryCallable<UpdateBiReservationRequest,BiReservation>
updateBiReservationCallable()
Updates a BI reservation.CapacityCommitment
updateCapacityCommitment(CapacityCommitment capacityCommitment, com.google.protobuf.FieldMask updateMask)
Updates an existing capacity commitment.CapacityCommitment
updateCapacityCommitment(UpdateCapacityCommitmentRequest request)
Updates an existing capacity commitment.com.google.api.gax.rpc.UnaryCallable<UpdateCapacityCommitmentRequest,CapacityCommitment>
updateCapacityCommitmentCallable()
Updates an existing capacity commitment.Reservation
updateReservation(Reservation reservation, com.google.protobuf.FieldMask updateMask)
Updates an existing reservation resource.Reservation
updateReservation(UpdateReservationRequest request)
Updates an existing reservation resource.com.google.api.gax.rpc.UnaryCallable<UpdateReservationRequest,Reservation>
updateReservationCallable()
Updates an existing reservation resource.
-
-
-
Constructor Detail
-
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 Detail
-
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:
com.google.api.gax.rpc.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:
com.google.api.gax.rpc.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:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
createReservationCallable
public final com.google.api.gax.rpc.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
public final ReservationServiceClient.ListReservationsPagedResponse listReservations(LocationName 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()) { 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:
com.google.api.gax.rpc.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:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listReservations
public final ReservationServiceClient.ListReservationsPagedResponse listReservations(ListReservationsRequest request)
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:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listReservationsPagedCallable
public final com.google.api.gax.rpc.UnaryCallable<ListReservationsRequest,ReservationServiceClient.ListReservationsPagedResponse> 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 com.google.api.gax.rpc.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:
com.google.api.gax.rpc.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:
com.google.api.gax.rpc.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:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getReservationCallable
public final com.google.api.gax.rpc.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:
com.google.api.gax.rpc.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:
com.google.api.gax.rpc.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:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
deleteReservationCallable
public final com.google.api.gax.rpc.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:
com.google.api.gax.rpc.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:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updateReservationCallable
public final com.google.api.gax.rpc.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(); }
-
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:
com.google.api.gax.rpc.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:
com.google.api.gax.rpc.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:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
createCapacityCommitmentCallable
public final com.google.api.gax.rpc.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:
com.google.api.gax.rpc.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:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listCapacityCommitments
public final ReservationServiceClient.ListCapacityCommitmentsPagedResponse listCapacityCommitments(ListCapacityCommitmentsRequest request)
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:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listCapacityCommitmentsPagedCallable
public final com.google.api.gax.rpc.UnaryCallable<ListCapacityCommitmentsRequest,ReservationServiceClient.ListCapacityCommitmentsPagedResponse> 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 com.google.api.gax.rpc.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:
com.google.api.gax.rpc.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:
com.google.api.gax.rpc.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:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getCapacityCommitmentCallable
public final com.google.api.gax.rpc.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:
com.google.api.gax.rpc.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:
com.google.api.gax.rpc.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:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
deleteCapacityCommitmentCallable
public final com.google.api.gax.rpc.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:
com.google.api.gax.rpc.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:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updateCapacityCommitmentCallable
public final com.google.api.gax.rpc.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:
com.google.api.gax.rpc.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:
com.google.api.gax.rpc.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:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
splitCapacityCommitmentCallable
public final com.google.api.gax.rpc.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:
com.google.api.gax.rpc.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:
com.google.api.gax.rpc.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>()) .build(); CapacityCommitment response = reservationServiceClient.mergeCapacityCommitments(request); }
- Parameters:
request
- The request object containing all of the parameters for the API call.- Throws:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
mergeCapacityCommitmentsCallable
public final com.google.api.gax.rpc.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>()) .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:
com.google.api.gax.rpc.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:
com.google.api.gax.rpc.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:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
createAssignmentCallable
public final com.google.api.gax.rpc.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
public final ReservationServiceClient.ListAssignmentsPagedResponse listAssignments(ReservationName 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()) { 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:
com.google.api.gax.rpc.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:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listAssignments
public final ReservationServiceClient.ListAssignmentsPagedResponse listAssignments(ListAssignmentsRequest request)
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:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
listAssignmentsPagedCallable
public final com.google.api.gax.rpc.UnaryCallable<ListAssignmentsRequest,ReservationServiceClient.ListAssignmentsPagedResponse> 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 com.google.api.gax.rpc.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:
com.google.api.gax.rpc.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:
com.google.api.gax.rpc.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:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
deleteAssignmentCallable
public final com.google.api.gax.rpc.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 public final ReservationServiceClient.SearchAssignmentsPagedResponse searchAssignments(LocationName 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()) { 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:
com.google.api.gax.rpc.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:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
searchAssignments
@Deprecated public final ReservationServiceClient.SearchAssignmentsPagedResponse searchAssignments(SearchAssignmentsRequest request)
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:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
searchAssignmentsPagedCallable
@Deprecated public final com.google.api.gax.rpc.UnaryCallable<SearchAssignmentsRequest,ReservationServiceClient.SearchAssignmentsPagedResponse> 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 public final com.google.api.gax.rpc.UnaryCallable<SearchAssignmentsRequest,SearchAssignmentsResponse> 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:
com.google.api.gax.rpc.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:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
searchAllAssignments
public final ReservationServiceClient.SearchAllAssignmentsPagedResponse searchAllAssignments(SearchAllAssignmentsRequest request)
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:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
searchAllAssignmentsPagedCallable
public final com.google.api.gax.rpc.UnaryCallable<SearchAllAssignmentsRequest,ReservationServiceClient.SearchAllAssignmentsPagedResponse> 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 com.google.api.gax.rpc.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:
com.google.api.gax.rpc.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:
com.google.api.gax.rpc.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:
com.google.api.gax.rpc.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:
com.google.api.gax.rpc.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:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
moveAssignmentCallable
public final com.google.api.gax.rpc.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:
com.google.api.gax.rpc.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:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updateAssignmentCallable
public final com.google.api.gax.rpc.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:
com.google.api.gax.rpc.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:
com.google.api.gax.rpc.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:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
getBiReservationCallable
public final com.google.api.gax.rpc.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:
com.google.api.gax.rpc.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:
com.google.api.gax.rpc.ApiException
- if the remote call fails
-
updateBiReservationCallable
public final com.google.api.gax.rpc.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(); }
-
close
public final void close()
- Specified by:
close
in interfaceAutoCloseable
-
shutdown
public void shutdown()
- Specified by:
shutdown
in interfacecom.google.api.gax.core.BackgroundResource
-
isShutdown
public boolean isShutdown()
- Specified by:
isShutdown
in interfacecom.google.api.gax.core.BackgroundResource
-
isTerminated
public boolean isTerminated()
- Specified by:
isTerminated
in interfacecom.google.api.gax.core.BackgroundResource
-
shutdownNow
public void shutdownNow()
- Specified by:
shutdownNow
in interfacecom.google.api.gax.core.BackgroundResource
-
awaitTermination
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException
- Specified by:
awaitTermination
in interfacecom.google.api.gax.core.BackgroundResource
- Throws:
InterruptedException
-
-