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("/acl_add_replace", func(w http.ResponseWriter, req *http.Request) {
14 var request = new(ACLAddReplace)
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.ACLAddReplace(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("/acl_del", func(w http.ResponseWriter, req *http.Request) {
37 var request = new(ACLDel)
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.ACLDel(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("/acl_interface_add_del", func(w http.ResponseWriter, req *http.Request) {
60 var request = new(ACLInterfaceAddDel)
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.ACLInterfaceAddDel(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("/acl_interface_set_acl_list", func(w http.ResponseWriter, req *http.Request) {
83 var request = new(ACLInterfaceSetACLList)
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.ACLInterfaceSetACLList(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("/acl_interface_set_etype_whitelist", func(w http.ResponseWriter, req *http.Request) {
106 var request = new(ACLInterfaceSetEtypeWhitelist)
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.ACLInterfaceSetEtypeWhitelist(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("/acl_plugin_control_ping", func(w http.ResponseWriter, req *http.Request) {
129 var request = new(ACLPluginControlPing)
130 reply, err := rpc.ACLPluginControlPing(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("/acl_plugin_get_conn_table_max_entries", func(w http.ResponseWriter, req *http.Request) {
143 var request = new(ACLPluginGetConnTableMaxEntries)
144 reply, err := rpc.ACLPluginGetConnTableMaxEntries(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("/acl_plugin_get_version", func(w http.ResponseWriter, req *http.Request) {
157 var request = new(ACLPluginGetVersion)
158 reply, err := rpc.ACLPluginGetVersion(req.Context(), request)
160 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
163 rep, err := json.MarshalIndent(reply, "", " ")
165 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
170 mux.HandleFunc("/acl_stats_intf_counters_enable", func(w http.ResponseWriter, req *http.Request) {
171 var request = new(ACLStatsIntfCountersEnable)
172 b, err := ioutil.ReadAll(req.Body)
174 http.Error(w, "read body failed", http.StatusBadRequest)
177 if err := json.Unmarshal(b, request); err != nil {
178 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
181 reply, err := rpc.ACLStatsIntfCountersEnable(req.Context(), request)
183 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
186 rep, err := json.MarshalIndent(reply, "", " ")
188 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
193 mux.HandleFunc("/macip_acl_add", func(w http.ResponseWriter, req *http.Request) {
194 var request = new(MacipACLAdd)
195 b, err := ioutil.ReadAll(req.Body)
197 http.Error(w, "read body failed", http.StatusBadRequest)
200 if err := json.Unmarshal(b, request); err != nil {
201 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
204 reply, err := rpc.MacipACLAdd(req.Context(), request)
206 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
209 rep, err := json.MarshalIndent(reply, "", " ")
211 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
216 mux.HandleFunc("/macip_acl_add_replace", func(w http.ResponseWriter, req *http.Request) {
217 var request = new(MacipACLAddReplace)
218 b, err := ioutil.ReadAll(req.Body)
220 http.Error(w, "read body failed", http.StatusBadRequest)
223 if err := json.Unmarshal(b, request); err != nil {
224 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
227 reply, err := rpc.MacipACLAddReplace(req.Context(), request)
229 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
232 rep, err := json.MarshalIndent(reply, "", " ")
234 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
239 mux.HandleFunc("/macip_acl_del", func(w http.ResponseWriter, req *http.Request) {
240 var request = new(MacipACLDel)
241 b, err := ioutil.ReadAll(req.Body)
243 http.Error(w, "read body failed", http.StatusBadRequest)
246 if err := json.Unmarshal(b, request); err != nil {
247 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
250 reply, err := rpc.MacipACLDel(req.Context(), request)
252 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
255 rep, err := json.MarshalIndent(reply, "", " ")
257 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
262 mux.HandleFunc("/macip_acl_interface_add_del", func(w http.ResponseWriter, req *http.Request) {
263 var request = new(MacipACLInterfaceAddDel)
264 b, err := ioutil.ReadAll(req.Body)
266 http.Error(w, "read body failed", http.StatusBadRequest)
269 if err := json.Unmarshal(b, request); err != nil {
270 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
273 reply, err := rpc.MacipACLInterfaceAddDel(req.Context(), request)
275 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
278 rep, err := json.MarshalIndent(reply, "", " ")
280 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
285 mux.HandleFunc("/macip_acl_interface_get", func(w http.ResponseWriter, req *http.Request) {
286 var request = new(MacipACLInterfaceGet)
287 reply, err := rpc.MacipACLInterfaceGet(req.Context(), request)
289 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
292 rep, err := json.MarshalIndent(reply, "", " ")
294 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
299 return http.HandlerFunc(mux.ServeHTTP)