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