GetInfluxDBNamesAsync() публичный Метод

Queries and Gets list of all existing databases in the Influx server instance
When Influx needs authentication, and no user name password is supplied or auth fails all other HTTP exceptions InfluxDB service is not available on the port mentioned
public GetInfluxDBNamesAsync ( ) : Task>
Результат Task>
Пример #1
0
 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;
     }
 }
        public async Task TestGetInfluxDBNamesAsync()
        {
            try
            {

                var client = new InfluxDBClient (influxUrl, dbUName, dbpwd);
                var r = await client.GetInfluxDBNamesAsync ();
                Assert.IsTrue (r != null && r.Count > 0, "GetInfluxDBNamesAsync retunred null or empty collection");
            }
            catch ( Exception e )
            {
                Assert.Fail ("Unexpected exception of type {0} caught: {1}",
                            e.GetType (), e.Message);
                return;
            }
        }
 public async Task TestGetInfluxDBNamesAsync_Auth2()
 {
     var client = new InfluxDBClient (influxUrl, invalidUName, dbpwd);
     var r = await client.GetInfluxDBNamesAsync ();
 }
 public async Task TestGetInfluxDBNamesAsync_Auth()
 {
     var client = new InfluxDBClient (influxUrl);
     var r = await client.GetInfluxDBNamesAsync ();
 }
 public async Task TestGetInfluxDBNamesAsync_ServiceUnavailable()
 {
     var client = new InfluxDBClient (invalidInfluxUrl);
     var r = await client.GetInfluxDBNamesAsync ();
 }
Пример #6
0
 private static async Task<bool> VerifyDatabaseAsync (InfluxDBClient client, string DBName)
 {
     try
     {
         //verify DB exists, create if not
         var dbNames = await client.GetInfluxDBNamesAsync ();
         if (dbNames.Contains (DBName))
             return true;
         else
         {
             var filter = settings.FileFormat == FileFormats.Perfmon ? settings.PerfmonFile.Filter : settings.GenericFile.Filter;
             if (filter == Filters.Measurement || filter == Filters.Field)
             {
                 Logger.LogLine (LogLevel.Info, "Measurement/Field filtering is not applicable for new database!!");
                 filter = Filters.None;
             }
             return await client.CreateDatabaseAsync (DBName);
         }
     }
     catch (Exception e)
     {
         Logger.LogLine (LogLevel.Info, "Unexpected exception of type {0} caught: {1}",
                     e.GetType (), e.Message);
     }
     return false;
 }