in mantis-control-plane/mantis-control-plane-server/src/main/java/io/mantisrx/master/api/akka/route/v1/ResourceClustersNonLeaderRedirectRoute.java [130:289]
protected Route constructRoutes() {
Route result = pathPrefix(
RESOURCECLUSTERS_API_PREFIX,
() -> concat(
// /
pathEndOrSingleSlash(() -> concat(
// GET
get(this::getRegisteredResourceClustersRoute),
// POST
post(this::provisionResourceClustersRoute)
)
),
// /list
pathPrefix(
"list",
() -> concat(
// GET
get(this::listClusters))
),
// /{}
path(
PathMatchers.segment(),
(clusterName) -> pathEndOrSingleSlash(() -> concat(
// GET
get(() -> getResourceClusterInstanceRoute(clusterName)),
// Delete
delete(() -> deleteResourceClusterInstanceRoute(clusterName))
))
),
// /{}/scaleSku
path(
PathMatchers.segment().slash("scaleSku"),
(clusterName) -> pathEndOrSingleSlash(() -> concat(
// POST
post(() -> scaleClusterSku(clusterName))
))
),
// /{}/disableTaskExecutors
path(
PathMatchers.segment().slash("disableTaskExecutors"),
(clusterName) -> pathEndOrSingleSlash(() -> concat(
post(() -> disableTaskExecutors(getClusterID(clusterName)))))
),
// /{}/setScalerStatus
path(
PathMatchers.segment().slash("setScalerStatus"),
(clusterName) -> pathEndOrSingleSlash(() -> concat(
post(() -> setScalerStatus(clusterName))))
),
// /{}/upgrade
path(
PathMatchers.segment().slash("upgrade"),
(clusterName) -> pathEndOrSingleSlash(() -> concat(
// POST
post(() -> upgradeCluster(clusterName))
))
),
// /{}/getResourceOverview
path(
PathMatchers.segment().slash("getResourceOverview"),
(clusterName) -> pathEndOrSingleSlash(
() -> concat(get(() -> getResourceOverview(getClusterID(clusterName)))))
),
// /{}/activeJobOverview?pageSize={}&startingIndex={}
path(
PathMatchers.segment().slash("activeJobOverview"),
(clusterName) -> pathEndOrSingleSlash(() -> concat(get(() ->
parameterOptional("startingIndex", startingIndex ->
parameterOptional("pageSize", pageSize ->
getActiveJobOverview(getClusterID(clusterName), startingIndex,
pageSize))))))
),
// /{}/getRegisteredTaskExecutors
path(
PathMatchers.segment().slash("getRegisteredTaskExecutors"),
(clusterName) -> pathEndOrSingleSlash(() -> concat(
get(() -> mkTaskExecutorsRoute(getClusterID(clusterName), (rc, req) -> rc.getRegisteredTaskExecutors(req.getAttributes())))))
),
// /{}/getBusyTaskExecutors
path(
PathMatchers.segment().slash("getBusyTaskExecutors"),
(clusterName) -> pathEndOrSingleSlash(() -> concat(
get(() -> mkTaskExecutorsRoute(getClusterID(clusterName), (rc, req) -> rc.getBusyTaskExecutors(req.getAttributes())))))
),
// /{}/getDisabledTaskExecutors
path(
PathMatchers.segment().slash("getDisabledTaskExecutors"),
(clusterName) -> pathEndOrSingleSlash(() -> concat(
get(() -> mkTaskExecutorsRoute(getClusterID(clusterName), (rc, req) -> rc.getDisabledTaskExecutors(req.getAttributes())))))
),
// /{}/getAvailableTaskExecutors
path(
PathMatchers.segment().slash("getAvailableTaskExecutors"),
(clusterName) -> pathEndOrSingleSlash(() -> concat(
get(() -> mkTaskExecutorsRoute(getClusterID(clusterName), (rc, req) -> rc.getAvailableTaskExecutors(req.getAttributes())))))
),
// /{}/getUnregisteredTaskExecutors
path(
PathMatchers.segment().slash("getUnregisteredTaskExecutors"),
(clusterName) -> pathEndOrSingleSlash(() -> concat(
get(() -> mkTaskExecutorsRoute(getClusterID(clusterName), (rc, req) -> rc.getUnregisteredTaskExecutors(req.getAttributes())))))
),
// /{}/scaleRule
path(
PathMatchers.segment().slash("scaleRule"),
(clusterName) -> pathEndOrSingleSlash(() -> concat(
// POST
post(() -> createSingleScaleRule(clusterName))
))
),
// /{}/scaleRules
path(
PathMatchers.segment().slash("scaleRules"),
(clusterName) -> pathEndOrSingleSlash(() -> concat(
// GET
get(() -> getScaleRules(clusterName)),
// POST
post(() -> createAllScaleRules(clusterName))
))
),
// /{}/cacheJobArtifacts
path(
PathMatchers.segment().slash("cacheJobArtifacts"),
(clusterName) -> pathEndOrSingleSlash(() -> concat(
// GET
get(() -> withFuture(gateway.getClusterFor(getClusterID(clusterName))
.getJobArtifactsToCache())),
// POST
post(() -> cacheJobArtifacts(clusterName)),
// DELETE
delete(() -> removeJobArtifactsToCache(clusterName))
))
),
// /api/v1/resourceClusters/{}/taskExecutors/{}/getTaskExecutorState
pathPrefix(
PathMatchers.segment().slash("taskExecutors"),
(clusterName) -> concat(
path(
PathMatchers.segment().slash("getTaskExecutorState"),
(taskExecutorId) ->
pathEndOrSingleSlash(() -> concat(
get(() -> getTaskExecutorState(getClusterID(clusterName),
getTaskExecutorID(taskExecutorId))))))
)
)
));
return result;
}