public async Task <ActionResult <JobStatusResponse> > SubmitJob([FromBody] JobSubmitRequest request) { _eventTracker.TrackInfo("SubmitJob", "Submitting a new job", request); if (User.Identity.Name == null) { _eventTracker.TrackInfo("SubmitJob", "Unauthorized attempt to list all jobs"); return(Unauthorized()); } if (request.Attributes == null) { request.Attributes = new Dictionary <string, Dictionary <string, string> >(); } var jobSubmit = new JobSubmit { JobName = request.JobName, TopicQuery = request.TopicQuery, SelectedAcquirersIdentifiers = request.SelectedAcquirers, SelectedAnalysersIdentifiers = request.SelectedAnalysers, }; var jobStatus = await _jobManagementService.SubmitJob(jobSubmit, request.Attributes); var response = new JobStatusResponse { JobId = jobStatus.JobId, Status = jobStatus.Status, }; _eventTracker.TrackInfo("SubmitJob", "New job submitted", response); return(Ok(response)); }
public IActionResult SubmitJob(SubmitJobModel model) { try { _logger.LogDebug($"Endpoint: \"JobManagement\" Method: \"SubmitJob\" Parameters: \"{model}\""); ValidationResult validationResult = new JobManagementValidator(model).Validate(); if (!validationResult.IsValid) { ExceptionHandler.ThrowProperExternalException(new InputValidationException(validationResult.Message)); } return(Ok(_service.SubmitJob(model.CreatedJobInfoId, model.SessionCode))); } catch (Exception e) { return(BadRequest(e.Message)); } }