1 /* 2 * Make.org Core API 3 * Copyright (C) 2020 Make.org 4 * 5 * This program is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU Affero General Public License as 7 * published by the Free Software Foundation, either version 3 of the 8 * License, or (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Affero General Public License for more details. 14 * 15 * You should have received a copy of the GNU Affero General Public License 16 * along with this program. If not, see <https://www.gnu.org/licenses/>. 17 * 18 */ 19 20 package org.make.api.technical.healthcheck 21 22 import grizzled.slf4j.Logging 23 import org.make.api.technical.healthcheck.HealthCheck.Status 24 import org.make.swift.SwiftClient 25 26 import scala.concurrent.{ExecutionContext, Future} 27 28 class SwiftHealthCheck(swiftClient: SwiftClient) extends HealthCheck with Logging { 29 30 override val techno: String = "swift" 31 32 override def healthCheck()(implicit ctx: ExecutionContext): Future[Status] = { 33 swiftClient 34 .listBuckets() 35 .map { 36 case Nil => 37 Status.NOK(Some("Unexpected result in swift health check: containers list is empty")) 38 case _ => Status.OK 39 } 40 } 41 }
| Line | Stmt Id | Pos | Tree | Symbol | Tests | Code |
|---|---|---|---|---|---|---|
| 30 | 35093 | 1084 - 1091 | Literal | <nosymbol> | "swift" | |
| 35 | 48123 | 1178 - 1375 | ApplyToImplicitArgs | scala.concurrent.Future.map | SwiftHealthCheck.this.swiftClient.listBuckets().map[org.make.api.technical.healthcheck.HealthCheck.Status](((x0$1: Seq[org.make.swift.model.Bucket]) => x0$1 match { case scala.`package`.Nil => org.make.api.technical.healthcheck.HealthCheck.Status.NOK.apply(scala.Some.apply[String]("Unexpected result in swift health check: containers list is empty")) case _ => org.make.api.technical.healthcheck.HealthCheck.Status.OK }))(ctx) |