aboutsummaryrefslogtreecommitdiffstats
path: root/binapi/l3xc/l3xc_rest.ba.go
diff options
context:
space:
mode:
Diffstat (limited to 'binapi/l3xc/l3xc_rest.ba.go')
-rw-r--r--binapi/l3xc/l3xc_rest.ba.go74
1 files changed, 74 insertions, 0 deletions
diff --git a/binapi/l3xc/l3xc_rest.ba.go b/binapi/l3xc/l3xc_rest.ba.go
new file mode 100644
index 0000000..2b2c9ba
--- /dev/null
+++ b/binapi/l3xc/l3xc_rest.ba.go
@@ -0,0 +1,74 @@
+// Code generated by GoVPP's binapi-generator. DO NOT EDIT.
+
+package l3xc
+
+import (
+ "encoding/json"
+ "io/ioutil"
+ "net/http"
+)
+
+func RESTHandler(rpc RPCService) http.Handler {
+ mux := http.NewServeMux()
+ mux.HandleFunc("/l3xc_del", func(w http.ResponseWriter, req *http.Request) {
+ var request = new(L3xcDel)
+ b, err := ioutil.ReadAll(req.Body)
+ if err != nil {
+ http.Error(w, "read body failed", http.StatusBadRequest)
+ return
+ }
+ if err := json.Unmarshal(b, request); err != nil {
+ http.Error(w, "unmarshal data failed", http.StatusBadRequest)
+ return
+ }
+ reply, err := rpc.L3xcDel(req.Context(), request)
+ if err != nil {
+ http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
+ return
+ }
+ rep, err := json.MarshalIndent(reply, "", " ")
+ if err != nil {
+ http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
+ return
+ }
+ w.Write(rep)
+ })
+ mux.HandleFunc("/l3xc_plugin_get_version", func(w http.ResponseWriter, req *http.Request) {
+ var request = new(L3xcPluginGetVersion)
+ reply, err := rpc.L3xcPluginGetVersion(req.Context(), request)
+ if err != nil {
+ http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
+ return
+ }
+ rep, err := json.MarshalIndent(reply, "", " ")
+ if err != nil {
+ http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
+ return
+ }
+ w.Write(rep)
+ })
+ mux.HandleFunc("/l3xc_update", func(w http.ResponseWriter, req *http.Request) {
+ var request = new(L3xcUpdate)
+ b, err := ioutil.ReadAll(req.Body)
+ if err != nil {
+ http.Error(w, "read body failed", http.StatusBadRequest)
+ return
+ }
+ if err := json.Unmarshal(b, request); err != nil {
+ http.Error(w, "unmarshal data failed", http.StatusBadRequest)
+ return
+ }
+ reply, err := rpc.L3xcUpdate(req.Context(), request)
+ if err != nil {
+ http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
+ return
+ }
+ rep, err := json.MarshalIndent(reply, "", " ")
+ if err != nil {
+ http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
+ return
+ }
+ w.Write(rep)
+ })
+ return http.HandlerFunc(mux.ServeHTTP)
+}