Documentation
¶
Overview ¶
@host http://localhost:8000 @BasePath /v1
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Api ¶
func Api(router *gin.Engine, cfg APIMuxConfig)
Api constructs a http.Handler with all application routes defined.
func JobsRoutesV1 ¶
func OpenApiRoute ¶
func OpenApiRoute(cfg OpenApiConfig, router *gin.Engine)
Types ¶
type APIMuxConfig ¶
type APIMuxConfig struct {
Log *otelzap.Logger
DB *sqlx.DB
OpenApi OpenApiConfig
}
APIMuxConfig contains all the mandatory systems required by handlers.
type ErrorResponse ¶
type ErrorResponse struct {
Error string `json:"error"`
}
type Jobs ¶
type Jobs struct {
// contains filtered or unexported fields
}
func NewJobsHandler ¶
func NewJobsHandler(service *jobService.Service) *Jobs
func (*Jobs) CreateJob ¶
func (j *Jobs) CreateJob() gin.HandlerFunc
CreateJob godoc @Summary Create a job @Description Create a job with the given job create request @Tags jobs @Accept json @Produce json @Param job body model.JobCreate true "Job Create" @Success 201 {object} model.Job @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /jobs [post]
func (*Jobs) DeleteJob ¶
func (j *Jobs) DeleteJob() gin.HandlerFunc
DeleteJob godoc @Summary Delete a job @Description Delete a job with the given job ID @Tags jobs @Accept json @Produce json @Param id path string true "Job ID" @Success 204 @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /jobs/{id} [delete]
func (*Jobs) GetJob ¶
func (j *Jobs) GetJob() gin.HandlerFunc
GetJob godoc @Summary Get a job @Description Get a job with the given job ID @Tags jobs @Accept json @Produce json @Param id path string true "Job ID" @Success 200 {object} model.Job @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /jobs/{id} [get]
func (*Jobs) GetJobExecutions ¶
func (j *Jobs) GetJobExecutions() gin.HandlerFunc
GetJobExecutions godoc @Summary Get job executions @Description Get job executions with the given job ID, failed only flag, limit and offset @Tags jobs @Accept json @Produce json @Param id path string true "Job ID" @Param failedOnly query bool false "Failed Only" @Param limit query int false "Limit" @Param offset query int false "Offset" @Success 200 {object} []model.JobExecution @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /jobs/{id}/executions [get]
func (*Jobs) ListJobs ¶
func (j *Jobs) ListJobs() gin.HandlerFunc
ListJobs godoc @Summary List jobs @Description List jobs with the given limit and offset @Tags jobs @Accept json @Produce json @Param limit query int false "Limit" @Param offset query int false "Offset" @Param tags query array false "Tags" @Success 200 {object} []model.Job @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /jobs [get]
func (*Jobs) UpdateJob ¶
func (j *Jobs) UpdateJob() gin.HandlerFunc
UpdateJob godoc @Summary Update a job @Description Update a job with the given job update request @Tags jobs @Accept json @Produce json @Param id path string true "Job ID" @Param job body model.JobUpdate true "Job Update" @Success 200 {object} model.Job @Failure 400 {object} ErrorResponse @Failure 500 {object} ErrorResponse @Router /jobs/{id} [put]