1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
11 func RESTHandler(rpc RPCService) http.Handler {
12 mux := http.NewServeMux()
13 mux.HandleFunc("/svs_enable_disable", func(w http.ResponseWriter, req *http.Request) {
14 var request = new(SvsEnableDisable)
15 b, err := ioutil.ReadAll(req.Body)
17 http.Error(w, "read body failed", http.StatusBadRequest)
20 if err := json.Unmarshal(b, request); err != nil {
21 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
24 reply, err := rpc.SvsEnableDisable(req.Context(), request)
26 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
29 rep, err := json.MarshalIndent(reply, "", " ")
31 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
36 mux.HandleFunc("/svs_plugin_get_version", func(w http.ResponseWriter, req *http.Request) {
37 var request = new(SvsPluginGetVersion)
38 reply, err := rpc.SvsPluginGetVersion(req.Context(), request)
40 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
43 rep, err := json.MarshalIndent(reply, "", " ")
45 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
50 mux.HandleFunc("/svs_route_add_del", func(w http.ResponseWriter, req *http.Request) {
51 var request = new(SvsRouteAddDel)
52 b, err := ioutil.ReadAll(req.Body)
54 http.Error(w, "read body failed", http.StatusBadRequest)
57 if err := json.Unmarshal(b, request); err != nil {
58 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
61 reply, err := rpc.SvsRouteAddDel(req.Context(), request)
63 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
66 rep, err := json.MarshalIndent(reply, "", " ")
68 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
73 mux.HandleFunc("/svs_table_add_del", func(w http.ResponseWriter, req *http.Request) {
74 var request = new(SvsTableAddDel)
75 b, err := ioutil.ReadAll(req.Body)
77 http.Error(w, "read body failed", http.StatusBadRequest)
80 if err := json.Unmarshal(b, request); err != nil {
81 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
84 reply, err := rpc.SvsTableAddDel(req.Context(), request)
86 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
89 rep, err := json.MarshalIndent(reply, "", " ")
91 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
96 return http.HandlerFunc(mux.ServeHTTP)