diff options
Diffstat (limited to 'binapi/pg')
-rw-r--r-- | binapi/pg/pg.ba.go | 4 | ||||
-rw-r--r-- | binapi/pg/pg_rest.ba.go | 83 | ||||
-rw-r--r-- | binapi/pg/pg_rpc.ba.go | 8 |
3 files changed, 6 insertions, 89 deletions
diff --git a/binapi/pg/pg.ba.go b/binapi/pg/pg.ba.go index 9a522c2..5fc4efb 100644 --- a/binapi/pg/pg.ba.go +++ b/binapi/pg/pg.ba.go @@ -1,7 +1,7 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: -// binapi-generator: v0.4.0-dev -// VPP: 20.05-release +// binapi-generator: v0.4.0 +// VPP: 20.05.1-release // source: /usr/share/vpp/api/core/pg.api.json // Package pg contains generated bindings for API file pg.api. diff --git a/binapi/pg/pg_rest.ba.go b/binapi/pg/pg_rest.ba.go deleted file mode 100644 index 6384ac4..0000000 --- a/binapi/pg/pg_rest.ba.go +++ /dev/null @@ -1,83 +0,0 @@ -// Code generated by GoVPP's binapi-generator. DO NOT EDIT. - -package pg - -import ( - "encoding/json" - "io/ioutil" - "net/http" -) - -func RESTHandler(rpc RPCService) http.Handler { - mux := http.NewServeMux() - mux.HandleFunc("/pg_capture", func(w http.ResponseWriter, req *http.Request) { - var request = new(PgCapture) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.PgCapture(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/pg_create_interface", func(w http.ResponseWriter, req *http.Request) { - var request = new(PgCreateInterface) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.PgCreateInterface(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - mux.HandleFunc("/pg_enable_disable", func(w http.ResponseWriter, req *http.Request) { - var request = new(PgEnableDisable) - b, err := ioutil.ReadAll(req.Body) - if err != nil { - http.Error(w, "read body failed", http.StatusBadRequest) - return - } - if err := json.Unmarshal(b, request); err != nil { - http.Error(w, "unmarshal data failed", http.StatusBadRequest) - return - } - reply, err := rpc.PgEnableDisable(req.Context(), request) - if err != nil { - http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError) - return - } - rep, err := json.MarshalIndent(reply, "", " ") - if err != nil { - http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError) - return - } - w.Write(rep) - }) - return http.HandlerFunc(mux.ServeHTTP) -} diff --git a/binapi/pg/pg_rpc.ba.go b/binapi/pg/pg_rpc.ba.go index 28790a8..697f684 100644 --- a/binapi/pg/pg_rpc.ba.go +++ b/binapi/pg/pg_rpc.ba.go @@ -8,7 +8,7 @@ import ( api "git.fd.io/govpp.git/api" ) -// RPCService defines RPC service pg. +// RPCService defines RPC service pg. type RPCService interface { PgCapture(ctx context.Context, in *PgCapture) (*PgCaptureReply, error) PgCreateInterface(ctx context.Context, in *PgCreateInterface) (*PgCreateInterfaceReply, error) @@ -29,7 +29,7 @@ func (c *serviceClient) PgCapture(ctx context.Context, in *PgCapture) (*PgCaptur if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) PgCreateInterface(ctx context.Context, in *PgCreateInterface) (*PgCreateInterfaceReply, error) { @@ -38,7 +38,7 @@ func (c *serviceClient) PgCreateInterface(ctx context.Context, in *PgCreateInter if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } func (c *serviceClient) PgEnableDisable(ctx context.Context, in *PgEnableDisable) (*PgEnableDisableReply, error) { @@ -47,5 +47,5 @@ func (c *serviceClient) PgEnableDisable(ctx context.Context, in *PgEnableDisable if err != nil { return nil, err } - return out, nil + return out, api.RetvalToVPPApiError(out.Retval) } |