in hq/app/aws/package.scala [30:53]
def get(account: AwsAccount): Attempt[AwsClient[A]] = {
val clientsForAccount = clients.filter { client =>
client.account == account
}
clientsForAccount match {
case singleClient :: Nil => Attempt.Right(singleClient)
case Nil =>
val errorString = s"No ${classTag.runtimeClass.getSimpleName} client exists for ${account.id}"
logger.warn(errorString)
Attempt.Left(FailedAttempt(Failure(
errorString,
s"Cannot find AWS client",
500
)))
case multipleClients =>
val errorString = s"More than one ${classTag.runtimeClass.getSimpleName} client exists for ${account.id} - perhaps you need to use get(account, region)??"
logger.warn(errorString)
Attempt.Left(FailedAttempt(Failure(
errorString,
s"Multiple AWS clients found when only one was expected",
500
)))
}
}