feat: add rest routes to take the control of flink jobs
This commit is contained in:
55
internal/rest/router.go
Normal file
55
internal/rest/router.go
Normal file
@@ -0,0 +1,55 @@
|
||||
package rest
|
||||
|
||||
import (
|
||||
"flink-kube-operator/internal/rest/controller"
|
||||
"net/http"
|
||||
|
||||
"github.com/danielgtaylor/huma/v2"
|
||||
)
|
||||
|
||||
func initRouter(api huma.API) {
|
||||
huma.Register(api, huma.Operation{
|
||||
OperationID: "get-jobs",
|
||||
Method: http.MethodGet,
|
||||
Path: "/jobs",
|
||||
Summary: "Get Jobs",
|
||||
Description: "Get Flink Jobs",
|
||||
Tags: []string{"Job"},
|
||||
}, controller.GetJobs)
|
||||
|
||||
huma.Register(api, huma.Operation{
|
||||
OperationID: "stop-job",
|
||||
Method: http.MethodPost,
|
||||
Path: "/jobs/{uid}/stop",
|
||||
Summary: "Stop Job",
|
||||
Description: "Stop Flink Job",
|
||||
Tags: []string{"Job"},
|
||||
}, controller.StopJob)
|
||||
|
||||
huma.Register(api, huma.Operation{
|
||||
OperationID: "start-job",
|
||||
Method: http.MethodPost,
|
||||
Path: "/jobs/{uid}/start",
|
||||
Summary: "Start Job",
|
||||
Description: "Start Flink Job",
|
||||
Tags: []string{"Job"},
|
||||
}, controller.StartJob)
|
||||
|
||||
huma.Register(api, huma.Operation{
|
||||
OperationID: "remove-jar",
|
||||
Method: http.MethodPost,
|
||||
Path: "/jobs/{uid}/remove-jar",
|
||||
Summary: "Remove Job Jar",
|
||||
Description: "Remove Flink Job Jar",
|
||||
Tags: []string{"Job"},
|
||||
}, controller.RemoveJobJar)
|
||||
|
||||
huma.Register(api, huma.Operation{
|
||||
OperationID: "pause-job",
|
||||
Method: http.MethodPost,
|
||||
Path: "/jobs/{uid}/pause",
|
||||
Summary: "Pause Job",
|
||||
Description: "Pause Flink Job",
|
||||
Tags: []string{"Job"},
|
||||
}, controller.PauseJob)
|
||||
}
|
||||
Reference in New Issue
Block a user