protected internal InfluxDBClient(InfluxDBClientOptions options)
        {
            Arguments.CheckNotNull(options, nameof(options));

            _options        = options;
            _loggingHandler = new LoggingHandler(options.LogLevel);
            _gzipHandler    = new GzipHandler();

            var version = AssemblyHelper.GetVersion(typeof(InfluxDBClient));

            _apiClient = new ApiClient(options, _loggingHandler, _gzipHandler);
            _apiClient.RestClient.UserAgent = $"influxdb-client-csharp/{version}";

            _exceptionFactory = (methodName, response) =>
                                !response.IsSuccessful ? HttpException.Create(response, response.Content) : null;

            _setupService = new SetupService((Configuration)_apiClient.Configuration)
            {
                ExceptionFactory = _exceptionFactory
            };
            _healthService = new HealthService((Configuration)_apiClient.Configuration)
            {
                ExceptionFactory = _exceptionFactory
            };
            _readyService = new ReadyService((Configuration)_apiClient.Configuration)
            {
                ExceptionFactory = _exceptionFactory
            };
        }
Esempio n. 2
0
        protected internal InfluxDBClient(InfluxDBClientOptions options)
        {
            Arguments.CheckNotNull(options, nameof(options));

            _options        = options;
            _loggingHandler = new LoggingHandler(options.LogLevel);
            _gzipHandler    = new GzipHandler();

            _apiClient = new ApiClient(options, _loggingHandler, _gzipHandler);

            _exceptionFactory = (methodName, response) =>
                                !response.IsSuccessful ? HttpException.Create(response) : null;

            _setupService = new SetupService((Configuration)_apiClient.Configuration)
            {
                ExceptionFactory = _exceptionFactory
            };
            _healthService = new HealthService((Configuration)_apiClient.Configuration)
            {
                ExceptionFactory = _exceptionFactory
            };
            _readyService = new ReadyService((Configuration)_apiClient.Configuration)
            {
                ExceptionFactory = _exceptionFactory
            };
        }