/// <summary> /// Creates a <see cref="ServicesClient"/> which uses the specified call invoker for remote operations. /// </summary> /// <param name="callInvoker"> /// The <see cref="grpccore::CallInvoker"/> for remote operations. Must not be null. /// </param> /// <param name="settings">Optional <see cref="ServicesSettings"/>.</param> /// <returns>The created <see cref="ServicesClient"/>.</returns> internal static ServicesClient Create(grpccore::CallInvoker callInvoker, ServicesSettings settings = null) { gax::GaxPreconditions.CheckNotNull(callInvoker, nameof(callInvoker)); grpcinter::Interceptor interceptor = settings?.Interceptor; if (interceptor != null) { callInvoker = grpcinter::CallInvokerExtensions.Intercept(callInvoker, interceptor); } Services.ServicesClient grpcClient = new Services.ServicesClient(callInvoker); return(new ServicesClientImpl(grpcClient, settings)); }
/// <summary> /// Constructs a client wrapper for the Services service, with the specified gRPC client and settings. /// </summary> /// <param name="grpcClient">The underlying gRPC client.</param> /// <param name="settings">The base <see cref="ServicesSettings"/> used within this client.</param> public ServicesClientImpl(Services.ServicesClient grpcClient, ServicesSettings settings) { GrpcClient = grpcClient; ServicesSettings effectiveSettings = settings ?? ServicesSettings.GetDefault(); gaxgrpc::ClientHelper clientHelper = new gaxgrpc::ClientHelper(effectiveSettings); UpdateServiceOperationsClient = new lro::OperationsClientImpl(grpcClient.CreateOperationsClient(), effectiveSettings.UpdateServiceOperationsSettings); DeleteServiceOperationsClient = new lro::OperationsClientImpl(grpcClient.CreateOperationsClient(), effectiveSettings.DeleteServiceOperationsSettings); _callListServices = clientHelper.BuildApiCall <ListServicesRequest, ListServicesResponse>(grpcClient.ListServicesAsync, grpcClient.ListServices, effectiveSettings.ListServicesSettings).WithGoogleRequestParam("parent", request => request.Parent); Modify_ApiCall(ref _callListServices); Modify_ListServicesApiCall(ref _callListServices); _callGetService = clientHelper.BuildApiCall <GetServiceRequest, Service>(grpcClient.GetServiceAsync, grpcClient.GetService, effectiveSettings.GetServiceSettings).WithGoogleRequestParam("name", request => request.Name); Modify_ApiCall(ref _callGetService); Modify_GetServiceApiCall(ref _callGetService); _callUpdateService = clientHelper.BuildApiCall <UpdateServiceRequest, lro::Operation>(grpcClient.UpdateServiceAsync, grpcClient.UpdateService, effectiveSettings.UpdateServiceSettings).WithGoogleRequestParam("name", request => request.Name); Modify_ApiCall(ref _callUpdateService); Modify_UpdateServiceApiCall(ref _callUpdateService); _callDeleteService = clientHelper.BuildApiCall <DeleteServiceRequest, lro::Operation>(grpcClient.DeleteServiceAsync, grpcClient.DeleteService, effectiveSettings.DeleteServiceSettings).WithGoogleRequestParam("name", request => request.Name); Modify_ApiCall(ref _callDeleteService); Modify_DeleteServiceApiCall(ref _callDeleteService); OnConstruction(grpcClient, effectiveSettings, clientHelper); }
partial void OnConstruction(Services.ServicesClient grpcClient, ServicesSettings effectiveSettings, gaxgrpc::ClientHelper clientHelper);