private def isLogType()

in src/main/scala/com/gu/contentapi/Lambda.scala [38:54]


  private def isLogType(typeName: String, s3Entity: S3EventNotification.S3Entity): Boolean =
    s3Entity.getBucket.getName == typeName ||
      s3Entity.getObject.getKey.startsWith(typeName)

  private def handleReportsFromFastly(objects: List[Path]): Unit = {
    objects foreach { obj =>
      Loader.linesFromFile(obj).map(_.flatMap(FastlyLog.apply)) match {
        case Success(allFastlyLogs) =>
          logger.debug(s"Fastly: processing ${obj.toString}")
          val downloadsLogs = allFastlyLogs.filter(FastlyLog.onlyDownloads && FastlyLog.onlyGet)
          Ophan.send(downloadsLogs.flatMap(Event(_)))

        case Failure(err) =>
          logger.error(s"Could not load fastly logs from tempfile ${obj.toString}: ${err.getMessage}", err)
      }
    }
  }