示例#1
0
        /// <summary>
        /// Constructs a client wrapper for the Speech service, with the specified gRPC client and settings.
        /// </summary>
        /// <param name="grpcClient">The underlying gRPC client.</param>
        /// <param name="settings">The base <see cref="SpeechSettings"/> used within this client </param>
        public SpeechClientImpl(Speech.SpeechClient grpcClient, SpeechSettings settings)
        {
            this.GrpcClient = grpcClient;
            SpeechSettings effectiveSettings = settings ?? SpeechSettings.GetDefault();

            _clientHelper      = new ClientHelper(effectiveSettings);
            _callSyncRecognize = _clientHelper.BuildApiCall <SyncRecognizeRequest, SyncRecognizeResponse>(
                GrpcClient.SyncRecognizeAsync, GrpcClient.SyncRecognize, effectiveSettings.SyncRecognizeSettings);
            _callAsyncRecognize = _clientHelper.BuildApiCall <AsyncRecognizeRequest, Operation>(
                GrpcClient.AsyncRecognizeAsync, GrpcClient.AsyncRecognize, effectiveSettings.AsyncRecognizeSettings);
        }
        /// <summary>
        /// Constructs a client wrapper for the ErrorGroupService service, with the specified gRPC client and settings.
        /// </summary>
        /// <param name="grpcClient">The underlying gRPC client.</param>
        /// <param name="settings">The base <see cref="ErrorGroupServiceSettings"/> used within this client </param>
        public ErrorGroupServiceClientImpl(ErrorGroupService.ErrorGroupServiceClient grpcClient, ErrorGroupServiceSettings settings)
        {
            this.GrpcClient = grpcClient;
            ErrorGroupServiceSettings effectiveSettings = settings ?? ErrorGroupServiceSettings.GetDefault();

            _clientHelper = new ClientHelper(effectiveSettings);
            _callGetGroup = _clientHelper.BuildApiCall <GetGroupRequest, ErrorGroup>(
                GrpcClient.GetGroupAsync, GrpcClient.GetGroup, effectiveSettings.GetGroupSettings);
            _callUpdateGroup = _clientHelper.BuildApiCall <UpdateGroupRequest, ErrorGroup>(
                GrpcClient.UpdateGroupAsync, GrpcClient.UpdateGroup, effectiveSettings.UpdateGroupSettings);
        }
示例#3
0
        /// <summary>
        /// Constructs a client wrapper for the TraceService service, with the specified gRPC client and settings.
        /// </summary>
        /// <param name="grpcClient">The underlying gRPC client.</param>
        /// <param name="settings">The base <see cref="TraceServiceSettings"/> used within this client </param>
        public TraceServiceClientImpl(TraceService.TraceServiceClient grpcClient, TraceServiceSettings settings)
        {
            GrpcClient = grpcClient;
            TraceServiceSettings effectiveSettings = settings ?? TraceServiceSettings.GetDefault();
            ClientHelper         clientHelper      = new ClientHelper(effectiveSettings);

            _callBatchWriteSpans = clientHelper.BuildApiCall <BatchWriteSpansRequest, Empty>(
                GrpcClient.BatchWriteSpansAsync, GrpcClient.BatchWriteSpans, effectiveSettings.BatchWriteSpansSettings);
            _callCreateSpan = clientHelper.BuildApiCall <Span, Span>(
                GrpcClient.CreateSpanAsync, GrpcClient.CreateSpan, effectiveSettings.CreateSpanSettings);
            OnConstruction(grpcClient, effectiveSettings, clientHelper);
        }
示例#4
0
        public LanguageServiceClientImpl(LanguageService.LanguageServiceClient grpcClient, LanguageServiceSettings settings)
        {
            this.GrpcClient = grpcClient;
            LanguageServiceSettings effectiveSettings = settings ?? LanguageServiceSettings.GetDefault();

            _clientHelper         = new ClientHelper(effectiveSettings);
            _callAnalyzeSentiment = _clientHelper.BuildApiCall <AnalyzeSentimentRequest, AnalyzeSentimentResponse>(
                GrpcClient.AnalyzeSentimentAsync, GrpcClient.AnalyzeSentiment, effectiveSettings.AnalyzeSentimentSettings);
            _callAnalyzeEntities = _clientHelper.BuildApiCall <AnalyzeEntitiesRequest, AnalyzeEntitiesResponse>(
                GrpcClient.AnalyzeEntitiesAsync, GrpcClient.AnalyzeEntities, effectiveSettings.AnalyzeEntitiesSettings);
            _callAnnotateText = _clientHelper.BuildApiCall <AnnotateTextRequest, AnnotateTextResponse>(
                GrpcClient.AnnotateTextAsync, GrpcClient.AnnotateText, effectiveSettings.AnnotateTextSettings);
        }
        public LoggingServiceV2ClientImpl(LoggingServiceV2.LoggingServiceV2Client grpcClient, LoggingServiceV2Settings settings)
        {
            this.GrpcClient = grpcClient;
            LoggingServiceV2Settings effectiveSettings = settings ?? LoggingServiceV2Settings.GetDefault();

            _clientHelper  = new ClientHelper(effectiveSettings);
            _callDeleteLog = _clientHelper.BuildApiCall <DeleteLogRequest, Empty>(
                GrpcClient.DeleteLogAsync, GrpcClient.DeleteLog, effectiveSettings.DeleteLogSettings);
            _callWriteLogEntries = _clientHelper.BuildApiCall <WriteLogEntriesRequest, WriteLogEntriesResponse>(
                GrpcClient.WriteLogEntriesAsync, GrpcClient.WriteLogEntries, effectiveSettings.WriteLogEntriesSettings);
            _callListLogEntries = _clientHelper.BuildApiCall <ListLogEntriesRequest, ListLogEntriesResponse>(
                GrpcClient.ListLogEntriesAsync, GrpcClient.ListLogEntries, effectiveSettings.ListLogEntriesSettings);
        }
        /// <summary>
        /// Constructs a client wrapper for the TraceService service, with the specified gRPC client and settings.
        /// </summary>
        /// <param name="grpcClient">The underlying gRPC client.</param>
        /// <param name="settings">The base <see cref="TraceServiceSettings"/> used within this client </param>
        public TraceServiceClientImpl(TraceService.TraceServiceClient grpcClient, TraceServiceSettings settings)
        {
            this.GrpcClient = grpcClient;
            TraceServiceSettings effectiveSettings = settings ?? TraceServiceSettings.GetDefault();

            _clientHelper    = new ClientHelper(effectiveSettings);
            _callPatchTraces = _clientHelper.BuildApiCall <PatchTracesRequest, Empty>(
                GrpcClient.PatchTracesAsync, GrpcClient.PatchTraces, effectiveSettings.PatchTracesSettings);
            _callGetTrace = _clientHelper.BuildApiCall <GetTraceRequest, Trace>(
                GrpcClient.GetTraceAsync, GrpcClient.GetTrace, effectiveSettings.GetTraceSettings);
            _callListTraces = _clientHelper.BuildApiCall <ListTracesRequest, ListTracesResponse>(
                GrpcClient.ListTracesAsync, GrpcClient.ListTraces, effectiveSettings.ListTracesSettings);
        }
        /// <summary>
        /// Constructs a client wrapper for the ErrorStatsService service, with the specified gRPC client and settings.
        /// </summary>
        /// <param name="grpcClient">The underlying gRPC client.</param>
        /// <param name="settings">The base <see cref="ErrorStatsServiceSettings"/> used within this client </param>
        public ErrorStatsServiceClientImpl(ErrorStatsService.ErrorStatsServiceClient grpcClient, ErrorStatsServiceSettings settings)
        {
            this.GrpcClient = grpcClient;
            ErrorStatsServiceSettings effectiveSettings = settings ?? ErrorStatsServiceSettings.GetDefault();

            _clientHelper       = new ClientHelper(effectiveSettings);
            _callListGroupStats = _clientHelper.BuildApiCall <ListGroupStatsRequest, ListGroupStatsResponse>(
                GrpcClient.ListGroupStatsAsync, GrpcClient.ListGroupStats, effectiveSettings.ListGroupStatsSettings);
            _callListEvents = _clientHelper.BuildApiCall <ListEventsRequest, ListEventsResponse>(
                GrpcClient.ListEventsAsync, GrpcClient.ListEvents, effectiveSettings.ListEventsSettings);
            _callDeleteEvents = _clientHelper.BuildApiCall <DeleteEventsRequest, DeleteEventsResponse>(
                GrpcClient.DeleteEventsAsync, GrpcClient.DeleteEvents, effectiveSettings.DeleteEventsSettings);
        }
        /// <summary>
        /// Constructs a client wrapper for the Controller2 service, with the specified gRPC client and settings.
        /// </summary>
        /// <param name="grpcClient">The underlying gRPC client.</param>
        /// <param name="settings">The base <see cref="Controller2Settings"/> used within this client </param>
        public Controller2ClientImpl(Controller2.Controller2Client grpcClient, Controller2Settings settings)
        {
            GrpcClient = grpcClient;
            Controller2Settings effectiveSettings = settings ?? Controller2Settings.GetDefault();
            ClientHelper        clientHelper      = new ClientHelper(effectiveSettings);

            _callRegisterDebuggee = clientHelper.BuildApiCall <RegisterDebuggeeRequest, RegisterDebuggeeResponse>(
                GrpcClient.RegisterDebuggeeAsync, GrpcClient.RegisterDebuggee, effectiveSettings.RegisterDebuggeeSettings);
            _callListActiveBreakpoints = clientHelper.BuildApiCall <ListActiveBreakpointsRequest, ListActiveBreakpointsResponse>(
                GrpcClient.ListActiveBreakpointsAsync, GrpcClient.ListActiveBreakpoints, effectiveSettings.ListActiveBreakpointsSettings);
            _callUpdateActiveBreakpoint = clientHelper.BuildApiCall <UpdateActiveBreakpointRequest, UpdateActiveBreakpointResponse>(
                GrpcClient.UpdateActiveBreakpointAsync, GrpcClient.UpdateActiveBreakpoint, effectiveSettings.UpdateActiveBreakpointSettings);
            OnConstruction(grpcClient, effectiveSettings, clientHelper);
        }
        /// <summary>
        /// Constructs a client wrapper for the ImageAnnotator service, with the specified gRPC client and settings.
        /// </summary>
        /// <param name="grpcClient">The underlying gRPC client.</param>
        /// <param name="settings">The base <see cref="ImageAnnotatorSettings"/> used within this client </param>
        public ImageAnnotatorClientImpl(ImageAnnotator.ImageAnnotatorClient grpcClient, ImageAnnotatorSettings settings)
        {
            GrpcClient = grpcClient;
            ImageAnnotatorSettings effectiveSettings = settings ?? ImageAnnotatorSettings.GetDefault();
            ClientHelper           clientHelper      = new ClientHelper(effectiveSettings);

            AsyncBatchAnnotateFilesOperationsClient = new OperationsClientImpl(
                grpcClient.CreateOperationsClient(), effectiveSettings.AsyncBatchAnnotateFilesOperationsSettings);
            _callBatchAnnotateImages = clientHelper.BuildApiCall <BatchAnnotateImagesRequest, BatchAnnotateImagesResponse>(
                GrpcClient.BatchAnnotateImagesAsync, GrpcClient.BatchAnnotateImages, effectiveSettings.BatchAnnotateImagesSettings);
            _callAsyncBatchAnnotateFiles = clientHelper.BuildApiCall <AsyncBatchAnnotateFilesRequest, Operation>(
                GrpcClient.AsyncBatchAnnotateFilesAsync, GrpcClient.AsyncBatchAnnotateFiles, effectiveSettings.AsyncBatchAnnotateFilesSettings);
            OnConstruction(grpcClient, effectiveSettings, clientHelper);
        }
        /// <summary>
        /// Constructs a client wrapper for the Bigtable service, with the specified gRPC client and settings.
        /// </summary>
        /// <param name="grpcClient">The underlying gRPC client.</param>
        /// <param name="settings">The base <see cref="BigtableSettings"/> used within this client </param>
        public BigtableClientImpl(Bigtable.BigtableClient grpcClient, BigtableSettings settings)
        {
            this.GrpcClient = grpcClient;
            BigtableSettings effectiveSettings = settings ?? BigtableSettings.GetDefault();
            ClientHelper     clientHelper      = new ClientHelper(effectiveSettings);

            _callMutateRow = clientHelper.BuildApiCall <MutateRowRequest, MutateRowResponse>(
                GrpcClient.MutateRowAsync, GrpcClient.MutateRow, effectiveSettings.MutateRowSettings);
            _callCheckAndMutateRow = clientHelper.BuildApiCall <CheckAndMutateRowRequest, CheckAndMutateRowResponse>(
                GrpcClient.CheckAndMutateRowAsync, GrpcClient.CheckAndMutateRow, effectiveSettings.CheckAndMutateRowSettings);
            _callReadModifyWriteRow = clientHelper.BuildApiCall <ReadModifyWriteRowRequest, ReadModifyWriteRowResponse>(
                GrpcClient.ReadModifyWriteRowAsync, GrpcClient.ReadModifyWriteRow, effectiveSettings.ReadModifyWriteRowSettings);
            OnConstruction(grpcClient, effectiveSettings, clientHelper);
        }
        /// <summary>
        /// Constructs a client wrapper for the Operations service, with the specified gRPC client and settings.
        /// </summary>
        /// <param name="grpcClient">The underlying gRPC client.</param>
        /// <param name="settings">The base <see cref="OperationsSettings"/> used within this client </param>
        public OperationsClientImpl(Operations.OperationsClient grpcClient, OperationsSettings settings)
        {
            this.GrpcClient = grpcClient;
            OperationsSettings effectiveSettings = settings ?? OperationsSettings.GetDefault();

            _clientHelper     = new ClientHelper(effectiveSettings);
            _callGetOperation = _clientHelper.BuildApiCall <GetOperationRequest, Operation>(
                GrpcClient.GetOperationAsync, GrpcClient.GetOperation, effectiveSettings.GetOperationSettings);
            _callListOperations = _clientHelper.BuildApiCall <ListOperationsRequest, ListOperationsResponse>(
                GrpcClient.ListOperationsAsync, GrpcClient.ListOperations, effectiveSettings.ListOperationsSettings);
            _callCancelOperation = _clientHelper.BuildApiCall <CancelOperationRequest, Empty>(
                GrpcClient.CancelOperationAsync, GrpcClient.CancelOperation, effectiveSettings.CancelOperationSettings);
            _callDeleteOperation = _clientHelper.BuildApiCall <DeleteOperationRequest, Empty>(
                GrpcClient.DeleteOperationAsync, GrpcClient.DeleteOperation, effectiveSettings.DeleteOperationSettings);
        }
示例#12
0
        /// <summary>
        /// Constructs a client wrapper for the FirestoreAdmin service, with the specified gRPC client and settings.
        /// </summary>
        /// <param name="grpcClient">The underlying gRPC client.</param>
        /// <param name="settings">The base <see cref="FirestoreAdminSettings"/> used within this client </param>
        public FirestoreAdminClientImpl(FirestoreAdmin.FirestoreAdminClient grpcClient, FirestoreAdminSettings settings)
        {
            GrpcClient = grpcClient;
            FirestoreAdminSettings effectiveSettings = settings ?? FirestoreAdminSettings.GetDefault();
            ClientHelper           clientHelper      = new ClientHelper(effectiveSettings);

            _callCreateIndex = clientHelper.BuildApiCall <CreateIndexRequest, Operation>(
                GrpcClient.CreateIndexAsync, GrpcClient.CreateIndex, effectiveSettings.CreateIndexSettings);
            _callListIndexes = clientHelper.BuildApiCall <ListIndexesRequest, ListIndexesResponse>(
                GrpcClient.ListIndexesAsync, GrpcClient.ListIndexes, effectiveSettings.ListIndexesSettings);
            _callGetIndex = clientHelper.BuildApiCall <GetIndexRequest, Index>(
                GrpcClient.GetIndexAsync, GrpcClient.GetIndex, effectiveSettings.GetIndexSettings);
            _callDeleteIndex = clientHelper.BuildApiCall <DeleteIndexRequest, Empty>(
                GrpcClient.DeleteIndexAsync, GrpcClient.DeleteIndex, effectiveSettings.DeleteIndexSettings);
            OnConstruction(grpcClient, effectiveSettings, clientHelper);
        }
示例#13
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);
        }
示例#14
0
        /// <summary>
        /// Constructs a client wrapper for the Speech service, with the specified gRPC client and settings.
        /// </summary>
        /// <param name="grpcClient">The underlying gRPC client.</param>
        /// <param name="settings">The base <see cref="SpeechSettings"/> used within this client </param>
        public SpeechClientImpl(Speech.SpeechClient grpcClient, SpeechSettings settings)
        {
            GrpcClient = grpcClient;
            SpeechSettings effectiveSettings = settings ?? SpeechSettings.GetDefault();
            ClientHelper   clientHelper      = new ClientHelper(effectiveSettings);

            LongRunningRecognizeOperationsClient = new OperationsClientImpl(
                grpcClient.CreateOperationsClient(), effectiveSettings.LongRunningRecognizeOperationsSettings);
            _callRecognize = clientHelper.BuildApiCall <RecognizeRequest, RecognizeResponse>(
                GrpcClient.RecognizeAsync, GrpcClient.Recognize, effectiveSettings.RecognizeSettings);
            _callLongRunningRecognize = clientHelper.BuildApiCall <LongRunningRecognizeRequest, Operation>(
                GrpcClient.LongRunningRecognizeAsync, GrpcClient.LongRunningRecognize, effectiveSettings.LongRunningRecognizeSettings);
            _callStreamingRecognize = clientHelper.BuildApiCall <StreamingRecognizeRequest, StreamingRecognizeResponse>(
                GrpcClient.StreamingRecognize, effectiveSettings.StreamingRecognizeSettings, effectiveSettings.StreamingRecognizeStreamingSettings);
            OnConstruction(grpcClient, effectiveSettings, clientHelper);
        }
        /// <summary>
        /// Constructs a client wrapper for the LanguageService service, with the specified gRPC client and settings.
        /// </summary>
        /// <param name="grpcClient">The underlying gRPC client.</param>
        /// <param name="settings">The base <see cref="LanguageServiceSettings"/> used within this client </param>
        public LanguageServiceClientImpl(LanguageService.LanguageServiceClient grpcClient, LanguageServiceSettings settings)
        {
            GrpcClient = grpcClient;
            LanguageServiceSettings effectiveSettings = settings ?? LanguageServiceSettings.GetDefault();
            ClientHelper            clientHelper      = new ClientHelper(effectiveSettings);

            _callAnalyzeSentiment = clientHelper.BuildApiCall <AnalyzeSentimentRequest, AnalyzeSentimentResponse>(
                GrpcClient.AnalyzeSentimentAsync, GrpcClient.AnalyzeSentiment, effectiveSettings.AnalyzeSentimentSettings);
            _callAnalyzeEntities = clientHelper.BuildApiCall <AnalyzeEntitiesRequest, AnalyzeEntitiesResponse>(
                GrpcClient.AnalyzeEntitiesAsync, GrpcClient.AnalyzeEntities, effectiveSettings.AnalyzeEntitiesSettings);
            _callAnalyzeSyntax = clientHelper.BuildApiCall <AnalyzeSyntaxRequest, AnalyzeSyntaxResponse>(
                GrpcClient.AnalyzeSyntaxAsync, GrpcClient.AnalyzeSyntax, effectiveSettings.AnalyzeSyntaxSettings);
            _callAnnotateText = clientHelper.BuildApiCall <AnnotateTextRequest, AnnotateTextResponse>(
                GrpcClient.AnnotateTextAsync, GrpcClient.AnnotateText, effectiveSettings.AnnotateTextSettings);
            OnConstruction(grpcClient, effectiveSettings, clientHelper);
        }
        public MetricsServiceV2ClientImpl(MetricsServiceV2.MetricsServiceV2Client grpcClient, MetricsServiceV2Settings settings)
        {
            this.GrpcClient = grpcClient;
            MetricsServiceV2Settings effectiveSettings = settings ?? MetricsServiceV2Settings.GetDefault();

            _clientHelper       = new ClientHelper(effectiveSettings);
            _callListLogMetrics = _clientHelper.BuildApiCall <ListLogMetricsRequest, ListLogMetricsResponse>(
                GrpcClient.ListLogMetricsAsync, GrpcClient.ListLogMetrics, effectiveSettings.ListLogMetricsSettings);
            _callGetLogMetric = _clientHelper.BuildApiCall <GetLogMetricRequest, LogMetric>(
                GrpcClient.GetLogMetricAsync, GrpcClient.GetLogMetric, effectiveSettings.GetLogMetricSettings);
            _callCreateLogMetric = _clientHelper.BuildApiCall <CreateLogMetricRequest, LogMetric>(
                GrpcClient.CreateLogMetricAsync, GrpcClient.CreateLogMetric, effectiveSettings.CreateLogMetricSettings);
            _callUpdateLogMetric = _clientHelper.BuildApiCall <UpdateLogMetricRequest, LogMetric>(
                GrpcClient.UpdateLogMetricAsync, GrpcClient.UpdateLogMetric, effectiveSettings.UpdateLogMetricSettings);
            _callDeleteLogMetric = _clientHelper.BuildApiCall <DeleteLogMetricRequest, Empty>(
                GrpcClient.DeleteLogMetricAsync, GrpcClient.DeleteLogMetric, effectiveSettings.DeleteLogMetricSettings);
        }
        public ConfigServiceV2ClientImpl(ConfigServiceV2.ConfigServiceV2Client grpcClient, ConfigServiceV2Settings settings)
        {
            this.GrpcClient = grpcClient;
            ConfigServiceV2Settings effectiveSettings = settings ?? ConfigServiceV2Settings.GetDefault();

            _clientHelper  = new ClientHelper(effectiveSettings);
            _callListSinks = _clientHelper.BuildApiCall <ListSinksRequest, ListSinksResponse>(
                GrpcClient.ListSinksAsync, GrpcClient.ListSinks, effectiveSettings.ListSinksSettings);
            _callGetSink = _clientHelper.BuildApiCall <GetSinkRequest, LogSink>(
                GrpcClient.GetSinkAsync, GrpcClient.GetSink, effectiveSettings.GetSinkSettings);
            _callCreateSink = _clientHelper.BuildApiCall <CreateSinkRequest, LogSink>(
                GrpcClient.CreateSinkAsync, GrpcClient.CreateSink, effectiveSettings.CreateSinkSettings);
            _callUpdateSink = _clientHelper.BuildApiCall <UpdateSinkRequest, LogSink>(
                GrpcClient.UpdateSinkAsync, GrpcClient.UpdateSink, effectiveSettings.UpdateSinkSettings);
            _callDeleteSink = _clientHelper.BuildApiCall <DeleteSinkRequest, Empty>(
                GrpcClient.DeleteSinkAsync, GrpcClient.DeleteSink, effectiveSettings.DeleteSinkSettings);
        }
        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>
        /// Constructs a client wrapper for the ImageAnnotator service, with the specified gRPC client and settings.
        /// </summary>
        /// <param name="grpcClient">The underlying gRPC client.</param>
        /// <param name="settings">The base <see cref="ImageAnnotatorSettings"/> used within this client </param>
        public ImageAnnotatorClientImpl(ImageAnnotator.ImageAnnotatorClient grpcClient, ImageAnnotatorSettings settings)
        {
            this.GrpcClient = grpcClient;
            ImageAnnotatorSettings effectiveSettings = settings ?? ImageAnnotatorSettings.GetDefault();

            _clientHelper            = new ClientHelper(effectiveSettings);
            _callBatchAnnotateImages = _clientHelper.BuildApiCall <BatchAnnotateImagesRequest, BatchAnnotateImagesResponse>(
                GrpcClient.BatchAnnotateImagesAsync, GrpcClient.BatchAnnotateImages, effectiveSettings.BatchAnnotateImagesSettings);
        }
示例#20
0
        /// <summary>
        /// Constructs a client wrapper for the ReportErrorsService service, with the specified gRPC client and settings.
        /// </summary>
        /// <param name="grpcClient">The underlying gRPC client.</param>
        /// <param name="settings">The base <see cref="ReportErrorsServiceSettings"/> used within this client </param>
        public ReportErrorsServiceClientImpl(ReportErrorsService.ReportErrorsServiceClient grpcClient, ReportErrorsServiceSettings settings)
        {
            this.GrpcClient = grpcClient;
            ReportErrorsServiceSettings effectiveSettings = settings ?? ReportErrorsServiceSettings.GetDefault();

            _clientHelper         = new ClientHelper(effectiveSettings);
            _callReportErrorEvent = _clientHelper.BuildApiCall <ReportErrorEventRequest, ReportErrorEventResponse>(
                GrpcClient.ReportErrorEventAsync, GrpcClient.ReportErrorEvent, effectiveSettings.ReportErrorEventSettings);
        }
示例#21
0
        public MetricsServiceV2ClientImpl(MetricsServiceV2.IMetricsServiceV2Client grpcClient, MetricsServiceV2Settings settings)
        {
            this.GrpcClient = grpcClient;
            MetricsServiceV2Settings effectiveSettings = settings ?? MetricsServiceV2Settings.GetDefault();
            IClock effectiveClock = effectiveSettings.Clock ?? SystemClock.Instance;

            _clientHelper       = new ClientHelper(effectiveSettings);
            _callListLogMetrics = _clientHelper.BuildApiCall <ListLogMetricsRequest, ListLogMetricsResponse>(GrpcClient.ListLogMetricsAsync, GrpcClient.ListLogMetrics)
                                  .WithRetry(effectiveSettings.ListLogMetricsRetry, effectiveClock, null);
            _callGetLogMetric = _clientHelper.BuildApiCall <GetLogMetricRequest, LogMetric>(GrpcClient.GetLogMetricAsync, GrpcClient.GetLogMetric)
                                .WithRetry(effectiveSettings.GetLogMetricRetry, effectiveClock, null);
            _callCreateLogMetric = _clientHelper.BuildApiCall <CreateLogMetricRequest, LogMetric>(GrpcClient.CreateLogMetricAsync, GrpcClient.CreateLogMetric)
                                   .WithRetry(effectiveSettings.CreateLogMetricRetry, effectiveClock, null);
            _callUpdateLogMetric = _clientHelper.BuildApiCall <UpdateLogMetricRequest, LogMetric>(GrpcClient.UpdateLogMetricAsync, GrpcClient.UpdateLogMetric)
                                   .WithRetry(effectiveSettings.UpdateLogMetricRetry, effectiveClock, null);
            _callDeleteLogMetric = _clientHelper.BuildApiCall <DeleteLogMetricRequest, Empty>(GrpcClient.DeleteLogMetricAsync, GrpcClient.DeleteLogMetric)
                                   .WithRetry(effectiveSettings.DeleteLogMetricRetry, effectiveClock, null);
        }
示例#22
0
        public SpeechClientImpl(Speech.SpeechClient grpcClient, SpeechSettings settings)
        {
            this.GrpcClient = grpcClient;
            SpeechSettings effectiveSettings = settings ?? SpeechSettings.GetDefault();

            _clientHelper = new ClientHelper(effectiveSettings);
            _callNonStreamingRecognize = _clientHelper.BuildApiCall <RecognizeRequest, NonStreamingRecognizeResponse>(
                GrpcClient.NonStreamingRecognizeAsync, GrpcClient.NonStreamingRecognize, effectiveSettings.NonStreamingRecognizeSettings);
        }
示例#23
0
 public void BuildApiCall_PerCallSettings()
 {
     var perCallSettings = CallSettings.FromCancellationToken(new CancellationTokenSource().Token);
     var helper = new ClientHelper(new DummySettings());
     var server = new DummyServer();
     var apiCall = helper.BuildApiCall<SimpleRequest, SimpleResponse>(
         server.MethodAsync, server.MethodSync, null);
     apiCall.Sync(null, perCallSettings);
     Assert.Equal(perCallSettings.CancellationToken, server.CallOptions.CancellationToken);
 }
示例#24
0
        public void BuildServerStreamingApiCall_PerMethodSettings()
        {
            var perMethodSettings = CallSettings.FromCancellationToken(new CancellationTokenSource().Token);
            var helper            = new ClientHelper(new DummySettings());
            var server            = new DummyServerServerStreaming();
            var apiCall           = helper.BuildApiCall <SimpleRequest, SimpleResponse>(server.Call, perMethodSettings);

            apiCall.Call(null, null);
            Assert.Equal(perMethodSettings.CancellationToken, server.CallOptions.CancellationToken);
        }
示例#25
0
        public void BuildApiCall_PerMethodSettings()
        {
            var perMethodSettings = CallSettings.FromCancellationToken(new CancellationTokenSource().Token);
            var helper            = new ClientHelper(new SimpleSettings(), logger: null);
            var server            = new DummyServerNonStreaming();
            var apiCall           = helper.BuildApiCall <SimpleRequest, SimpleResponse>(
                "Method", server.MethodAsync, server.MethodSync, perMethodSettings);

            apiCall.Sync(null, null);
            Assert.Equal(perMethodSettings.CancellationToken, server.CallOptions.CancellationToken);
        }
示例#26
0
        /// <summary>
        /// Constructs a client wrapper for the VideoIntelligenceService service, with the specified gRPC client and settings.
        /// </summary>
        /// <param name="grpcClient">The underlying gRPC client.</param>
        /// <param name="settings">The base <see cref="VideoIntelligenceServiceSettings"/> used within this client </param>
        public VideoIntelligenceServiceClientImpl(VideoIntelligenceService.VideoIntelligenceServiceClient grpcClient, VideoIntelligenceServiceSettings settings)
        {
            GrpcClient = grpcClient;
            VideoIntelligenceServiceSettings effectiveSettings = settings ?? VideoIntelligenceServiceSettings.GetDefault();
            ClientHelper clientHelper = new ClientHelper(effectiveSettings);

            AnnotateVideoOperationsClient = new OperationsClientImpl(
                grpcClient.CreateOperationsClient(), effectiveSettings.AnnotateVideoOperationsSettings);
            _callAnnotateVideo = clientHelper.BuildApiCall <AnnotateVideoRequest, Operation>(
                GrpcClient.AnnotateVideoAsync, GrpcClient.AnnotateVideo, effectiveSettings.AnnotateVideoSettings);
            OnConstruction(grpcClient, effectiveSettings, clientHelper);
        }
示例#27
0
        public void BuildClientStreamingApiCall_ClientSettings()
        {
            var clientSettings = CallSettings.FromCancellationToken(new CancellationTokenSource().Token);
            var helper         = new ClientHelper(new SimpleSettings {
                CallSettings = clientSettings
            }, logger: null);
            var server  = new DummyServerClientStreaming();
            var apiCall = helper.BuildApiCall <SimpleRequest, SimpleResponse>("Method", server.Call, null, null);

            apiCall.Call(null);
            Assert.Equal(clientSettings.CancellationToken, server.CallOptions.CancellationToken);
        }
        public PublisherClientImpl(Publisher.IPublisherClient grpcClient, PublisherSettings settings)
        {
            this.GrpcClient = grpcClient;
            PublisherSettings effectiveSettings = settings ?? PublisherSettings.GetDefault();
            IClock            effectiveClock    = effectiveSettings.Clock ?? SystemClock.Instance;

            _clientHelper    = new ClientHelper(effectiveSettings);
            _callCreateTopic = _clientHelper.BuildApiCall <Topic, Topic>(GrpcClient.CreateTopicAsync, GrpcClient.CreateTopic)
                               .WithRetry(effectiveSettings.CreateTopicRetry, effectiveClock, null);
            _callPublish = _clientHelper.BuildApiCall <PublishRequest, PublishResponse>(GrpcClient.PublishAsync, GrpcClient.Publish)
                           .WithRetry(effectiveSettings.PublishRetry, effectiveClock, null);
            _callGetTopic = _clientHelper.BuildApiCall <GetTopicRequest, Topic>(GrpcClient.GetTopicAsync, GrpcClient.GetTopic)
                            .WithRetry(effectiveSettings.GetTopicRetry, effectiveClock, null);
            _callListTopics = _clientHelper.BuildApiCall <ListTopicsRequest, ListTopicsResponse>(GrpcClient.ListTopicsAsync, GrpcClient.ListTopics)
                              .WithRetry(effectiveSettings.ListTopicsRetry, effectiveClock, null);
            _callListTopicSubscriptions = _clientHelper.BuildApiCall <ListTopicSubscriptionsRequest, ListTopicSubscriptionsResponse>(GrpcClient.ListTopicSubscriptionsAsync, GrpcClient.ListTopicSubscriptions)
                                          .WithRetry(effectiveSettings.ListTopicSubscriptionsRetry, effectiveClock, null);
            _callDeleteTopic = _clientHelper.BuildApiCall <DeleteTopicRequest, Empty>(GrpcClient.DeleteTopicAsync, GrpcClient.DeleteTopic)
                               .WithRetry(effectiveSettings.DeleteTopicRetry, effectiveClock, null);
        }
示例#29
0
 partial void OnConstruction(Spanner.SpannerClient grpcClient, SpannerSettings effectiveSettings, ClientHelper clientHelper)
 {
     _callExecuteSqlStream = clientHelper.BuildApiCall <ExecuteSqlRequest, PartialResultSet>(
         GrpcClient.ExecuteStreamingSql, null);
 }