github.com/aristanetworks/goarista@v0.0.0-20240514173732-cca2755bbd44/gnmireverse/gnmireverse_grpc.pb.go (about) 1 // Copyright (c) 2020 Arista Networks, Inc. 2 // Use of this source code is governed by the Apache License 2.0 3 // that can be found in the COPYING file. 4 5 // Code generated by protoc-gen-go-grpc. DO NOT EDIT. 6 // versions: 7 // - protoc-gen-go-grpc v1.3.0 8 // - protoc v4.22.2 9 // source: gnmireverse.proto 10 11 // Package gNMIReverse defines a service specification that reverses the 12 // direction of the dial for gNMI Subscribe and gNMI Get. 13 // 14 // gNMI is a "dial-in" service, where the telemetry collector must make a 15 // connection to the gNMI target. With gNMIReverse, a client can be run 16 // alongside the gNMI target and then "dial-out" to a gNMIReverse server 17 // to send streaming data. 18 19 package gnmireverse 20 21 import ( 22 context "context" 23 gnmi "github.com/openconfig/gnmi/proto/gnmi" 24 grpc "google.golang.org/grpc" 25 codes "google.golang.org/grpc/codes" 26 status "google.golang.org/grpc/status" 27 emptypb "google.golang.org/protobuf/types/known/emptypb" 28 ) 29 30 // This is a compile-time assertion to ensure that this generated file 31 // is compatible with the grpc package it is being compiled against. 32 // Requires gRPC-Go v1.32.0 or later. 33 const _ = grpc.SupportPackageIsVersion7 34 35 const ( 36 GNMIReverse_Publish_FullMethodName = "/gnmireverse.gNMIReverse/Publish" 37 GNMIReverse_PublishGet_FullMethodName = "/gnmireverse.gNMIReverse/PublishGet" 38 ) 39 40 // GNMIReverseClient is the client API for GNMIReverse service. 41 // 42 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. 43 type GNMIReverseClient interface { 44 // Publish allows the client to publish gNMI SubscribeResponses to the 45 // collector server. The client is typically run alongside the gNMI target 46 // and forwards SubscribeResponses from the target to the collector server. 47 // The request is specified by the client. 48 Publish(ctx context.Context, opts ...grpc.CallOption) (GNMIReverse_PublishClient, error) 49 // PublishGet allows the client to publish gNMI GetResponses to the 50 // collector server. The client is typically run alongside the gNMI target 51 // and forwards GetResponses from the target to the collector server. 52 // The request and sample interval are specified by the client. 53 PublishGet(ctx context.Context, opts ...grpc.CallOption) (GNMIReverse_PublishGetClient, error) 54 } 55 56 type gNMIReverseClient struct { 57 cc grpc.ClientConnInterface 58 } 59 60 func NewGNMIReverseClient(cc grpc.ClientConnInterface) GNMIReverseClient { 61 return &gNMIReverseClient{cc} 62 } 63 64 func (c *gNMIReverseClient) Publish(ctx context.Context, opts ...grpc.CallOption) (GNMIReverse_PublishClient, error) { 65 stream, err := c.cc.NewStream(ctx, &GNMIReverse_ServiceDesc.Streams[0], GNMIReverse_Publish_FullMethodName, opts...) 66 if err != nil { 67 return nil, err 68 } 69 x := &gNMIReversePublishClient{stream} 70 return x, nil 71 } 72 73 type GNMIReverse_PublishClient interface { 74 Send(*gnmi.SubscribeResponse) error 75 CloseAndRecv() (*emptypb.Empty, error) 76 grpc.ClientStream 77 } 78 79 type gNMIReversePublishClient struct { 80 grpc.ClientStream 81 } 82 83 func (x *gNMIReversePublishClient) Send(m *gnmi.SubscribeResponse) error { 84 return x.ClientStream.SendMsg(m) 85 } 86 87 func (x *gNMIReversePublishClient) CloseAndRecv() (*emptypb.Empty, error) { 88 if err := x.ClientStream.CloseSend(); err != nil { 89 return nil, err 90 } 91 m := new(emptypb.Empty) 92 if err := x.ClientStream.RecvMsg(m); err != nil { 93 return nil, err 94 } 95 return m, nil 96 } 97 98 func (c *gNMIReverseClient) PublishGet(ctx context.Context, opts ...grpc.CallOption) (GNMIReverse_PublishGetClient, error) { 99 stream, err := c.cc.NewStream(ctx, &GNMIReverse_ServiceDesc.Streams[1], GNMIReverse_PublishGet_FullMethodName, opts...) 100 if err != nil { 101 return nil, err 102 } 103 x := &gNMIReversePublishGetClient{stream} 104 return x, nil 105 } 106 107 type GNMIReverse_PublishGetClient interface { 108 Send(*gnmi.GetResponse) error 109 CloseAndRecv() (*emptypb.Empty, error) 110 grpc.ClientStream 111 } 112 113 type gNMIReversePublishGetClient struct { 114 grpc.ClientStream 115 } 116 117 func (x *gNMIReversePublishGetClient) Send(m *gnmi.GetResponse) error { 118 return x.ClientStream.SendMsg(m) 119 } 120 121 func (x *gNMIReversePublishGetClient) CloseAndRecv() (*emptypb.Empty, error) { 122 if err := x.ClientStream.CloseSend(); err != nil { 123 return nil, err 124 } 125 m := new(emptypb.Empty) 126 if err := x.ClientStream.RecvMsg(m); err != nil { 127 return nil, err 128 } 129 return m, nil 130 } 131 132 // GNMIReverseServer is the server API for GNMIReverse service. 133 // All implementations must embed UnimplementedGNMIReverseServer 134 // for forward compatibility 135 type GNMIReverseServer interface { 136 // Publish allows the client to publish gNMI SubscribeResponses to the 137 // collector server. The client is typically run alongside the gNMI target 138 // and forwards SubscribeResponses from the target to the collector server. 139 // The request is specified by the client. 140 Publish(GNMIReverse_PublishServer) error 141 // PublishGet allows the client to publish gNMI GetResponses to the 142 // collector server. The client is typically run alongside the gNMI target 143 // and forwards GetResponses from the target to the collector server. 144 // The request and sample interval are specified by the client. 145 PublishGet(GNMIReverse_PublishGetServer) error 146 mustEmbedUnimplementedGNMIReverseServer() 147 } 148 149 // UnimplementedGNMIReverseServer must be embedded to have forward compatible implementations. 150 type UnimplementedGNMIReverseServer struct { 151 } 152 153 func (UnimplementedGNMIReverseServer) Publish(GNMIReverse_PublishServer) error { 154 return status.Errorf(codes.Unimplemented, "method Publish not implemented") 155 } 156 func (UnimplementedGNMIReverseServer) PublishGet(GNMIReverse_PublishGetServer) error { 157 return status.Errorf(codes.Unimplemented, "method PublishGet not implemented") 158 } 159 func (UnimplementedGNMIReverseServer) mustEmbedUnimplementedGNMIReverseServer() {} 160 161 // UnsafeGNMIReverseServer may be embedded to opt out of forward compatibility for this service. 162 // Use of this interface is not recommended, as added methods to GNMIReverseServer will 163 // result in compilation errors. 164 type UnsafeGNMIReverseServer interface { 165 mustEmbedUnimplementedGNMIReverseServer() 166 } 167 168 func RegisterGNMIReverseServer(s grpc.ServiceRegistrar, srv GNMIReverseServer) { 169 s.RegisterService(&GNMIReverse_ServiceDesc, srv) 170 } 171 172 func _GNMIReverse_Publish_Handler(srv interface{}, stream grpc.ServerStream) error { 173 return srv.(GNMIReverseServer).Publish(&gNMIReversePublishServer{stream}) 174 } 175 176 type GNMIReverse_PublishServer interface { 177 SendAndClose(*emptypb.Empty) error 178 Recv() (*gnmi.SubscribeResponse, error) 179 grpc.ServerStream 180 } 181 182 type gNMIReversePublishServer struct { 183 grpc.ServerStream 184 } 185 186 func (x *gNMIReversePublishServer) SendAndClose(m *emptypb.Empty) error { 187 return x.ServerStream.SendMsg(m) 188 } 189 190 func (x *gNMIReversePublishServer) Recv() (*gnmi.SubscribeResponse, error) { 191 m := new(gnmi.SubscribeResponse) 192 if err := x.ServerStream.RecvMsg(m); err != nil { 193 return nil, err 194 } 195 return m, nil 196 } 197 198 func _GNMIReverse_PublishGet_Handler(srv interface{}, stream grpc.ServerStream) error { 199 return srv.(GNMIReverseServer).PublishGet(&gNMIReversePublishGetServer{stream}) 200 } 201 202 type GNMIReverse_PublishGetServer interface { 203 SendAndClose(*emptypb.Empty) error 204 Recv() (*gnmi.GetResponse, error) 205 grpc.ServerStream 206 } 207 208 type gNMIReversePublishGetServer struct { 209 grpc.ServerStream 210 } 211 212 func (x *gNMIReversePublishGetServer) SendAndClose(m *emptypb.Empty) error { 213 return x.ServerStream.SendMsg(m) 214 } 215 216 func (x *gNMIReversePublishGetServer) Recv() (*gnmi.GetResponse, error) { 217 m := new(gnmi.GetResponse) 218 if err := x.ServerStream.RecvMsg(m); err != nil { 219 return nil, err 220 } 221 return m, nil 222 } 223 224 // GNMIReverse_ServiceDesc is the grpc.ServiceDesc for GNMIReverse service. 225 // It's only intended for direct use with grpc.RegisterService, 226 // and not to be introspected or modified (even as a copy) 227 var GNMIReverse_ServiceDesc = grpc.ServiceDesc{ 228 ServiceName: "gnmireverse.gNMIReverse", 229 HandlerType: (*GNMIReverseServer)(nil), 230 Methods: []grpc.MethodDesc{}, 231 Streams: []grpc.StreamDesc{ 232 { 233 StreamName: "Publish", 234 Handler: _GNMIReverse_Publish_Handler, 235 ClientStreams: true, 236 }, 237 { 238 StreamName: "PublishGet", 239 Handler: _GNMIReverse_PublishGet_Handler, 240 ClientStreams: true, 241 }, 242 }, 243 Metadata: "gnmireverse.proto", 244 }