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

com.google.cloud.bigquery.reservation.v1.stub.GrpcReservationServiceStub Maven / Gradle / Ivy

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

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

import static com.google.cloud.bigquery.reservation.v1.ReservationServiceClient.ListAssignmentsPagedResponse;
import static com.google.cloud.bigquery.reservation.v1.ReservationServiceClient.ListCapacityCommitmentsPagedResponse;
import static com.google.cloud.bigquery.reservation.v1.ReservationServiceClient.ListReservationsPagedResponse;
import static com.google.cloud.bigquery.reservation.v1.ReservationServiceClient.SearchAllAssignmentsPagedResponse;
import static com.google.cloud.bigquery.reservation.v1.ReservationServiceClient.SearchAssignmentsPagedResponse;

import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.core.BackgroundResourceAggregation;
import com.google.api.gax.grpc.GrpcCallSettings;
import com.google.api.gax.grpc.GrpcStubCallableFactory;
import com.google.api.gax.rpc.ClientContext;
import com.google.api.gax.rpc.RequestParamsBuilder;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.cloud.bigquery.reservation.v1.Assignment;
import com.google.cloud.bigquery.reservation.v1.BiReservation;
import com.google.cloud.bigquery.reservation.v1.CapacityCommitment;
import com.google.cloud.bigquery.reservation.v1.CreateAssignmentRequest;
import com.google.cloud.bigquery.reservation.v1.CreateCapacityCommitmentRequest;
import com.google.cloud.bigquery.reservation.v1.CreateReservationRequest;
import com.google.cloud.bigquery.reservation.v1.DeleteAssignmentRequest;
import com.google.cloud.bigquery.reservation.v1.DeleteCapacityCommitmentRequest;
import com.google.cloud.bigquery.reservation.v1.DeleteReservationRequest;
import com.google.cloud.bigquery.reservation.v1.GetBiReservationRequest;
import com.google.cloud.bigquery.reservation.v1.GetCapacityCommitmentRequest;
import com.google.cloud.bigquery.reservation.v1.GetReservationRequest;
import com.google.cloud.bigquery.reservation.v1.ListAssignmentsRequest;
import com.google.cloud.bigquery.reservation.v1.ListAssignmentsResponse;
import com.google.cloud.bigquery.reservation.v1.ListCapacityCommitmentsRequest;
import com.google.cloud.bigquery.reservation.v1.ListCapacityCommitmentsResponse;
import com.google.cloud.bigquery.reservation.v1.ListReservationsRequest;
import com.google.cloud.bigquery.reservation.v1.ListReservationsResponse;
import com.google.cloud.bigquery.reservation.v1.MergeCapacityCommitmentsRequest;
import com.google.cloud.bigquery.reservation.v1.MoveAssignmentRequest;
import com.google.cloud.bigquery.reservation.v1.Reservation;
import com.google.cloud.bigquery.reservation.v1.SearchAllAssignmentsRequest;
import com.google.cloud.bigquery.reservation.v1.SearchAllAssignmentsResponse;
import com.google.cloud.bigquery.reservation.v1.SearchAssignmentsRequest;
import com.google.cloud.bigquery.reservation.v1.SearchAssignmentsResponse;
import com.google.cloud.bigquery.reservation.v1.SplitCapacityCommitmentRequest;
import com.google.cloud.bigquery.reservation.v1.SplitCapacityCommitmentResponse;
import com.google.cloud.bigquery.reservation.v1.UpdateAssignmentRequest;
import com.google.cloud.bigquery.reservation.v1.UpdateBiReservationRequest;
import com.google.cloud.bigquery.reservation.v1.UpdateCapacityCommitmentRequest;
import com.google.cloud.bigquery.reservation.v1.UpdateReservationRequest;
import com.google.longrunning.stub.GrpcOperationsStub;
import com.google.protobuf.Empty;
import io.grpc.MethodDescriptor;
import io.grpc.protobuf.ProtoUtils;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import javax.annotation.Generated;

// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
 * gRPC stub implementation for the ReservationService service API.
 *
 * 

This class is for advanced usage and reflects the underlying API directly. */ @Generated("by gapic-generator-java") public class GrpcReservationServiceStub extends ReservationServiceStub { private static final MethodDescriptor createReservationMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName( "google.cloud.bigquery.reservation.v1.ReservationService/CreateReservation") .setRequestMarshaller( ProtoUtils.marshaller(CreateReservationRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Reservation.getDefaultInstance())) .build(); private static final MethodDescriptor listReservationsMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName( "google.cloud.bigquery.reservation.v1.ReservationService/ListReservations") .setRequestMarshaller( ProtoUtils.marshaller(ListReservationsRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(ListReservationsResponse.getDefaultInstance())) .build(); private static final MethodDescriptor getReservationMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName( "google.cloud.bigquery.reservation.v1.ReservationService/GetReservation") .setRequestMarshaller( ProtoUtils.marshaller(GetReservationRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Reservation.getDefaultInstance())) .build(); private static final MethodDescriptor deleteReservationMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName( "google.cloud.bigquery.reservation.v1.ReservationService/DeleteReservation") .setRequestMarshaller( ProtoUtils.marshaller(DeleteReservationRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); private static final MethodDescriptor updateReservationMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName( "google.cloud.bigquery.reservation.v1.ReservationService/UpdateReservation") .setRequestMarshaller( ProtoUtils.marshaller(UpdateReservationRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Reservation.getDefaultInstance())) .build(); private static final MethodDescriptor createCapacityCommitmentMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName( "google.cloud.bigquery.reservation.v1.ReservationService/CreateCapacityCommitment") .setRequestMarshaller( ProtoUtils.marshaller(CreateCapacityCommitmentRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(CapacityCommitment.getDefaultInstance())) .build(); private static final MethodDescriptor< ListCapacityCommitmentsRequest, ListCapacityCommitmentsResponse> listCapacityCommitmentsMethodDescriptor = MethodDescriptor .newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName( "google.cloud.bigquery.reservation.v1.ReservationService/ListCapacityCommitments") .setRequestMarshaller( ProtoUtils.marshaller(ListCapacityCommitmentsRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(ListCapacityCommitmentsResponse.getDefaultInstance())) .build(); private static final MethodDescriptor getCapacityCommitmentMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName( "google.cloud.bigquery.reservation.v1.ReservationService/GetCapacityCommitment") .setRequestMarshaller( ProtoUtils.marshaller(GetCapacityCommitmentRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(CapacityCommitment.getDefaultInstance())) .build(); private static final MethodDescriptor deleteCapacityCommitmentMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName( "google.cloud.bigquery.reservation.v1.ReservationService/DeleteCapacityCommitment") .setRequestMarshaller( ProtoUtils.marshaller(DeleteCapacityCommitmentRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); private static final MethodDescriptor updateCapacityCommitmentMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName( "google.cloud.bigquery.reservation.v1.ReservationService/UpdateCapacityCommitment") .setRequestMarshaller( ProtoUtils.marshaller(UpdateCapacityCommitmentRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(CapacityCommitment.getDefaultInstance())) .build(); private static final MethodDescriptor< SplitCapacityCommitmentRequest, SplitCapacityCommitmentResponse> splitCapacityCommitmentMethodDescriptor = MethodDescriptor .newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName( "google.cloud.bigquery.reservation.v1.ReservationService/SplitCapacityCommitment") .setRequestMarshaller( ProtoUtils.marshaller(SplitCapacityCommitmentRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(SplitCapacityCommitmentResponse.getDefaultInstance())) .build(); private static final MethodDescriptor mergeCapacityCommitmentsMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName( "google.cloud.bigquery.reservation.v1.ReservationService/MergeCapacityCommitments") .setRequestMarshaller( ProtoUtils.marshaller(MergeCapacityCommitmentsRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(CapacityCommitment.getDefaultInstance())) .build(); private static final MethodDescriptor createAssignmentMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName( "google.cloud.bigquery.reservation.v1.ReservationService/CreateAssignment") .setRequestMarshaller( ProtoUtils.marshaller(CreateAssignmentRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Assignment.getDefaultInstance())) .build(); private static final MethodDescriptor listAssignmentsMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName( "google.cloud.bigquery.reservation.v1.ReservationService/ListAssignments") .setRequestMarshaller( ProtoUtils.marshaller(ListAssignmentsRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(ListAssignmentsResponse.getDefaultInstance())) .build(); private static final MethodDescriptor deleteAssignmentMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName( "google.cloud.bigquery.reservation.v1.ReservationService/DeleteAssignment") .setRequestMarshaller( ProtoUtils.marshaller(DeleteAssignmentRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Empty.getDefaultInstance())) .build(); private static final MethodDescriptor searchAssignmentsMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName( "google.cloud.bigquery.reservation.v1.ReservationService/SearchAssignments") .setRequestMarshaller( ProtoUtils.marshaller(SearchAssignmentsRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(SearchAssignmentsResponse.getDefaultInstance())) .build(); private static final MethodDescriptor searchAllAssignmentsMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName( "google.cloud.bigquery.reservation.v1.ReservationService/SearchAllAssignments") .setRequestMarshaller( ProtoUtils.marshaller(SearchAllAssignmentsRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(SearchAllAssignmentsResponse.getDefaultInstance())) .build(); private static final MethodDescriptor moveAssignmentMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName( "google.cloud.bigquery.reservation.v1.ReservationService/MoveAssignment") .setRequestMarshaller( ProtoUtils.marshaller(MoveAssignmentRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Assignment.getDefaultInstance())) .build(); private static final MethodDescriptor updateAssignmentMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName( "google.cloud.bigquery.reservation.v1.ReservationService/UpdateAssignment") .setRequestMarshaller( ProtoUtils.marshaller(UpdateAssignmentRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Assignment.getDefaultInstance())) .build(); private static final MethodDescriptor getBiReservationMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName( "google.cloud.bigquery.reservation.v1.ReservationService/GetBiReservation") .setRequestMarshaller( ProtoUtils.marshaller(GetBiReservationRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(BiReservation.getDefaultInstance())) .build(); private static final MethodDescriptor updateBiReservationMethodDescriptor = MethodDescriptor.newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName( "google.cloud.bigquery.reservation.v1.ReservationService/UpdateBiReservation") .setRequestMarshaller( ProtoUtils.marshaller(UpdateBiReservationRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(BiReservation.getDefaultInstance())) .build(); private final UnaryCallable createReservationCallable; private final UnaryCallable listReservationsCallable; private final UnaryCallable listReservationsPagedCallable; private final UnaryCallable getReservationCallable; private final UnaryCallable deleteReservationCallable; private final UnaryCallable updateReservationCallable; private final UnaryCallable createCapacityCommitmentCallable; private final UnaryCallable listCapacityCommitmentsCallable; private final UnaryCallable listCapacityCommitmentsPagedCallable; private final UnaryCallable getCapacityCommitmentCallable; private final UnaryCallable deleteCapacityCommitmentCallable; private final UnaryCallable updateCapacityCommitmentCallable; private final UnaryCallable splitCapacityCommitmentCallable; private final UnaryCallable mergeCapacityCommitmentsCallable; private final UnaryCallable createAssignmentCallable; private final UnaryCallable listAssignmentsCallable; private final UnaryCallable listAssignmentsPagedCallable; private final UnaryCallable deleteAssignmentCallable; private final UnaryCallable searchAssignmentsCallable; private final UnaryCallable searchAssignmentsPagedCallable; private final UnaryCallable searchAllAssignmentsCallable; private final UnaryCallable searchAllAssignmentsPagedCallable; private final UnaryCallable moveAssignmentCallable; private final UnaryCallable updateAssignmentCallable; private final UnaryCallable getBiReservationCallable; private final UnaryCallable updateBiReservationCallable; private final BackgroundResource backgroundResources; private final GrpcOperationsStub operationsStub; private final GrpcStubCallableFactory callableFactory; public static final GrpcReservationServiceStub create(ReservationServiceStubSettings settings) throws IOException { return new GrpcReservationServiceStub(settings, ClientContext.create(settings)); } public static final GrpcReservationServiceStub create(ClientContext clientContext) throws IOException { return new GrpcReservationServiceStub( ReservationServiceStubSettings.newBuilder().build(), clientContext); } public static final GrpcReservationServiceStub create( ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { return new GrpcReservationServiceStub( ReservationServiceStubSettings.newBuilder().build(), clientContext, callableFactory); } /** * Constructs an instance of GrpcReservationServiceStub, using the given settings. This is * protected so that it is easy to make a subclass, but otherwise, the static factory methods * should be preferred. */ protected GrpcReservationServiceStub( ReservationServiceStubSettings settings, ClientContext clientContext) throws IOException { this(settings, clientContext, new GrpcReservationServiceCallableFactory()); } /** * Constructs an instance of GrpcReservationServiceStub, using the given settings. This is * protected so that it is easy to make a subclass, but otherwise, the static factory methods * should be preferred. */ protected GrpcReservationServiceStub( ReservationServiceStubSettings settings, ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { this.callableFactory = callableFactory; this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); GrpcCallSettings createReservationTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(createReservationMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings listReservationsTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(listReservationsMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings getReservationTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(getReservationMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings deleteReservationTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(deleteReservationMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings updateReservationTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(updateReservationMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add( "reservation.name", String.valueOf(request.getReservation().getName())); return builder.build(); }) .build(); GrpcCallSettings createCapacityCommitmentTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(createCapacityCommitmentMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings listCapacityCommitmentsTransportSettings = GrpcCallSettings .newBuilder() .setMethodDescriptor(listCapacityCommitmentsMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings getCapacityCommitmentTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(getCapacityCommitmentMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings deleteCapacityCommitmentTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(deleteCapacityCommitmentMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings updateCapacityCommitmentTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(updateCapacityCommitmentMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add( "capacity_commitment.name", String.valueOf(request.getCapacityCommitment().getName())); return builder.build(); }) .build(); GrpcCallSettings splitCapacityCommitmentTransportSettings = GrpcCallSettings .newBuilder() .setMethodDescriptor(splitCapacityCommitmentMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings mergeCapacityCommitmentsTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(mergeCapacityCommitmentsMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings createAssignmentTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(createAssignmentMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings listAssignmentsTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(listAssignmentsMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings deleteAssignmentTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(deleteAssignmentMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings searchAssignmentsTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(searchAssignmentsMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings searchAllAssignmentsTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(searchAllAssignmentsMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings moveAssignmentTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(moveAssignmentMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings updateAssignmentTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(updateAssignmentMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("assignment.name", String.valueOf(request.getAssignment().getName())); return builder.build(); }) .build(); GrpcCallSettings getBiReservationTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(getBiReservationMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings updateBiReservationTransportSettings = GrpcCallSettings.newBuilder() .setMethodDescriptor(updateBiReservationMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add( "bi_reservation.name", String.valueOf(request.getBiReservation().getName())); return builder.build(); }) .build(); this.createReservationCallable = callableFactory.createUnaryCallable( createReservationTransportSettings, settings.createReservationSettings(), clientContext); this.listReservationsCallable = callableFactory.createUnaryCallable( listReservationsTransportSettings, settings.listReservationsSettings(), clientContext); this.listReservationsPagedCallable = callableFactory.createPagedCallable( listReservationsTransportSettings, settings.listReservationsSettings(), clientContext); this.getReservationCallable = callableFactory.createUnaryCallable( getReservationTransportSettings, settings.getReservationSettings(), clientContext); this.deleteReservationCallable = callableFactory.createUnaryCallable( deleteReservationTransportSettings, settings.deleteReservationSettings(), clientContext); this.updateReservationCallable = callableFactory.createUnaryCallable( updateReservationTransportSettings, settings.updateReservationSettings(), clientContext); this.createCapacityCommitmentCallable = callableFactory.createUnaryCallable( createCapacityCommitmentTransportSettings, settings.createCapacityCommitmentSettings(), clientContext); this.listCapacityCommitmentsCallable = callableFactory.createUnaryCallable( listCapacityCommitmentsTransportSettings, settings.listCapacityCommitmentsSettings(), clientContext); this.listCapacityCommitmentsPagedCallable = callableFactory.createPagedCallable( listCapacityCommitmentsTransportSettings, settings.listCapacityCommitmentsSettings(), clientContext); this.getCapacityCommitmentCallable = callableFactory.createUnaryCallable( getCapacityCommitmentTransportSettings, settings.getCapacityCommitmentSettings(), clientContext); this.deleteCapacityCommitmentCallable = callableFactory.createUnaryCallable( deleteCapacityCommitmentTransportSettings, settings.deleteCapacityCommitmentSettings(), clientContext); this.updateCapacityCommitmentCallable = callableFactory.createUnaryCallable( updateCapacityCommitmentTransportSettings, settings.updateCapacityCommitmentSettings(), clientContext); this.splitCapacityCommitmentCallable = callableFactory.createUnaryCallable( splitCapacityCommitmentTransportSettings, settings.splitCapacityCommitmentSettings(), clientContext); this.mergeCapacityCommitmentsCallable = callableFactory.createUnaryCallable( mergeCapacityCommitmentsTransportSettings, settings.mergeCapacityCommitmentsSettings(), clientContext); this.createAssignmentCallable = callableFactory.createUnaryCallable( createAssignmentTransportSettings, settings.createAssignmentSettings(), clientContext); this.listAssignmentsCallable = callableFactory.createUnaryCallable( listAssignmentsTransportSettings, settings.listAssignmentsSettings(), clientContext); this.listAssignmentsPagedCallable = callableFactory.createPagedCallable( listAssignmentsTransportSettings, settings.listAssignmentsSettings(), clientContext); this.deleteAssignmentCallable = callableFactory.createUnaryCallable( deleteAssignmentTransportSettings, settings.deleteAssignmentSettings(), clientContext); this.searchAssignmentsCallable = callableFactory.createUnaryCallable( searchAssignmentsTransportSettings, settings.searchAssignmentsSettings(), clientContext); this.searchAssignmentsPagedCallable = callableFactory.createPagedCallable( searchAssignmentsTransportSettings, settings.searchAssignmentsSettings(), clientContext); this.searchAllAssignmentsCallable = callableFactory.createUnaryCallable( searchAllAssignmentsTransportSettings, settings.searchAllAssignmentsSettings(), clientContext); this.searchAllAssignmentsPagedCallable = callableFactory.createPagedCallable( searchAllAssignmentsTransportSettings, settings.searchAllAssignmentsSettings(), clientContext); this.moveAssignmentCallable = callableFactory.createUnaryCallable( moveAssignmentTransportSettings, settings.moveAssignmentSettings(), clientContext); this.updateAssignmentCallable = callableFactory.createUnaryCallable( updateAssignmentTransportSettings, settings.updateAssignmentSettings(), clientContext); this.getBiReservationCallable = callableFactory.createUnaryCallable( getBiReservationTransportSettings, settings.getBiReservationSettings(), clientContext); this.updateBiReservationCallable = callableFactory.createUnaryCallable( updateBiReservationTransportSettings, settings.updateBiReservationSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); } public GrpcOperationsStub getOperationsStub() { return operationsStub; } @Override public UnaryCallable createReservationCallable() { return createReservationCallable; } @Override public UnaryCallable listReservationsCallable() { return listReservationsCallable; } @Override public UnaryCallable listReservationsPagedCallable() { return listReservationsPagedCallable; } @Override public UnaryCallable getReservationCallable() { return getReservationCallable; } @Override public UnaryCallable deleteReservationCallable() { return deleteReservationCallable; } @Override public UnaryCallable updateReservationCallable() { return updateReservationCallable; } @Override public UnaryCallable createCapacityCommitmentCallable() { return createCapacityCommitmentCallable; } @Override public UnaryCallable listCapacityCommitmentsCallable() { return listCapacityCommitmentsCallable; } @Override public UnaryCallable listCapacityCommitmentsPagedCallable() { return listCapacityCommitmentsPagedCallable; } @Override public UnaryCallable getCapacityCommitmentCallable() { return getCapacityCommitmentCallable; } @Override public UnaryCallable deleteCapacityCommitmentCallable() { return deleteCapacityCommitmentCallable; } @Override public UnaryCallable updateCapacityCommitmentCallable() { return updateCapacityCommitmentCallable; } @Override public UnaryCallable splitCapacityCommitmentCallable() { return splitCapacityCommitmentCallable; } @Override public UnaryCallable mergeCapacityCommitmentsCallable() { return mergeCapacityCommitmentsCallable; } @Override public UnaryCallable createAssignmentCallable() { return createAssignmentCallable; } @Override public UnaryCallable listAssignmentsCallable() { return listAssignmentsCallable; } @Override public UnaryCallable listAssignmentsPagedCallable() { return listAssignmentsPagedCallable; } @Override public UnaryCallable deleteAssignmentCallable() { return deleteAssignmentCallable; } @Override public UnaryCallable searchAssignmentsCallable() { return searchAssignmentsCallable; } @Override public UnaryCallable searchAssignmentsPagedCallable() { return searchAssignmentsPagedCallable; } @Override public UnaryCallable searchAllAssignmentsCallable() { return searchAllAssignmentsCallable; } @Override public UnaryCallable searchAllAssignmentsPagedCallable() { return searchAllAssignmentsPagedCallable; } @Override public UnaryCallable moveAssignmentCallable() { return moveAssignmentCallable; } @Override public UnaryCallable updateAssignmentCallable() { return updateAssignmentCallable; } @Override public UnaryCallable getBiReservationCallable() { return getBiReservationCallable; } @Override public UnaryCallable updateBiReservationCallable() { return updateBiReservationCallable; } @Override public final void close() { try { backgroundResources.close(); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new IllegalStateException("Failed to close resource", e); } } @Override public void shutdown() { backgroundResources.shutdown(); } @Override public boolean isShutdown() { return backgroundResources.isShutdown(); } @Override public boolean isTerminated() { return backgroundResources.isTerminated(); } @Override public void shutdownNow() { backgroundResources.shutdownNow(); } @Override public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { return backgroundResources.awaitTermination(duration, unit); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy