public static async Task <IActionResult> Run( [HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] HttpRequest req, ILogger log) { log.LogInformation("SaveDAFApplicationConfig processed a request."); var entGraphConfig = new LCUGraphConfig() { APIKey = Environment.GetEnvironmentVariable("LCU_GRAPH_API_KEY"), Host = Environment.GetEnvironmentVariable("LCU_GRAPH_HOST"), Database = Environment.GetEnvironmentVariable("LCU_GRAPH_DATABASE"), Graph = Environment.GetEnvironmentVariable("LCU_GRAPH") }; string apiKey = req.Query["apiKey"]; var appGraph = new AppGraph(entGraphConfig); var requestBody = await new StreamReader(req.Body).ReadToEndAsync(); var response = new BaseResponse(); var appConfig = requestBody.FromJSON <DAFApplicationConfiguration>(); var appResult = await appGraph.SaveDAFApplication(apiKey, appConfig); response.Status = Status.Success; return(new JsonResult(response, new JsonSerializerSettings())); }
public static async Task <IActionResult> Run( [HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] HttpRequest req, ILogger log) { log.LogInformation("CreateApplication function processed a request."); var entGraphConfig = new LCUGraphConfig() { APIKey = Environment.GetEnvironmentVariable("LCU_GRAPH_API_KEY"), Host = Environment.GetEnvironmentVariable("LCU_GRAPH_HOST"), Database = Environment.GetEnvironmentVariable("LCU_GRAPH_DATABASE"), Graph = Environment.GetEnvironmentVariable("LCU_GRAPH") }; var appGraph = new ApplicationGraph(entGraphConfig); var requestBody = await new StreamReader(req.Body).ReadToEndAsync(); var app = requestBody.FromJSON <Application>(); app = await appGraph.Create(app); var response = new BaseResponse <Application>(); if (app != null) { response.Model = app; response.Status = Status.Success; } else { response.Status = Status.GeneralError.Clone("The application was not created."); } return(new JsonResult(response, new JsonSerializerSettings())); }
public AppGraph(LCUGraphConfig config) : base(config) { }