Skip to content
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ trait FireCloudApiService
with OauthApiService
with RegisterApiService
with WorkspaceApiService
with WorkspaceV2ApiService
with MethodConfigurationApiService
with SubmissionApiService
with StatusApiService
Expand Down Expand Up @@ -213,7 +212,6 @@ trait FireCloudApiService
userServiceRoutes ~
managedGroupServiceRoutes ~
workspaceRoutes ~
workspaceV2Routes ~
statusRoutes ~
pathPrefix("api") {
apiRoutes
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package org.broadinstitute.dsde.firecloud.webservice

import akka.http.scaladsl.model.HttpMethods
import akka.http.scaladsl.server.Route
import com.google.common.net.UrlEscapers
import org.broadinstitute.dsde.firecloud.FireCloudConfig.Rawls.entityQueryPathFromWorkspace
import org.broadinstitute.dsde.firecloud.model.ModelJsonProtocol._
import org.broadinstitute.dsde.firecloud.model._
import org.broadinstitute.dsde.firecloud.service.{FireCloudDirectives, FireCloudRequestBuilding}
Expand Down Expand Up @@ -45,75 +42,27 @@ trait EntityApiService
}
} ~
pathPrefix("entities") {
pathEnd {
requireUserInfo() { _ =>
passthrough(encodeUri(baseRawlsEntitiesUrl), HttpMethods.GET)
}
} ~
path("copy") {
post {
requireUserInfo() { userInfo =>
parameter(Symbol("linkExistingEntities").?) { linkExistingEntities =>
entity(as[EntityCopyWithoutDestinationDefinition]) { copyRequest =>
val linkExistingEntitiesBool =
Try(linkExistingEntities.getOrElse("false").toBoolean).getOrElse(false)
val copyMethodConfig = new EntityCopyDefinition(
sourceWorkspace = copyRequest.sourceWorkspace,
destinationWorkspace = WorkspaceName(workspaceNamespace, workspaceName),
entityType = copyRequest.entityType,
entityNames = copyRequest.entityNames
)
val extReq = Post(FireCloudConfig.Rawls.workspacesEntitiesCopyUrl(linkExistingEntitiesBool),
copyMethodConfig
)
path("copy") {
post {
requireUserInfo() { userInfo =>
parameter(Symbol("linkExistingEntities").?) { linkExistingEntities =>
entity(as[EntityCopyWithoutDestinationDefinition]) { copyRequest =>
val linkExistingEntitiesBool =
Try(linkExistingEntities.getOrElse("false").toBoolean).getOrElse(false)
val copyMethodConfig = new EntityCopyDefinition(
sourceWorkspace = copyRequest.sourceWorkspace,
destinationWorkspace = WorkspaceName(workspaceNamespace, workspaceName),
entityType = copyRequest.entityType,
entityNames = copyRequest.entityNames
)
val extReq = Post(FireCloudConfig.Rawls.workspacesEntitiesCopyUrl(linkExistingEntitiesBool),
copyMethodConfig
)

complete(userAuthedRequest(extReq)(userInfo))
}
complete(userAuthedRequest(extReq)(userInfo))
}
}
}
} ~
path("delete") {
post {
passthrough(encodeUri(baseRawlsEntitiesUrl + "/delete"), HttpMethods.POST)
}
} ~
pathPrefix(Segment) { entityType =>
streamingPassthrough(
FireCloudConfig.Rawls.entityPathFromWorkspace(escapePathSegment(workspaceNamespace),
escapePathSegment(workspaceName)
) + "/" + entityType
)
}
} ~
pathPrefix("entityQuery") {
streamingPassthrough(
entityQueryPathFromWorkspace(escapePathSegment(workspaceNamespace), escapePathSegment(workspaceName))
)
} ~
pathPrefix("entityTypes") {
extractRequest { req =>
pathPrefix(Segment) { _ => // entityType
// all passthroughs under entityTypes use the same path in Orch as they do in Rawls,
// so we can just grab the path from the request object
val passthroughTarget = encodeUri(FireCloudConfig.Rawls.baseUrl + req.uri.path.toString)
pathEnd {
patch {
passthrough(passthroughTarget, HttpMethods.PATCH)
} ~
delete {
passthrough(passthroughTarget, HttpMethods.DELETE)
}
} ~
pathPrefix("attributes") {
path(Segment) { _ => // attributeName
pathEnd {
patch {
passthrough(passthroughTarget, HttpMethods.PATCH)
}
}
}
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ trait PassthroughApiService extends Directives with StreamingPassthrough {
val passthroughRoutes: Route = concat(
pathPrefix("ga4gh")(streamingPassthrough(s"$agora/ga4gh")),
pathPrefix("api" / "billing")(streamingPassthrough(s"$rawls/api/billing")),
pathPrefix("api" / "notifications")(streamingPassthrough(s"$rawls/api/notifications"))
pathPrefix("api" / "notifications")(streamingPassthrough(s"$rawls/api/notifications")),
pathPrefix("api" / "workspaces")(streamingPassthrough(s"$rawls/api/workspaces"))
)

}
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
package org.broadinstitute.dsde.firecloud.webservice

import akka.http.scaladsl.server.Route
import org.broadinstitute.dsde.firecloud.FireCloudConfig.Rawls.{submissionQueueStatusUrl, workspacesUrl}
import org.broadinstitute.dsde.firecloud.FireCloudConfig.Rawls.submissionQueueStatusUrl
import org.broadinstitute.dsde.firecloud.service.FireCloudDirectives
import org.broadinstitute.dsde.firecloud.utils.StreamingPassthrough

trait SubmissionApiService extends FireCloudDirectives with StreamingPassthrough {
val submissionServiceRoutes: Route =
pathPrefix("submissions" / "queueStatus") {
streamingPassthrough(submissionQueueStatusUrl)
} ~
pathPrefix("workspaces" / Segment / Segment / "submissions") { (namespace, name) =>
// N.B. streamingPassthrough to ".../submissions" also handles ".../submissionsCount"
streamingPassthrough(s"$workspacesUrl/${escapePathSegment(namespace)}/${escapePathSegment(name)}/submissions")
}
}
}
Loading
Loading