public String update(Request req, Response res) { PipelineConfig existingPipelineConfig = fetchEntityFromConfig(req.params("pipeline_name")); PipelineConfig pipelineConfigFromRequest = buildEntityFromRequestBody(req); if (isRenameAttempt(existingPipelineConfig, pipelineConfigFromRequest)) { throw haltBecauseRenameOfEntityIsNotSupported("pipelines"); } haltIfPipelineIsDefinedRemotely(existingPipelineConfig); if (isPutRequestStale(req, existingPipelineConfig)) { throw haltBecauseEtagDoesNotMatch("pipeline", existingPipelineConfig.getName()); } HttpLocalizedOperationResult result = new HttpLocalizedOperationResult(); pipelineConfigService.updatePipelineConfig(SessionUtils.currentUsername(), pipelineConfigFromRequest, etagFor(existingPipelineConfig), result); return handleCreateOrUpdateResponse(req, res, pipelineConfigFromRequest, result); }