public async Task <IEnumerable <DataCollectionConfig> > GetDataCollectionsConfigAsync(string configSetName, CancellationToken cancellationToken) { var configName = (configSetName + "/" + DataCollectionsConfigFileName).TrimStart('/'); var json = await _configProvider.GetConfigContentAsync(configName, cancellationToken); return(_dataCollectJsonConfigsProvider.GetDataCollectionsConfig(json)); }
public async Task <IEnumerable <StorageConfig> > GetStorageConfigsAsync(CancellationToken cancellationToken) { var json = await _configProvider.GetConfigContentAsync(StorageConfigName, cancellationToken); var result = _storageJsonConfigProvider.GetStorageConfigs(json); if (result.Any(x => string.IsNullOrEmpty(x.StorageType))) { throw new Exception("Invalid StorageType"); } return(result); }
public async Task <string> GetConfigContentAsync(string fileName, CancellationToken cancellationToken) { try { _logger.LogInformation("Started getting config file '{fileName}' content", fileName); var result = await _configProvider.GetConfigContentAsync(fileName, cancellationToken); _logger.LogInformation("Finished getting config file '{fileName}' content", fileName); return(result); } catch (Exception e) { _logger.LogCritical("Error getting config file '{fileName}' content: {errorMessage}", fileName, e.GetAggregateMessages()); throw; } }
public async Task <IEnumerable <User> > GetUsersAsync(CancellationToken cancellationToken) { var json = await _configProvider.GetConfigContentAsync(UsersConfigName, cancellationToken); return(_usersJsonProvider.GetUsers(json)); }
public async Task <string> GetConfigFileContentAsync(string fileName, IConfigProvider configFileProvider, CancellationToken cancellationToken) { var result = _cache.GetOrAdd(fileName, (key) => configFileProvider.GetConfigContentAsync(key, cancellationToken).Result); return(await Task.FromResult(result)); }