using System.Configuration;
namespace InfluxDB.Client.Configurations
{
public class Influx2 : ConfigurationSection
{
///
/// The url to connect the InfluxDB.
///
[ConfigurationProperty("url", IsKey = true, IsRequired = true)]
public string Url
{
get => (string)base["url"];
set => base["url"] = value;
}
///
/// Specify the default destination organization for writes and queries.
///
[ConfigurationProperty("org", IsKey = true, IsRequired = false)]
public string Org
{
get => (string)base["org"];
set => base["org"] = value;
}
///
/// Specify the default destination bucket for writes.
///
[ConfigurationProperty("bucket", IsKey = true, IsRequired = false)]
public string Bucket
{
get => (string)base["bucket"];
set => base["bucket"] = value;
}
///
/// The token to use for the authorization.
///
[ConfigurationProperty("token", IsKey = true, IsRequired = false)]
public string Token
{
get => (string)base["token"];
set => base["token"] = value;
}
///
/// The log level for the request and response information.
///
[ConfigurationProperty("logLevel", IsKey = true, IsRequired = false)]
public string LogLevel
{
get => (string)base["logLevel"];
set => base["logLevel"] = value;
}
///
/// The timespan to wait before the HTTP request times out.
///
[ConfigurationProperty("timeout", IsKey = true, IsRequired = false)]
public string Timeout
{
get => (string)base["timeout"];
set => base["timeout"] = value;
}
///
/// Configure automatically following HTTP 3xx redirects.
///
[ConfigurationProperty("allowHttpRedirects", IsKey = true, IsRequired = false)]
public bool AllowHttpRedirects
{
get => (bool)base["allowHttpRedirects"];
set => base["allowHttpRedirects"] = value;
}
///
/// Ignore Certificate Validation Errors when false
///
[ConfigurationProperty("verifySsl", IsKey = true, IsRequired = false, DefaultValue = true)]
public bool VerifySsl
{
get => (bool)base["verifySsl"];
set => base["verifySsl"] = value;
}
[ConfigurationProperty("tags", IsRequired = false)]
public TagCollection Tags
{
get => base["tags"] as TagCollection;
set => base["tags"] = value;
}
[ConfigurationCollection(typeof(TagElement))]
public class TagCollection : ConfigurationElementCollection
{
public override ConfigurationElementCollectionType CollectionType =>
ConfigurationElementCollectionType.BasicMapAlternate;
protected override string ElementName => "tag";
protected override ConfigurationElement CreateNewElement()
{
return new TagElement();
}
protected override object GetElementKey(ConfigurationElement element)
{
return ((TagElement)element).Name;
}
}
public class TagElement : ConfigurationElement
{
[ConfigurationProperty("name", IsRequired = true, IsKey = true)]
public string Name => (string)base["name"];
[ConfigurationProperty("value", IsRequired = false)]
public string Value => (string)base["value"];
}
}
}