4e6b21f16cd998e0c7b5d65348ca69755680a5eb
[govpp.git] / binapi / lb / lb_rpc.ba.go
1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2
3 package lb
4
5 import (
6         "context"
7         "fmt"
8         "io"
9
10         api "git.fd.io/govpp.git/api"
11         memclnt "git.fd.io/govpp.git/binapi/memclnt"
12 )
13
14 // RPCService defines RPC service lb.
15 type RPCService interface {
16         LbAddDelAs(ctx context.Context, in *LbAddDelAs) (*LbAddDelAsReply, error)
17         LbAddDelIntfNat4(ctx context.Context, in *LbAddDelIntfNat4) (*LbAddDelIntfNat4Reply, error)
18         LbAddDelIntfNat6(ctx context.Context, in *LbAddDelIntfNat6) (*LbAddDelIntfNat6Reply, error)
19         LbAddDelVip(ctx context.Context, in *LbAddDelVip) (*LbAddDelVipReply, error)
20         LbAsDump(ctx context.Context, in *LbAsDump) (RPCService_LbAsDumpClient, error)
21         LbConf(ctx context.Context, in *LbConf) (*LbConfReply, error)
22         LbFlushVip(ctx context.Context, in *LbFlushVip) (*LbFlushVipReply, error)
23         LbVipDump(ctx context.Context, in *LbVipDump) (RPCService_LbVipDumpClient, error)
24 }
25
26 type serviceClient struct {
27         conn api.Connection
28 }
29
30 func NewServiceClient(conn api.Connection) RPCService {
31         return &serviceClient{conn}
32 }
33
34 func (c *serviceClient) LbAddDelAs(ctx context.Context, in *LbAddDelAs) (*LbAddDelAsReply, error) {
35         out := new(LbAddDelAsReply)
36         err := c.conn.Invoke(ctx, in, out)
37         if err != nil {
38                 return nil, err
39         }
40         return out, api.RetvalToVPPApiError(out.Retval)
41 }
42
43 func (c *serviceClient) LbAddDelIntfNat4(ctx context.Context, in *LbAddDelIntfNat4) (*LbAddDelIntfNat4Reply, error) {
44         out := new(LbAddDelIntfNat4Reply)
45         err := c.conn.Invoke(ctx, in, out)
46         if err != nil {
47                 return nil, err
48         }
49         return out, api.RetvalToVPPApiError(out.Retval)
50 }
51
52 func (c *serviceClient) LbAddDelIntfNat6(ctx context.Context, in *LbAddDelIntfNat6) (*LbAddDelIntfNat6Reply, error) {
53         out := new(LbAddDelIntfNat6Reply)
54         err := c.conn.Invoke(ctx, in, out)
55         if err != nil {
56                 return nil, err
57         }
58         return out, api.RetvalToVPPApiError(out.Retval)
59 }
60
61 func (c *serviceClient) LbAddDelVip(ctx context.Context, in *LbAddDelVip) (*LbAddDelVipReply, error) {
62         out := new(LbAddDelVipReply)
63         err := c.conn.Invoke(ctx, in, out)
64         if err != nil {
65                 return nil, err
66         }
67         return out, api.RetvalToVPPApiError(out.Retval)
68 }
69
70 func (c *serviceClient) LbAsDump(ctx context.Context, in *LbAsDump) (RPCService_LbAsDumpClient, error) {
71         stream, err := c.conn.NewStream(ctx)
72         if err != nil {
73                 return nil, err
74         }
75         x := &serviceClient_LbAsDumpClient{stream}
76         if err := x.Stream.SendMsg(in); err != nil {
77                 return nil, err
78         }
79         if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil {
80                 return nil, err
81         }
82         return x, nil
83 }
84
85 type RPCService_LbAsDumpClient interface {
86         Recv() (*LbAsDetails, error)
87         api.Stream
88 }
89
90 type serviceClient_LbAsDumpClient struct {
91         api.Stream
92 }
93
94 func (c *serviceClient_LbAsDumpClient) Recv() (*LbAsDetails, error) {
95         msg, err := c.Stream.RecvMsg()
96         if err != nil {
97                 return nil, err
98         }
99         switch m := msg.(type) {
100         case *LbAsDetails:
101                 return m, nil
102         case *memclnt.ControlPingReply:
103                 err = c.Stream.Close()
104                 if err != nil {
105                         return nil, err
106                 }
107                 return nil, io.EOF
108         default:
109                 return nil, fmt.Errorf("unexpected message: %T %v", m, m)
110         }
111 }
112
113 func (c *serviceClient) LbConf(ctx context.Context, in *LbConf) (*LbConfReply, error) {
114         out := new(LbConfReply)
115         err := c.conn.Invoke(ctx, in, out)
116         if err != nil {
117                 return nil, err
118         }
119         return out, api.RetvalToVPPApiError(out.Retval)
120 }
121
122 func (c *serviceClient) LbFlushVip(ctx context.Context, in *LbFlushVip) (*LbFlushVipReply, error) {
123         out := new(LbFlushVipReply)
124         err := c.conn.Invoke(ctx, in, out)
125         if err != nil {
126                 return nil, err
127         }
128         return out, api.RetvalToVPPApiError(out.Retval)
129 }
130
131 func (c *serviceClient) LbVipDump(ctx context.Context, in *LbVipDump) (RPCService_LbVipDumpClient, error) {
132         stream, err := c.conn.NewStream(ctx)
133         if err != nil {
134                 return nil, err
135         }
136         x := &serviceClient_LbVipDumpClient{stream}
137         if err := x.Stream.SendMsg(in); err != nil {
138                 return nil, err
139         }
140         if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil {
141                 return nil, err
142         }
143         return x, nil
144 }
145
146 type RPCService_LbVipDumpClient interface {
147         Recv() (*LbVipDetails, error)
148         api.Stream
149 }
150
151 type serviceClient_LbVipDumpClient struct {
152         api.Stream
153 }
154
155 func (c *serviceClient_LbVipDumpClient) Recv() (*LbVipDetails, error) {
156         msg, err := c.Stream.RecvMsg()
157         if err != nil {
158                 return nil, err
159         }
160         switch m := msg.(type) {
161         case *LbVipDetails:
162                 return m, nil
163         case *memclnt.ControlPingReply:
164                 err = c.Stream.Close()
165                 if err != nil {
166                         return nil, err
167                 }
168                 return nil, io.EOF
169         default:
170                 return nil, fmt.Errorf("unexpected message: %T %v", m, m)
171         }
172 }