Improve doc & fix import ordering
[govpp.git] / binapi / l3xc / l3xc_rpc.ba.go
1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2
3 package l3xc
4
5 import (
6         "context"
7         "fmt"
8         "io"
9
10         api "git.fd.io/govpp.git/api"
11         vpe "git.fd.io/govpp.git/binapi/vpe"
12 )
13
14 // RPCService defines RPC service  l3xc.
15 type RPCService interface {
16         L3xcDel(ctx context.Context, in *L3xcDel) (*L3xcDelReply, error)
17         L3xcDump(ctx context.Context, in *L3xcDump) (RPCService_L3xcDumpClient, error)
18         L3xcPluginGetVersion(ctx context.Context, in *L3xcPluginGetVersion) (*L3xcPluginGetVersionReply, error)
19         L3xcUpdate(ctx context.Context, in *L3xcUpdate) (*L3xcUpdateReply, error)
20 }
21
22 type serviceClient struct {
23         conn api.Connection
24 }
25
26 func NewServiceClient(conn api.Connection) RPCService {
27         return &serviceClient{conn}
28 }
29
30 func (c *serviceClient) L3xcDel(ctx context.Context, in *L3xcDel) (*L3xcDelReply, error) {
31         out := new(L3xcDelReply)
32         err := c.conn.Invoke(ctx, in, out)
33         if err != nil {
34                 return nil, err
35         }
36         return out, nil
37 }
38
39 func (c *serviceClient) L3xcDump(ctx context.Context, in *L3xcDump) (RPCService_L3xcDumpClient, error) {
40         stream, err := c.conn.NewStream(ctx)
41         if err != nil {
42                 return nil, err
43         }
44         x := &serviceClient_L3xcDumpClient{stream}
45         if err := x.Stream.SendMsg(in); err != nil {
46                 return nil, err
47         }
48         if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil {
49                 return nil, err
50         }
51         return x, nil
52 }
53
54 type RPCService_L3xcDumpClient interface {
55         Recv() (*L3xcDetails, error)
56         api.Stream
57 }
58
59 type serviceClient_L3xcDumpClient struct {
60         api.Stream
61 }
62
63 func (c *serviceClient_L3xcDumpClient) Recv() (*L3xcDetails, error) {
64         msg, err := c.Stream.RecvMsg()
65         if err != nil {
66                 return nil, err
67         }
68         switch m := msg.(type) {
69         case *L3xcDetails:
70                 return m, nil
71         case *vpe.ControlPingReply:
72                 return nil, io.EOF
73         default:
74                 return nil, fmt.Errorf("unexpected message: %T %v", m, m)
75         }
76 }
77
78 func (c *serviceClient) L3xcPluginGetVersion(ctx context.Context, in *L3xcPluginGetVersion) (*L3xcPluginGetVersionReply, error) {
79         out := new(L3xcPluginGetVersionReply)
80         err := c.conn.Invoke(ctx, in, out)
81         if err != nil {
82                 return nil, err
83         }
84         return out, nil
85 }
86
87 func (c *serviceClient) L3xcUpdate(ctx context.Context, in *L3xcUpdate) (*L3xcUpdateReply, error) {
88         out := new(L3xcUpdateReply)
89         err := c.conn.Invoke(ctx, in, out)
90         if err != nil {
91                 return nil, err
92         }
93         return out, nil
94 }