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("/dhcp6_clients_enable_disable", func(w http.ResponseWriter, req *http.Request) {
14 var request = new(DHCP6ClientsEnableDisable)
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.DHCP6ClientsEnableDisable(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("/dhcp6_duid_ll_set", func(w http.ResponseWriter, req *http.Request) {
37 var request = new(DHCP6DuidLlSet)
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.DHCP6DuidLlSet(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("/dhcp6_pd_send_client_message", func(w http.ResponseWriter, req *http.Request) {
60 var request = new(DHCP6PdSendClientMessage)
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.DHCP6PdSendClientMessage(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("/dhcp6_send_client_message", func(w http.ResponseWriter, req *http.Request) {
83 var request = new(DHCP6SendClientMessage)
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.DHCP6SendClientMessage(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("/dhcp_client_config", func(w http.ResponseWriter, req *http.Request) {
106 var request = new(DHCPClientConfig)
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.DHCPClientConfig(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("/dhcp_plugin_control_ping", func(w http.ResponseWriter, req *http.Request) {
129 var request = new(DHCPPluginControlPing)
130 reply, err := rpc.DHCPPluginControlPing(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("/dhcp_plugin_get_version", func(w http.ResponseWriter, req *http.Request) {
143 var request = new(DHCPPluginGetVersion)
144 reply, err := rpc.DHCPPluginGetVersion(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("/dhcp_proxy_config", func(w http.ResponseWriter, req *http.Request) {
157 var request = new(DHCPProxyConfig)
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.DHCPProxyConfig(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("/dhcp_proxy_set_vss", func(w http.ResponseWriter, req *http.Request) {
180 var request = new(DHCPProxySetVss)
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.DHCPProxySetVss(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 mux.HandleFunc("/want_dhcp6_pd_reply_events", func(w http.ResponseWriter, req *http.Request) {
203 var request = new(WantDHCP6PdReplyEvents)
204 b, err := ioutil.ReadAll(req.Body)
206 http.Error(w, "read body failed", http.StatusBadRequest)
209 if err := json.Unmarshal(b, request); err != nil {
210 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
213 reply, err := rpc.WantDHCP6PdReplyEvents(req.Context(), request)
215 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
218 rep, err := json.MarshalIndent(reply, "", " ")
220 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
225 mux.HandleFunc("/want_dhcp6_reply_events", func(w http.ResponseWriter, req *http.Request) {
226 var request = new(WantDHCP6ReplyEvents)
227 b, err := ioutil.ReadAll(req.Body)
229 http.Error(w, "read body failed", http.StatusBadRequest)
232 if err := json.Unmarshal(b, request); err != nil {
233 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
236 reply, err := rpc.WantDHCP6ReplyEvents(req.Context(), request)
238 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
241 rep, err := json.MarshalIndent(reply, "", " ")
243 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
248 return http.HandlerFunc(mux.ServeHTTP)