in path-manager/app/controllers/PathManagerController.scala [33:72]
def registerExistingPath(id: Long) = Action { request =>
request.body.asJson.map(_.as[PathRecord]) match {
case (Some(path)) if path.identifier != id => {
PathOperationErrors.increment
logger.warn("registerExistingPath failed, identifier in url and body do not match")
BadRequest("identifier in url and body do not match")
}
case Some(path) if path.`type` == "alias" => {
PathStore.registerAlias(path) match {
case Left(error) => BadRequest(error)
case Right(records) => {
PathMigrationRegistrations.increment
argoOk(Json.toJson(records))
}
}
}
case Some(path) if path.`type` == "canonical" => {
PathStore.registerCanonical(path) match {
case Left(error) => BadRequest(error)
case Right(records) => {
PathMigrationRegistrations.increment
argoOk(Json.toJson(records))
}
}
}
case Some(_) => {
PathOperationErrors.increment
logger.warn("registerExistingPath failed, only canonical and alias paths can be updated at present")
BadRequest("only canonical paths can be updated at present")
}
case None => {
PathOperationErrors.increment
logger.warn("registerExistingPath failed, unable to parse PathRecord from request body")
BadRequest("unable to parse PathRecord from request body")
}
}
}