/// <summary> /// Gets the default values for all modules in asynchronous fashion. /// </summary> /// <param name="firmwareVersion">The firmware version.</param> /// <param name="deviceType">Type of the device.</param> /// <returns></returns> public async Task <IEnumerable <ModuleReadModel> > GetDefaultValuesAllModulesAsync(string firmwareVersion, string deviceType) { _logger.LogInformation($"{Prefix}: methodName: {nameof(GetDefaultValuesAllModulesAsync)} Getting default values for {firmwareVersion} and {deviceType}."); _logger.LogInformation($"{Prefix}: methodName: {nameof(GetDefaultValuesAllModulesAsync)} Cloning firmware version git repository."); var firmwareVersionUrl = await _firmwareVersionServiceManager.GetFirmwareUrlAsync(deviceType).ConfigureAwait(false); _firmwareVersionServiceManager.SetGitRepoUrl(deviceType, firmwareVersionUrl); await _firmwareVersionServiceManager.CloneGitRepoAsync().ConfigureAwait(false); // read default values from toml file defaults.toml var defaultValueFromTomlFile = await _firmwareVersionServiceManager.GetDefaultTomlFileContentAsync(firmwareVersion).ConfigureAwait(false); _logger.LogInformation($"{Prefix}: methodName: {nameof(GetDefaultValuesAllModulesAsync)} Getting list of modules {firmwareVersion} and {deviceType}."); var listOfModules = await _firmwareVersionServiceManager.GetListOfModulesAsync(firmwareVersion, deviceType).ConfigureAwait(false); _moduleServiceManager.SetConnection(); // clone git repo when we need it. await _moduleServiceManager.CloneGitRepoAsync().ConfigureAwait(false); // get list of all modules. await _moduleServiceManager.UpdateMetaTomlAsync(listOfModules).ConfigureAwait(false); _logger.LogInformation($"{Prefix}: methodName: {nameof(GetDefaultValuesAllModulesAsync)} Merging default values with module information. {firmwareVersion} and {deviceType}."); await MergeValuesWithModulesAsync(defaultValueFromTomlFile, listOfModules); return(listOfModules); }
/// <summary> /// Returns the list of all modules and blocks from config.toml. /// </summary> /// <param name="configTomlFileContent">config.toml as string.</param> /// <returns></returns> public async Task <object> GenerateConfigTomlModelAsync(string configTomlFileContent) { var prefix = nameof(ConfigCreateFromManager); _logger.LogInformation($"{prefix}: methodName: {nameof(GenerateConfigTomlModelAsync)} Getting list of modules and blocks from config.toml file."); // Clone repo here. await _moduleServiceManager.CloneGitRepoAsync().ConfigureAwait(false); var data = await GenerateConfigTomlModelWithoutGitAsync(configTomlFileContent).ConfigureAwait(false); return(data); }