Loading go-apps/meep-vis/server/subscriptionCommon.go +1 −1 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ type SubscriptionCommon struct { Links *Links `json:"_links,omitempty"` // URI selected by the service consumer, to receive notifications on the subscribed RNIS information. This shall be included in the request and response. SubscriptionType string `json:"subscriptionType"` CallbackReference string `json:"callbackReference,omitempty"` CallbackReference string `json:"callbackReference"` WebsockNotifConfig *WebsockNotifConfig `json:"websockNotifConfig,omitempty"` FilterCriteria *V2xMsgSubscriptionFilterCriteria `json:"filterCriteria"` ExpiryDeadline *TimeStamp `json:"expiryDeadline,omitempty"` Loading go-apps/meep-vis/server/vis.go +23 −12 Original line number Diff line number Diff line Loading @@ -1301,22 +1301,23 @@ func individualSubscriptionPut(w http.ResponseWriter, r *http.Request) { return } if subscriptionCommon.CallbackReference == "" && subscriptionCommon.WebsockNotifConfig.WebsocketUri == "" { if subscriptionCommon.CallbackReference == "" { if 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 } if subscriptionCommon.FilterCriteria == nil { log.Error("Mandatory attribute FilterCriteria is missing for this subscription type") errHandlerProblemDetails(w, "Mandatory attribute FilterCriteria is missing for this subscription type", http.StatusBadRequest) log.Error("Mandatory attribute FilterCriteria parameter should be present") errHandlerProblemDetails(w, "Mandatory attribute FilterCriteria is missing in the request body.", http.StatusBadRequest) return } link := subscriptionCommon.Links if link == nil || link.Self == nil { log.Error("Mandatory Link parameter not present") errHandlerProblemDetails(w, "Mandatory Link parameter not present", http.StatusBadRequest) log.Error("Mandatory _links parameter should be present") errHandlerProblemDetails(w, "Mandatory attribute _links is missing in the request body.", http.StatusBadRequest) return } Loading @@ -1342,6 +1343,14 @@ func individualSubscriptionPut(w http.ResponseWriter, r *http.Request) { return } v2xMsgSubscription, _ := rc.JSONGetEntry(baseKey+"subscriptions:"+subIdParamStr, ".") if v2xMsgSubscription == "" { log.Error("subscription not found against the provided subscriptionId") errHandlerProblemDetails(w, "subscription not found against the provided subscriptionId", http.StatusNotFound) return } if subscription.FilterCriteria.StdOrganization == "" { log.Error("Mandatory StdOrganization parameter should be present") errHandlerProblemDetails(w, "Mandatory attribute StdOrganization is missing in the request body.", http.StatusBadRequest) Loading Loading @@ -1393,13 +1402,15 @@ func individualSubscriptionDelete(w http.ResponseWriter, r *http.Request) { vars := mux.Vars(r) subIdParamStr := vars["subscriptionId"] jsonRespDB, _ := rc.JSONGetEntry(baseKey+"subscriptions:"+subIdParamStr, ".") if jsonRespDB == "" { w.WriteHeader(http.StatusNotFound) _, err := rc.JSONGetEntry(baseKey+"subscriptions:"+subIdParamStr, ".") if err != nil { err = errors.New("mtsSessionInfo not found against the provided the sessionId") log.Error(err.Error()) errHandlerProblemDetails(w, err.Error(), http.StatusNotFound) return } err := delSubscription(baseKey+"subscriptions", subIdParamStr, false) err = delSubscription(baseKey+"subscriptions", subIdParamStr, false) if err != nil { errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return Loading Loading
go-apps/meep-vis/server/subscriptionCommon.go +1 −1 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ type SubscriptionCommon struct { Links *Links `json:"_links,omitempty"` // URI selected by the service consumer, to receive notifications on the subscribed RNIS information. This shall be included in the request and response. SubscriptionType string `json:"subscriptionType"` CallbackReference string `json:"callbackReference,omitempty"` CallbackReference string `json:"callbackReference"` WebsockNotifConfig *WebsockNotifConfig `json:"websockNotifConfig,omitempty"` FilterCriteria *V2xMsgSubscriptionFilterCriteria `json:"filterCriteria"` ExpiryDeadline *TimeStamp `json:"expiryDeadline,omitempty"` Loading
go-apps/meep-vis/server/vis.go +23 −12 Original line number Diff line number Diff line Loading @@ -1301,22 +1301,23 @@ func individualSubscriptionPut(w http.ResponseWriter, r *http.Request) { return } if subscriptionCommon.CallbackReference == "" && subscriptionCommon.WebsockNotifConfig.WebsocketUri == "" { if subscriptionCommon.CallbackReference == "" { if 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 } if subscriptionCommon.FilterCriteria == nil { log.Error("Mandatory attribute FilterCriteria is missing for this subscription type") errHandlerProblemDetails(w, "Mandatory attribute FilterCriteria is missing for this subscription type", http.StatusBadRequest) log.Error("Mandatory attribute FilterCriteria parameter should be present") errHandlerProblemDetails(w, "Mandatory attribute FilterCriteria is missing in the request body.", http.StatusBadRequest) return } link := subscriptionCommon.Links if link == nil || link.Self == nil { log.Error("Mandatory Link parameter not present") errHandlerProblemDetails(w, "Mandatory Link parameter not present", http.StatusBadRequest) log.Error("Mandatory _links parameter should be present") errHandlerProblemDetails(w, "Mandatory attribute _links is missing in the request body.", http.StatusBadRequest) return } Loading @@ -1342,6 +1343,14 @@ func individualSubscriptionPut(w http.ResponseWriter, r *http.Request) { return } v2xMsgSubscription, _ := rc.JSONGetEntry(baseKey+"subscriptions:"+subIdParamStr, ".") if v2xMsgSubscription == "" { log.Error("subscription not found against the provided subscriptionId") errHandlerProblemDetails(w, "subscription not found against the provided subscriptionId", http.StatusNotFound) return } if subscription.FilterCriteria.StdOrganization == "" { log.Error("Mandatory StdOrganization parameter should be present") errHandlerProblemDetails(w, "Mandatory attribute StdOrganization is missing in the request body.", http.StatusBadRequest) Loading Loading @@ -1393,13 +1402,15 @@ func individualSubscriptionDelete(w http.ResponseWriter, r *http.Request) { vars := mux.Vars(r) subIdParamStr := vars["subscriptionId"] jsonRespDB, _ := rc.JSONGetEntry(baseKey+"subscriptions:"+subIdParamStr, ".") if jsonRespDB == "" { w.WriteHeader(http.StatusNotFound) _, err := rc.JSONGetEntry(baseKey+"subscriptions:"+subIdParamStr, ".") if err != nil { err = errors.New("mtsSessionInfo not found against the provided the sessionId") log.Error(err.Error()) errHandlerProblemDetails(w, err.Error(), http.StatusNotFound) return } err := delSubscription(baseKey+"subscriptions", subIdParamStr, false) err = delSubscription(baseKey+"subscriptions", subIdParamStr, false) if err != nil { errHandlerProblemDetails(w, err.Error(), http.StatusInternalServerError) return Loading