diff options
Diffstat (limited to 'binapi/ioam_vxlan_gpe/ioam_vxlan_gpe_rest.ba.go')
-rw-r--r-- | binapi/ioam_vxlan_gpe/ioam_vxlan_gpe_rest.ba.go | 152 |
1 files changed, 152 insertions, 0 deletions
diff --git a/binapi/ioam_vxlan_gpe/ioam_vxlan_gpe_rest.ba.go b/binapi/ioam_vxlan_gpe/ioam_vxlan_gpe_rest.ba.go new file mode 100644 index 0000000..bc34d36 --- /dev/null +++ b/binapi/ioam_vxlan_gpe/ioam_vxlan_gpe_rest.ba.go @@ -0,0 +1,152 @@ +// Code generated by GoVPP's binapi-generator. DO NOT EDIT. + +package ioam_vxlan_gpe + +import ( + "encoding/json" + "io/ioutil" + "net/http" +) + +func RESTHandler(rpc RPCService) http.Handler { + mux := http.NewServeMux() + mux.HandleFunc("/vxlan_gpe_ioam_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(VxlanGpeIoamDisable) + 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.VxlanGpeIoamDisable(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("/vxlan_gpe_ioam_enable", func(w http.ResponseWriter, req *http.Request) { + var request = new(VxlanGpeIoamEnable) + 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.VxlanGpeIoamEnable(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("/vxlan_gpe_ioam_transit_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(VxlanGpeIoamTransitDisable) + 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.VxlanGpeIoamTransitDisable(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("/vxlan_gpe_ioam_transit_enable", func(w http.ResponseWriter, req *http.Request) { + var request = new(VxlanGpeIoamTransitEnable) + 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.VxlanGpeIoamTransitEnable(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("/vxlan_gpe_ioam_vni_disable", func(w http.ResponseWriter, req *http.Request) { + var request = new(VxlanGpeIoamVniDisable) + 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.VxlanGpeIoamVniDisable(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("/vxlan_gpe_ioam_vni_enable", func(w http.ResponseWriter, req *http.Request) { + var request = new(VxlanGpeIoamVniEnable) + 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.VxlanGpeIoamVniEnable(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) +} |