예제 #1
0
        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));
        }
예제 #2
0
        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));
        }
예제 #3
0
        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);
        }
예제 #4
0
        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");
        }
예제 #5
0
        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);
        }
예제 #6
0
        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);
        }
예제 #7
0
        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);
        }
예제 #8
0
        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"));
        }
예제 #9
0
        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);
        }
예제 #10
0
        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"));
        }