Improve doc & fix import ordering
[govpp.git] / binapi / lacp / lacp_rpc.ba.go
1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2
3 package lacp
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  lacp.
15 type RPCService interface {
16         SwInterfaceLacpDump(ctx context.Context, in *SwInterfaceLacpDump) (RPCService_SwInterfaceLacpDumpClient, error)
17 }
18
19 type serviceClient struct {
20         conn api.Connection
21 }
22
23 func NewServiceClient(conn api.Connection) RPCService {
24         return &serviceClient{conn}
25 }
26
27 func (c *serviceClient) SwInterfaceLacpDump(ctx context.Context, in *SwInterfaceLacpDump) (RPCService_SwInterfaceLacpDumpClient, error) {
28         stream, err := c.conn.NewStream(ctx)
29         if err != nil {
30                 return nil, err
31         }
32         x := &serviceClient_SwInterfaceLacpDumpClient{stream}
33         if err := x.Stream.SendMsg(in); err != nil {
34                 return nil, err
35         }
36         if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil {
37                 return nil, err
38         }
39         return x, nil
40 }
41
42 type RPCService_SwInterfaceLacpDumpClient interface {
43         Recv() (*SwInterfaceLacpDetails, error)
44         api.Stream
45 }
46
47 type serviceClient_SwInterfaceLacpDumpClient struct {
48         api.Stream
49 }
50
51 func (c *serviceClient_SwInterfaceLacpDumpClient) Recv() (*SwInterfaceLacpDetails, error) {
52         msg, err := c.Stream.RecvMsg()
53         if err != nil {
54                 return nil, err
55         }
56         switch m := msg.(type) {
57         case *SwInterfaceLacpDetails:
58                 return m, nil
59         case *vpe.ControlPingReply:
60                 return nil, io.EOF
61         default:
62                 return nil, fmt.Errorf("unexpected message: %T %v", m, m)
63         }
64 }