public async Task<List<String>> GetInfluxDBNamesAsync () { var dbNames = new List<String> (); var dbs = await QueryMultiSeriesAsync (null, "SHOW DATABASES"); foreach (var db in dbs.FirstOrDefault ()?.Entries) dbNames.Add (db?.Name); return dbNames; }
private static async Task<InfluxDBClient> GetClientAsync (InfluxerConfigSection settings) { var client = new InfluxDBClient (settings.InfluxDB.InfluxUri, settings.InfluxDB.UserName, settings.InfluxDB.Password); var dbNames = await client.GetInfluxDBNamesAsync (); if (dbNames.Contains (settings.InfluxDB.DatabaseName)) return client; else { await client.CreateDatabaseAsync (settings.InfluxDB.DatabaseName); return client; } }