github.com/hashicorp/go-plugin@v1.6.0/internal/plugin/grpc_stdio_grpc.pb.go (about)

     1  // Copyright (c) HashiCorp, Inc.
     2  // SPDX-License-Identifier: MPL-2.0
     3  
     4  // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
     5  // versions:
     6  // - protoc-gen-go-grpc v1.3.0
     7  // - protoc             (unknown)
     8  // source: internal/plugin/grpc_stdio.proto
     9  
    10  package plugin
    11  
    12  import (
    13  	context "context"
    14  	grpc "google.golang.org/grpc"
    15  	codes "google.golang.org/grpc/codes"
    16  	status "google.golang.org/grpc/status"
    17  	emptypb "google.golang.org/protobuf/types/known/emptypb"
    18  )
    19  
    20  // This is a compile-time assertion to ensure that this generated file
    21  // is compatible with the grpc package it is being compiled against.
    22  // Requires gRPC-Go v1.32.0 or later.
    23  const _ = grpc.SupportPackageIsVersion7
    24  
    25  const (
    26  	GRPCStdio_StreamStdio_FullMethodName = "/plugin.GRPCStdio/StreamStdio"
    27  )
    28  
    29  // GRPCStdioClient is the client API for GRPCStdio service.
    30  //
    31  // 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.
    32  type GRPCStdioClient interface {
    33  	// StreamStdio returns a stream that contains all the stdout/stderr.
    34  	// This RPC endpoint must only be called ONCE. Once stdio data is consumed
    35  	// it is not sent again.
    36  	//
    37  	// Callers should connect early to prevent blocking on the plugin process.
    38  	StreamStdio(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (GRPCStdio_StreamStdioClient, error)
    39  }
    40  
    41  type gRPCStdioClient struct {
    42  	cc grpc.ClientConnInterface
    43  }
    44  
    45  func NewGRPCStdioClient(cc grpc.ClientConnInterface) GRPCStdioClient {
    46  	return &gRPCStdioClient{cc}
    47  }
    48  
    49  func (c *gRPCStdioClient) StreamStdio(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (GRPCStdio_StreamStdioClient, error) {
    50  	stream, err := c.cc.NewStream(ctx, &GRPCStdio_ServiceDesc.Streams[0], GRPCStdio_StreamStdio_FullMethodName, opts...)
    51  	if err != nil {
    52  		return nil, err
    53  	}
    54  	x := &gRPCStdioStreamStdioClient{stream}
    55  	if err := x.ClientStream.SendMsg(in); err != nil {
    56  		return nil, err
    57  	}
    58  	if err := x.ClientStream.CloseSend(); err != nil {
    59  		return nil, err
    60  	}
    61  	return x, nil
    62  }
    63  
    64  type GRPCStdio_StreamStdioClient interface {
    65  	Recv() (*StdioData, error)
    66  	grpc.ClientStream
    67  }
    68  
    69  type gRPCStdioStreamStdioClient struct {
    70  	grpc.ClientStream
    71  }
    72  
    73  func (x *gRPCStdioStreamStdioClient) Recv() (*StdioData, error) {
    74  	m := new(StdioData)
    75  	if err := x.ClientStream.RecvMsg(m); err != nil {
    76  		return nil, err
    77  	}
    78  	return m, nil
    79  }
    80  
    81  // GRPCStdioServer is the server API for GRPCStdio service.
    82  // All implementations should embed UnimplementedGRPCStdioServer
    83  // for forward compatibility
    84  type GRPCStdioServer interface {
    85  	// StreamStdio returns a stream that contains all the stdout/stderr.
    86  	// This RPC endpoint must only be called ONCE. Once stdio data is consumed
    87  	// it is not sent again.
    88  	//
    89  	// Callers should connect early to prevent blocking on the plugin process.
    90  	StreamStdio(*emptypb.Empty, GRPCStdio_StreamStdioServer) error
    91  }
    92  
    93  // UnimplementedGRPCStdioServer should be embedded to have forward compatible implementations.
    94  type UnimplementedGRPCStdioServer struct {
    95  }
    96  
    97  func (UnimplementedGRPCStdioServer) StreamStdio(*emptypb.Empty, GRPCStdio_StreamStdioServer) error {
    98  	return status.Errorf(codes.Unimplemented, "method StreamStdio not implemented")
    99  }
   100  
   101  // UnsafeGRPCStdioServer may be embedded to opt out of forward compatibility for this service.
   102  // Use of this interface is not recommended, as added methods to GRPCStdioServer will
   103  // result in compilation errors.
   104  type UnsafeGRPCStdioServer interface {
   105  	mustEmbedUnimplementedGRPCStdioServer()
   106  }
   107  
   108  func RegisterGRPCStdioServer(s grpc.ServiceRegistrar, srv GRPCStdioServer) {
   109  	s.RegisterService(&GRPCStdio_ServiceDesc, srv)
   110  }
   111  
   112  func _GRPCStdio_StreamStdio_Handler(srv interface{}, stream grpc.ServerStream) error {
   113  	m := new(emptypb.Empty)
   114  	if err := stream.RecvMsg(m); err != nil {
   115  		return err
   116  	}
   117  	return srv.(GRPCStdioServer).StreamStdio(m, &gRPCStdioStreamStdioServer{stream})
   118  }
   119  
   120  type GRPCStdio_StreamStdioServer interface {
   121  	Send(*StdioData) error
   122  	grpc.ServerStream
   123  }
   124  
   125  type gRPCStdioStreamStdioServer struct {
   126  	grpc.ServerStream
   127  }
   128  
   129  func (x *gRPCStdioStreamStdioServer) Send(m *StdioData) error {
   130  	return x.ServerStream.SendMsg(m)
   131  }
   132  
   133  // GRPCStdio_ServiceDesc is the grpc.ServiceDesc for GRPCStdio service.
   134  // It's only intended for direct use with grpc.RegisterService,
   135  // and not to be introspected or modified (even as a copy)
   136  var GRPCStdio_ServiceDesc = grpc.ServiceDesc{
   137  	ServiceName: "plugin.GRPCStdio",
   138  	HandlerType: (*GRPCStdioServer)(nil),
   139  	Methods:     []grpc.MethodDesc{},
   140  	Streams: []grpc.StreamDesc{
   141  		{
   142  			StreamName:    "StreamStdio",
   143  			Handler:       _GRPCStdio_StreamStdio_Handler,
   144  			ServerStreams: true,
   145  		},
   146  	},
   147  	Metadata: "internal/plugin/grpc_stdio.proto",
   148  }