public InfluxDbClientConfiguration(Uri endpoint, string username, string password, InfluxVersion influxVersion) { Validate.NotNull(endpoint, "Endpoint may not be null or empty."); Validate.NotNullOrEmpty(password, "Password may not be null or empty."); Validate.NotNullOrEmpty(username, "Username may not be null or empty."); Username = username; Password = password; InfluxVersion = influxVersion; EndpointBaseUri = SanitizeEndpoint(endpoint, false); }
public InfluxDbClientConfiguration(Uri endpoint, string username, string password, InfluxVersion influxVersion, TimeSpan?requestTimeout) { Validate.NotNull(endpoint, "Endpoint may not be null or empty."); Validate.NotNullOrEmpty(password, "Password may not be null or empty."); Validate.NotNullOrEmpty(username, "Username may not be null or empty."); Username = username; Password = password; InfluxVersion = influxVersion; EndpointBaseUri = SanitizeEndpoint(endpoint, false); RequestTimeout = requestTimeout; _httpClient = new HttpClient(); }
public InfluxDb(string url, string username, string password, InfluxVersion influxVersion = InfluxVersion.Auto, TimeSpan?requestTimeout = null) : this(new InfluxDbClientConfiguration(new Uri(url), username, password, influxVersion, requestTimeout)) { Validate.NotNullOrEmpty(url, "The URL may not be null or empty."); Validate.NotNullOrEmpty(username, "The username may not be null or empty."); }
public InfluxDb(string url, string username, string password, InfluxVersion influxVersion) : this(new InfluxDbClientConfiguration(new Uri(url), username, password, influxVersion)) { Validate.NotNullOrEmpty(url, "The URL may not be null or empty."); Validate.NotNullOrEmpty(username, "The username may not be null or empty."); }
public InfluxDb(string url, string username, string password, InfluxVersion influxVersion, TimeSpan? requestTimeout = null) : this(new InfluxDbClientConfiguration(new Uri(url), username, password, influxVersion, requestTimeout)) { Validate.NotNullOrEmpty(url, "The URL may not be null or empty."); Validate.NotNullOrEmpty(username, "The username may not be null or empty."); }
public InfluxDbAgent(string url, string databaseName, string userName, string password, TimeSpan?requestTimeout = null, InfluxVersion influxVersion = InfluxVersion.Auto) { _url = url; _databaseName = databaseName; _userName = userName; _password = password; _influxDb = new Lazy <InfluxDb>(() => { Uri result; if (!Uri.TryCreate(_url, UriKind.Absolute, out result)) { var exp = new InvalidOperationException("Unable to parse provided connection as url."); exp.Data.Add("Url", _url); throw exp; } try { return(new InfluxDb(url, userName, password, influxVersion, requestTimeout)); } catch (Exception exception) { var exp = new InvalidOperationException("Could not establish a connection to the database.", exception); exp.Data.Add("Url", _url); exp.Data.Add("DatabaseName", _databaseName); exp.Data.Add("Username", _userName); throw exp; } }); }
public InfluxDbAgent(string url, string databaseName, string userName, string password, InfluxVersion influxVersion = InfluxVersion.Auto) { _databaseName = databaseName; _userName = userName; _password = password; Uri result; if (!Uri.TryCreate(url, UriKind.Absolute, out result)) { var exp = new InvalidOperationException("Unable to parse provided connection as url."); exp.Data.Add("Url", url); throw exp; } try { _influxDb = new InfluxDb(url, userName, password, influxVersion); } catch (Exception exception) { var exp = new InvalidOperationException("Could not establish a connection to the database.", exception); exp.Data.Add("Url", url); exp.Data.Add("Username", userName); throw exp; } }
public InfluxDbAgent(string url, string databaseName, string userName, string password, TimeSpan? requestTimeout, InfluxVersion influxVersion = InfluxVersion.Auto) { _databaseName = databaseName; _userName = userName; _password = password; Uri result; if (!Uri.TryCreate(url, UriKind.Absolute, out result)) { var exp = new InvalidOperationException("Unable to parse provided connection as url."); exp.Data.Add("Url", url); throw exp; } try { _influxDb = new InfluxDb(url, userName, password, influxVersion, requestTimeout); } catch (Exception exception) { var exp = new InvalidOperationException("Could not establish a connection to the database.", exception); exp.Data.Add("Url", url); exp.Data.Add("Username", userName); throw exp; } }