public ConfigServiceV2ClientImpl(ConfigServiceV2.IConfigServiceV2Client grpcClient, ConfigServiceV2Settings settings) { this.GrpcClient = grpcClient; ConfigServiceV2Settings effectiveSettings = settings ?? ConfigServiceV2Settings.GetDefault(); IClock effectiveClock = effectiveSettings.Clock ?? SystemClock.Instance; _clientHelper = new ClientHelper(effectiveSettings); _callListSinks = _clientHelper.BuildApiCall <ListSinksRequest, ListSinksResponse>(GrpcClient.ListSinksAsync, GrpcClient.ListSinks) .WithRetry(effectiveSettings.ListSinksRetry, effectiveClock, null); _callGetSink = _clientHelper.BuildApiCall <GetSinkRequest, LogSink>(GrpcClient.GetSinkAsync, GrpcClient.GetSink) .WithRetry(effectiveSettings.GetSinkRetry, effectiveClock, null); _callCreateSink = _clientHelper.BuildApiCall <CreateSinkRequest, LogSink>(GrpcClient.CreateSinkAsync, GrpcClient.CreateSink) .WithRetry(effectiveSettings.CreateSinkRetry, effectiveClock, null); _callUpdateSink = _clientHelper.BuildApiCall <UpdateSinkRequest, LogSink>(GrpcClient.UpdateSinkAsync, GrpcClient.UpdateSink) .WithRetry(effectiveSettings.UpdateSinkRetry, effectiveClock, null); _callDeleteSink = _clientHelper.BuildApiCall <DeleteSinkRequest, Empty>(GrpcClient.DeleteSinkAsync, GrpcClient.DeleteSink) .WithRetry(effectiveSettings.DeleteSinkRetry, effectiveClock, null); }
/// <summary> /// Wrap a GRPC ConfigServiceV2 client for more convenient use. /// </summary> /// <param name="grpcClient">A GRPC client to wrap.</param> /// <param name="settings"> /// An optional <see cref="ConfigServiceV2Settings"/> to configure this wrapper. /// If null or not specified, then the default settings are used. /// </param> /// <returns>A <see cref="ConfigServiceV2Client"/> that wraps the specified GRPC client.</returns> public static ConfigServiceV2Client ToClient( this ConfigServiceV2.IConfigServiceV2Client grpcClient, ConfigServiceV2Settings settings = null ) => new ConfigServiceV2ClientImpl(grpcClient, settings);