Class ReservationServiceClient
- All Implemented Interfaces:
BackgroundResource,AutoCloseable
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().
| Method | Description | Method Variants |
|---|---|---|
CreateReservation |
Creates a new reservation resource. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListReservations |
Lists all the reservations for the project in the specified location. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetReservation |
Returns information about the reservation. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteReservation |
Deletes a reservation. Returns `google.rpc.Code.FAILED_PRECONDITION` when reservation has assignments. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpdateReservation |
Updates an existing reservation resource. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
FailoverReservation |
Fail over a reservation to the secondary location. The operation should be done in the current secondary location, which will be promoted to the new primary location for the reservation. Attempting to failover a reservation in the current primary location will fail with the error code `google.rpc.Code.FAILED_PRECONDITION`. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CreateCapacityCommitment |
Creates a new capacity commitment resource. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListCapacityCommitments |
Lists all the capacity commitments for the admin project. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetCapacityCommitment |
Returns information about the capacity commitment. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteCapacityCommitment |
Deletes a capacity commitment. Attempting to delete capacity commitment before its commitment_end_time will fail with the error code `google.rpc.Code.FAILED_PRECONDITION`. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpdateCapacityCommitment |
Updates an existing capacity commitment. Only `plan` and `renewal_plan` fields can be updated. Plan can only be changed to a plan of a longer commitment period. Attempting to change to a plan with shorter commitment period will fail with the error code `google.rpc.Code.FAILED_PRECONDITION`. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
SplitCapacityCommitment |
Splits capacity commitment to two commitments of the same plan and `commitment_end_time`. A common use case is to enable downgrading commitments. For example, in order to downgrade from 10000 slots to 8000, you might split a 10000 capacity commitment into commitments of 2000 and 8000. Then, you delete the first one after the commitment end time passes. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
MergeCapacityCommitments |
Merges capacity commitments of the same plan into a single commitment. The resulting capacity commitment has the greater commitment_end_time out of the to-be-merged capacity commitments. Attempting to merge capacity commitments of different plan will fail with the error code `google.rpc.Code.FAILED_PRECONDITION`. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CreateAssignment |
Creates an assignment object which allows the given project to submit jobs of a certain type using slots from the specified reservation. Currently a resource (project, folder, organization) can only have one assignment per each (job_type, location) combination, and that reservation will be used for all jobs of the matching type. Different assignments can be created on different levels of the projects, folders or organization hierarchy. During query execution, the assignment is looked up at the project, folder and organization levels in that order. The first assignment found is applied to the query. When creating assignments, it does not matter if other assignments exist at higher levels. Example:
"None" assignments represent an absence of the assignment. Projects assigned to None use on-demand pricing. To create a "None" assignment, use "none" as a reservation_id in the parent. Example parent: `projects/myproject/locations/US/reservations/none`. Returns `google.rpc.Code.PERMISSION_DENIED` if user does not have 'bigquery.admin' permissions on the project using the reservation and the project that owns this reservation. Returns `google.rpc.Code.INVALID_ARGUMENT` when location of the assignment does not match location of the reservation. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListAssignments |
Lists assignments. Only explicitly created assignments will be returned. Example:
In this example, ListAssignments will just return the above two assignments for reservation `res1`, and no expansion/merge will happen. The wildcard "-" can be used for reservations in the request. In that case all assignments belongs to the specified project and location will be listed. **Note** "-" cannot be used for projects nor locations. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteAssignment |
Deletes a assignment. No expansion will happen. Example:
In this example, deletion of the `<organizationA, res1>` assignment won't affect the other assignment `<project1, res1>`. After said deletion, queries from `project1` will still use `res1` while queries from `project2` will switch to use on-demand mode. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
SearchAssignments |
Deprecated: Looks up assignments for a specified resource for a particular region. If the request is about a project: 1. Assignments created on the project will be returned if they exist. 2. Otherwise assignments created on the closest ancestor will be returned. 3. Assignments for different JobTypes will all be returned. The same logic applies if the request is about a folder. If the request is about an organization, then assignments created on the organization will be returned (organization doesn't have ancestors). Comparing to ListAssignments, there are some behavior differences: 1. permission on the assignee will be verified in this API. 2. Hierarchy lookup (project->folder->organization) happens in this API. 3. Parent here is `projects/*/locations/*`, instead of `projects/*/locations/*reservations/*`. **Note** "-" cannot be used for projects nor locations. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
SearchAllAssignments |
Looks up assignments for a specified resource for a particular region. If the request is about a project: 1. Assignments created on the project will be returned if they exist. 2. Otherwise assignments created on the closest ancestor will be returned. 3. Assignments for different JobTypes will all be returned. The same logic applies if the request is about a folder. If the request is about an organization, then assignments created on the organization will be returned (organization doesn't have ancestors). Comparing to ListAssignments, there are some behavior differences: 1. permission on the assignee will be verified in this API. 2. Hierarchy lookup (project->folder->organization) happens in this API. 3. Parent here is `projects/*/locations/*`, instead of `projects/*/locations/*reservations/*`. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
MoveAssignment |
Moves an assignment under a new reservation. This differs from removing an existing assignment and recreating a new one by providing a transactional change that ensures an assignee always has an associated reservation. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpdateAssignment |
Updates an existing assignment. Only the `priority` field can be updated. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetBiReservation |
Retrieves a BI reservation. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpdateBiReservation |
Updates a BI reservation. Only fields specified in the `field_mask` are updated. A singleton BI reservation always exists with default size 0. In order to reserve BI capacity it needs to be updated to an amount greater than 0. In order to release BI capacity reservation size must be set to 0. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetIamPolicy |
Gets the access control policy for a resource. May return:
Supported resources are: - Reservations - ReservationAssignments To call this method, you must have the following Google IAM permissions: - `bigqueryreservation.reservations.getIamPolicy` to get policies on reservations. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
SetIamPolicy |
Sets an access control policy for a resource. Replaces any existing policy. Supported resources are: - Reservations To call this method, you must have the following Google IAM permissions: - `bigqueryreservation.reservations.setIamPolicy` to set policies on reservations. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
TestIamPermissions |
Gets your permissions on a resource. Returns an empty set of permissions if the resource doesn't exist. Supported resources are: - Reservations No Google IAM permissions are required to call this method. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CreateReservationGroup |
Creates a new reservation group. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetReservationGroup |
Returns information about the reservation group. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteReservationGroup |
Deletes a reservation. Returns `google.rpc.Code.FAILED_PRECONDITION` when reservation has assignments. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ListReservationGroups |
Lists all the reservation groups for the project in the specified location. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic class -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedConstructs an instance of ReservationServiceClient, using the given settings.protected -
Method Summary
Modifier and TypeMethodDescriptionbooleanawaitTermination(long duration, TimeUnit unit) final voidclose()static final ReservationServiceClientcreate()Constructs an instance of ReservationServiceClient with default settings.static final ReservationServiceClientcreate(ReservationServiceSettings settings) Constructs an instance of ReservationServiceClient, using the given settings.static final ReservationServiceClientcreate(ReservationServiceStub stub) Constructs an instance of ReservationServiceClient, using the given stub for making calls.final AssignmentcreateAssignment(CreateAssignmentRequest request) Creates an assignment object which allows the given project to submit jobs of a certain type using slots from the specified reservation.final AssignmentcreateAssignment(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.final AssignmentcreateAssignment(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.Creates an assignment object which allows the given project to submit jobs of a certain type using slots from the specified reservation.final CapacityCommitmentCreates a new capacity commitment resource.final CapacityCommitmentcreateCapacityCommitment(LocationName parent, CapacityCommitment capacityCommitment) Creates a new capacity commitment resource.final CapacityCommitmentcreateCapacityCommitment(String parent, CapacityCommitment capacityCommitment) Creates a new capacity commitment resource.Creates a new capacity commitment resource.final ReservationCreates a new reservation resource.final ReservationcreateReservation(LocationName parent, Reservation reservation, String reservationId) Creates a new reservation resource.final ReservationcreateReservation(String parent, Reservation reservation, String reservationId) Creates a new reservation resource.Creates a new reservation resource.final ReservationGroupCreates a new reservation group.Creates a new reservation group.final voidDeletes a assignment.final voiddeleteAssignment(DeleteAssignmentRequest request) Deletes a assignment.final voiddeleteAssignment(String name) Deletes a assignment.final UnaryCallable<DeleteAssignmentRequest,com.google.protobuf.Empty> Deletes a assignment.final voidDeletes a capacity commitment.final voidDeletes a capacity commitment.final voidDeletes a capacity commitment.final UnaryCallable<DeleteCapacityCommitmentRequest,com.google.protobuf.Empty> Deletes a capacity commitment.final voidDeletes a reservation.final voidDeletes a reservation.final voiddeleteReservation(String name) Deletes a reservation.final UnaryCallable<DeleteReservationRequest,com.google.protobuf.Empty> Deletes a reservation.final voidDeletes a reservation.final voidDeletes a reservation.final voiddeleteReservationGroup(String name) Deletes a reservation.final UnaryCallable<DeleteReservationGroupRequest,com.google.protobuf.Empty> Deletes a reservation.final ReservationFail over a reservation to the secondary location.Fail over a reservation to the secondary location.final BiReservationRetrieves a BI reservation.final BiReservationgetBiReservation(GetBiReservationRequest request) Retrieves a BI reservation.final BiReservationgetBiReservation(String name) Retrieves a BI reservation.Retrieves a BI reservation.final CapacityCommitmentReturns information about the capacity commitment.final CapacityCommitmentReturns information about the capacity commitment.final CapacityCommitmentgetCapacityCommitment(String name) Returns information about the capacity commitment.Returns information about the capacity commitment.final com.google.iam.v1.PolicygetIamPolicy(ResourceName resource) Gets the access control policy for a resource.final com.google.iam.v1.PolicygetIamPolicy(com.google.iam.v1.GetIamPolicyRequest request) Gets the access control policy for a resource.final com.google.iam.v1.PolicygetIamPolicy(String resource) Gets the access control policy for a resource.final UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy> Gets the access control policy for a resource.final ReservationgetReservation(GetReservationRequest request) Returns information about the reservation.final ReservationReturns information about the reservation.final ReservationgetReservation(String name) Returns information about the reservation.Returns information about the reservation.final ReservationGroupReturns information about the reservation group.final ReservationGroupReturns information about the reservation group.final ReservationGroupgetReservationGroup(String name) Returns information about the reservation group.Returns information about the reservation group.getStub()booleanbooleanlistAssignments(ListAssignmentsRequest request) Lists assignments.listAssignments(ReservationName parent) Lists assignments.listAssignments(String parent) Lists assignments.Lists assignments.Lists assignments.Lists all the capacity commitments for the admin project.listCapacityCommitments(LocationName parent) Lists all the capacity commitments for the admin project.listCapacityCommitments(String parent) Lists all the capacity commitments for the admin project.Lists all the capacity commitments for the admin project.final UnaryCallable<ListCapacityCommitmentsRequest,ReservationServiceClient.ListCapacityCommitmentsPagedResponse> Lists all the capacity commitments for the admin project.Lists all the reservation groups for the project in the specified location.listReservationGroups(LocationName parent) Lists all the reservation groups for the project in the specified location.listReservationGroups(String parent) Lists all the reservation groups for the project in the specified location.Lists all the reservation groups for the project in the specified location.final UnaryCallable<ListReservationGroupsRequest,ReservationServiceClient.ListReservationGroupsPagedResponse> Lists all the reservation groups for the project in the specified location.listReservations(ListReservationsRequest request) Lists all the reservations for the project in the specified location.listReservations(LocationName parent) Lists all the reservations for the project in the specified location.listReservations(String parent) Lists all the reservations for the project in the specified location.Lists all the reservations for the project in the specified location.Lists all the reservations for the project in the specified location.final CapacityCommitmentmergeCapacityCommitments(LocationName parent, List<String> capacityCommitmentIds) Merges capacity commitments of the same plan into a single commitment.final CapacityCommitmentMerges capacity commitments of the same plan into a single commitment.final CapacityCommitmentmergeCapacityCommitments(String parent, List<String> capacityCommitmentIds) Merges capacity commitments of the same plan into a single commitment.Merges capacity commitments of the same plan into a single commitment.final AssignmentmoveAssignment(AssignmentName name, ReservationName destinationId) Moves an assignment under a new reservation.final AssignmentmoveAssignment(AssignmentName name, String destinationId) Moves an assignment under a new reservation.final AssignmentmoveAssignment(MoveAssignmentRequest request) Moves an assignment under a new reservation.final AssignmentmoveAssignment(String name, ReservationName destinationId) Moves an assignment under a new reservation.final AssignmentmoveAssignment(String name, String destinationId) Moves an assignment under a new reservation.Moves an assignment under a new reservation.searchAllAssignments(LocationName parent, String query) Looks up assignments for a specified resource for a particular region.Looks up assignments for a specified resource for a particular region.searchAllAssignments(String parent, String query) Looks up assignments for a specified resource for a particular region.Looks up assignments for a specified resource for a particular region.final UnaryCallable<SearchAllAssignmentsRequest,ReservationServiceClient.SearchAllAssignmentsPagedResponse> Looks up assignments for a specified resource for a particular region.searchAssignments(LocationName parent, String query) Deprecated.This method is deprecated and will be removed in the next major version update.Deprecated.This method is deprecated and will be removed in the next major version update.searchAssignments(String parent, String query) Deprecated.This method is deprecated and will be removed in the next major version update.Deprecated.This method is deprecated and will be removed in the next major version update.final UnaryCallable<SearchAssignmentsRequest,ReservationServiceClient.SearchAssignmentsPagedResponse> Deprecated.This method is deprecated and will be removed in the next major version update.final com.google.iam.v1.PolicysetIamPolicy(ResourceName resource, com.google.iam.v1.Policy policy) Sets an access control policy for a resource.final com.google.iam.v1.PolicysetIamPolicy(com.google.iam.v1.SetIamPolicyRequest request) Sets an access control policy for a resource.final com.google.iam.v1.PolicysetIamPolicy(String resource, com.google.iam.v1.Policy policy) Sets an access control policy for a resource.final UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy> Sets an access control policy for a resource.voidshutdown()voidsplitCapacityCommitment(CapacityCommitmentName name, long slotCount) Splits capacity commitment to two commitments of the same plan and `commitment_end_time`.Splits capacity commitment to two commitments of the same plan and `commitment_end_time`.splitCapacityCommitment(String name, long slotCount) Splits capacity commitment to two commitments of the same plan and `commitment_end_time`.Splits capacity commitment to two commitments of the same plan and `commitment_end_time`.final com.google.iam.v1.TestIamPermissionsResponsetestIamPermissions(com.google.iam.v1.TestIamPermissionsRequest request) Gets your permissions on a resource.final UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse> Gets your permissions on a resource.final AssignmentupdateAssignment(Assignment assignment, com.google.protobuf.FieldMask updateMask) Updates an existing assignment.final AssignmentupdateAssignment(UpdateAssignmentRequest request) Updates an existing assignment.Updates an existing assignment.final BiReservationupdateBiReservation(BiReservation biReservation, com.google.protobuf.FieldMask updateMask) Updates a BI reservation.final BiReservationUpdates a BI reservation.Updates a BI reservation.final CapacityCommitmentupdateCapacityCommitment(CapacityCommitment capacityCommitment, com.google.protobuf.FieldMask updateMask) Updates an existing capacity commitment.final CapacityCommitmentUpdates an existing capacity commitment.Updates an existing capacity commitment.final ReservationupdateReservation(Reservation reservation, com.google.protobuf.FieldMask updateMask) Updates an existing reservation resource.final ReservationUpdates an existing reservation resource.Updates an existing reservation resource.
-
Constructor Details
-
ReservationServiceClient
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
-
-
Method Details
-
create
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
Constructs an instance of ReservationServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(ReservationServiceSettings). -
getSettings
-
getStub
-
createReservation
public final Reservation createReservation(LocationName parent, Reservation reservation, String reservationId) Creates a new reservation resource.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); Reservation reservation = Reservation.newBuilder().build(); String reservationId = "reservationId1116965383"; Reservation response = reservationServiceClient.createReservation(parent, reservation, reservationId); }- Parameters:
parent- Required. Project, location. E.g., `projects/myproject/locations/US`reservation- Definition of the new reservation to create.reservationId- The reservation ID. It must only contain lower case alphanumeric characters or dashes. It must start with a letter and must not end with a dash. Its maximum length is 64 characters.- Throws:
ApiException- if the remote call fails
-
createReservation
public final Reservation createReservation(String parent, Reservation reservation, String reservationId) Creates a new reservation resource.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); Reservation reservation = Reservation.newBuilder().build(); String reservationId = "reservationId1116965383"; Reservation response = reservationServiceClient.createReservation(parent, reservation, reservationId); }- Parameters:
parent- Required. Project, location. E.g., `projects/myproject/locations/US`reservation- Definition of the new reservation to create.reservationId- The reservation ID. It must only contain lower case alphanumeric characters or dashes. It must start with a letter and must not end with a dash. Its maximum length is 64 characters.- Throws:
ApiException- if the remote call fails
-
createReservation
Creates a new reservation resource.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { CreateReservationRequest request = CreateReservationRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setReservationId("reservationId1116965383") .setReservation(Reservation.newBuilder().build()) .build(); Reservation response = reservationServiceClient.createReservation(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
createReservationCallable
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:
ApiException- if the remote call fails
-
listReservations
Lists all the reservations for the project in the specified location.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); for (Reservation element : reservationServiceClient.listReservations(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The parent resource name containing project and location, e.g.: `projects/myproject/locations/US`- Throws:
ApiException- if the remote call fails
-
listReservations
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:
ApiException- if the remote call fails
-
listReservationsPagedCallable
public final 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 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
Returns information about the reservation.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { ReservationName name = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]"); Reservation response = reservationServiceClient.getReservation(name); }- Parameters:
name- Required. Resource name of the reservation to retrieve. E.g., `projects/myproject/locations/US/reservations/team1-prod`- Throws:
ApiException- if the remote call fails
-
getReservation
Returns information about the reservation.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { String name = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString(); Reservation response = reservationServiceClient.getReservation(name); }- Parameters:
name- Required. Resource name of the reservation to retrieve. E.g., `projects/myproject/locations/US/reservations/team1-prod`- Throws:
ApiException- if the remote call fails
-
getReservation
Returns information about the reservation.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { GetReservationRequest request = GetReservationRequest.newBuilder() .setName(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString()) .build(); Reservation response = reservationServiceClient.getReservation(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getReservationCallable
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
Deletes a reservation. Returns `google.rpc.Code.FAILED_PRECONDITION` when reservation has assignments.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { ReservationName name = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]"); reservationServiceClient.deleteReservation(name); }- Parameters:
name- Required. Resource name of the reservation to retrieve. E.g., `projects/myproject/locations/US/reservations/team1-prod`- Throws:
ApiException- if the remote call fails
-
deleteReservation
Deletes a reservation. Returns `google.rpc.Code.FAILED_PRECONDITION` when reservation has assignments.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { String name = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString(); reservationServiceClient.deleteReservation(name); }- Parameters:
name- Required. Resource name of the reservation to retrieve. E.g., `projects/myproject/locations/US/reservations/team1-prod`- Throws:
ApiException- if the remote call fails
-
deleteReservation
Deletes a reservation. Returns `google.rpc.Code.FAILED_PRECONDITION` when reservation has assignments.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { DeleteReservationRequest request = DeleteReservationRequest.newBuilder() .setName(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString()) .build(); reservationServiceClient.deleteReservation(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
deleteReservationCallable
public final UnaryCallable<DeleteReservationRequest,com.google.protobuf.Empty> deleteReservationCallable()Deletes a reservation. Returns `google.rpc.Code.FAILED_PRECONDITION` when reservation has assignments.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { DeleteReservationRequest request = DeleteReservationRequest.newBuilder() .setName(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString()) .build(); ApiFuture<Empty> future = reservationServiceClient.deleteReservationCallable().futureCall(request); // Do something. future.get(); } -
updateReservation
public final Reservation updateReservation(Reservation reservation, com.google.protobuf.FieldMask updateMask) Updates an existing reservation resource.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { Reservation reservation = Reservation.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); Reservation response = reservationServiceClient.updateReservation(reservation, updateMask); }- Parameters:
reservation- Content of the reservation to update.updateMask- Standard field mask for the set of fields to be updated.- Throws:
ApiException- if the remote call fails
-
updateReservation
Updates an existing reservation resource.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { UpdateReservationRequest request = UpdateReservationRequest.newBuilder() .setReservation(Reservation.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); Reservation response = reservationServiceClient.updateReservation(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
updateReservationCallable
Updates an existing reservation resource.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { UpdateReservationRequest request = UpdateReservationRequest.newBuilder() .setReservation(Reservation.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); ApiFuture<Reservation> future = reservationServiceClient.updateReservationCallable().futureCall(request); // Do something. Reservation response = future.get(); } -
failoverReservation
Fail over a reservation to the secondary location. The operation should be done in the current secondary location, which will be promoted to the new primary location for the reservation. Attempting to failover a reservation in the current primary location will fail with the error code `google.rpc.Code.FAILED_PRECONDITION`.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { FailoverReservationRequest request = FailoverReservationRequest.newBuilder() .setName(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString()) .setFailoverMode(FailoverMode.forNumber(0)) .build(); Reservation response = reservationServiceClient.failoverReservation(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
failoverReservationCallable
Fail over a reservation to the secondary location. The operation should be done in the current secondary location, which will be promoted to the new primary location for the reservation. Attempting to failover a reservation in the current primary location will fail with the error code `google.rpc.Code.FAILED_PRECONDITION`.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { FailoverReservationRequest request = FailoverReservationRequest.newBuilder() .setName(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString()) .setFailoverMode(FailoverMode.forNumber(0)) .build(); ApiFuture<Reservation> future = reservationServiceClient.failoverReservationCallable().futureCall(request); // Do something. Reservation response = future.get(); } -
createCapacityCommitment
public final CapacityCommitment createCapacityCommitment(LocationName parent, CapacityCommitment capacityCommitment) Creates a new capacity commitment resource.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); CapacityCommitment capacityCommitment = CapacityCommitment.newBuilder().build(); CapacityCommitment response = reservationServiceClient.createCapacityCommitment(parent, capacityCommitment); }- Parameters:
parent- Required. Resource name of the parent reservation. E.g., `projects/myproject/locations/US`capacityCommitment- Content of the capacity commitment to create.- Throws:
ApiException- if the remote call fails
-
createCapacityCommitment
public final CapacityCommitment createCapacityCommitment(String parent, CapacityCommitment capacityCommitment) Creates a new capacity commitment resource.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); CapacityCommitment capacityCommitment = CapacityCommitment.newBuilder().build(); CapacityCommitment response = reservationServiceClient.createCapacityCommitment(parent, capacityCommitment); }- Parameters:
parent- Required. Resource name of the parent reservation. E.g., `projects/myproject/locations/US`capacityCommitment- Content of the capacity commitment to create.- Throws:
ApiException- if the remote call fails
-
createCapacityCommitment
Creates a new capacity commitment resource.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { CreateCapacityCommitmentRequest request = CreateCapacityCommitmentRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setCapacityCommitment(CapacityCommitment.newBuilder().build()) .setEnforceSingleAdminProjectPerOrg(true) .setCapacityCommitmentId("capacityCommitmentId1185645802") .build(); CapacityCommitment response = reservationServiceClient.createCapacityCommitment(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
createCapacityCommitmentCallable
public final UnaryCallable<CreateCapacityCommitmentRequest,CapacityCommitment> createCapacityCommitmentCallable()Creates a new capacity commitment resource.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { CreateCapacityCommitmentRequest request = CreateCapacityCommitmentRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setCapacityCommitment(CapacityCommitment.newBuilder().build()) .setEnforceSingleAdminProjectPerOrg(true) .setCapacityCommitmentId("capacityCommitmentId1185645802") .build(); ApiFuture<CapacityCommitment> future = reservationServiceClient.createCapacityCommitmentCallable().futureCall(request); // Do something. CapacityCommitment response = future.get(); } -
listCapacityCommitments
public final ReservationServiceClient.ListCapacityCommitmentsPagedResponse listCapacityCommitments(LocationName parent) Lists all the capacity commitments for the admin project.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); for (CapacityCommitment element : reservationServiceClient.listCapacityCommitments(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. Resource name of the parent reservation. E.g., `projects/myproject/locations/US`- Throws:
ApiException- if the remote call fails
-
listCapacityCommitments
public final ReservationServiceClient.ListCapacityCommitmentsPagedResponse listCapacityCommitments(String parent) Lists all the capacity commitments for the admin project.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); for (CapacityCommitment element : reservationServiceClient.listCapacityCommitments(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. Resource name of the parent reservation. E.g., `projects/myproject/locations/US`- Throws:
ApiException- if the remote call fails
-
listCapacityCommitments
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:
ApiException- if the remote call fails
-
listCapacityCommitmentsPagedCallable
public final 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 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
Returns information about the capacity commitment.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { CapacityCommitmentName name = CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]"); CapacityCommitment response = reservationServiceClient.getCapacityCommitment(name); }- Parameters:
name- Required. Resource name of the capacity commitment to retrieve. E.g., `projects/myproject/locations/US/capacityCommitments/123`- Throws:
ApiException- if the remote call fails
-
getCapacityCommitment
Returns information about the capacity commitment.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { String name = CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]").toString(); CapacityCommitment response = reservationServiceClient.getCapacityCommitment(name); }- Parameters:
name- Required. Resource name of the capacity commitment to retrieve. E.g., `projects/myproject/locations/US/capacityCommitments/123`- Throws:
ApiException- if the remote call fails
-
getCapacityCommitment
Returns information about the capacity commitment.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { GetCapacityCommitmentRequest request = GetCapacityCommitmentRequest.newBuilder() .setName( CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]") .toString()) .build(); CapacityCommitment response = reservationServiceClient.getCapacityCommitment(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getCapacityCommitmentCallable
public final UnaryCallable<GetCapacityCommitmentRequest,CapacityCommitment> getCapacityCommitmentCallable()Returns information about the capacity commitment.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { GetCapacityCommitmentRequest request = GetCapacityCommitmentRequest.newBuilder() .setName( CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]") .toString()) .build(); ApiFuture<CapacityCommitment> future = reservationServiceClient.getCapacityCommitmentCallable().futureCall(request); // Do something. CapacityCommitment response = future.get(); } -
deleteCapacityCommitment
Deletes a capacity commitment. Attempting to delete capacity commitment before its commitment_end_time will fail with the error code `google.rpc.Code.FAILED_PRECONDITION`.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { CapacityCommitmentName name = CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]"); reservationServiceClient.deleteCapacityCommitment(name); }- Parameters:
name- Required. Resource name of the capacity commitment to delete. E.g., `projects/myproject/locations/US/capacityCommitments/123`- Throws:
ApiException- if the remote call fails
-
deleteCapacityCommitment
Deletes a capacity commitment. Attempting to delete capacity commitment before its commitment_end_time will fail with the error code `google.rpc.Code.FAILED_PRECONDITION`.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { String name = CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]").toString(); reservationServiceClient.deleteCapacityCommitment(name); }- Parameters:
name- Required. Resource name of the capacity commitment to delete. E.g., `projects/myproject/locations/US/capacityCommitments/123`- Throws:
ApiException- if the remote call fails
-
deleteCapacityCommitment
Deletes a capacity commitment. Attempting to delete capacity commitment before its commitment_end_time will fail with the error code `google.rpc.Code.FAILED_PRECONDITION`.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { DeleteCapacityCommitmentRequest request = DeleteCapacityCommitmentRequest.newBuilder() .setName( CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]") .toString()) .setForce(true) .build(); reservationServiceClient.deleteCapacityCommitment(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
deleteCapacityCommitmentCallable
public final UnaryCallable<DeleteCapacityCommitmentRequest,com.google.protobuf.Empty> deleteCapacityCommitmentCallable()Deletes a capacity commitment. Attempting to delete capacity commitment before its commitment_end_time will fail with the error code `google.rpc.Code.FAILED_PRECONDITION`.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { DeleteCapacityCommitmentRequest request = DeleteCapacityCommitmentRequest.newBuilder() .setName( CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]") .toString()) .setForce(true) .build(); ApiFuture<Empty> future = reservationServiceClient.deleteCapacityCommitmentCallable().futureCall(request); // Do something. future.get(); } -
updateCapacityCommitment
public final CapacityCommitment updateCapacityCommitment(CapacityCommitment capacityCommitment, com.google.protobuf.FieldMask updateMask) Updates an existing capacity commitment.Only `plan` and `renewal_plan` fields can be updated.
Plan can only be changed to a plan of a longer commitment period. Attempting to change to a plan with shorter commitment period will fail with the error code `google.rpc.Code.FAILED_PRECONDITION`.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { CapacityCommitment capacityCommitment = CapacityCommitment.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); CapacityCommitment response = reservationServiceClient.updateCapacityCommitment(capacityCommitment, updateMask); }- Parameters:
capacityCommitment- Content of the capacity commitment to update.updateMask- Standard field mask for the set of fields to be updated.- Throws:
ApiException- if the remote call fails
-
updateCapacityCommitment
Updates an existing capacity commitment.Only `plan` and `renewal_plan` fields can be updated.
Plan can only be changed to a plan of a longer commitment period. Attempting to change to a plan with shorter commitment period will fail with the error code `google.rpc.Code.FAILED_PRECONDITION`.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { UpdateCapacityCommitmentRequest request = UpdateCapacityCommitmentRequest.newBuilder() .setCapacityCommitment(CapacityCommitment.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); CapacityCommitment response = reservationServiceClient.updateCapacityCommitment(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
updateCapacityCommitmentCallable
public final UnaryCallable<UpdateCapacityCommitmentRequest,CapacityCommitment> updateCapacityCommitmentCallable()Updates an existing capacity commitment.Only `plan` and `renewal_plan` fields can be updated.
Plan can only be changed to a plan of a longer commitment period. Attempting to change to a plan with shorter commitment period will fail with the error code `google.rpc.Code.FAILED_PRECONDITION`.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { UpdateCapacityCommitmentRequest request = UpdateCapacityCommitmentRequest.newBuilder() .setCapacityCommitment(CapacityCommitment.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); ApiFuture<CapacityCommitment> future = reservationServiceClient.updateCapacityCommitmentCallable().futureCall(request); // Do something. CapacityCommitment response = future.get(); } -
splitCapacityCommitment
public final SplitCapacityCommitmentResponse splitCapacityCommitment(CapacityCommitmentName name, long slotCount) Splits capacity commitment to two commitments of the same plan and `commitment_end_time`.A common use case is to enable downgrading commitments.
For example, in order to downgrade from 10000 slots to 8000, you might split a 10000 capacity commitment into commitments of 2000 and 8000. Then, you delete the first one after the commitment end time passes.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { CapacityCommitmentName name = CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]"); long slotCount = -191518834; SplitCapacityCommitmentResponse response = reservationServiceClient.splitCapacityCommitment(name, slotCount); }- Parameters:
name- Required. The resource name e.g.,: `projects/myproject/locations/US/capacityCommitments/123`slotCount- Number of slots in the capacity commitment after the split.- Throws:
ApiException- if the remote call fails
-
splitCapacityCommitment
Splits capacity commitment to two commitments of the same plan and `commitment_end_time`.A common use case is to enable downgrading commitments.
For example, in order to downgrade from 10000 slots to 8000, you might split a 10000 capacity commitment into commitments of 2000 and 8000. Then, you delete the first one after the commitment end time passes.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { String name = CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]").toString(); long slotCount = -191518834; SplitCapacityCommitmentResponse response = reservationServiceClient.splitCapacityCommitment(name, slotCount); }- Parameters:
name- Required. The resource name e.g.,: `projects/myproject/locations/US/capacityCommitments/123`slotCount- Number of slots in the capacity commitment after the split.- Throws:
ApiException- if the remote call fails
-
splitCapacityCommitment
public final SplitCapacityCommitmentResponse splitCapacityCommitment(SplitCapacityCommitmentRequest request) Splits capacity commitment to two commitments of the same plan and `commitment_end_time`.A common use case is to enable downgrading commitments.
For example, in order to downgrade from 10000 slots to 8000, you might split a 10000 capacity commitment into commitments of 2000 and 8000. Then, you delete the first one after the commitment end time passes.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { SplitCapacityCommitmentRequest request = SplitCapacityCommitmentRequest.newBuilder() .setName( CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]") .toString()) .setSlotCount(-191518834) .build(); SplitCapacityCommitmentResponse response = reservationServiceClient.splitCapacityCommitment(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
splitCapacityCommitmentCallable
public final UnaryCallable<SplitCapacityCommitmentRequest,SplitCapacityCommitmentResponse> splitCapacityCommitmentCallable()Splits capacity commitment to two commitments of the same plan and `commitment_end_time`.A common use case is to enable downgrading commitments.
For example, in order to downgrade from 10000 slots to 8000, you might split a 10000 capacity commitment into commitments of 2000 and 8000. Then, you delete the first one after the commitment end time passes.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { SplitCapacityCommitmentRequest request = SplitCapacityCommitmentRequest.newBuilder() .setName( CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]") .toString()) .setSlotCount(-191518834) .build(); ApiFuture<SplitCapacityCommitmentResponse> future = reservationServiceClient.splitCapacityCommitmentCallable().futureCall(request); // Do something. SplitCapacityCommitmentResponse response = future.get(); } -
mergeCapacityCommitments
public final CapacityCommitment mergeCapacityCommitments(LocationName parent, List<String> capacityCommitmentIds) Merges capacity commitments of the same plan into a single commitment.The resulting capacity commitment has the greater commitment_end_time out of the to-be-merged capacity commitments.
Attempting to merge capacity commitments of different plan will fail with the error code `google.rpc.Code.FAILED_PRECONDITION`.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); List<String> capacityCommitmentIds = new ArrayList<>(); CapacityCommitment response = reservationServiceClient.mergeCapacityCommitments(parent, capacityCommitmentIds); }- Parameters:
parent- Parent resource that identifies admin project and location e.g., `projects/myproject/locations/us`capacityCommitmentIds- Ids of capacity commitments to merge. These capacity commitments must exist under admin project and location specified in the parent. ID is the last portion of capacity commitment name e.g., 'abc' for projects/myproject/locations/US/capacityCommitments/abc- Throws:
ApiException- if the remote call fails
-
mergeCapacityCommitments
public final CapacityCommitment mergeCapacityCommitments(String parent, List<String> capacityCommitmentIds) Merges capacity commitments of the same plan into a single commitment.The resulting capacity commitment has the greater commitment_end_time out of the to-be-merged capacity commitments.
Attempting to merge capacity commitments of different plan will fail with the error code `google.rpc.Code.FAILED_PRECONDITION`.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); List<String> capacityCommitmentIds = new ArrayList<>(); CapacityCommitment response = reservationServiceClient.mergeCapacityCommitments(parent, capacityCommitmentIds); }- Parameters:
parent- Parent resource that identifies admin project and location e.g., `projects/myproject/locations/us`capacityCommitmentIds- Ids of capacity commitments to merge. These capacity commitments must exist under admin project and location specified in the parent. ID is the last portion of capacity commitment name e.g., 'abc' for projects/myproject/locations/US/capacityCommitments/abc- Throws:
ApiException- if the remote call fails
-
mergeCapacityCommitments
Merges capacity commitments of the same plan into a single commitment.The resulting capacity commitment has the greater commitment_end_time out of the to-be-merged capacity commitments.
Attempting to merge capacity commitments of different plan will fail with the error code `google.rpc.Code.FAILED_PRECONDITION`.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { MergeCapacityCommitmentsRequest request = MergeCapacityCommitmentsRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .addAllCapacityCommitmentIds(new ArrayList<String>()) .setCapacityCommitmentId("capacityCommitmentId1185645802") .build(); CapacityCommitment response = reservationServiceClient.mergeCapacityCommitments(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
mergeCapacityCommitmentsCallable
public final UnaryCallable<MergeCapacityCommitmentsRequest,CapacityCommitment> mergeCapacityCommitmentsCallable()Merges capacity commitments of the same plan into a single commitment.The resulting capacity commitment has the greater commitment_end_time out of the to-be-merged capacity commitments.
Attempting to merge capacity commitments of different plan will fail with the error code `google.rpc.Code.FAILED_PRECONDITION`.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { MergeCapacityCommitmentsRequest request = MergeCapacityCommitmentsRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .addAllCapacityCommitmentIds(new ArrayList<String>()) .setCapacityCommitmentId("capacityCommitmentId1185645802") .build(); ApiFuture<CapacityCommitment> future = reservationServiceClient.mergeCapacityCommitmentsCallable().futureCall(request); // Do something. CapacityCommitment response = future.get(); } -
createAssignment
Creates an assignment object which allows the given project to submit jobs of a certain type using slots from the specified reservation.Currently a resource (project, folder, organization) can only have one assignment per each (job_type, location) combination, and that reservation will be used for all jobs of the matching type.
Different assignments can be created on different levels of the projects, folders or organization hierarchy. During query execution, the assignment is looked up at the project, folder and organization levels in that order. The first assignment found is applied to the query.
When creating assignments, it does not matter if other assignments exist at higher levels.
Example:
- The organization `organizationA` contains two projects, `project1` and `project2`.
- Assignments for all three entities (`organizationA`, `project1`, and `project2`) could all be created and mapped to the same or different reservations.
"None" assignments represent an absence of the assignment. Projects assigned to None use on-demand pricing. To create a "None" assignment, use "none" as a reservation_id in the parent. Example parent: `projects/myproject/locations/US/reservations/none`.
Returns `google.rpc.Code.PERMISSION_DENIED` if user does not have 'bigquery.admin' permissions on the project using the reservation and the project that owns this reservation.
Returns `google.rpc.Code.INVALID_ARGUMENT` when location of the assignment does not match location of the reservation.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { ReservationName parent = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]"); Assignment assignment = Assignment.newBuilder().build(); Assignment response = reservationServiceClient.createAssignment(parent, assignment); }- Parameters:
parent- Required. The parent resource name of the assignment E.g. `projects/myproject/locations/US/reservations/team1-prod`assignment- Assignment resource to create.- Throws:
ApiException- if the remote call fails
-
createAssignment
Creates an assignment object which allows the given project to submit jobs of a certain type using slots from the specified reservation.Currently a resource (project, folder, organization) can only have one assignment per each (job_type, location) combination, and that reservation will be used for all jobs of the matching type.
Different assignments can be created on different levels of the projects, folders or organization hierarchy. During query execution, the assignment is looked up at the project, folder and organization levels in that order. The first assignment found is applied to the query.
When creating assignments, it does not matter if other assignments exist at higher levels.
Example:
- The organization `organizationA` contains two projects, `project1` and `project2`.
- Assignments for all three entities (`organizationA`, `project1`, and `project2`) could all be created and mapped to the same or different reservations.
"None" assignments represent an absence of the assignment. Projects assigned to None use on-demand pricing. To create a "None" assignment, use "none" as a reservation_id in the parent. Example parent: `projects/myproject/locations/US/reservations/none`.
Returns `google.rpc.Code.PERMISSION_DENIED` if user does not have 'bigquery.admin' permissions on the project using the reservation and the project that owns this reservation.
Returns `google.rpc.Code.INVALID_ARGUMENT` when location of the assignment does not match location of the reservation.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { String parent = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString(); Assignment assignment = Assignment.newBuilder().build(); Assignment response = reservationServiceClient.createAssignment(parent, assignment); }- Parameters:
parent- Required. The parent resource name of the assignment E.g. `projects/myproject/locations/US/reservations/team1-prod`assignment- Assignment resource to create.- Throws:
ApiException- if the remote call fails
-
createAssignment
Creates an assignment object which allows the given project to submit jobs of a certain type using slots from the specified reservation.Currently a resource (project, folder, organization) can only have one assignment per each (job_type, location) combination, and that reservation will be used for all jobs of the matching type.
Different assignments can be created on different levels of the projects, folders or organization hierarchy. During query execution, the assignment is looked up at the project, folder and organization levels in that order. The first assignment found is applied to the query.
When creating assignments, it does not matter if other assignments exist at higher levels.
Example:
- The organization `organizationA` contains two projects, `project1` and `project2`.
- Assignments for all three entities (`organizationA`, `project1`, and `project2`) could all be created and mapped to the same or different reservations.
"None" assignments represent an absence of the assignment. Projects assigned to None use on-demand pricing. To create a "None" assignment, use "none" as a reservation_id in the parent. Example parent: `projects/myproject/locations/US/reservations/none`.
Returns `google.rpc.Code.PERMISSION_DENIED` if user does not have 'bigquery.admin' permissions on the project using the reservation and the project that owns this reservation.
Returns `google.rpc.Code.INVALID_ARGUMENT` when location of the assignment does not match location of the reservation.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { CreateAssignmentRequest request = CreateAssignmentRequest.newBuilder() .setParent(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString()) .setAssignment(Assignment.newBuilder().build()) .setAssignmentId("assignmentId-1603989304") .build(); Assignment response = reservationServiceClient.createAssignment(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
createAssignmentCallable
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:
ApiException- if the remote call fails
-
listAssignments
Lists assignments.Only explicitly created assignments will be returned.
Example:
- Organization `organizationA` contains two projects, `project1` and `project2`.
- Reservation `res1` exists and was created previously.
- CreateAssignment was used previously to define the following associations between entities and reservations: `<organizationA, res1>` and `<project1, res1>`
In this example, ListAssignments will just return the above two assignments for reservation `res1`, and no expansion/merge will happen.
The wildcard "-" can be used for reservations in the request. In that case all assignments belongs to the specified project and location will be listed.
**Note** "-" cannot be used for projects nor locations.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { String parent = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString(); for (Assignment element : reservationServiceClient.listAssignments(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The parent resource name e.g.:`projects/myproject/locations/US/reservations/team1-prod`
Or:
`projects/myproject/locations/US/reservations/-`
- Throws:
ApiException- if the remote call fails
-
listAssignments
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:
ApiException- if the remote call fails
-
listAssignmentsPagedCallable
public final 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 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
Deletes a assignment. No expansion will happen.Example:
- Organization `organizationA` contains two projects, `project1` and `project2`.
- Reservation `res1` exists and was created previously.
- CreateAssignment was used previously to define the following associations between entities and reservations: `<organizationA, res1>` and `<project1, res1>`
In this example, deletion of the `<organizationA, res1>` assignment won't affect the other assignment `<project1, res1>`. After said deletion, queries from `project1` will still use `res1` while queries from `project2` will switch to use on-demand mode.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { AssignmentName name = AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]"); reservationServiceClient.deleteAssignment(name); }- Parameters:
name- Required. Name of the resource, e.g. `projects/myproject/locations/US/reservations/team1-prod/assignments/123`- Throws:
ApiException- if the remote call fails
-
deleteAssignment
Deletes a assignment. No expansion will happen.Example:
- Organization `organizationA` contains two projects, `project1` and `project2`.
- Reservation `res1` exists and was created previously.
- CreateAssignment was used previously to define the following associations between entities and reservations: `<organizationA, res1>` and `<project1, res1>`
In this example, deletion of the `<organizationA, res1>` assignment won't affect the other assignment `<project1, res1>`. After said deletion, queries from `project1` will still use `res1` while queries from `project2` will switch to use on-demand mode.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { String name = AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]").toString(); reservationServiceClient.deleteAssignment(name); }- Parameters:
name- Required. Name of the resource, e.g. `projects/myproject/locations/US/reservations/team1-prod/assignments/123`- Throws:
ApiException- if the remote call fails
-
deleteAssignment
Deletes a assignment. No expansion will happen.Example:
- Organization `organizationA` contains two projects, `project1` and `project2`.
- Reservation `res1` exists and was created previously.
- CreateAssignment was used previously to define the following associations between entities and reservations: `<organizationA, res1>` and `<project1, res1>`
In this example, deletion of the `<organizationA, res1>` assignment won't affect the other assignment `<project1, res1>`. After said deletion, queries from `project1` will still use `res1` while queries from `project2` will switch to use on-demand mode.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { DeleteAssignmentRequest request = DeleteAssignmentRequest.newBuilder() .setName( AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]") .toString()) .build(); reservationServiceClient.deleteAssignment(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
deleteAssignmentCallable
public final UnaryCallable<DeleteAssignmentRequest,com.google.protobuf.Empty> deleteAssignmentCallable()Deletes a assignment. No expansion will happen.Example:
- Organization `organizationA` contains two projects, `project1` and `project2`.
- Reservation `res1` exists and was created previously.
- CreateAssignment was used previously to define the following associations between entities and reservations: `<organizationA, res1>` and `<project1, res1>`
In this example, deletion of the `<organizationA, res1>` assignment won't affect the other assignment `<project1, res1>`. After said deletion, queries from `project1` will still use `res1` while queries from `project2` will switch to use on-demand mode.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { DeleteAssignmentRequest request = DeleteAssignmentRequest.newBuilder() .setName( AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]") .toString()) .build(); ApiFuture<Empty> future = reservationServiceClient.deleteAssignmentCallable().futureCall(request); // Do something. future.get(); } -
searchAssignments
@Deprecated 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:
ApiException- if the remote call fails
-
searchAssignments
@Deprecated public final ReservationServiceClient.SearchAssignmentsPagedResponse searchAssignments(String parent, String query) Deprecated.This method is deprecated and will be removed in the next major version update.Deprecated: Looks up assignments for a specified resource for a particular region. If the request is about a project:1. Assignments created on the project will be returned if they exist. 2. Otherwise assignments created on the closest ancestor will be returned. 3. Assignments for different JobTypes will all be returned.
The same logic applies if the request is about a folder.
If the request is about an organization, then assignments created on the organization will be returned (organization doesn't have ancestors).
Comparing to ListAssignments, there are some behavior differences:
1. permission on the assignee will be verified in this API. 2. Hierarchy lookup (project->folder->organization) happens in this API. 3. Parent here is `projects/*/locations/*`, instead of `projects/*/locations/*reservations/*`.
**Note** "-" cannot be used for projects nor locations.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); String query = "query107944136"; for (Assignment element : reservationServiceClient.searchAssignments(parent, query).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The resource name of the admin project(containing project and location), e.g.: `projects/myproject/locations/US`.query- Please specify resource name as assignee in the query.Examples:
- `assignee=projects/myproject`
- `assignee=folders/123`
- `assignee=organizations/456`
- Throws:
ApiException- if the remote call fails
-
searchAssignments
@Deprecated 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:
ApiException- if the remote call fails
-
searchAssignmentsPagedCallable
@Deprecated public final 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 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:
ApiException- if the remote call fails
-
searchAllAssignments
public final ReservationServiceClient.SearchAllAssignmentsPagedResponse searchAllAssignments(String parent, String query) Looks up assignments for a specified resource for a particular region. If the request is about a project:1. Assignments created on the project will be returned if they exist. 2. Otherwise assignments created on the closest ancestor will be returned. 3. Assignments for different JobTypes will all be returned.
The same logic applies if the request is about a folder.
If the request is about an organization, then assignments created on the organization will be returned (organization doesn't have ancestors).
Comparing to ListAssignments, there are some behavior differences:
1. permission on the assignee will be verified in this API. 2. Hierarchy lookup (project->folder->organization) happens in this API. 3. Parent here is `projects/*/locations/*`, instead of `projects/*/locations/*reservations/*`.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); String query = "query107944136"; for (Assignment element : reservationServiceClient.searchAllAssignments(parent, query).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The resource name with location (project name could be the wildcard '-'), e.g.: `projects/-/locations/US`.query- Please specify resource name as assignee in the query.Examples:
- `assignee=projects/myproject`
- `assignee=folders/123`
- `assignee=organizations/456`
- Throws:
ApiException- if the remote call fails
-
searchAllAssignments
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:
ApiException- if the remote call fails
-
searchAllAssignmentsPagedCallable
public final 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 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
Moves an assignment under a new reservation.This differs from removing an existing assignment and recreating a new one by providing a transactional change that ensures an assignee always has an associated reservation.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { AssignmentName name = AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]"); ReservationName destinationId = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]"); Assignment response = reservationServiceClient.moveAssignment(name, destinationId); }- Parameters:
name- Required. The resource name of the assignment, e.g. `projects/myproject/locations/US/reservations/team1-prod/assignments/123`destinationId- The new reservation ID, e.g.: `projects/myotherproject/locations/US/reservations/team2-prod`- Throws:
ApiException- if the remote call fails
-
moveAssignment
Moves an assignment under a new reservation.This differs from removing an existing assignment and recreating a new one by providing a transactional change that ensures an assignee always has an associated reservation.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { AssignmentName name = AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]"); String destinationId = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString(); Assignment response = reservationServiceClient.moveAssignment(name, destinationId); }- Parameters:
name- Required. The resource name of the assignment, e.g. `projects/myproject/locations/US/reservations/team1-prod/assignments/123`destinationId- The new reservation ID, e.g.: `projects/myotherproject/locations/US/reservations/team2-prod`- Throws:
ApiException- if the remote call fails
-
moveAssignment
Moves an assignment under a new reservation.This differs from removing an existing assignment and recreating a new one by providing a transactional change that ensures an assignee always has an associated reservation.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { String name = AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]").toString(); ReservationName destinationId = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]"); Assignment response = reservationServiceClient.moveAssignment(name, destinationId); }- Parameters:
name- Required. The resource name of the assignment, e.g. `projects/myproject/locations/US/reservations/team1-prod/assignments/123`destinationId- The new reservation ID, e.g.: `projects/myotherproject/locations/US/reservations/team2-prod`- Throws:
ApiException- if the remote call fails
-
moveAssignment
Moves an assignment under a new reservation.This differs from removing an existing assignment and recreating a new one by providing a transactional change that ensures an assignee always has an associated reservation.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { String name = AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]").toString(); String destinationId = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString(); Assignment response = reservationServiceClient.moveAssignment(name, destinationId); }- Parameters:
name- Required. The resource name of the assignment, e.g. `projects/myproject/locations/US/reservations/team1-prod/assignments/123`destinationId- The new reservation ID, e.g.: `projects/myotherproject/locations/US/reservations/team2-prod`- Throws:
ApiException- if the remote call fails
-
moveAssignment
Moves an assignment under a new reservation.This differs from removing an existing assignment and recreating a new one by providing a transactional change that ensures an assignee always has an associated reservation.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { MoveAssignmentRequest request = MoveAssignmentRequest.newBuilder() .setName( AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]") .toString()) .setDestinationId( ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString()) .setAssignmentId("assignmentId-1603989304") .build(); Assignment response = reservationServiceClient.moveAssignment(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
moveAssignmentCallable
Moves an assignment under a new reservation.This differs from removing an existing assignment and recreating a new one by providing a transactional change that ensures an assignee always has an associated reservation.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { MoveAssignmentRequest request = MoveAssignmentRequest.newBuilder() .setName( AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]") .toString()) .setDestinationId( ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString()) .setAssignmentId("assignmentId-1603989304") .build(); ApiFuture<Assignment> future = reservationServiceClient.moveAssignmentCallable().futureCall(request); // Do something. Assignment response = future.get(); } -
updateAssignment
public final Assignment updateAssignment(Assignment assignment, com.google.protobuf.FieldMask updateMask) Updates an existing assignment.Only the `priority` field can be updated.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { Assignment assignment = Assignment.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); Assignment response = reservationServiceClient.updateAssignment(assignment, updateMask); }- Parameters:
assignment- Content of the assignment to update.updateMask- Standard field mask for the set of fields to be updated.- Throws:
ApiException- if the remote call fails
-
updateAssignment
Updates an existing assignment.Only the `priority` field can be updated.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { UpdateAssignmentRequest request = UpdateAssignmentRequest.newBuilder() .setAssignment(Assignment.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); Assignment response = reservationServiceClient.updateAssignment(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
updateAssignmentCallable
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
Retrieves a BI reservation.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { BiReservationName name = BiReservationName.of("[PROJECT]", "[LOCATION]"); BiReservation response = reservationServiceClient.getBiReservation(name); }- Parameters:
name- Required. Name of the requested reservation, for example: `projects/{project_id}/locations/{location_id}/biReservation`- Throws:
ApiException- if the remote call fails
-
getBiReservation
Retrieves a BI reservation.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { String name = BiReservationName.of("[PROJECT]", "[LOCATION]").toString(); BiReservation response = reservationServiceClient.getBiReservation(name); }- Parameters:
name- Required. Name of the requested reservation, for example: `projects/{project_id}/locations/{location_id}/biReservation`- Throws:
ApiException- if the remote call fails
-
getBiReservation
Retrieves a BI reservation.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { GetBiReservationRequest request = GetBiReservationRequest.newBuilder() .setName(BiReservationName.of("[PROJECT]", "[LOCATION]").toString()) .build(); BiReservation response = reservationServiceClient.getBiReservation(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getBiReservationCallable
Retrieves a BI reservation.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { GetBiReservationRequest request = GetBiReservationRequest.newBuilder() .setName(BiReservationName.of("[PROJECT]", "[LOCATION]").toString()) .build(); ApiFuture<BiReservation> future = reservationServiceClient.getBiReservationCallable().futureCall(request); // Do something. BiReservation response = future.get(); } -
updateBiReservation
public final BiReservation updateBiReservation(BiReservation biReservation, com.google.protobuf.FieldMask updateMask) Updates a BI reservation.Only fields specified in the `field_mask` are updated.
A singleton BI reservation always exists with default size 0. In order to reserve BI capacity it needs to be updated to an amount greater than 0. In order to release BI capacity reservation size must be set to 0.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { BiReservation biReservation = BiReservation.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); BiReservation response = reservationServiceClient.updateBiReservation(biReservation, updateMask); }- Parameters:
biReservation- A reservation to update.updateMask- A list of fields to be updated in this request.- Throws:
ApiException- if the remote call fails
-
updateBiReservation
Updates a BI reservation.Only fields specified in the `field_mask` are updated.
A singleton BI reservation always exists with default size 0. In order to reserve BI capacity it needs to be updated to an amount greater than 0. In order to release BI capacity reservation size must be set to 0.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { UpdateBiReservationRequest request = UpdateBiReservationRequest.newBuilder() .setBiReservation(BiReservation.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); BiReservation response = reservationServiceClient.updateBiReservation(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
updateBiReservationCallable
Updates a BI reservation.Only fields specified in the `field_mask` are updated.
A singleton BI reservation always exists with default size 0. In order to reserve BI capacity it needs to be updated to an amount greater than 0. In order to release BI capacity reservation size must be set to 0.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { UpdateBiReservationRequest request = UpdateBiReservationRequest.newBuilder() .setBiReservation(BiReservation.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); ApiFuture<BiReservation> future = reservationServiceClient.updateBiReservationCallable().futureCall(request); // Do something. BiReservation response = future.get(); } -
getIamPolicy
Gets the access control policy for a resource. May return:- A`NOT_FOUND` error if the resource doesn't exist or you don't have the permission to view it.
- An empty policy if the resource exists but doesn't have a set policy.
Supported resources are: - Reservations - ReservationAssignments
To call this method, you must have the following Google IAM permissions:
- `bigqueryreservation.reservations.getIamPolicy` to get policies on reservations.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { ResourceName resource = AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]"); Policy response = reservationServiceClient.getIamPolicy(resource); }- Parameters:
resource- REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.- Throws:
ApiException- if the remote call fails
-
getIamPolicy
Gets the access control policy for a resource. May return:- A`NOT_FOUND` error if the resource doesn't exist or you don't have the permission to view it.
- An empty policy if the resource exists but doesn't have a set policy.
Supported resources are: - Reservations - ReservationAssignments
To call this method, you must have the following Google IAM permissions:
- `bigqueryreservation.reservations.getIamPolicy` to get policies on reservations.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { String resource = AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]").toString(); Policy response = reservationServiceClient.getIamPolicy(resource); }- Parameters:
resource- REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.- Throws:
ApiException- if the remote call fails
-
getIamPolicy
public final com.google.iam.v1.Policy getIamPolicy(com.google.iam.v1.GetIamPolicyRequest request) Gets the access control policy for a resource. May return:- A`NOT_FOUND` error if the resource doesn't exist or you don't have the permission to view it.
- An empty policy if the resource exists but doesn't have a set policy.
Supported resources are: - Reservations - ReservationAssignments
To call this method, you must have the following Google IAM permissions:
- `bigqueryreservation.reservations.getIamPolicy` to get policies on reservations.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder() .setResource( AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]") .toString()) .setOptions(GetPolicyOptions.newBuilder().build()) .build(); Policy response = reservationServiceClient.getIamPolicy(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getIamPolicyCallable
public final UnaryCallable<com.google.iam.v1.GetIamPolicyRequest,com.google.iam.v1.Policy> getIamPolicyCallable()Gets the access control policy for a resource. May return:- A`NOT_FOUND` error if the resource doesn't exist or you don't have the permission to view it.
- An empty policy if the resource exists but doesn't have a set policy.
Supported resources are: - Reservations - ReservationAssignments
To call this method, you must have the following Google IAM permissions:
- `bigqueryreservation.reservations.getIamPolicy` to get policies on reservations.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { GetIamPolicyRequest request = GetIamPolicyRequest.newBuilder() .setResource( AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]") .toString()) .setOptions(GetPolicyOptions.newBuilder().build()) .build(); ApiFuture<Policy> future = reservationServiceClient.getIamPolicyCallable().futureCall(request); // Do something. Policy response = future.get(); } -
setIamPolicy
public final com.google.iam.v1.Policy setIamPolicy(ResourceName resource, com.google.iam.v1.Policy policy) Sets an access control policy for a resource. Replaces any existing policy.Supported resources are: - Reservations
To call this method, you must have the following Google IAM permissions:
- `bigqueryreservation.reservations.setIamPolicy` to set policies on reservations.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { ResourceName resource = AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]"); Policy policy = Policy.newBuilder().build(); Policy response = reservationServiceClient.setIamPolicy(resource, policy); }- Parameters:
resource- REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.policy- REQUIRED: The complete policy to be applied to the `resource`. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them.- Throws:
ApiException- if the remote call fails
-
setIamPolicy
public final com.google.iam.v1.Policy setIamPolicy(String resource, com.google.iam.v1.Policy policy) Sets an access control policy for a resource. Replaces any existing policy.Supported resources are: - Reservations
To call this method, you must have the following Google IAM permissions:
- `bigqueryreservation.reservations.setIamPolicy` to set policies on reservations.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { String resource = AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]").toString(); Policy policy = Policy.newBuilder().build(); Policy response = reservationServiceClient.setIamPolicy(resource, policy); }- Parameters:
resource- REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.policy- REQUIRED: The complete policy to be applied to the `resource`. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them.- Throws:
ApiException- if the remote call fails
-
setIamPolicy
public final com.google.iam.v1.Policy setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request) Sets an access control policy for a resource. Replaces any existing policy.Supported resources are: - Reservations
To call this method, you must have the following Google IAM permissions:
- `bigqueryreservation.reservations.setIamPolicy` to set policies on reservations.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder() .setResource( AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]") .toString()) .setPolicy(Policy.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); Policy response = reservationServiceClient.setIamPolicy(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
setIamPolicyCallable
public final UnaryCallable<com.google.iam.v1.SetIamPolicyRequest,com.google.iam.v1.Policy> setIamPolicyCallable()Sets an access control policy for a resource. Replaces any existing policy.Supported resources are: - Reservations
To call this method, you must have the following Google IAM permissions:
- `bigqueryreservation.reservations.setIamPolicy` to set policies on reservations.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { SetIamPolicyRequest request = SetIamPolicyRequest.newBuilder() .setResource( AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]") .toString()) .setPolicy(Policy.newBuilder().build()) .setUpdateMask(FieldMask.newBuilder().build()) .build(); ApiFuture<Policy> future = reservationServiceClient.setIamPolicyCallable().futureCall(request); // Do something. Policy response = future.get(); } -
testIamPermissions
public final com.google.iam.v1.TestIamPermissionsResponse testIamPermissions(com.google.iam.v1.TestIamPermissionsRequest request) Gets your permissions on a resource. Returns an empty set of permissions if the resource doesn't exist.Supported resources are: - Reservations
No Google IAM permissions are required to call this method.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder() .setResource( AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]") .toString()) .addAllPermissions(new ArrayList<String>()) .build(); TestIamPermissionsResponse response = reservationServiceClient.testIamPermissions(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
testIamPermissionsCallable
public final UnaryCallable<com.google.iam.v1.TestIamPermissionsRequest,com.google.iam.v1.TestIamPermissionsResponse> testIamPermissionsCallable()Gets your permissions on a resource. Returns an empty set of permissions if the resource doesn't exist.Supported resources are: - Reservations
No Google IAM permissions are required to call this method.
Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { TestIamPermissionsRequest request = TestIamPermissionsRequest.newBuilder() .setResource( AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]") .toString()) .addAllPermissions(new ArrayList<String>()) .build(); ApiFuture<TestIamPermissionsResponse> future = reservationServiceClient.testIamPermissionsCallable().futureCall(request); // Do something. TestIamPermissionsResponse response = future.get(); } -
createReservationGroup
Creates a new reservation group.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { CreateReservationGroupRequest request = CreateReservationGroupRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setReservationGroupId("reservationGroupId-1636887922") .setReservationGroup(ReservationGroup.newBuilder().build()) .build(); ReservationGroup response = reservationServiceClient.createReservationGroup(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
createReservationGroupCallable
public final UnaryCallable<CreateReservationGroupRequest,ReservationGroup> createReservationGroupCallable()Creates a new reservation group.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { CreateReservationGroupRequest request = CreateReservationGroupRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setReservationGroupId("reservationGroupId-1636887922") .setReservationGroup(ReservationGroup.newBuilder().build()) .build(); ApiFuture<ReservationGroup> future = reservationServiceClient.createReservationGroupCallable().futureCall(request); // Do something. ReservationGroup response = future.get(); } -
getReservationGroup
Returns information about the reservation group.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { ReservationGroupName name = ReservationGroupName.of("[PROJECT]", "[LOCATION]", "[RESERVATION_GROUP]"); ReservationGroup response = reservationServiceClient.getReservationGroup(name); }- Parameters:
name- Required. Resource name of the reservation group to retrieve. E.g., `projects/myproject/locations/US/reservationGroups/team1-prod`- Throws:
ApiException- if the remote call fails
-
getReservationGroup
Returns information about the reservation group.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { String name = ReservationGroupName.of("[PROJECT]", "[LOCATION]", "[RESERVATION_GROUP]").toString(); ReservationGroup response = reservationServiceClient.getReservationGroup(name); }- Parameters:
name- Required. Resource name of the reservation group to retrieve. E.g., `projects/myproject/locations/US/reservationGroups/team1-prod`- Throws:
ApiException- if the remote call fails
-
getReservationGroup
Returns information about the reservation group.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { GetReservationGroupRequest request = GetReservationGroupRequest.newBuilder() .setName( ReservationGroupName.of("[PROJECT]", "[LOCATION]", "[RESERVATION_GROUP]") .toString()) .build(); ReservationGroup response = reservationServiceClient.getReservationGroup(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
getReservationGroupCallable
public final UnaryCallable<GetReservationGroupRequest,ReservationGroup> getReservationGroupCallable()Returns information about the reservation group.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { GetReservationGroupRequest request = GetReservationGroupRequest.newBuilder() .setName( ReservationGroupName.of("[PROJECT]", "[LOCATION]", "[RESERVATION_GROUP]") .toString()) .build(); ApiFuture<ReservationGroup> future = reservationServiceClient.getReservationGroupCallable().futureCall(request); // Do something. ReservationGroup response = future.get(); } -
deleteReservationGroup
Deletes a reservation. Returns `google.rpc.Code.FAILED_PRECONDITION` when reservation has assignments.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { ReservationGroupName name = ReservationGroupName.of("[PROJECT]", "[LOCATION]", "[RESERVATION_GROUP]"); reservationServiceClient.deleteReservationGroup(name); }- Parameters:
name- Required. Resource name of the reservation group to retrieve. E.g., `projects/myproject/locations/US/reservationGroups/team1-prod`- Throws:
ApiException- if the remote call fails
-
deleteReservationGroup
Deletes a reservation. Returns `google.rpc.Code.FAILED_PRECONDITION` when reservation has assignments.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { String name = ReservationGroupName.of("[PROJECT]", "[LOCATION]", "[RESERVATION_GROUP]").toString(); reservationServiceClient.deleteReservationGroup(name); }- Parameters:
name- Required. Resource name of the reservation group to retrieve. E.g., `projects/myproject/locations/US/reservationGroups/team1-prod`- Throws:
ApiException- if the remote call fails
-
deleteReservationGroup
Deletes a reservation. Returns `google.rpc.Code.FAILED_PRECONDITION` when reservation has assignments.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { DeleteReservationGroupRequest request = DeleteReservationGroupRequest.newBuilder() .setName( ReservationGroupName.of("[PROJECT]", "[LOCATION]", "[RESERVATION_GROUP]") .toString()) .build(); reservationServiceClient.deleteReservationGroup(request); }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
deleteReservationGroupCallable
public final UnaryCallable<DeleteReservationGroupRequest,com.google.protobuf.Empty> deleteReservationGroupCallable()Deletes a reservation. Returns `google.rpc.Code.FAILED_PRECONDITION` when reservation has assignments.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { DeleteReservationGroupRequest request = DeleteReservationGroupRequest.newBuilder() .setName( ReservationGroupName.of("[PROJECT]", "[LOCATION]", "[RESERVATION_GROUP]") .toString()) .build(); ApiFuture<Empty> future = reservationServiceClient.deleteReservationGroupCallable().futureCall(request); // Do something. future.get(); } -
listReservationGroups
public final ReservationServiceClient.ListReservationGroupsPagedResponse listReservationGroups(LocationName parent) Lists all the reservation groups for the project in the specified location.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); for (ReservationGroup element : reservationServiceClient.listReservationGroups(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The parent resource name containing project and location, e.g.: `projects/myproject/locations/US`- Throws:
ApiException- if the remote call fails
-
listReservationGroups
public final ReservationServiceClient.ListReservationGroupsPagedResponse listReservationGroups(String parent) Lists all the reservation groups for the project in the specified location.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); for (ReservationGroup element : reservationServiceClient.listReservationGroups(parent).iterateAll()) { // doThingsWith(element); } }- Parameters:
parent- Required. The parent resource name containing project and location, e.g.: `projects/myproject/locations/US`- Throws:
ApiException- if the remote call fails
-
listReservationGroups
public final ReservationServiceClient.ListReservationGroupsPagedResponse listReservationGroups(ListReservationGroupsRequest request) Lists all the reservation groups for the project in the specified location.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { ListReservationGroupsRequest request = ListReservationGroupsRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); for (ReservationGroup element : reservationServiceClient.listReservationGroups(request).iterateAll()) { // doThingsWith(element); } }- Parameters:
request- The request object containing all of the parameters for the API call.- Throws:
ApiException- if the remote call fails
-
listReservationGroupsPagedCallable
public final UnaryCallable<ListReservationGroupsRequest,ReservationServiceClient.ListReservationGroupsPagedResponse> listReservationGroupsPagedCallable()Lists all the reservation groups for the project in the specified location.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { ListReservationGroupsRequest request = ListReservationGroupsRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); ApiFuture<ReservationGroup> future = reservationServiceClient.listReservationGroupsPagedCallable().futureCall(request); // Do something. for (ReservationGroup element : future.get().iterateAll()) { // doThingsWith(element); } } -
listReservationGroupsCallable
public final UnaryCallable<ListReservationGroupsRequest,ListReservationGroupsResponse> listReservationGroupsCallable()Lists all the reservation groups for the project in the specified location.Sample code:
// This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { ListReservationGroupsRequest request = ListReservationGroupsRequest.newBuilder() .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) .setPageSize(883849137) .setPageToken("pageToken873572522") .build(); while (true) { ListReservationGroupsResponse response = reservationServiceClient.listReservationGroupsCallable().call(request); for (ReservationGroup element : response.getReservationGroupsList()) { // doThingsWith(element); } String nextPageToken = response.getNextPageToken(); if (!Strings.isNullOrEmpty(nextPageToken)) { request = request.toBuilder().setPageToken(nextPageToken).build(); } else { break; } } } -
close
public final void close()- Specified by:
closein interfaceAutoCloseable
-
shutdown
public void shutdown()- Specified by:
shutdownin interfaceBackgroundResource
-
isShutdown
public boolean isShutdown()- Specified by:
isShutdownin interfaceBackgroundResource
-
isTerminated
public boolean isTerminated()- Specified by:
isTerminatedin interfaceBackgroundResource
-
shutdownNow
public void shutdownNow()- Specified by:
shutdownNowin interfaceBackgroundResource
-
awaitTermination
- Specified by:
awaitTerminationin interfaceBackgroundResource- Throws:
InterruptedException
-