public static async Task <IActionResult> Result( [HttpTrigger(AuthorizationLevel.Function, "get", Route = null)] HttpRequest req, ILogger log) { log.LogInformation("GetResult: Starting."); string jsonResult = "OK"; try { string storageAccount = Common.Helpers.Common.GetStorageKey(req); string source = Common.Helpers.Common.GetQueryString(req, "name"); int id = Common.Helpers.Common.GetIntFromWebQuery(req, "id"); DataQC qc = new DataQC(storageAccount); List <DmsIndex> results = await qc.GetResult(source, id); jsonResult = JsonConvert.SerializeObject(results, Formatting.Indented); } catch (Exception ex) { log.LogError($"GetResult: Error getting QCResults: {ex}"); return(new BadRequestObjectResult($"Error getting QCResults: {ex}")); } log.LogInformation("GetResult: Complete."); return(new OkObjectResult(jsonResult)); }
public static async Task <IActionResult> DataQcResults( [HttpTrigger(AuthorizationLevel.Function, "get", Route = null)] HttpRequest req, ILogger log) { log.LogInformation("GetDataQcResults: Starting."); string jsonResult = "OK"; try { string storageAccount = Common.Helpers.Common.GetStorageKey(req); string source = Common.Helpers.Common.GetQueryString(req, "name"); DataQC qc = new DataQC(storageAccount); DataQCParameters qcParms = new DataQCParameters(); qcParms.DataConnector = source; List <QcResult> qcResults = new List <QcResult>(); qcResults = await qc.GetQCRules(qcParms); jsonResult = JsonConvert.SerializeObject(qcResults, Formatting.Indented); } catch (Exception ex) { log.LogError($"GetDataQcResults: Error getting QCResults: {ex}"); return(new BadRequestObjectResult($"Error getting QCResults: {ex}")); } log.LogInformation("GetDataQcResults: Complete."); return(new OkObjectResult(jsonResult)); }
public async Task <ActionResult <string> > ExecuteRule(DataQCParameters qcParams) { string result = "[]"; try { if (qcParams == null) { return(BadRequest()); } string tmpConnString = Request.Headers["AzureStorageConnection"]; DataQC qc = new DataQC(tmpConnString); List <int> failedObjects = new List <int>(); failedObjects = await qc.ExecuteQcRule(qcParams); RuleFailures ruleFailures = new RuleFailures() { RuleId = qcParams.RuleId, Failures = failedObjects }; result = JsonConvert.SerializeObject(ruleFailures); } catch (Exception ex) { return(BadRequest(ex.ToString())); } return(result); }
public static async Task <string> CloseDataQC([ActivityTrigger] DataQCDataOpsCloseParameters parms, ILogger log) { log.LogInformation($"CloseDataQC: Starting"); DataOpParameters pipe = parms.Parameters; DataQCParameters qcParms = JObject.Parse(pipe.JsonParameters).ToObject <DataQCParameters>(); DataQC qc = new DataQC(pipe.StorageAccount); await qc.CloseDataQC(qcParms.DataConnector, parms.Failures); log.LogInformation($"CloseDataQC: Complete"); return("Data QC Closed"); }
public static async Task <List <QcResult> > InitDataQC([ActivityTrigger] DataOpParameters pipe, ILogger log) { log.LogInformation($"InitDataQC: Starting"); DataQC qc = new DataQC(pipe.StorageAccount); DataQCParameters qcParms = JObject.Parse(pipe.JsonParameters).ToObject <DataQCParameters>(); List <QcResult> qcList = await qc.GetQCRules(qcParms); log.LogInformation($"InitDataQC: Number of QC rules are {qcList.Count}"); await qc.ClearQCFlags(qcParms.DataConnector); log.LogInformation($"InitDataQC: Complete"); return(qcList); }
public async Task <ActionResult <string> > GetFailures(string source, int id) { string result = "[]"; try { string tmpConnString = Request.Headers["AzureStorageConnection"]; DataQC qc = new DataQC(tmpConnString); result = await qc.GetQCFailures(source, id); } catch (Exception) { return(BadRequest()); } return(result); }
public async Task <ActionResult <List <QcResult> > > Get(string source) { List <QcResult> results = new List <QcResult>(); try { string tmpConnString = Request.Headers["AzureStorageConnection"]; DataQC qc = new DataQC(tmpConnString); DataQCParameters qcParms = new DataQCParameters(); qcParms.DataConnector = source; //qcResults = await qc.GetQCRules(qcParms); results = await qc.GetResults(source); } catch (Exception ex) { return(BadRequest($"{ex}")); } return(results); }
public async Task <ActionResult <string> > CloseRulesExecution(string source, DataQCParameters qcParams) { try { if (qcParams == null) { return(BadRequest()); } string tmpConnString = Request.Headers["AzureStorageConnection"]; DataQC qc = new DataQC(tmpConnString); await qc.CloseDataQC(source, qcParams.Failures); } catch (Exception ex) { return(BadRequest(ex.ToString())); } return(Ok($"OK")); }
public static async Task <List <int> > DataQC([ActivityTrigger] DataOpParameters pipe, ILogger log) { List <int> result = new List <int>(); try { log.LogInformation($"DataQC: Starting"); DataQC qc = new DataQC(pipe.StorageAccount); DataQCParameters qcParms = JObject.Parse(pipe.JsonParameters).ToObject <DataQCParameters>(); result = await qc.ExecuteQcRule(qcParms); log.LogInformation($"DataQC: completed rule id {qcParms.RuleId} with result = {result}"); } catch (Exception ex) { log.LogInformation($"InitDataQC:Serious exception {ex}"); } return(result); }
public async Task <ActionResult <string> > ClearQCFlags(string source) { if (String.IsNullOrEmpty(source)) { return(BadRequest()); } try { string tmpConnString = Request.Headers["AzureStorageConnection"]; DataQC qc = new DataQC(tmpConnString); await qc.ClearQCFlags(source); } catch (Exception ex) { return(BadRequest(ex.ToString())); } return(Ok($"OK")); }