"net"
"net/http"
"os/exec"
+ "scoringmgr"
"servicemgr"
"strconv"
+
+ "github.com/gorilla/mux"
)
// APIV1DeviceResourceUsageCPUGet function
}
}
+// APIV1ScoringmgrScoreLibnameGet function
+func APIV1ScoringmgrScoreLibnameGet(w http.ResponseWriter, r *http.Request) {
+ log.Printf("[%s] APIV1ScoringmgrScoreLibnameGet", logPrefix)
+
+ vars := mux.Vars(r)
+ libName := vars["libname"]
+
+ name := libName
+ target := scoringmgr.ConstLocalTarget
+
+ scoreValue, err := scoringmgr.GetScore(target, name)
+
+ respInfo := make(map[string]interface{})
+ respInfo["ScoreValue"] = scoreValue
+ respBytes, err := json.Marshal(respInfo)
+
+ if err != nil {
+ w.WriteHeader(http.StatusBadRequest)
+ } else {
+ writeJSONResponse(w, respBytes, http.StatusOK)
+ }
+}
+
func writeJSONResponse(w http.ResponseWriter, data []byte, status int) {
log.Printf("[%s] writeJSONResponse: %s", logPrefix, data)
w.Header().Set("Content-Type", "application/json; charset=UTF-8")
"/api/v1/servicemgr/services/notification/{serviceid}",
APIV1ServicemgrServicesNotificationServiceIDPost,
},
+
+ Route{
+ "APIV1ScoringmgrScoreLibnameGet",
+ strings.ToUpper("Get"),
+ "/api/v1/scoringmgr/score/{libname}",
+ APIV1ScoringmgrScoreLibnameGet,
+ },
}