diff --git a/google-cloud-bigqueryreservation/src/main/java/com/google/cloud/bigquery/reservation/v1/ReservationServiceClient.java b/google-cloud-bigqueryreservation/src/main/java/com/google/cloud/bigquery/reservation/v1/ReservationServiceClient.java index 08e2055b..32a9d221 100644 --- a/google-cloud-bigqueryreservation/src/main/java/com/google/cloud/bigquery/reservation/v1/ReservationServiceClient.java +++ b/google-cloud-bigqueryreservation/src/main/java/com/google/cloud/bigquery/reservation/v1/ReservationServiceClient.java @@ -55,6 +55,16 @@ *
This class provides the ability to make remote calls to the backing service through method * calls that map to API methods. Sample code to get started: * + *
{@code + * 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(). @@ -161,6 +171,18 @@ public ReservationServiceStub getStub() { /** * Creates a new reservation resource. * + *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + * Reservation reservation = Reservation.newBuilder().build(); + * String reservationId = "reservationId1116965383"; + * Reservation response = + * reservationServiceClient.createReservation(parent, reservation, reservationId); + * } + * }+ * * @param parent Required. Project, location. E.g., `projects/myproject/locations/US` * @param reservation Definition of the new reservation to create. * @param reservationId The reservation ID. This field must only contain lower case alphanumeric @@ -182,6 +204,18 @@ public final Reservation createReservation( /** * Creates a new reservation resource. * + *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * String parent = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString(); + * Reservation reservation = Reservation.newBuilder().build(); + * String reservationId = "reservationId1116965383"; + * Reservation response = + * reservationServiceClient.createReservation(parent, reservation, reservationId); + * } + * }+ * * @param parent Required. Project, location. E.g., `projects/myproject/locations/US` * @param reservation Definition of the new reservation to create. * @param reservationId The reservation ID. This field must only contain lower case alphanumeric @@ -203,6 +237,20 @@ public final Reservation createReservation( /** * Creates a new reservation resource. * + *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * CreateReservationRequest request = + * CreateReservationRequest.newBuilder() + * .setParent(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString()) + * .setReservationId("reservationId1116965383") + * .setReservation(Reservation.newBuilder().build()) + * .build(); + * Reservation response = reservationServiceClient.createReservation(request); + * } + * }+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -215,6 +263,21 @@ public final Reservation createReservation(CreateReservationRequest request) { * Creates a new reservation resource. * *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * CreateReservationRequest request = + * CreateReservationRequest.newBuilder() + * .setParent(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString()) + * .setReservationId("reservationId1116965383") + * .setReservation(Reservation.newBuilder().build()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * reservationServiceClient.createReservationCallable().futureCall(request); + * // Do something. + * Reservation response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + * for (Reservation element : reservationServiceClient.listReservations(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * * @param parent Required. The parent resource name containing project and location, e.g.: * `projects/myproject/locations/US` * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -240,6 +314,17 @@ public final ListReservationsPagedResponse listReservations(LocationName parent) /** * Lists all the reservations for the project in the specified location. * + *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * String parent = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString(); + * for (Reservation element : reservationServiceClient.listReservations(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * * @param parent Required. The parent resource name containing project and location, e.g.: * `projects/myproject/locations/US` * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -254,6 +339,22 @@ public final ListReservationsPagedResponse listReservations(String parent) { /** * Lists all the reservations for the project in the specified location. * + *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * ListReservationsRequest request = + * ListReservationsRequest.newBuilder() + * .setParent(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * for (Reservation element : reservationServiceClient.listReservations(request).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -266,6 +367,23 @@ public final ListReservationsPagedResponse listReservations(ListReservationsRequ * Lists all the reservations for the project in the specified location. * *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * ListReservationsRequest request = + * ListReservationsRequest.newBuilder() + * .setParent(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * reservationServiceClient.listReservationsPagedCallable().futureCall(request); + * // Do something. + * for (Reservation element : future.get().iterateAll()) { + * // doThingsWith(element); + * } + * } + * }
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * while (true) { + * ListReservationsResponse response = + * reservationServiceClient.listReservationsCallable().call(request); + * for (Reservation element : response.getResponsesList()) { + * // doThingsWith(element); + * } + * String nextPageToken = response.getNextPageToken(); + * if (!Strings.isNullOrEmpty(nextPageToken)) { + * request = request.toBuilder().setPageToken(nextPageToken).build(); + * } else { + * break; + * } + * } + * } + * }*/ public final UnaryCallable
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * ReservationName name = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]"); + * Reservation response = reservationServiceClient.getReservation(name); + * } + * }+ * * @param name Required. Resource name of the reservation to retrieve. E.g., * `projects/myproject/locations/US/reservations/team1-prod` * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -301,6 +446,15 @@ public final Reservation getReservation(ReservationName name) { /** * Returns information about the reservation. * + *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * String name = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString(); + * Reservation response = reservationServiceClient.getReservation(name); + * } + * }+ * * @param name Required. Resource name of the reservation to retrieve. E.g., * `projects/myproject/locations/US/reservations/team1-prod` * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -314,6 +468,18 @@ public final Reservation getReservation(String name) { /** * Returns information about the reservation. * + *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * GetReservationRequest request = + * GetReservationRequest.newBuilder() + * .setName(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString()) + * .build(); + * Reservation response = reservationServiceClient.getReservation(request); + * } + * }+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -326,6 +492,19 @@ public final Reservation getReservation(GetReservationRequest request) { * Returns information about the reservation. * *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * GetReservationRequest request = + * GetReservationRequest.newBuilder() + * .setName(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * reservationServiceClient.getReservationCallable().futureCall(request); + * // Do something. + * Reservation response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * ReservationName name = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]"); + * reservationServiceClient.deleteReservation(name); + * } + * }+ * * @param name Required. Resource name of the reservation to retrieve. E.g., * `projects/myproject/locations/US/reservations/team1-prod` * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -353,6 +541,15 @@ public final void deleteReservation(ReservationName name) { * Deletes a reservation. Returns `google.rpc.Code.FAILED_PRECONDITION` when reservation has * assignments. * + *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * String name = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString(); + * reservationServiceClient.deleteReservation(name); + * } + * }+ * * @param name Required. Resource name of the reservation to retrieve. E.g., * `projects/myproject/locations/US/reservations/team1-prod` * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -367,6 +564,18 @@ public final void deleteReservation(String name) { * Deletes a reservation. Returns `google.rpc.Code.FAILED_PRECONDITION` when reservation has * assignments. * + *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * DeleteReservationRequest request = + * DeleteReservationRequest.newBuilder() + * .setName(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString()) + * .build(); + * reservationServiceClient.deleteReservation(request); + * } + * }+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -380,6 +589,19 @@ public final void deleteReservation(DeleteReservationRequest request) { * assignments. * *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * DeleteReservationRequest request = + * DeleteReservationRequest.newBuilder() + * .setName(ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]").toString()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * reservationServiceClient.deleteReservationCallable().futureCall(request); + * // Do something. + * future.get(); + * } + * }
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * Reservation reservation = Reservation.newBuilder().build(); + * FieldMask updateMask = FieldMask.newBuilder().build(); + * Reservation response = reservationServiceClient.updateReservation(reservation, updateMask); + * } + * }+ * * @param reservation Content of the reservation to update. * @param updateMask Standard field mask for the set of fields to be updated. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -406,6 +638,19 @@ public final Reservation updateReservation(Reservation reservation, FieldMask up /** * Updates an existing reservation resource. * + *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * UpdateReservationRequest request = + * UpdateReservationRequest.newBuilder() + * .setReservation(Reservation.newBuilder().build()) + * .setUpdateMask(FieldMask.newBuilder().build()) + * .build(); + * Reservation response = reservationServiceClient.updateReservation(request); + * } + * }+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -418,6 +663,20 @@ public final Reservation updateReservation(UpdateReservationRequest request) { * Updates an existing reservation resource. * *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * UpdateReservationRequest request = + * UpdateReservationRequest.newBuilder() + * .setReservation(Reservation.newBuilder().build()) + * .setUpdateMask(FieldMask.newBuilder().build()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * reservationServiceClient.updateReservationCallable().futureCall(request); + * // Do something. + * Reservation response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + * CapacityCommitment capacityCommitment = CapacityCommitment.newBuilder().build(); + * CapacityCommitment response = + * reservationServiceClient.createCapacityCommitment(parent, capacityCommitment); + * } + * }+ * * @param parent Required. Resource name of the parent reservation. E.g., * `projects/myproject/locations/US` * @param capacityCommitment Content of the capacity commitment to create. @@ -446,6 +716,18 @@ public final CapacityCommitment createCapacityCommitment( /** * Creates a new capacity commitment resource. * + *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * String parent = + * CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]").toString(); + * CapacityCommitment capacityCommitment = CapacityCommitment.newBuilder().build(); + * CapacityCommitment response = + * reservationServiceClient.createCapacityCommitment(parent, capacityCommitment); + * } + * }+ * * @param parent Required. Resource name of the parent reservation. E.g., * `projects/myproject/locations/US` * @param capacityCommitment Content of the capacity commitment to create. @@ -465,6 +747,22 @@ public final CapacityCommitment createCapacityCommitment( /** * Creates a new capacity commitment resource. * + *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * CreateCapacityCommitmentRequest request = + * CreateCapacityCommitmentRequest.newBuilder() + * .setParent( + * CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]") + * .toString()) + * .setCapacityCommitment(CapacityCommitment.newBuilder().build()) + * .setEnforceSingleAdminProjectPerOrg(true) + * .build(); + * CapacityCommitment response = reservationServiceClient.createCapacityCommitment(request); + * } + * }+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -478,6 +776,23 @@ public final CapacityCommitment createCapacityCommitment( * Creates a new capacity commitment resource. * *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * CreateCapacityCommitmentRequest request = + * CreateCapacityCommitmentRequest.newBuilder() + * .setParent( + * CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]") + * .toString()) + * .setCapacityCommitment(CapacityCommitment.newBuilder().build()) + * .setEnforceSingleAdminProjectPerOrg(true) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * reservationServiceClient.createCapacityCommitmentCallable().futureCall(request); + * // Do something. + * CapacityCommitment response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + * for (CapacityCommitment element : + * reservationServiceClient.listCapacityCommitments(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * * @param parent Required. Resource name of the parent reservation. E.g., * `projects/myproject/locations/US` * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -504,6 +831,19 @@ public final ListCapacityCommitmentsPagedResponse listCapacityCommitments(Locati /** * Lists all the capacity commitments for the admin project. * + *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * String parent = + * CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]").toString(); + * for (CapacityCommitment element : + * reservationServiceClient.listCapacityCommitments(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * * @param parent Required. Resource name of the parent reservation. E.g., * `projects/myproject/locations/US` * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -518,6 +858,25 @@ public final ListCapacityCommitmentsPagedResponse listCapacityCommitments(String /** * Lists all the capacity commitments for the admin project. * + *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * ListCapacityCommitmentsRequest request = + * ListCapacityCommitmentsRequest.newBuilder() + * .setParent( + * CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]") + * .toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * for (CapacityCommitment element : + * reservationServiceClient.listCapacityCommitments(request).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -531,6 +890,25 @@ public final ListCapacityCommitmentsPagedResponse listCapacityCommitments( * Lists all the capacity commitments for the admin project. * *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * ListCapacityCommitmentsRequest request = + * ListCapacityCommitmentsRequest.newBuilder() + * .setParent( + * CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]") + * .toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * reservationServiceClient.listCapacityCommitmentsPagedCallable().futureCall(request); + * // Do something. + * for (CapacityCommitment element : future.get().iterateAll()) { + * // doThingsWith(element); + * } + * } + * }
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * while (true) { + * ListCapacityCommitmentsResponse response = + * reservationServiceClient.listCapacityCommitmentsCallable().call(request); + * for (CapacityCommitment element : response.getResponsesList()) { + * // doThingsWith(element); + * } + * String nextPageToken = response.getNextPageToken(); + * if (!Strings.isNullOrEmpty(nextPageToken)) { + * request = request.toBuilder().setPageToken(nextPageToken).build(); + * } else { + * break; + * } + * } + * } + * }*/ public final UnaryCallable
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * CapacityCommitmentName name = + * CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]"); + * CapacityCommitment response = reservationServiceClient.getCapacityCommitment(name); + * } + * }+ * * @param name Required. Resource name of the capacity commitment to retrieve. E.g., * `projects/myproject/locations/US/capacityCommitments/123` * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -568,6 +974,16 @@ public final CapacityCommitment getCapacityCommitment(CapacityCommitmentName nam /** * Returns information about the capacity commitment. * + *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * String name = + * CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]").toString(); + * CapacityCommitment response = reservationServiceClient.getCapacityCommitment(name); + * } + * }+ * * @param name Required. Resource name of the capacity commitment to retrieve. E.g., * `projects/myproject/locations/US/capacityCommitments/123` * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -582,6 +998,20 @@ public final CapacityCommitment getCapacityCommitment(String name) { /** * Returns information about the capacity commitment. * + *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * GetCapacityCommitmentRequest request = + * GetCapacityCommitmentRequest.newBuilder() + * .setName( + * CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]") + * .toString()) + * .build(); + * CapacityCommitment response = reservationServiceClient.getCapacityCommitment(request); + * } + * }+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -594,6 +1024,21 @@ public final CapacityCommitment getCapacityCommitment(GetCapacityCommitmentReque * Returns information about the capacity commitment. * *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * GetCapacityCommitmentRequest request = + * GetCapacityCommitmentRequest.newBuilder() + * .setName( + * CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]") + * .toString()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * reservationServiceClient.getCapacityCommitmentCallable().futureCall(request); + * // Do something. + * CapacityCommitment response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * CapacityCommitmentName name = + * CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]"); + * reservationServiceClient.deleteCapacityCommitment(name); + * } + * }+ * * @param name Required. Resource name of the capacity commitment to delete. E.g., * `projects/myproject/locations/US/capacityCommitments/123` * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -622,6 +1077,16 @@ public final void deleteCapacityCommitment(CapacityCommitmentName name) { * Deletes a capacity commitment. Attempting to delete capacity commitment before its * commitment_end_time will fail with the error code `google.rpc.Code.FAILED_PRECONDITION`. * + *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * String name = + * CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]").toString(); + * reservationServiceClient.deleteCapacityCommitment(name); + * } + * }+ * * @param name Required. Resource name of the capacity commitment to delete. E.g., * `projects/myproject/locations/US/capacityCommitments/123` * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -637,6 +1102,20 @@ public final void deleteCapacityCommitment(String name) { * Deletes a capacity commitment. Attempting to delete capacity commitment before its * commitment_end_time will fail with the error code `google.rpc.Code.FAILED_PRECONDITION`. * + *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * DeleteCapacityCommitmentRequest request = + * DeleteCapacityCommitmentRequest.newBuilder() + * .setName( + * CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]") + * .toString()) + * .build(); + * reservationServiceClient.deleteCapacityCommitment(request); + * } + * }+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -650,6 +1129,21 @@ public final void deleteCapacityCommitment(DeleteCapacityCommitmentRequest reque * commitment_end_time will fail with the error code `google.rpc.Code.FAILED_PRECONDITION`. * *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * DeleteCapacityCommitmentRequest request = + * DeleteCapacityCommitmentRequest.newBuilder() + * .setName( + * CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]") + * .toString()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * reservationServiceClient.deleteCapacityCommitmentCallable().futureCall(request); + * // Do something. + * future.get(); + * } + * }
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * CapacityCommitment capacityCommitment = CapacityCommitment.newBuilder().build(); + * FieldMask updateMask = FieldMask.newBuilder().build(); + * CapacityCommitment response = + * reservationServiceClient.updateCapacityCommitment(capacityCommitment, updateMask); + * } + * }+ * * @param capacityCommitment Content of the capacity commitment to update. * @param updateMask Standard field mask for the set of fields to be updated. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -690,6 +1195,19 @@ public final CapacityCommitment updateCapacityCommitment( * plan with shorter commitment period will fail with the error code * `google.rpc.Code.FAILED_PRECONDITION`. * + *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * UpdateCapacityCommitmentRequest request = + * UpdateCapacityCommitmentRequest.newBuilder() + * .setCapacityCommitment(CapacityCommitment.newBuilder().build()) + * .setUpdateMask(FieldMask.newBuilder().build()) + * .build(); + * CapacityCommitment response = reservationServiceClient.updateCapacityCommitment(request); + * } + * }+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -709,6 +1227,20 @@ public final CapacityCommitment updateCapacityCommitment( * `google.rpc.Code.FAILED_PRECONDITION`. * *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * UpdateCapacityCommitmentRequest request = + * UpdateCapacityCommitmentRequest.newBuilder() + * .setCapacityCommitment(CapacityCommitment.newBuilder().build()) + * .setUpdateMask(FieldMask.newBuilder().build()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * reservationServiceClient.updateCapacityCommitmentCallable().futureCall(request); + * // Do something. + * CapacityCommitment response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * CapacityCommitmentName name = + * CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]"); + * long slotCount = -191518834; + * SplitCapacityCommitmentResponse response = + * reservationServiceClient.splitCapacityCommitment(name, slotCount); + * } + * }+ * * @param name Required. The resource name e.g.,: * `projects/myproject/locations/US/capacityCommitments/123` * @param slotCount Number of slots in the capacity commitment after the split. @@ -750,6 +1294,18 @@ public final SplitCapacityCommitmentResponse splitCapacityCommitment( * capacity commitment into commitments of 2000 and 8000. Then, you would change the plan of the * first one to `FLEX` and then delete it. * + *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * String name = + * CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]").toString(); + * long slotCount = -191518834; + * SplitCapacityCommitmentResponse response = + * reservationServiceClient.splitCapacityCommitment(name, slotCount); + * } + * }+ * * @param name Required. The resource name e.g.,: * `projects/myproject/locations/US/capacityCommitments/123` * @param slotCount Number of slots in the capacity commitment after the split. @@ -772,6 +1328,22 @@ public final SplitCapacityCommitmentResponse splitCapacityCommitment( * capacity commitment into commitments of 2000 and 8000. Then, you would change the plan of the * first one to `FLEX` and then delete it. * + *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * SplitCapacityCommitmentRequest request = + * SplitCapacityCommitmentRequest.newBuilder() + * .setName( + * CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]") + * .toString()) + * .setSlotCount(-191518834) + * .build(); + * SplitCapacityCommitmentResponse response = + * reservationServiceClient.splitCapacityCommitment(request); + * } + * }+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -791,6 +1363,22 @@ public final SplitCapacityCommitmentResponse splitCapacityCommitment( * first one to `FLEX` and then delete it. * *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * SplitCapacityCommitmentRequest request = + * SplitCapacityCommitmentRequest.newBuilder() + * .setName( + * CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]") + * .toString()) + * .setSlotCount(-191518834) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * reservationServiceClient.splitCapacityCommitmentCallable().futureCall(request); + * // Do something. + * SplitCapacityCommitmentResponse response = future.get(); + * } + * }
Attempting to merge capacity commitments of different plan will fail with the error code * `google.rpc.Code.FAILED_PRECONDITION`. * + *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + * List+ * * @param parent Parent resource that identifies admin project and location e.g., * `projects/myproject/locations/us` * @param capacityCommitmentIds Ids of capacity commitments to merge. These capacity commitments @@ -835,6 +1434,18 @@ public final CapacityCommitment mergeCapacityCommitments( *capacityCommitmentIds = new ArrayList<>(); + * CapacityCommitment response = + * reservationServiceClient.mergeCapacityCommitments(parent, capacityCommitmentIds); + * } + * }
Attempting to merge capacity commitments of different plan will fail with the error code * `google.rpc.Code.FAILED_PRECONDITION`. * + *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * String parent = + * CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]").toString(); + * List+ * * @param parent Parent resource that identifies admin project and location e.g., * `projects/myproject/locations/us` * @param capacityCommitmentIds Ids of capacity commitments to merge. These capacity commitments @@ -863,6 +1474,21 @@ public final CapacityCommitment mergeCapacityCommitments( *capacityCommitmentIds = new ArrayList<>(); + * CapacityCommitment response = + * reservationServiceClient.mergeCapacityCommitments(parent, capacityCommitmentIds); + * } + * }
Attempting to merge capacity commitments of different plan will fail with the error code * `google.rpc.Code.FAILED_PRECONDITION`. * + *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * MergeCapacityCommitmentsRequest request = + * MergeCapacityCommitmentsRequest.newBuilder() + * .setParent( + * CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]") + * .toString()) + * .addAllCapacityCommitmentIds(new ArrayList+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -882,6 +1508,22 @@ public final CapacityCommitment mergeCapacityCommitments( * `google.rpc.Code.FAILED_PRECONDITION`. * *()) + * .build(); + * CapacityCommitment response = reservationServiceClient.mergeCapacityCommitments(request); + * } + * }
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * MergeCapacityCommitmentsRequest request = + * MergeCapacityCommitmentsRequest.newBuilder() + * .setParent( + * CapacityCommitmentName.of("[PROJECT]", "[LOCATION]", "[CAPACITY_COMMITMENT]") + * .toString()) + * .addAllCapacityCommitmentIds(new ArrayList*/ public final UnaryCallable()) + * .build(); + * ApiFuture future = + * reservationServiceClient.mergeCapacityCommitmentsCallable().futureCall(request); + * // Do something. + * CapacityCommitment response = future.get(); + * } + * }
Returns `google.rpc.Code.INVALID_ARGUMENT` when location of the assignment does not match * location of the reservation. * + *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * ReservationName parent = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]"); + * Assignment assignment = Assignment.newBuilder().build(); + * Assignment response = reservationServiceClient.createAssignment(parent, assignment); + * } + * }+ * * @param parent Required. The parent resource name of the assignment E.g. * `projects/myproject/locations/US/reservations/team1-prod` * @param assignment Assignment resource to create. @@ -962,6 +1614,17 @@ public final Assignment createAssignment(ReservationName parent, Assignment assi *
Returns `google.rpc.Code.INVALID_ARGUMENT` when location of the assignment does not match * location of the reservation. * + *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * String parent = + * AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]").toString(); + * Assignment assignment = Assignment.newBuilder().build(); + * Assignment response = reservationServiceClient.createAssignment(parent, assignment); + * } + * }+ * * @param parent Required. The parent resource name of the assignment E.g. * `projects/myproject/locations/US/reservations/team1-prod` * @param assignment Assignment resource to create. @@ -1003,6 +1666,21 @@ public final Assignment createAssignment(String parent, Assignment assignment) { *
Returns `google.rpc.Code.INVALID_ARGUMENT` when location of the assignment does not match * location of the reservation. * + *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * CreateAssignmentRequest request = + * CreateAssignmentRequest.newBuilder() + * .setParent( + * AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]") + * .toString()) + * .setAssignment(Assignment.newBuilder().build()) + * .build(); + * Assignment response = reservationServiceClient.createAssignment(request); + * } + * }+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -1041,6 +1719,22 @@ public final Assignment createAssignment(CreateAssignmentRequest request) { * location of the reservation. * *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * CreateAssignmentRequest request = + * CreateAssignmentRequest.newBuilder() + * .setParent( + * AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]") + * .toString()) + * .setAssignment(Assignment.newBuilder().build()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * reservationServiceClient.createAssignmentCallable().futureCall(request); + * // Do something. + * Assignment response = future.get(); + * } + * }
**Note** "-" cannot be used for projects nor locations. * + *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * ReservationName parent = ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]"); + * for (Assignment element : reservationServiceClient.listAssignments(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * * @param parent Required. The parent resource name e.g.: *
`projects/myproject/locations/US/reservations/team1-prod` *
Or: @@ -1106,6 +1811,18 @@ public final ListAssignmentsPagedResponse listAssignments(ReservationName parent * *
**Note** "-" cannot be used for projects nor locations. * + *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * String parent = + * AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]").toString(); + * for (Assignment element : reservationServiceClient.listAssignments(parent).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * * @param parent Required. The parent resource name e.g.: *
`projects/myproject/locations/US/reservations/team1-prod` *
Or: @@ -1140,6 +1857,24 @@ public final ListAssignmentsPagedResponse listAssignments(String parent) { * *
**Note** "-" cannot be used for projects nor locations. * + *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * ListAssignmentsRequest request = + * ListAssignmentsRequest.newBuilder() + * .setParent( + * AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]") + * .toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * for (Assignment element : reservationServiceClient.listAssignments(request).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -1171,6 +1906,25 @@ public final ListAssignmentsPagedResponse listAssignments(ListAssignmentsRequest *
**Note** "-" cannot be used for projects nor locations. * *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * ListAssignmentsRequest request = + * ListAssignmentsRequest.newBuilder() + * .setParent( + * AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]") + * .toString()) + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * reservationServiceClient.listAssignmentsPagedCallable().futureCall(request); + * // Do something. + * for (Assignment element : future.get().iterateAll()) { + * // doThingsWith(element); + * } + * } + * }
**Note** "-" cannot be used for projects nor locations. * *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * while (true) { + * ListAssignmentsResponse response = + * reservationServiceClient.listAssignmentsCallable().call(request); + * for (Assignment element : response.getResponsesList()) { + * // doThingsWith(element); + * } + * String nextPageToken = response.getNextPageToken(); + * if (!Strings.isNullOrEmpty(nextPageToken)) { + * request = request.toBuilder().setPageToken(nextPageToken).build(); + * } else { + * break; + * } + * } + * } + * }*/ public final UnaryCallable
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * AssignmentName name = + * AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]"); + * reservationServiceClient.deleteAssignment(name); + * } + * }+ * * @param name Required. Name of the resource, e.g. * `projects/myproject/locations/US/reservations/team1-prod/assignments/123` * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -1251,6 +2033,16 @@ public final void deleteAssignment(AssignmentName name) { * other assignment `<project1, res1>`. After said deletion, queries from `project1` will * still use `res1` while queries from `project2` will switch to use on-demand mode. * + *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * String name = + * AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]").toString(); + * reservationServiceClient.deleteAssignment(name); + * } + * }+ * * @param name Required. Name of the resource, e.g. * `projects/myproject/locations/US/reservations/team1-prod/assignments/123` * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -1277,6 +2069,20 @@ public final void deleteAssignment(String name) { * other assignment `<project1, res1>`. After said deletion, queries from `project1` will * still use `res1` while queries from `project2` will switch to use on-demand mode. * + *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * DeleteAssignmentRequest request = + * DeleteAssignmentRequest.newBuilder() + * .setName( + * AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]") + * .toString()) + * .build(); + * reservationServiceClient.deleteAssignment(request); + * } + * }+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -1302,6 +2108,21 @@ public final void deleteAssignment(DeleteAssignmentRequest request) { * still use `res1` while queries from `project2` will switch to use on-demand mode. * *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * DeleteAssignmentRequest request = + * DeleteAssignmentRequest.newBuilder() + * .setName( + * AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]") + * .toString()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * reservationServiceClient.deleteAssignmentCallable().futureCall(request); + * // Do something. + * future.get(); + * } + * }
**Note** "-" cannot be used for projects nor locations. * + *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + * String query = "query107944136"; + * for (Assignment element : + * reservationServiceClient.searchAssignments(parent, query).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * * @param parent Required. The resource name of the admin project(containing project and * location), e.g.: `projects/myproject/locations/US`. * @param query Please specify resource name as assignee in the query. @@ -1374,6 +2208,19 @@ public final SearchAssignmentsPagedResponse searchAssignments(LocationName paren * *
**Note** "-" cannot be used for projects nor locations. * + *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + * String query = "query107944136"; + * for (Assignment element : + * reservationServiceClient.searchAssignments(parent, query).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * * @param parent Required. The resource name of the admin project(containing project and * location), e.g.: `projects/myproject/locations/US`. * @param query Please specify resource name as assignee in the query. @@ -1415,6 +2262,23 @@ public final SearchAssignmentsPagedResponse searchAssignments(String parent, Str * *
**Note** "-" cannot be used for projects nor locations. * + *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * SearchAssignmentsRequest request = + * SearchAssignmentsRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setQuery("query107944136") + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * for (Assignment element : reservationServiceClient.searchAssignments(request).iterateAll()) { + * // doThingsWith(element); + * } + * } + * }+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -1446,6 +2310,24 @@ public final SearchAssignmentsPagedResponse searchAssignments(SearchAssignmentsR *
**Note** "-" cannot be used for projects nor locations. * *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * SearchAssignmentsRequest request = + * SearchAssignmentsRequest.newBuilder() + * .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + * .setQuery("query107944136") + * .setPageSize(883849137) + * .setPageToken("pageToken873572522") + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * reservationServiceClient.searchAssignmentsPagedCallable().futureCall(request); + * // Do something. + * for (Assignment element : future.get().iterateAll()) { + * // doThingsWith(element); + * } + * } + * }
**Note** "-" cannot be used for projects nor locations. * *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * while (true) { + * SearchAssignmentsResponse response = + * reservationServiceClient.searchAssignmentsCallable().call(request); + * for (Assignment element : response.getResponsesList()) { + * // doThingsWith(element); + * } + * String nextPageToken = response.getNextPageToken(); + * if (!Strings.isNullOrEmpty(nextPageToken)) { + * request = request.toBuilder().setPageToken(nextPageToken).build(); + * } else { + * break; + * } + * } + * } + * }*/ public final UnaryCallable
This differs from removing an existing assignment and recreating a new one by providing a * transactional change that ensures an assignee always has an associated reservation. * + *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * AssignmentName name = + * AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]"); + * ReservationName destinationId = + * ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]"); + * Assignment response = reservationServiceClient.moveAssignment(name, destinationId); + * } + * }+ * * @param name Required. The resource name of the assignment, e.g. * `projects/myproject/locations/US/reservations/team1-prod/assignments/123` * @param destinationId The new reservation ID, e.g.: @@ -1511,6 +2423,18 @@ public final Assignment moveAssignment(AssignmentName name, ReservationName dest *
This differs from removing an existing assignment and recreating a new one by providing a * transactional change that ensures an assignee always has an associated reservation. * + *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * AssignmentName name = + * AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]"); + * String destinationId = + * AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]").toString(); + * Assignment response = reservationServiceClient.moveAssignment(name, destinationId); + * } + * }+ * * @param name Required. The resource name of the assignment, e.g. * `projects/myproject/locations/US/reservations/team1-prod/assignments/123` * @param destinationId The new reservation ID, e.g.: @@ -1533,6 +2457,18 @@ public final Assignment moveAssignment(AssignmentName name, String destinationId *
This differs from removing an existing assignment and recreating a new one by providing a * transactional change that ensures an assignee always has an associated reservation. * + *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * String name = + * AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]").toString(); + * ReservationName destinationId = + * ReservationName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]"); + * Assignment response = reservationServiceClient.moveAssignment(name, destinationId); + * } + * }+ * * @param name Required. The resource name of the assignment, e.g. * `projects/myproject/locations/US/reservations/team1-prod/assignments/123` * @param destinationId The new reservation ID, e.g.: @@ -1555,6 +2491,18 @@ public final Assignment moveAssignment(String name, ReservationName destinationI *
This differs from removing an existing assignment and recreating a new one by providing a * transactional change that ensures an assignee always has an associated reservation. * + *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * String name = + * AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]").toString(); + * String destinationId = + * AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]").toString(); + * Assignment response = reservationServiceClient.moveAssignment(name, destinationId); + * } + * }+ * * @param name Required. The resource name of the assignment, e.g. * `projects/myproject/locations/US/reservations/team1-prod/assignments/123` * @param destinationId The new reservation ID, e.g.: @@ -1574,6 +2522,23 @@ public final Assignment moveAssignment(String name, String destinationId) { *
This differs from removing an existing assignment and recreating a new one by providing a * transactional change that ensures an assignee always has an associated reservation. * + *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * MoveAssignmentRequest request = + * MoveAssignmentRequest.newBuilder() + * .setName( + * AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]") + * .toString()) + * .setDestinationId( + * AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]") + * .toString()) + * .build(); + * Assignment response = reservationServiceClient.moveAssignment(request); + * } + * }+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -1589,6 +2554,24 @@ public final Assignment moveAssignment(MoveAssignmentRequest request) { * transactional change that ensures an assignee always has an associated reservation. * *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * MoveAssignmentRequest request = + * MoveAssignmentRequest.newBuilder() + * .setName( + * AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]") + * .toString()) + * .setDestinationId( + * AssignmentName.of("[PROJECT]", "[LOCATION]", "[RESERVATION]", "[ASSIGNMENT]") + * .toString()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * reservationServiceClient.moveAssignmentCallable().futureCall(request); + * // Do something. + * Assignment response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * BiReservationName name = BiReservationName.of("[PROJECT]", "[LOCATION]"); + * BiReservation response = reservationServiceClient.getBiReservation(name); + * } + * }+ * * @param name Required. Name of the requested reservation, for example: * `projects/{project_id}/locations/{location_id}/bireservation` * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -1612,6 +2604,15 @@ public final BiReservation getBiReservation(BiReservationName name) { /** * Retrieves a BI reservation. * + *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * String name = BiReservationName.of("[PROJECT]", "[LOCATION]").toString(); + * BiReservation response = reservationServiceClient.getBiReservation(name); + * } + * }+ * * @param name Required. Name of the requested reservation, for example: * `projects/{project_id}/locations/{location_id}/bireservation` * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -1625,6 +2626,18 @@ public final BiReservation getBiReservation(String name) { /** * Retrieves a BI reservation. * + *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * GetBiReservationRequest request = + * GetBiReservationRequest.newBuilder() + * .setName(BiReservationName.of("[PROJECT]", "[LOCATION]").toString()) + * .build(); + * BiReservation response = reservationServiceClient.getBiReservation(request); + * } + * }+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -1637,6 +2650,19 @@ public final BiReservation getBiReservation(GetBiReservationRequest request) { * Retrieves a BI reservation. * *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * GetBiReservationRequest request = + * GetBiReservationRequest.newBuilder() + * .setName(BiReservationName.of("[PROJECT]", "[LOCATION]").toString()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * reservationServiceClient.getBiReservationCallable().futureCall(request); + * // Do something. + * BiReservation response = future.get(); + * } + * }
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * BiReservation biReservation = BiReservation.newBuilder().build(); + * FieldMask updateMask = FieldMask.newBuilder().build(); + * BiReservation response = + * reservationServiceClient.updateBiReservation(biReservation, updateMask); + * } + * }+ * * @param biReservation A reservation to update. * @param updateMask A list of fields to be updated in this request. * @throws com.google.api.gax.rpc.ApiException if the remote call fails @@ -1676,6 +2713,19 @@ public final BiReservation updateBiReservation( * capacity it needs to be updated to an amount greater than 0. In order to release BI capacity * reservation size must be set to 0. * + *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * UpdateBiReservationRequest request = + * UpdateBiReservationRequest.newBuilder() + * .setBiReservation(BiReservation.newBuilder().build()) + * .setUpdateMask(FieldMask.newBuilder().build()) + * .build(); + * BiReservation response = reservationServiceClient.updateBiReservation(request); + * } + * }+ * * @param request The request object containing all of the parameters for the API call. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ @@ -1694,6 +2744,20 @@ public final BiReservation updateBiReservation(UpdateBiReservationRequest reques * reservation size must be set to 0. * *
Sample code: + * + *
{@code + * try (ReservationServiceClient reservationServiceClient = ReservationServiceClient.create()) { + * UpdateBiReservationRequest request = + * UpdateBiReservationRequest.newBuilder() + * .setBiReservation(BiReservation.newBuilder().build()) + * .setUpdateMask(FieldMask.newBuilder().build()) + * .build(); + * ApiFuture*/ public final UnaryCallablefuture = + * reservationServiceClient.updateBiReservationCallable().futureCall(request); + * // Do something. + * BiReservation response = future.get(); + * } + * }
Sample for ReservationServiceClient: + * + *
{@code + * 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); + * } + * }*/ @Generated("by gapic-generator-java") package com.google.cloud.bigquery.reservation.v1; diff --git a/synth.metadata b/synth.metadata index 1c3bb5b3..81adcf19 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,15 +4,15 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/java-bigqueryreservation.git", - "sha": "03d320160a8525cccb964b2845d5373abaff07bc" + "sha": "624c7890b9d2e6c4ea526ad909b0c4a8c6f564d7" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "91e206bcfeaf8948ea03fe3cb1b7616108496cd3", - "internalRef": "350949863" + "sha": "8d8c008e56f1af31d57f75561e0f1848ffb29eeb", + "internalRef": "356341083" } }, {