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("/ikev2_initiate_del_child_sa", func(w http.ResponseWriter, req *http.Request) {
14 var request = new(Ikev2InitiateDelChildSa)
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.Ikev2InitiateDelChildSa(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("/ikev2_initiate_del_ike_sa", func(w http.ResponseWriter, req *http.Request) {
37 var request = new(Ikev2InitiateDelIkeSa)
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.Ikev2InitiateDelIkeSa(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("/ikev2_initiate_rekey_child_sa", func(w http.ResponseWriter, req *http.Request) {
60 var request = new(Ikev2InitiateRekeyChildSa)
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.Ikev2InitiateRekeyChildSa(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("/ikev2_initiate_sa_init", func(w http.ResponseWriter, req *http.Request) {
83 var request = new(Ikev2InitiateSaInit)
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.Ikev2InitiateSaInit(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("/ikev2_plugin_get_version", func(w http.ResponseWriter, req *http.Request) {
106 var request = new(Ikev2PluginGetVersion)
107 reply, err := rpc.Ikev2PluginGetVersion(req.Context(), request)
109 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
112 rep, err := json.MarshalIndent(reply, "", " ")
114 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
119 mux.HandleFunc("/ikev2_profile_add_del", func(w http.ResponseWriter, req *http.Request) {
120 var request = new(Ikev2ProfileAddDel)
121 b, err := ioutil.ReadAll(req.Body)
123 http.Error(w, "read body failed", http.StatusBadRequest)
126 if err := json.Unmarshal(b, request); err != nil {
127 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
130 reply, err := rpc.Ikev2ProfileAddDel(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("/ikev2_profile_set_auth", func(w http.ResponseWriter, req *http.Request) {
143 var request = new(Ikev2ProfileSetAuth)
144 b, err := ioutil.ReadAll(req.Body)
146 http.Error(w, "read body failed", http.StatusBadRequest)
149 if err := json.Unmarshal(b, request); err != nil {
150 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
153 reply, err := rpc.Ikev2ProfileSetAuth(req.Context(), request)
155 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
158 rep, err := json.MarshalIndent(reply, "", " ")
160 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
165 mux.HandleFunc("/ikev2_profile_set_id", func(w http.ResponseWriter, req *http.Request) {
166 var request = new(Ikev2ProfileSetID)
167 b, err := ioutil.ReadAll(req.Body)
169 http.Error(w, "read body failed", http.StatusBadRequest)
172 if err := json.Unmarshal(b, request); err != nil {
173 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
176 reply, err := rpc.Ikev2ProfileSetID(req.Context(), request)
178 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
181 rep, err := json.MarshalIndent(reply, "", " ")
183 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
188 mux.HandleFunc("/ikev2_profile_set_ipsec_udp_port", func(w http.ResponseWriter, req *http.Request) {
189 var request = new(Ikev2ProfileSetIpsecUDPPort)
190 b, err := ioutil.ReadAll(req.Body)
192 http.Error(w, "read body failed", http.StatusBadRequest)
195 if err := json.Unmarshal(b, request); err != nil {
196 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
199 reply, err := rpc.Ikev2ProfileSetIpsecUDPPort(req.Context(), request)
201 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
204 rep, err := json.MarshalIndent(reply, "", " ")
206 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
211 mux.HandleFunc("/ikev2_profile_set_liveness", func(w http.ResponseWriter, req *http.Request) {
212 var request = new(Ikev2ProfileSetLiveness)
213 b, err := ioutil.ReadAll(req.Body)
215 http.Error(w, "read body failed", http.StatusBadRequest)
218 if err := json.Unmarshal(b, request); err != nil {
219 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
222 reply, err := rpc.Ikev2ProfileSetLiveness(req.Context(), request)
224 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
227 rep, err := json.MarshalIndent(reply, "", " ")
229 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
234 mux.HandleFunc("/ikev2_profile_set_ts", func(w http.ResponseWriter, req *http.Request) {
235 var request = new(Ikev2ProfileSetTs)
236 b, err := ioutil.ReadAll(req.Body)
238 http.Error(w, "read body failed", http.StatusBadRequest)
241 if err := json.Unmarshal(b, request); err != nil {
242 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
245 reply, err := rpc.Ikev2ProfileSetTs(req.Context(), request)
247 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
250 rep, err := json.MarshalIndent(reply, "", " ")
252 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
257 mux.HandleFunc("/ikev2_profile_set_udp_encap", func(w http.ResponseWriter, req *http.Request) {
258 var request = new(Ikev2ProfileSetUDPEncap)
259 b, err := ioutil.ReadAll(req.Body)
261 http.Error(w, "read body failed", http.StatusBadRequest)
264 if err := json.Unmarshal(b, request); err != nil {
265 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
268 reply, err := rpc.Ikev2ProfileSetUDPEncap(req.Context(), request)
270 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
273 rep, err := json.MarshalIndent(reply, "", " ")
275 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
280 mux.HandleFunc("/ikev2_set_esp_transforms", func(w http.ResponseWriter, req *http.Request) {
281 var request = new(Ikev2SetEspTransforms)
282 b, err := ioutil.ReadAll(req.Body)
284 http.Error(w, "read body failed", http.StatusBadRequest)
287 if err := json.Unmarshal(b, request); err != nil {
288 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
291 reply, err := rpc.Ikev2SetEspTransforms(req.Context(), request)
293 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
296 rep, err := json.MarshalIndent(reply, "", " ")
298 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
303 mux.HandleFunc("/ikev2_set_ike_transforms", func(w http.ResponseWriter, req *http.Request) {
304 var request = new(Ikev2SetIkeTransforms)
305 b, err := ioutil.ReadAll(req.Body)
307 http.Error(w, "read body failed", http.StatusBadRequest)
310 if err := json.Unmarshal(b, request); err != nil {
311 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
314 reply, err := rpc.Ikev2SetIkeTransforms(req.Context(), request)
316 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
319 rep, err := json.MarshalIndent(reply, "", " ")
321 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
326 mux.HandleFunc("/ikev2_set_local_key", func(w http.ResponseWriter, req *http.Request) {
327 var request = new(Ikev2SetLocalKey)
328 b, err := ioutil.ReadAll(req.Body)
330 http.Error(w, "read body failed", http.StatusBadRequest)
333 if err := json.Unmarshal(b, request); err != nil {
334 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
337 reply, err := rpc.Ikev2SetLocalKey(req.Context(), request)
339 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
342 rep, err := json.MarshalIndent(reply, "", " ")
344 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
349 mux.HandleFunc("/ikev2_set_responder", func(w http.ResponseWriter, req *http.Request) {
350 var request = new(Ikev2SetResponder)
351 b, err := ioutil.ReadAll(req.Body)
353 http.Error(w, "read body failed", http.StatusBadRequest)
356 if err := json.Unmarshal(b, request); err != nil {
357 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
360 reply, err := rpc.Ikev2SetResponder(req.Context(), request)
362 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
365 rep, err := json.MarshalIndent(reply, "", " ")
367 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
372 mux.HandleFunc("/ikev2_set_sa_lifetime", func(w http.ResponseWriter, req *http.Request) {
373 var request = new(Ikev2SetSaLifetime)
374 b, err := ioutil.ReadAll(req.Body)
376 http.Error(w, "read body failed", http.StatusBadRequest)
379 if err := json.Unmarshal(b, request); err != nil {
380 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
383 reply, err := rpc.Ikev2SetSaLifetime(req.Context(), request)
385 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
388 rep, err := json.MarshalIndent(reply, "", " ")
390 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
395 mux.HandleFunc("/ikev2_set_tunnel_interface", func(w http.ResponseWriter, req *http.Request) {
396 var request = new(Ikev2SetTunnelInterface)
397 b, err := ioutil.ReadAll(req.Body)
399 http.Error(w, "read body failed", http.StatusBadRequest)
402 if err := json.Unmarshal(b, request); err != nil {
403 http.Error(w, "unmarshal data failed", http.StatusBadRequest)
406 reply, err := rpc.Ikev2SetTunnelInterface(req.Context(), request)
408 http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
411 rep, err := json.MarshalIndent(reply, "", " ")
413 http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
418 return http.HandlerFunc(mux.ServeHTTP)