public InfluxDbClient(IInfluxDbClientConfiguration configuration)
        {
            var requestClientFactory = new RequestClientFactory(configuration);

            _requestClient = requestClientFactory.GetRequestClient();

            // NOTE: once a breaking change occures, QueryBuilders will need to be resolved with factories
            _serieQueryBuilder       = new Lazy <ISerieQueryBuilder>(() => new SerieQueryBuilder(), true);
            _databaseQueryBuilder    = new Lazy <IDatabaseQueryBuilder>(() => new DatabaseQueryBuilder(), true);
            _retentionQueryBuilder   = new Lazy <IRetentionQueryBuilder>(() => new RetentionQueryBuilder(), true);
            _cqQueryBuilder          = new Lazy <ICqQueryBuilder>(() => new CqQueryBuilder(), true);
            _diagnosticsQueryBuilder = new Lazy <IDiagnosticsQueryBuilder>(() => new DiagnosticsQueryBuilder(), true);

            // NOTE: once a breaking change occures, Parsers will need to be resolved with factories
            _basicResponseParser       = new Lazy <IBasicResponseParser>(() => new BasicResponseParser(), true);
            _serieResponseParser       = new Lazy <ISerieResponseParser>(() => new SerieResponseParser(), true);
            _databaseResponseParser    = new Lazy <IDatabaseResponseParser>(() => new DatabaseResponseParser(), true);
            _retentionResponseParser   = new Lazy <IRetentionResponseParser>(() => new RetentionResponseParser(), true);
            _cqResponseParser          = new Lazy <ICqResponseParser>(() => new CqResponseParser(), true);
            _diagnosticsResponseParser = new Lazy <IDiagnosticsResponseParser>(() => new DiagnosticsParser(), true);

            // NOTE: once a breaking change occures, ClientModules will need to be resolved with factories
            _basicClientModule       = new Lazy <IBasicClientModule>(() => new BasicClientModule(_requestClient, _basicResponseParser.Value));
            _serieClientModule       = new Lazy <ISerieClientModule>(() => new SerieClientModule(_requestClient, _serieQueryBuilder.Value, _serieResponseParser.Value));
            _databaseClientModule    = new Lazy <IDatabaseClientModule>(() => new DatabaseClientModule(_requestClient, _databaseQueryBuilder.Value, _databaseResponseParser.Value));
            _retentionClientModule   = new Lazy <IRetentionClientModule>(() => new RetentionClientModule(_requestClient, _retentionQueryBuilder.Value, _retentionResponseParser.Value));
            _cqClientModule          = new Lazy <ICqClientModule>(() => new CqClientModule(_requestClient, _cqQueryBuilder.Value, _cqResponseParser.Value));
            _diagnosticsClientModule = new Lazy <IDiagnosticsClientModule>(() => new DiagnosticsClientModule(_requestClient, _diagnosticsQueryBuilder.Value, _diagnosticsResponseParser.Value));
        }
        //public KapacitorClient(string uri, string username, string password, KapacitorVersion kapacitorVersion)
        //     : this(new KapacitorClientConfiguration(new Uri(uri), username, password, kapacitorVersion))
        //{
        //}

        public KapacitorClient(KapacitorClientConfiguration configuration)
        {
            var requestClientFactory = new RequestClientFactory(configuration);

            _requestClient = requestClientFactory.GetRequestClient();

            _taskClientModule = new Lazy <ITaskClientModule>(() => new TaskClientModule(_requestClient));
        }
Пример #3
0
        public InfluxDbClient(IInfluxDbClientConfiguration configuration)
        {
            var requestClientFactory = new RequestClientFactory(configuration);

            _requestClient = requestClientFactory.GetRequestClient();

            // NOTE: once a breaking change occures, RequestModules will need to be resolved with factories
            _basicRequestModule     = new Lazy <IBasicRequestModule>(() => new BasicRequestModule(_requestClient), true);
            _databaseRequestModule  = new Lazy <IDatabaseRequestModule>(() => new DatabaseRequestModule(_requestClient), true);
            _retentionRequestModule = new Lazy <IRetentionRequestModule>(() => new RetentionRequestModule(_requestClient), true);
            _cqRequestModule        = new Lazy <ICqRequestModule>(() => new CqRequestModule(_requestClient), true);

            // NOTE: once a breaking change occures, ClientModules will need to be resolved with factories
            _basicClientModule     = new Lazy <IBasicClientModule>(() => new BasicClientModule(_requestClient, _basicRequestModule.Value));
            _databaseClientModule  = new Lazy <IDatabaseClientModule>(() => new DatabaseClientModule(_requestClient, _databaseRequestModule.Value));
            _retentionClientModule = new Lazy <IRetentionClientModule>(() => new RetentionClientModule(_requestClient, _retentionRequestModule.Value));
            _cqClientModule        = new Lazy <ICqClientModule>(() => new CqClientModule(_requestClient, _cqRequestModule.Value));
        }