def resendAtomMessage()

in app/controllers/PlutoController.scala [78:103]


  def resendAtomMessage(id: String) = APIHMACAuthAction {
    try {
      val atomContent = getPreviewAtom(id)
      val atom = MediaAtom.fromThrift(atomContent)

      (MediaAtomHelpers.getCurrentAssetVersion(atom), atom.plutoData) match {
        case (None, _) =>
          log.warn("Requested re-index on an atom with no currentAssetVersion, returning 400")
          BadRequest(Json.toJson(Map("status" -> "notfound", "detail" -> "atom had no current version, resync was probably sent too early")))
        case (_, None) =>
          log.warn("Requested re-index on an item with no pluto data, returning bad request")
          BadRequest(Json.toJson(Map("status"->"bad_data", "detail"->s"$id does not have pluto data attached")))
        case (Some(currentAssetVersion), Some(plutoData)) =>
          val versionWithId = id + s"-$currentAssetVersion"
          val pluto = new PlutoUploadActions(awsConfig)
          pluto.sendToPluto(PlutoResyncMetadataMessage.build(
            versionWithId,
            atom,
            awsConfig
          ))
          Ok(Json.toJson(atom))
      }
    } catch {
      commandExceptionAsResult
    }
  }