diff pkg/controllers/fwa.go @ 5195:d6710d29516b new-fwa

Started to move code around.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 07 May 2020 15:46:51 +0200
parents 445daeefca7b
children 5bc8daa986d9
line wrap: on
line diff
--- a/pkg/controllers/fwa.go	Wed May 06 17:35:40 2020 +0200
+++ b/pkg/controllers/fwa.go	Thu May 07 15:46:51 2020 +0200
@@ -14,20 +14,39 @@
 package controllers
 
 import (
+	"log"
 	"net/http"
 
 	"github.com/gorilla/mux"
 )
 
-func fairwayAvailability(res http.ResponseWriter, req *http.Request) {
+func fairwayAvailability(rw http.ResponseWriter, req *http.Request) {
 
 	vars := mux.Vars(req)
 
 	switch vars["kind"] {
 	case "bottleneck":
+		fairwayAvailabilityBottleneck(rw, req)
 	case "stretch":
 	case "section":
+	default:
+		http.Error(rw, "Invalid kind type.", http.StatusBadRequest)
+		return
 	}
 
 	// TODO: Implement me!
 }
+
+func fairwayAvailabilityBottleneck(rw http.ResponseWriter, req *http.Request) {
+
+	vars := mux.Vars(req)
+
+	bottleneckID := vars["name"]
+	if bottleneckID == "" {
+		http.Error(rw, "missing bottleneck_id", http.StatusBadRequest)
+		return
+	}
+	log.Printf("info: fairway availability for bottleneck_id '%s'\n", bottleneckID)
+
+	// TODO: Implement me!
+}