66 lines
1.7 KiB
Go
66 lines
1.7 KiB
Go
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)
|
|
|
|
huma.Register(api, huma.Operation{
|
|
OperationID: "download-savepoint",
|
|
Method: http.MethodGet,
|
|
Path: "/savepoint/download",
|
|
Summary: "Download Savepoint",
|
|
Description: "Download Savepoint",
|
|
Tags: []string{"Savepoint"},
|
|
}, controller.DownloadSavepoint)
|
|
|
|
}
|