public async Task <IActionResult> UpdateJobTaskDefinition(int projectId, int jobId, int taskId, UpdateJobTaskDefinitionDto jobTaskDefinition) { // exclude additional configs since it may contain secret values var requestBodyToLog = new UpdateJobTaskDefinitionDto { Id = jobTaskDefinition.Id, Name = jobTaskDefinition.Name, Configs = jobTaskDefinition.Configs, Provider = jobTaskDefinition.Provider, Sequence = jobTaskDefinition.Sequence, Type = jobTaskDefinition.Type }; _logger.LogInformation("Updating job task definition {taskId} in job definition {jobId}, project {projectId}. Request body: {@requestBodyToLog}", taskId, jobId, projectId, requestBodyToLog); try { if (taskId != jobTaskDefinition.Id) { _logger.LogWarning("Task Id doesn't match."); return(BadRequest("Task Id doesn't match.")); } var entity = _mapper.Map <JobTaskDefinition>(jobTaskDefinition); await _jobDefinitionService.UpdateJobTaskDefinition(entity); return(Ok()); } catch (DuplicateJobTaskDefinitionException dupTaskEx) { _logger.LogWarning(dupTaskEx, "Duplicate task name"); return(BadRequest(dupTaskEx.Message)); } catch (InvalidPluginTypeException pluginTypeEx) { _logger.LogWarning(pluginTypeEx, "Invalid provider's plugin type"); return(BadRequest(pluginTypeEx.Message)); } catch (ProviderNotInstalledException provEx) { _logger.LogWarning(provEx, "Provider not installed"); return(BadRequest(provEx.Message)); } catch (ExternalServiceRequiredException esrEx) { _logger.LogWarning(esrEx, "External service required"); return(BadRequest(esrEx.Message)); } catch (ExternalServiceNotFoundException esnfEx) { _logger.LogWarning(esnfEx, "External service not found"); return(BadRequest(esnfEx.Message)); } catch (IncorrectExternalServiceTypeException iestEx) { _logger.LogWarning(iestEx, "Incorrect external service type"); return(BadRequest(iestEx.Message)); } }
public async Task UpdateJobTaskDefinition(int projectId, int jobId, int taskId, UpdateJobTaskDefinitionDto dto) { var path = $"project/{projectId}/job/{jobId}/task/{taskId}"; await Api.Put(path, dto); }