Skip to content

Commit

Permalink
a few more
Browse files Browse the repository at this point in the history
  • Loading branch information
davidangb committed Dec 16, 2024
1 parent ebf434e commit 37a9ef6
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 99 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ trait CromIamApiService
with StreamingPassthrough {

lazy val workflowRoot: String = FireCloudConfig.CromIAM.authUrl + "/workflows/v1"
lazy val womtoolRoute: String = FireCloudConfig.CromIAM.authUrl + "/womtool/v1"
lazy val engineRoot: String = FireCloudConfig.CromIAM.baseUrl + "/engine/v1"
lazy val rawlsWorkflowRoot: String = FireCloudConfig.Rawls.authUrl + "/workflows"

Expand Down Expand Up @@ -46,18 +45,7 @@ trait CromIamApiService
streamingPassthrough(Uri.Path(localBase) -> Uri(workflowRoot))
}

val womToolRoute: Route =
pathPrefix("womtool" / Segment) { _ =>
path("describe") {
pathEnd {
post {
passthrough(s"$womtoolRoute/describe", HttpMethods.POST)
}
}
}
}

val cromIamApiServiceRoutes = rawlsServiceRoute ~ cromIamServiceRoutes ~ womToolRoute
val cromIamApiServiceRoutes = rawlsServiceRoute ~ cromIamServiceRoutes

val cromIamEngineRoutes: Route =
pathPrefix("engine" / Segment) { _ =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@ import org.broadinstitute.dsde.rawls.model.WorkspaceName
import org.slf4j.LoggerFactory

object MethodConfigurationApiService {
val remoteTemplatePath = FireCloudConfig.Rawls.authPrefix + "/methodconfigs/template"
val remoteTemplateURL = FireCloudConfig.Rawls.baseUrl + remoteTemplatePath

val remoteInputsOutputsPath = FireCloudConfig.Rawls.authPrefix + "/methodconfigs/inputsOutputs"
val remoteInputsOutputsURL = FireCloudConfig.Rawls.baseUrl + remoteInputsOutputsPath

val remoteCopyFromMethodRepoConfigPath = FireCloudConfig.Rawls.authPrefix + "/methodconfigs/copyFromMethodRepo"
val remoteCopyFromMethodRepoConfigUrl = FireCloudConfig.Rawls.baseUrl + remoteCopyFromMethodRepoConfigPath

Expand Down Expand Up @@ -99,94 +93,88 @@ trait MethodConfigurationApiService
lazy val log = LoggerFactory.getLogger(getClass)

val methodConfigurationRoutes: Route = requireUserInfo() { userInfo =>
path("template") {
passthrough(MethodConfigurationApiService.remoteTemplateURL, HttpMethods.POST)
} ~
path("inputsOutputs") {
passthrough(MethodConfigurationApiService.remoteInputsOutputsURL, HttpMethods.POST)
} ~
pathPrefix(ApiPrefix) {
pathPrefix(Segment / Segment / "method_configs") { (workspaceNamespace, workspaceName) =>
path("copyFromMethodRepo") {
post {
entity(as[CopyConfigurationIngest]) { ingest =>
val copyMethodConfig = new MethodConfigurationCopy(
methodRepoName = ingest.configurationName,
methodRepoNamespace = ingest.configurationNamespace,
methodRepoSnapshotId = ingest.configurationSnapshotId,
destination = Option(
MethodConfigurationId(
name = ingest.destinationName,
namespace = ingest.destinationNamespace,
workspaceName = Option(WorkspaceName(namespace = workspaceNamespace, name = workspaceName))
)
pathPrefix(ApiPrefix) {
pathPrefix(Segment / Segment / "method_configs") { (workspaceNamespace, workspaceName) =>
path("copyFromMethodRepo") {
post {
entity(as[CopyConfigurationIngest]) { ingest =>
val copyMethodConfig = new MethodConfigurationCopy(
methodRepoName = ingest.configurationName,
methodRepoNamespace = ingest.configurationNamespace,
methodRepoSnapshotId = ingest.configurationSnapshotId,
destination = Option(
MethodConfigurationId(
name = ingest.destinationName,
namespace = ingest.destinationNamespace,
workspaceName = Option(WorkspaceName(namespace = workspaceNamespace, name = workspaceName))
)
)
val extReq = Post(MethodConfigurationApiService.remoteCopyFromMethodRepoConfigUrl, copyMethodConfig)
)
val extReq = Post(MethodConfigurationApiService.remoteCopyFromMethodRepoConfigUrl, copyMethodConfig)

complete(userAuthedRequest(extReq)(userInfo))
}
complete(userAuthedRequest(extReq)(userInfo))
}
} ~ path("copyToMethodRepo") {
post {
entity(as[PublishConfigurationIngest]) { ingest =>
val copyMethodConfig = new MethodConfigurationPublish(
methodRepoName = ingest.configurationName,
methodRepoNamespace = ingest.configurationNamespace,
source = Option(
MethodConfigurationId(name = ingest.sourceName,
namespace = ingest.sourceNamespace,
workspaceName =
Option(WorkspaceName(namespace = workspaceNamespace, name = workspaceName))
)
}
} ~ path("copyToMethodRepo") {
post {
entity(as[PublishConfigurationIngest]) { ingest =>
val copyMethodConfig = new MethodConfigurationPublish(
methodRepoName = ingest.configurationName,
methodRepoNamespace = ingest.configurationNamespace,
source = Option(
MethodConfigurationId(name = ingest.sourceName,
namespace = ingest.sourceNamespace,
workspaceName =
Option(WorkspaceName(namespace = workspaceNamespace, name = workspaceName))
)
)
val extReq = Post(MethodConfigurationApiService.remoteCopyToMethodRepoConfigUrl, copyMethodConfig)
)
val extReq = Post(MethodConfigurationApiService.remoteCopyToMethodRepoConfigUrl, copyMethodConfig)

complete(userAuthedRequest(extReq)(userInfo))
}
complete(userAuthedRequest(extReq)(userInfo))
}
} ~ pathPrefix(Segment / Segment) { (configNamespace, configName) =>
pathEnd {
passthrough(
encodeUri(
MethodConfigurationApiService.remoteMethodConfigUrl(workspaceNamespace,
workspaceName,
configNamespace,
configName
)
),
HttpMethods.GET,
HttpMethods.PUT,
HttpMethods.POST,
HttpMethods.DELETE
}
} ~ pathPrefix(Segment / Segment) { (configNamespace, configName) =>
pathEnd {
passthrough(
encodeUri(
MethodConfigurationApiService.remoteMethodConfigUrl(workspaceNamespace,
workspaceName,
configNamespace,
configName
)
),
HttpMethods.GET,
HttpMethods.PUT,
HttpMethods.POST,
HttpMethods.DELETE
)
} ~
path("rename") {
passthrough(encodeUri(
MethodConfigurationApiService.remoteMethodConfigRenameUrl(workspaceNamespace,
workspaceName,
configNamespace,
configName
)
),
HttpMethods.POST
)
} ~
path("rename") {
passthrough(encodeUri(
MethodConfigurationApiService.remoteMethodConfigRenameUrl(workspaceNamespace,
path("validate") {
passthrough(encodeUri(
MethodConfigurationApiService.remoteMethodConfigValidateUrl(workspaceNamespace,
workspaceName,
configNamespace,
configName
)
),
HttpMethods.POST
)
} ~
path("validate") {
passthrough(encodeUri(
MethodConfigurationApiService.remoteMethodConfigValidateUrl(workspaceNamespace,
workspaceName,
configNamespace,
configName
)
),
HttpMethods.GET
)
}
}
)
),
HttpMethods.GET
)
}
}
}
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,28 @@ import org.broadinstitute.dsde.firecloud.utils.StreamingPassthrough
trait PassthroughApiService extends Directives with StreamingPassthrough {

private lazy val agora = FireCloudConfig.Agora.baseUrl
private lazy val cromiam = FireCloudConfig.CromIAM.baseUrl
private lazy val rawls = FireCloudConfig.Rawls.baseUrl
private lazy val sam = FireCloudConfig.Sam.baseUrl

val passthroughRoutes: Route = concat(
pathPrefix("api" / "billing")(streamingPassthrough(s"$rawls/api/billing")),
// Agora
pathPrefix("api" / "configurations")(streamingPassthrough(s"$agora/api/v1/configurations")),
pathPrefix("api" / "methods")(streamingPassthrough(s"$agora/api/v1/methods")),
pathPrefix("api" / "notifications")(streamingPassthrough(s"$rawls/api/notifications")),
pathPrefix("ga4gh")(streamingPassthrough(s"$agora/ga4gh")),
// CromIAM
pathPrefix("api" / "womtool")(streamingPassthrough(s"$cromiam/api/womtool")),
// Rawls
pathPrefix("api" / "inputsOutputs")(streamingPassthrough(s"$rawls/api/methodconfigs/inputsOutputs")),
pathPrefix("api" / "profile" / "billing")(streamingPassthrough(s"$rawls/api/user/billing")),
pathPrefix("api" / "template")(streamingPassthrough(s"$rawls/api/methodconfigs/template")),
// Sam
pathPrefix("api" / "proxyGroup")(streamingPassthrough(s"$sam/api/google/user/proxyGroup")),
pathPrefix("api" / "servicePerimeters")(streamingPassthrough(s"$rawls/api/servicePerimeters")),
pathPrefix("api" / "workspaces")(streamingPassthrough(s"$rawls/api/workspaces")),
pathPrefix("ga4gh")(streamingPassthrough(s"$agora/ga4gh")),
pathPrefix("register")(streamingPassthrough(s"$sam/register")),
// TODO: /tos is deprecated in Sam but not in Orch?
pathPrefix("tos")(streamingPassthrough(s"$sam/tos"))
pathPrefix("tos")(streamingPassthrough(s"$sam/tos")),

// any /api routes not otherwise defined will pass through to Rawls
pathPrefix("api")(streamingPassthrough(s"$rawls/api"))
)

}

0 comments on commit 37a9ef6

Please sign in to comment.