Exemplo n.º 1
0
        public async Task SavePipeline(DataOpsPipes pipe, List <PipeLine> tubes)
        {
            string name     = pipe.Name;
            var    response = await httpService.Post($"{url}/SavePipeline/{name}", tubes);

            if (!response.Success)
            {
                throw new ApplicationException(await response.GetBody());
            }
        }
Exemplo n.º 2
0
        public async Task CreatePipeline(DataOpsPipes pipe)
        {
            string name     = pipe.Name;
            var    response = await httpService.Post($"{url}/CreatePipeline/{name}");

            if (!response.Success)
            {
                throw new ApplicationException(await response.GetBody());
            }
        }
Exemplo n.º 3
0
        public async Task CreatePipeline(DataOpsPipes pipe)
        {
            string url = baseUrl.BuildFunctionUrl("SavePipeline", $"", apiKey);

            Console.WriteLine($"Url = {url}");
            var response = await httpService.Post(url, pipe);

            if (!response.Success)
            {
                throw new ApplicationException(await response.GetBody());
            }
        }
Exemplo n.º 4
0
        public async Task SavePipeline(DataOpsPipes pipe, List <PipeLine> tubes)
        {
            string name = pipe.Name;
            string url  = baseUrl.BuildFunctionUrl("SavePipelineData", $"name={name}", apiKey);

            Console.WriteLine($"Url = {url}");
            var response = await httpService.Post(url, tubes);

            if (!response.Success)
            {
                throw new ApplicationException(await response.GetBody());
            }
        }
        public static async Task <IActionResult> Create(
            [HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] HttpRequest req,
            ILogger log)
        {
            log.LogInformation("SavePipeline: Starting.");

            try
            {
                string       storageAccount = Utilities.GetAzureStorageConnection(req.Headers, log);
                string       requestBody    = await new StreamReader(req.Body).ReadToEndAsync();
                DataOpsPipes pipeName       = JsonConvert.DeserializeObject <DataOpsPipes>(requestBody);
                if (pipeName == null)
                {
                    log.LogError("SavePipeline: error missing pipe ops parameters");
                    return(new BadRequestObjectResult("Error missing pipe parameters"));
                }
                if (string.IsNullOrEmpty(pipeName.Name))
                {
                    log.LogError("SavePipeline: error missing pipeline name");
                    return(new BadRequestObjectResult("Error missing pipeline name"));
                }
                string name = pipeName.Name;
                if (!name.EndsWith(".txt"))
                {
                    name = name + ".txt";
                }
                log.LogInformation($"CreatePipeline: Pipe name {name}");
                DataOpsRepository dops = new DataOpsRepository(storageAccount);
                await dops.SavePipeline(name, "");
            }
            catch (Exception ex)
            {
                log.LogError($"SavePipeline: Error creating pipeline: {ex}");
                return(new BadRequestObjectResult($"Error creating pipeline: {ex}"));
            }
            string responseMessage = "OK";

            log.LogInformation("SavePipeline: Completed.");
            return(new OkObjectResult(responseMessage));
        }