/// <summary> /// A simple function that takes a string and does a ToUpper /// </summary> /// <param name="input"></param> /// <param name="context"></param> /// <returns></returns> public async Task FunctionHandler(WebApiRequest <SaasafrasCoreTableRebuildRequest> input, ILambdaContext context) { context.Logger.LogLine($"Entered function..."); using (var _mysql = new MySqlQueryHandler(context)) { context.Logger.LogLine($"Rebuilding core tables for {input.bodyJson.appId}, {input.bodyJson.version}"); await _mysql.RebuildCoreTables(input.bodyJson.solutionId, input.bodyJson.version); } }
/// <summary> /// A simple function that takes a string and does a ToUpper /// </summary> /// <param name="input"></param> /// <param name="context"></param> /// <returns></returns> public async Task FunctionHandler(SaasafrasRebuildRequest input, ILambdaContext context) { context.Logger.LogLine($"{Newtonsoft.Json.JsonConvert.SerializeObject(input)}"); using (var _mysql = new MySqlQueryHandler(context)) { switch (input.command) { case "rebuild-core-tables": context.Logger.LogLine($"Rebuilding app tables for {input.solutionId}, {input.version}"); try { var task = _mysql.RebuildCoreTables(input.solutionId, input.version); await task; } catch (Exception e) { context.Logger.LogLine(e.Message); } break; case "rebuild-app-tables": context.Logger.LogLine($"Rebuilding app tables for {input.solutionId}, {input.version}"); try { var task = _mysql.RebuildAppTable(input.solutionId, input.version, 'Y'); await task; } catch (Exception e) { context.Logger.LogLine(e.Message); } break; default: throw new Exception($"command {input.command} not recognized."); } } }