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("/gbp_bridge_domain_add", func(w http.ResponseWriter, req *http.Request) {
14 var request = new(GbpBridgeDomainAdd)
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.GbpBridgeDomainAdd(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("/gbp_bridge_domain_del", func(w http.ResponseWriter, req *http.Request) {
37 var request = new(GbpBridgeDomainDel)
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.GbpBridgeDomainDel(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("/gbp_contract_add_del", func(w http.ResponseWriter, req *http.Request) {
60 var request = new(GbpContractAddDel)
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.GbpContractAddDel(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("/gbp_endpoint_add", func(w http.ResponseWriter, req *http.Request) {
83 var request = new(GbpEndpointAdd)
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.GbpEndpointAdd(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("/gbp_endpoint_del", func(w http.ResponseWriter, req *http.Request) {
106 var request = new(GbpEndpointDel)
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.GbpEndpointDel(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("/gbp_endpoint_group_add", func(w http.ResponseWriter, req *http.Request) {
129 var request = new(GbpEndpointGroupAdd)
130 b, err := ioutil.ReadAll(req.Body)
132 http.Error(w, "read body failed", http.StatusBadRequest)
135 if err := json.Unmarshal(b, request); err != nil {
136 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
139 reply, err := rpc.GbpEndpointGroupAdd(req.Context(), request)
141 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
144 rep, err := json.MarshalIndent(reply, "", " ")
146 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
151 mux.HandleFunc("/gbp_endpoint_group_del", func(w http.ResponseWriter, req *http.Request) {
152 var request = new(GbpEndpointGroupDel)
153 b, err := ioutil.ReadAll(req.Body)
155 http.Error(w, "read body failed", http.StatusBadRequest)
158 if err := json.Unmarshal(b, request); err != nil {
159 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
162 reply, err := rpc.GbpEndpointGroupDel(req.Context(), request)
164 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
167 rep, err := json.MarshalIndent(reply, "", " ")
169 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
174 mux.HandleFunc("/gbp_ext_itf_add_del", func(w http.ResponseWriter, req *http.Request) {
175 var request = new(GbpExtItfAddDel)
176 b, err := ioutil.ReadAll(req.Body)
178 http.Error(w, "read body failed", http.StatusBadRequest)
181 if err := json.Unmarshal(b, request); err != nil {
182 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
185 reply, err := rpc.GbpExtItfAddDel(req.Context(), request)
187 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
190 rep, err := json.MarshalIndent(reply, "", " ")
192 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
197 mux.HandleFunc("/gbp_recirc_add_del", func(w http.ResponseWriter, req *http.Request) {
198 var request = new(GbpRecircAddDel)
199 b, err := ioutil.ReadAll(req.Body)
201 http.Error(w, "read body failed", http.StatusBadRequest)
204 if err := json.Unmarshal(b, request); err != nil {
205 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
208 reply, err := rpc.GbpRecircAddDel(req.Context(), request)
210 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
213 rep, err := json.MarshalIndent(reply, "", " ")
215 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
220 mux.HandleFunc("/gbp_route_domain_add", func(w http.ResponseWriter, req *http.Request) {
221 var request = new(GbpRouteDomainAdd)
222 b, err := ioutil.ReadAll(req.Body)
224 http.Error(w, "read body failed", http.StatusBadRequest)
227 if err := json.Unmarshal(b, request); err != nil {
228 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
231 reply, err := rpc.GbpRouteDomainAdd(req.Context(), request)
233 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
236 rep, err := json.MarshalIndent(reply, "", " ")
238 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
243 mux.HandleFunc("/gbp_route_domain_del", func(w http.ResponseWriter, req *http.Request) {
244 var request = new(GbpRouteDomainDel)
245 b, err := ioutil.ReadAll(req.Body)
247 http.Error(w, "read body failed", http.StatusBadRequest)
250 if err := json.Unmarshal(b, request); err != nil {
251 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
254 reply, err := rpc.GbpRouteDomainDel(req.Context(), request)
256 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
259 rep, err := json.MarshalIndent(reply, "", " ")
261 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
266 mux.HandleFunc("/gbp_subnet_add_del", func(w http.ResponseWriter, req *http.Request) {
267 var request = new(GbpSubnetAddDel)
268 b, err := ioutil.ReadAll(req.Body)
270 http.Error(w, "read body failed", http.StatusBadRequest)
273 if err := json.Unmarshal(b, request); err != nil {
274 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
277 reply, err := rpc.GbpSubnetAddDel(req.Context(), request)
279 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
282 rep, err := json.MarshalIndent(reply, "", " ")
284 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
289 mux.HandleFunc("/gbp_vxlan_tunnel_add", func(w http.ResponseWriter, req *http.Request) {
290 var request = new(GbpVxlanTunnelAdd)
291 b, err := ioutil.ReadAll(req.Body)
293 http.Error(w, "read body failed", http.StatusBadRequest)
296 if err := json.Unmarshal(b, request); err != nil {
297 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
300 reply, err := rpc.GbpVxlanTunnelAdd(req.Context(), request)
302 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
305 rep, err := json.MarshalIndent(reply, "", " ")
307 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
312 mux.HandleFunc("/gbp_vxlan_tunnel_del", func(w http.ResponseWriter, req *http.Request) {
313 var request = new(GbpVxlanTunnelDel)
314 b, err := ioutil.ReadAll(req.Body)
316 http.Error(w, "read body failed", http.StatusBadRequest)
319 if err := json.Unmarshal(b, request); err != nil {
320 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
323 reply, err := rpc.GbpVxlanTunnelDel(req.Context(), request)
325 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
328 rep, err := json.MarshalIndent(reply, "", " ")
330 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
335 return http.HandlerFunc(mux.ServeHTTP)