Improve doc & fix import ordering
[govpp.git] / binapi / session / session_rpc.ba.go
1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
2
3 package session
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  session.
15 type RPCService interface {
16         AppAddCertKeyPair(ctx context.Context, in *AppAddCertKeyPair) (*AppAddCertKeyPairReply, error)
17         AppAttach(ctx context.Context, in *AppAttach) (*AppAttachReply, error)
18         AppDelCertKeyPair(ctx context.Context, in *AppDelCertKeyPair) (*AppDelCertKeyPairReply, error)
19         AppNamespaceAddDel(ctx context.Context, in *AppNamespaceAddDel) (*AppNamespaceAddDelReply, error)
20         AppWorkerAddDel(ctx context.Context, in *AppWorkerAddDel) (*AppWorkerAddDelReply, error)
21         ApplicationDetach(ctx context.Context, in *ApplicationDetach) (*ApplicationDetachReply, error)
22         ApplicationTLSCertAdd(ctx context.Context, in *ApplicationTLSCertAdd) (*ApplicationTLSCertAddReply, error)
23         ApplicationTLSKeyAdd(ctx context.Context, in *ApplicationTLSKeyAdd) (*ApplicationTLSKeyAddReply, error)
24         SessionEnableDisable(ctx context.Context, in *SessionEnableDisable) (*SessionEnableDisableReply, error)
25         SessionRuleAddDel(ctx context.Context, in *SessionRuleAddDel) (*SessionRuleAddDelReply, error)
26         SessionRulesDump(ctx context.Context, in *SessionRulesDump) (RPCService_SessionRulesDumpClient, error)
27 }
28
29 type serviceClient struct {
30         conn api.Connection
31 }
32
33 func NewServiceClient(conn api.Connection) RPCService {
34         return &serviceClient{conn}
35 }
36
37 func (c *serviceClient) AppAddCertKeyPair(ctx context.Context, in *AppAddCertKeyPair) (*AppAddCertKeyPairReply, error) {
38         out := new(AppAddCertKeyPairReply)
39         err := c.conn.Invoke(ctx, in, out)
40         if err != nil {
41                 return nil, err
42         }
43         return out, nil
44 }
45
46 func (c *serviceClient) AppAttach(ctx context.Context, in *AppAttach) (*AppAttachReply, error) {
47         out := new(AppAttachReply)
48         err := c.conn.Invoke(ctx, in, out)
49         if err != nil {
50                 return nil, err
51         }
52         return out, nil
53 }
54
55 func (c *serviceClient) AppDelCertKeyPair(ctx context.Context, in *AppDelCertKeyPair) (*AppDelCertKeyPairReply, error) {
56         out := new(AppDelCertKeyPairReply)
57         err := c.conn.Invoke(ctx, in, out)
58         if err != nil {
59                 return nil, err
60         }
61         return out, nil
62 }
63
64 func (c *serviceClient) AppNamespaceAddDel(ctx context.Context, in *AppNamespaceAddDel) (*AppNamespaceAddDelReply, error) {
65         out := new(AppNamespaceAddDelReply)
66         err := c.conn.Invoke(ctx, in, out)
67         if err != nil {
68                 return nil, err
69         }
70         return out, nil
71 }
72
73 func (c *serviceClient) AppWorkerAddDel(ctx context.Context, in *AppWorkerAddDel) (*AppWorkerAddDelReply, error) {
74         out := new(AppWorkerAddDelReply)
75         err := c.conn.Invoke(ctx, in, out)
76         if err != nil {
77                 return nil, err
78         }
79         return out, nil
80 }
81
82 func (c *serviceClient) ApplicationDetach(ctx context.Context, in *ApplicationDetach) (*ApplicationDetachReply, error) {
83         out := new(ApplicationDetachReply)
84         err := c.conn.Invoke(ctx, in, out)
85         if err != nil {
86                 return nil, err
87         }
88         return out, nil
89 }
90
91 func (c *serviceClient) ApplicationTLSCertAdd(ctx context.Context, in *ApplicationTLSCertAdd) (*ApplicationTLSCertAddReply, error) {
92         out := new(ApplicationTLSCertAddReply)
93         err := c.conn.Invoke(ctx, in, out)
94         if err != nil {
95                 return nil, err
96         }
97         return out, nil
98 }
99
100 func (c *serviceClient) ApplicationTLSKeyAdd(ctx context.Context, in *ApplicationTLSKeyAdd) (*ApplicationTLSKeyAddReply, error) {
101         out := new(ApplicationTLSKeyAddReply)
102         err := c.conn.Invoke(ctx, in, out)
103         if err != nil {
104                 return nil, err
105         }
106         return out, nil
107 }
108
109 func (c *serviceClient) SessionEnableDisable(ctx context.Context, in *SessionEnableDisable) (*SessionEnableDisableReply, error) {
110         out := new(SessionEnableDisableReply)
111         err := c.conn.Invoke(ctx, in, out)
112         if err != nil {
113                 return nil, err
114         }
115         return out, nil
116 }
117
118 func (c *serviceClient) SessionRuleAddDel(ctx context.Context, in *SessionRuleAddDel) (*SessionRuleAddDelReply, error) {
119         out := new(SessionRuleAddDelReply)
120         err := c.conn.Invoke(ctx, in, out)
121         if err != nil {
122                 return nil, err
123         }
124         return out, nil
125 }
126
127 func (c *serviceClient) SessionRulesDump(ctx context.Context, in *SessionRulesDump) (RPCService_SessionRulesDumpClient, error) {
128         stream, err := c.conn.NewStream(ctx)
129         if err != nil {
130                 return nil, err
131         }
132         x := &serviceClient_SessionRulesDumpClient{stream}
133         if err := x.Stream.SendMsg(in); err != nil {
134                 return nil, err
135         }
136         if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil {
137                 return nil, err
138         }
139         return x, nil
140 }
141
142 type RPCService_SessionRulesDumpClient interface {
143         Recv() (*SessionRulesDetails, error)
144         api.Stream
145 }
146
147 type serviceClient_SessionRulesDumpClient struct {
148         api.Stream
149 }
150
151 func (c *serviceClient_SessionRulesDumpClient) Recv() (*SessionRulesDetails, error) {
152         msg, err := c.Stream.RecvMsg()
153         if err != nil {
154                 return nil, err
155         }
156         switch m := msg.(type) {
157         case *SessionRulesDetails:
158                 return m, nil
159         case *vpe.ControlPingReply:
160                 return nil, io.EOF
161         default:
162                 return nil, fmt.Errorf("unexpected message: %T %v", m, m)
163         }
164 }