Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AJ-1496: remove /api/duos/consent/orsp/{orspId} API #1249

Merged
merged 9 commits into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion local-dev/templates/firecloud-orchestration.conf.ctmpl
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ elasticsearch {
}

duos {
baseConsentUrl = "https://consent.dsde-dev.broadinstitute.org"
baseOntologyUrl = "https://consent-ontology.dsde-dev.broadinstitute.org"
dulvn = 4
}
Expand Down
36 changes: 0 additions & 36 deletions src/main/resources/swagger/api-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5540,42 +5540,6 @@ paths:
content: {}
x-passthrough: false
x-codegen-request-body-name: body
/api/duos/consent/orsp/{orspId}:
get:
tags:
- Library
summary: Find Consent by ORSP ID
operationId: duosConsentOrspId
parameters:
- name: orspId
in: path
description: Finds the consent for the provided ORSP ID.
required: true
schema:
type: string
responses:
200:
description: Consent
content:
application/json:
schema:
$ref: '#/components/schemas/Consent'
400:
description: The consent associated with the provided name has not been
approved.
content: {}
401:
description: Invalid authorization, must be a Terra user.
content: {}
404:
description: The consent associated with the provided name could not be
found.
content: {}
500:
description: Internal Server Error
content: {}
x-passthrough: true
x-passthrough-target: consent
/error:
get:
tags:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import org.broadinstitute.dsde.firecloud.dataaccess._
case class Application(agoraDAO: AgoraDAO,
googleServicesDAO: GoogleServicesDAO,
ontologyDAO: OntologyDAO,
consentDAO: ConsentDAO,
rawlsDAO: RawlsDAO,
samDAO: SamDAO,
searchDAO: SearchDAO,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,13 @@ object Boot extends App with LazyLogging {
val thurloeDAO:ThurloeDAO = new HttpThurloeDAO
val googleServicesDAO:GoogleServicesDAO = new HttpGoogleServicesDAO(FireCloudConfig.GoogleCloud.priceListUrl, GooglePriceList(GooglePrices(FireCloudConfig.GoogleCloud.defaultStoragePriceList, UsTieredPriceItem(FireCloudConfig.GoogleCloud.defaultEgressPriceList)), "v1", "1"))
val ontologyDAO:OntologyDAO = new ElasticSearchOntologyDAO(elasticSearchClient, FireCloudConfig.ElasticSearch.ontologyIndexName)
val consentDAO:ConsentDAO = new HttpConsentDAO
val researchPurposeSupport:ResearchPurposeSupport = new ESResearchPurposeSupport(ontologyDAO)
val searchDAO:SearchDAO = new ElasticSearchDAO(elasticSearchClient, FireCloudConfig.ElasticSearch.indexName, researchPurposeSupport)
val shareLogDAO:ShareLogDAO = new ElasticSearchShareLogDAO(elasticSearchClient, FireCloudConfig.ElasticSearch.shareLogIndexName)
val importServiceDAO:ImportServiceDAO = new HttpImportServiceDAO
val shibbolethDAO:ShibbolethDAO = new HttpShibbolethDAO

val app:Application = Application(agoraDAO, googleServicesDAO, ontologyDAO, consentDAO, rawlsDAO, samDAO, searchDAO, researchPurposeSupport, thurloeDAO, shareLogDAO, importServiceDAO, shibbolethDAO);
val app:Application = Application(agoraDAO, googleServicesDAO, ontologyDAO, rawlsDAO, samDAO, searchDAO, researchPurposeSupport, thurloeDAO, shareLogDAO, importServiceDAO, shibbolethDAO);

val agoraPermissionServiceConstructor: (UserInfo) => AgoraPermissionService = AgoraPermissionService.constructor(app)
val exportEntitiesByTypeActorConstructor: (ExportEntitiesByTypeArguments) => ExportEntitiesByTypeActor = ExportEntitiesByTypeActor.constructor(app, system)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ object FireCloudConfig {

object Duos {
private val duos = config.getConfig("duos")
val baseConsentUrl = duos.getString("baseConsentUrl")
val baseOntologyUrl = duos.getString("baseOntologyUrl")
val dulvn = duos.getInt("dulvn")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class HealthChecks(app: Application, registerSAs: Boolean = true)
def healthMonitorChecks: () => Map[Subsystem, Future[SubsystemStatus]] = () => {
Map(
Agora -> app.agoraDAO.status,
Consent -> app.consentDAO.status,
GoogleBuckets -> app.googleServicesDAO.status,
LibraryIndex -> app.searchDAO.status,
OntologyIndex -> app.ontologyDAO.status,
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
package org.broadinstitute.dsde.firecloud.dataaccess

import akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport
import akka.http.scaladsl.model.HttpResponse
import akka.http.scaladsl.unmarshalling.Unmarshal
import akka.http.scaladsl.unmarshalling._
import akka.stream.Materializer
import org.broadinstitute.dsde.firecloud.model.DUOS.ConsentStatus
import org.broadinstitute.dsde.firecloud.model.DropwizardHealth
import org.broadinstitute.dsde.firecloud.model.ModelJsonProtocol.{impDuosConsentStatus, impDropwizardHealth}
import org.broadinstitute.dsde.workbench.util.health.SubsystemStatus
import spray.json.DefaultJsonProtocol._
import spray.json._

import scala.concurrent.{ExecutionContext, Future}
import scala.concurrent.Future

/**
* Created by anichols on 4/21/17.
Expand All @@ -22,32 +13,4 @@ trait ReportsSubsystemStatus extends SprayJsonSupport {
def status: Future[SubsystemStatus]

def serviceName: String

def getStatusFromDropwizardChecks(response: Future[HttpResponse])(implicit ec: ExecutionContext, materializer: Materializer): Future[SubsystemStatus] = {
response flatMap { resp =>
Unmarshal(resp).to[ConsentStatus].map { status =>
val ok = status.ok.get
val errors = status.systems.get.
filter(dw => !dw._2.healthy).
map(dw => s"Error in ${dw._1}: ${dw._2.message.getOrElse("unspecified error")}").toList
if (ok)
SubsystemStatus(ok, None)
else
SubsystemStatus(ok, Some(errors))
}.recoverWith {
case _: Throwable =>
Unmarshal(resp).to[Map[String, DropwizardHealth]].map { dwStatus =>
val ok = dwStatus.values.forall(_.healthy)
val errors = dwStatus.
filter(dw => !dw._2.healthy).
map(dw => s"Error in ${dw._1}: ${dw._2.message.getOrElse("unspecified error")}").toList
if (ok)
SubsystemStatus(ok, None)
else
SubsystemStatus(ok, Some(errors))
}
}
}
}

}
119 changes: 0 additions & 119 deletions src/main/scala/org/broadinstitute/dsde/firecloud/model/DUOS.scala

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import akka.http.scaladsl.model.StatusCode
import akka.http.scaladsl.model.StatusCodes._
import akka.http.scaladsl.server.Directives._
import akka.http.scaladsl.server.{MalformedRequestContentRejection, RejectionHandler}
import org.broadinstitute.dsde.firecloud.model.DUOS._
import org.broadinstitute.dsde.firecloud.model.DataUse._
import org.broadinstitute.dsde.firecloud.model.ManagedGroupRoles.ManagedGroupRole
import org.broadinstitute.dsde.firecloud.model.OrchMethodRepository._
Expand All @@ -20,7 +19,7 @@ import org.broadinstitute.dsde.rawls.model._
import org.broadinstitute.dsde.workbench.model.ValueObjectFormat
import org.broadinstitute.dsde.workbench.model.WorkbenchIdentityJsonSupport._
import org.broadinstitute.dsde.workbench.model.google.GoogleModelJsonSupport.InstantFormat
import spray.json.{JsString, _}
import spray.json._

import scala.util.{Failure, Success, Try}

Expand Down Expand Up @@ -279,38 +278,11 @@ object ModelJsonProtocol extends WorkspaceJsonSupport with SprayJsonSupport {
implicit val impStructuredDataRequest: RootJsonFormat[StructuredDataRequest] = jsonFormat12(StructuredDataRequest)
implicit val impStructuredDataResponse: RootJsonFormat[StructuredDataResponse] = jsonFormat4(StructuredDataResponse)

implicit object impDuosDataUse extends RootJsonFormat[DuosDataUse] {
override def write(ddu: DuosDataUse): JsValue = {
val existingProps: Seq[(String, JsValue)] = Try(ddu.getClass.getDeclaredFields.map { f =>
f.setAccessible(true)
f.get(ddu) match {
case Some(x: Boolean) => f.getName -> x.toJson
case Some(y: String) => f.getName -> y.toJson
case Some((h: String) :: tail) => f.getName -> (h +: tail.collect { case z: String => z }).toJson
case _ => f.getName -> JsNull
}
}) match {
case Success(props) => props.toIndexedSeq.filterNot(_._2 == JsNull)
case Failure(ex) => serializationError(ex.getMessage)
}
JsObject(existingProps.toMap)
}
override def read(json: JsValue): DuosDataUse = {
Try(DuosDataUse.apply(json.asJsObject.fields)) match {
case Success(ddu) => ddu
case Failure(ex) => deserializationError(s"Could not read DuosDataUse value: $json", ex)
}
}
}
implicit val impDuosConsent: RootJsonFormat[Consent] = jsonFormat11(Consent)
implicit val impDuosConsentError: RootJsonFormat[ConsentError] = jsonFormat2(ConsentError)
implicit val impOntologyTermParent: RootJsonFormat[TermParent] = jsonFormat5(TermParent)
implicit val impOntologyTermResource: RootJsonFormat[TermResource] = jsonFormat7(TermResource)
implicit val impOntologyESTermParent: RootJsonFormat[ESTermParent] = jsonFormat2(ESTermParent)

implicit val impThurloeStatus: RootJsonFormat[ThurloeStatus] = jsonFormat2(ThurloeStatus)
implicit val impDropwizardHealth: RootJsonFormat[DropwizardHealth] = jsonFormat2(DropwizardHealth)
implicit val impDuosConsentStatus: RootJsonFormat[ConsentStatus] = jsonFormat3(ConsentStatus)

// don't make this implicit! It would be pulled in by anything including ModelJsonProtocol._
val entityExtractionRejectionHandler = RejectionHandler.newBuilder().handle {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ package org.broadinstitute.dsde.firecloud.model
* Created by anichols on 4/7/17.
*/
case class ThurloeStatus(status: String, error: Option[String])
case class DropwizardHealth(healthy: Boolean, message: Option[String])
Loading
Loading