Loading go-apps/meep-vis/server/api_v2xi.go +1 −1 Original line number Diff line number Diff line Loading @@ -40,7 +40,7 @@ func SubPOST(w http.ResponseWriter, r *http.Request) { } func IndividualSubscriptionDELETE(w http.ResponseWriter, r *http.Request) { notImplemented(w, r) individualSubscriptionDelete(w, r) } func IndividualSubscriptionGET(w http.ResponseWriter, r *http.Request) { Loading go-apps/meep-vis/server/vis.go +34 −12 Original line number Diff line number Diff line Loading @@ -1301,18 +1301,6 @@ func individualSubscriptionPut(w http.ResponseWriter, r *http.Request) { return } if subscriptionCommon.FilterCriteria == nil { log.Error("FilterCriteria should not be null for this subscription type") errHandlerProblemDetails(w, "Mandatory attribute FilterCriteria is missing for this subscription type", http.StatusBadRequest) return } if subscriptionCommon.CallbackReference == "" && subscriptionCommon.WebsockNotifConfig.WebsocketUri == "" { log.Error("At least one of CallbackReference and WebsockNotifConfig parameters should be present") errHandlerProblemDetails(w, "At least one of CallbackReference and WebsockNotifConfig parameters should be present.", http.StatusBadRequest) return } link := subscriptionCommon.Links if link == nil || link.Self == nil { log.Error("Mandatory Link parameter not present") Loading Loading @@ -1348,6 +1336,18 @@ func individualSubscriptionPut(w http.ResponseWriter, r *http.Request) { return } if subscriptionCommon.FilterCriteria == nil { log.Error("FilterCriteria should not be null for this subscription type") errHandlerProblemDetails(w, "Mandatory attribute FilterCriteria is missing for this subscription type", http.StatusBadRequest) return } if subscriptionCommon.CallbackReference == "" && subscriptionCommon.WebsockNotifConfig.WebsocketUri == "" { log.Error("At least one of CallbackReference and WebsockNotifConfig parameters should be present") errHandlerProblemDetails(w, "At least one of CallbackReference and WebsockNotifConfig parameters should be present.", http.StatusBadRequest) return } for _, msgTypeString := range subscription.FilterCriteria.MsgType { msgTypeInt, err := strconv.Atoi(msgTypeString) if msgTypeInt < 1 || msgTypeInt > 13 { Loading Loading @@ -1385,3 +1385,25 @@ func individualSubscriptionPut(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusNotFound) } } func individualSubscriptionDelete(w http.ResponseWriter, r *http.Request) { log.Info("individualSubDel") w.Header().Set("Content-Type", "application/json; charset=UTF-8") vars := mux.Vars(r) subIdParamStr := vars["subscriptionId"] jsonRespDB, _ := rc.JSONGetEntry(baseKey+"subscriptions:"+subIdParamStr, ".") if jsonRespDB == "" { w.WriteHeader(http.StatusNotFound) return } err := delSubscription(baseKey+"subscriptions", subIdParamStr, false) if err != nil { errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } w.WriteHeader(http.StatusNoContent) } Loading
go-apps/meep-vis/server/api_v2xi.go +1 −1 Original line number Diff line number Diff line Loading @@ -40,7 +40,7 @@ func SubPOST(w http.ResponseWriter, r *http.Request) { } func IndividualSubscriptionDELETE(w http.ResponseWriter, r *http.Request) { notImplemented(w, r) individualSubscriptionDelete(w, r) } func IndividualSubscriptionGET(w http.ResponseWriter, r *http.Request) { Loading
go-apps/meep-vis/server/vis.go +34 −12 Original line number Diff line number Diff line Loading @@ -1301,18 +1301,6 @@ func individualSubscriptionPut(w http.ResponseWriter, r *http.Request) { return } if subscriptionCommon.FilterCriteria == nil { log.Error("FilterCriteria should not be null for this subscription type") errHandlerProblemDetails(w, "Mandatory attribute FilterCriteria is missing for this subscription type", http.StatusBadRequest) return } if subscriptionCommon.CallbackReference == "" && subscriptionCommon.WebsockNotifConfig.WebsocketUri == "" { log.Error("At least one of CallbackReference and WebsockNotifConfig parameters should be present") errHandlerProblemDetails(w, "At least one of CallbackReference and WebsockNotifConfig parameters should be present.", http.StatusBadRequest) return } link := subscriptionCommon.Links if link == nil || link.Self == nil { log.Error("Mandatory Link parameter not present") Loading Loading @@ -1348,6 +1336,18 @@ func individualSubscriptionPut(w http.ResponseWriter, r *http.Request) { return } if subscriptionCommon.FilterCriteria == nil { log.Error("FilterCriteria should not be null for this subscription type") errHandlerProblemDetails(w, "Mandatory attribute FilterCriteria is missing for this subscription type", http.StatusBadRequest) return } if subscriptionCommon.CallbackReference == "" && subscriptionCommon.WebsockNotifConfig.WebsocketUri == "" { log.Error("At least one of CallbackReference and WebsockNotifConfig parameters should be present") errHandlerProblemDetails(w, "At least one of CallbackReference and WebsockNotifConfig parameters should be present.", http.StatusBadRequest) return } for _, msgTypeString := range subscription.FilterCriteria.MsgType { msgTypeInt, err := strconv.Atoi(msgTypeString) if msgTypeInt < 1 || msgTypeInt > 13 { Loading Loading @@ -1385,3 +1385,25 @@ func individualSubscriptionPut(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusNotFound) } } func individualSubscriptionDelete(w http.ResponseWriter, r *http.Request) { log.Info("individualSubDel") w.Header().Set("Content-Type", "application/json; charset=UTF-8") vars := mux.Vars(r) subIdParamStr := vars["subscriptionId"] jsonRespDB, _ := rc.JSONGetEntry(baseKey+"subscriptions:"+subIdParamStr, ".") if jsonRespDB == "" { w.WriteHeader(http.StatusNotFound) return } err := delSubscription(baseKey+"subscriptions", subIdParamStr, false) if err != nil { errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return } w.WriteHeader(http.StatusNoContent) }