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("/gpe_add_del_fwd_entry", func(w http.ResponseWriter, req *http.Request) {
14 var request = new(GpeAddDelFwdEntry)
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.GpeAddDelFwdEntry(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("/gpe_add_del_iface", func(w http.ResponseWriter, req *http.Request) {
37 var request = new(GpeAddDelIface)
38 b, err := ioutil.ReadAll(req.Body)
40 http.Error(w, "read body failed", http.StatusBadRequest)
43 if err := json.Unmarshal(b, request); err != nil {
44 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
47 reply, err := rpc.GpeAddDelIface(req.Context(), request)
49 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
52 rep, err := json.MarshalIndent(reply, "", " ")
54 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
59 mux.HandleFunc("/gpe_add_del_native_fwd_rpath", func(w http.ResponseWriter, req *http.Request) {
60 var request = new(GpeAddDelNativeFwdRpath)
61 b, err := ioutil.ReadAll(req.Body)
63 http.Error(w, "read body failed", http.StatusBadRequest)
66 if err := json.Unmarshal(b, request); err != nil {
67 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
70 reply, err := rpc.GpeAddDelNativeFwdRpath(req.Context(), request)
72 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
75 rep, err := json.MarshalIndent(reply, "", " ")
77 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
82 mux.HandleFunc("/gpe_enable_disable", func(w http.ResponseWriter, req *http.Request) {
83 var request = new(GpeEnableDisable)
84 b, err := ioutil.ReadAll(req.Body)
86 http.Error(w, "read body failed", http.StatusBadRequest)
89 if err := json.Unmarshal(b, request); err != nil {
90 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
93 reply, err := rpc.GpeEnableDisable(req.Context(), request)
95 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
98 rep, err := json.MarshalIndent(reply, "", " ")
100 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
105 mux.HandleFunc("/gpe_fwd_entries_get", func(w http.ResponseWriter, req *http.Request) {
106 var request = new(GpeFwdEntriesGet)
107 b, err := ioutil.ReadAll(req.Body)
109 http.Error(w, "read body failed", http.StatusBadRequest)
112 if err := json.Unmarshal(b, request); err != nil {
113 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
116 reply, err := rpc.GpeFwdEntriesGet(req.Context(), request)
118 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
121 rep, err := json.MarshalIndent(reply, "", " ")
123 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
128 mux.HandleFunc("/gpe_fwd_entry_vnis_get", func(w http.ResponseWriter, req *http.Request) {
129 var request = new(GpeFwdEntryVnisGet)
130 reply, err := rpc.GpeFwdEntryVnisGet(req.Context(), request)
132 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
135 rep, err := json.MarshalIndent(reply, "", " ")
137 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
142 mux.HandleFunc("/gpe_get_encap_mode", func(w http.ResponseWriter, req *http.Request) {
143 var request = new(GpeGetEncapMode)
144 reply, err := rpc.GpeGetEncapMode(req.Context(), request)
146 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
149 rep, err := json.MarshalIndent(reply, "", " ")
151 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
156 mux.HandleFunc("/gpe_native_fwd_rpaths_get", func(w http.ResponseWriter, req *http.Request) {
157 var request = new(GpeNativeFwdRpathsGet)
158 b, err := ioutil.ReadAll(req.Body)
160 http.Error(w, "read body failed", http.StatusBadRequest)
163 if err := json.Unmarshal(b, request); err != nil {
164 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
167 reply, err := rpc.GpeNativeFwdRpathsGet(req.Context(), request)
169 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
172 rep, err := json.MarshalIndent(reply, "", " ")
174 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
179 mux.HandleFunc("/gpe_set_encap_mode", func(w http.ResponseWriter, req *http.Request) {
180 var request = new(GpeSetEncapMode)
181 b, err := ioutil.ReadAll(req.Body)
183 http.Error(w, "read body failed", http.StatusBadRequest)
186 if err := json.Unmarshal(b, request); err != nil {
187 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
190 reply, err := rpc.GpeSetEncapMode(req.Context(), request)
192 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
195 rep, err := json.MarshalIndent(reply, "", " ")
197 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
202 return http.HandlerFunc(mux.ServeHTTP)