public LoggingServiceV2ClientImpl(LoggingServiceV2.ILoggingServiceV2Client grpcClient, LoggingServiceV2Settings settings)
        {
            this.GrpcClient = grpcClient;
            LoggingServiceV2Settings effectiveSettings = settings ?? LoggingServiceV2Settings.GetDefault();

            _clientHelper = new ClientHelper(effectiveSettings);
        }
Ejemplo n.º 2
0
        public LoggingServiceV2ClientImpl(LoggingServiceV2.ILoggingServiceV2Client grpcClient, LoggingServiceV2Settings settings)
        {
            this.GrpcClient = grpcClient;
            LoggingServiceV2Settings effectiveSettings = settings ?? LoggingServiceV2Settings.GetDefault();
            IClock effectiveClock = effectiveSettings.Clock ?? SystemClock.Instance;

            _clientHelper  = new ClientHelper(effectiveSettings);
            _callDeleteLog = _clientHelper.BuildApiCall <DeleteLogRequest, Empty>(GrpcClient.DeleteLogAsync, GrpcClient.DeleteLog)
                             .WithRetry(effectiveSettings.DeleteLogRetry, effectiveClock, null);
            _callWriteLogEntries = _clientHelper.BuildApiCall <WriteLogEntriesRequest, WriteLogEntriesResponse>(GrpcClient.WriteLogEntriesAsync, GrpcClient.WriteLogEntries)
                                   .WithRetry(effectiveSettings.WriteLogEntriesRetry, effectiveClock, null);
            _callListLogEntries = _clientHelper.BuildApiCall <ListLogEntriesRequest, ListLogEntriesResponse>(GrpcClient.ListLogEntriesAsync, GrpcClient.ListLogEntries)
                                  .WithRetry(effectiveSettings.ListLogEntriesRetry, effectiveClock, null);
            _callListMonitoredResourceDescriptors = _clientHelper.BuildApiCall <ListMonitoredResourceDescriptorsRequest, ListMonitoredResourceDescriptorsResponse>(GrpcClient.ListMonitoredResourceDescriptorsAsync, GrpcClient.ListMonitoredResourceDescriptors)
                                                    .WithRetry(effectiveSettings.ListMonitoredResourceDescriptorsRetry, effectiveClock, null);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Wrap a GRPC LoggingServiceV2 client for more convenient use.
 /// </summary>
 /// <param name="grpcClient">A GRPC client to wrap.</param>
 /// <param name="settings">
 /// An optional <see cref="LoggingServiceV2Settings"/> to configure this wrapper.
 /// If null or not specified, then the default settings are used.
 /// </param>
 /// <returns>A <see cref="LoggingServiceV2Client"/> that wraps the specified GRPC client.</returns>
 public static LoggingServiceV2Client ToClient(
     this LoggingServiceV2.ILoggingServiceV2Client grpcClient,
     LoggingServiceV2Settings settings = null
     ) => new LoggingServiceV2ClientImpl(grpcClient, settings);