flamenco/pkg/api/openapi_server.gen.go
2022-01-11 18:07:34 +01:00

103 lines
3.4 KiB
Go

// Package api provides primitives to interact with the openapi HTTP API.
//
// Code generated by github.com/deepmap/oapi-codegen version v1.9.0 DO NOT EDIT.
package api
import (
"github.com/labstack/echo/v4"
)
// ServerInterface represents all server handlers.
type ServerInterface interface {
// Submit a new job for Flamenco Manager to execute.
// (POST /api/jobs)
SubmitJob(ctx echo.Context) error
// Get list of job types and their parameters.
// (GET /api/jobs/types)
GetJobTypes(ctx echo.Context) error
// Register a new worker
// (POST /api/worker/register-worker)
RegisterWorker(ctx echo.Context) error
// Obtain a new task to execute
// (POST /api/worker/task)
ScheduleTask(ctx echo.Context) error
}
// ServerInterfaceWrapper converts echo contexts to parameters.
type ServerInterfaceWrapper struct {
Handler ServerInterface
}
// SubmitJob converts echo context to params.
func (w *ServerInterfaceWrapper) SubmitJob(ctx echo.Context) error {
var err error
// Invoke the callback with all the unmarshalled arguments
err = w.Handler.SubmitJob(ctx)
return err
}
// GetJobTypes converts echo context to params.
func (w *ServerInterfaceWrapper) GetJobTypes(ctx echo.Context) error {
var err error
// Invoke the callback with all the unmarshalled arguments
err = w.Handler.GetJobTypes(ctx)
return err
}
// RegisterWorker converts echo context to params.
func (w *ServerInterfaceWrapper) RegisterWorker(ctx echo.Context) error {
var err error
// Invoke the callback with all the unmarshalled arguments
err = w.Handler.RegisterWorker(ctx)
return err
}
// ScheduleTask converts echo context to params.
func (w *ServerInterfaceWrapper) ScheduleTask(ctx echo.Context) error {
var err error
ctx.Set(Worker_authScopes, []string{""})
// Invoke the callback with all the unmarshalled arguments
err = w.Handler.ScheduleTask(ctx)
return err
}
// This is a simple interface which specifies echo.Route addition functions which
// are present on both echo.Echo and echo.Group, since we want to allow using
// either of them for path registration
type EchoRouter interface {
CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
TRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
}
// RegisterHandlers adds each server route to the EchoRouter.
func RegisterHandlers(router EchoRouter, si ServerInterface) {
RegisterHandlersWithBaseURL(router, si, "")
}
// Registers handlers, and prepends BaseURL to the paths, so that the paths
// can be served under a prefix.
func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string) {
wrapper := ServerInterfaceWrapper{
Handler: si,
}
router.POST(baseURL+"/api/jobs", wrapper.SubmitJob)
router.GET(baseURL+"/api/jobs/types", wrapper.GetJobTypes)
router.POST(baseURL+"/api/worker/register-worker", wrapper.RegisterWorker)
router.POST(baseURL+"/api/worker/task", wrapper.ScheduleTask)
}