public Route constructRoutes()

in mantis-control-plane/mantis-control-plane-server/src/main/java/io/mantisrx/master/api/akka/route/v1/JobClustersRoute.java [104:236]


    public Route constructRoutes() {
        return pathPrefix(
                JOBCLUSTERS_API_PREFIX,
                () -> concat(
                        // api/v1/jobClusters
                        pathEndOrSingleSlash(() -> concat(

                                // GET
                                get(this::getJobClustersRoute),

                                // POST
                                post(this::postJobClustersRoute))
                        ),

                        // api/v1/jobClusters/{}
                        path(
                                PathMatchers.segment(),
                                (clusterName) -> pathEndOrSingleSlash(() -> concat(

                                        // GET
                                        get(() -> getJobClusterInstanceRoute(clusterName)),

                                        // PUT
                                        put(() -> putJobClusterInstanceRoute(clusterName)),

                                        // DELETE
                                        delete(() -> deleteJobClusterInstanceRoute(clusterName)))
                                )
                        ),

                        // api/v1/jobClusters/{}/latestJobDiscoveryInfo
                        path(
                            PathMatchers.segment().slash("latestJobDiscoveryInfo"),
                            (clusterName) -> pathEndOrSingleSlash(() -> concat(

                                // GET
                                get(() -> getLatestJobDiscoveryInfo(clusterName))
                            ))
                         ),
                        // api/v1/jobClusters/{}/actions/updateArtifact
                        path(
                                PathMatchers.segment().slash("actions").slash("updateArtifact"),
                                (clusterName) -> pathEndOrSingleSlash(() -> concat(

                                        // POST
                                        post(() -> updateClusterArtifactRoute(clusterName))
                                ))
                        ),
                        // api/v1/jobClusters/{}/actions/updateSchedulingInfo
                        path(
                            PathMatchers.segment().slash("actions").slash("updateSchedulingInfo"),
                            (clusterName) -> pathEndOrSingleSlash(() -> concat(

                                // POST
                                post(() -> updateClusterSchedulingInfo(clusterName))
                            ))
                        ),

                        // api/v1/jobClusters/{}/actions/updateSla
                        pathPrefix(
                                PathMatchers.segment().slash("actions").slash("updateSla"),
                                (clusterName) -> pathEndOrSingleSlash(() -> concat(

                                        // POST
                                        post(() -> updateClusterSlaRoute(clusterName))
                                ))
                        ),

                        // api/v1/jobClusters/{}/actions/updateMigrationStrategy
                        pathPrefix(
                                PathMatchers.segment()
                                            .slash("actions")
                                            .slash("updateMigrationStrategy"),
                                (clusterName) -> pathEndOrSingleSlash(() -> concat(

                                        // POST
                                        post(() -> updateMigrationStrategyRoute(clusterName))
                                ))
                        ),

                        // api/v1/jobClusters/{}/actions/updateLabel
                        pathPrefix(
                                PathMatchers.segment().slash("actions").slash("updateLabel"),
                                (clusterName) -> pathEndOrSingleSlash(() -> concat(

                                        // POST
                                        post(() -> updateJobClusterLabelRoute(clusterName))
                                ))
                        ),

                        // api/v1/jobClusters/{}/actions/enableCluster
                        pathPrefix(
                                PathMatchers.segment().slash("actions").slash("enableCluster"),
                                (clusterName) -> pathEndOrSingleSlash(() -> concat(

                                        // POST
                                        post(() -> updateJobClusterStateEnableRoute(clusterName))
                                ))
                        ),

                        // api/v1/jobClusters/{}/actions/disableCluster
                        pathPrefix(
                                PathMatchers.segment().slash("actions").slash("disableCluster"),
                                (clusterName) -> pathEndOrSingleSlash(() -> concat(

                                        // POST
                                        post(() -> updateJobClusterStateDisableRoute(clusterName))
                                ))
                        ),

                    // api/v1/jobClusters/{}/scalerRules
                    path(
                        PathMatchers.segment().slash("scalerRules"),
                        (clusterName) -> concat(
                            // POST
                            post(() -> createScalerRuleRoute(clusterName)),

                            // GET
                            get(() -> getScalerRulesRoute(clusterName))
                        )
                    ),

                    // api/v1/jobClusters/{}/scalerRules/{}
                    path(
                        PathMatchers.segment().slash("scalerRules").slash(PathMatchers.segment()),
                        (clusterName, ruleId) -> pathEndOrSingleSlash(() -> concat(
                            // DELETE
                            delete(() -> deleteScalerRuleRoute(clusterName, ruleId))
                        ))
                    )
                )
        );
    }