in hq/app/logic/IamUnrecognisedUsers.scala [25:46]
def getJanusUsernames(janusData: JanusData): List[String] =
janusData.access.userAccess.keys.toList
/**
* Removes the FailedAttempts from the Either and returns a list of tuples with only the Right values.
* This function uses generics to make it easier to test, but to avoid confusion it was written to take
* a Map of AWSAccount to Either and return a list of tuples of AWS Account to CredentialReportDisplay.
*/
def getCredsReportDisplayForAccount[A, B](allCreds: Map[A, Either[FailedAttempt, B]]): List[(A, B)] = {
allCreds.toList.foldLeft[List[(A, B)]](Nil) {
case (acc, (_, Left(failure))) =>
failure.firstException match {
case Some(cause) =>
logger.error(s"unable to generate credential report display: ${failure.logMessage}", cause)
case None =>
logger.error(s"unable to generate credential report display: ${failure.logMessage}")
}
acc
case (acc, (account, Right(credReportDisplay))) =>
(account, credReportDisplay) :: acc
}
}