Exemplo n.º 1
0
// TasksRunningHandler
func TasksRunningHandler(ren *render.Render, conf *config.Config) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		db, err := database.NewDatabase(conf)
		if err != nil {
			log.Fatalln(err)
			return
		}
		ren.JSON(w, http.StatusOK, db.TasksRunning())
	}
}
Exemplo n.º 2
0
// TasksResultsByUUIDHandler
func TasksResultsByUUIDHandler(ren *render.Render, conf *config.Config) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		vars := mux.Vars(r)
		uuid := vars["task_uuid"]
		db, err := database.NewDatabase(conf)
		if err != nil {
			log.Fatalln(err)
			return
		}
		ren.JSON(w, http.StatusOK, db.TaskResultsByUUID(uuid))
	}
}
Exemplo n.º 3
0
// DeploymentsByNameHandler
func DeploymentsByNameHandler(ren *render.Render, conf *config.Config) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		db, err := database.NewDatabase(conf)
		if err != nil {
			log.Fatalln(err)
			return
		}
		var dp NewDeploymentParams
		decoder := json.NewDecoder(r.Body)
		err = decoder.Decode(&dp)
		if err != nil {
			log.Println(err)
			return
		}
		ren.JSON(w, http.StatusOK, db.DeploymentsByName(dp.Name))
	}
}