...

Source file src/cloud.google.com/go/auth/grpctransport/testdata/echo_grpc.pb.go

Documentation: cloud.google.com/go/auth/grpctransport/testdata

     1  // Copyright 2023 Google LLC
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //      http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
    16  // versions:
    17  // - protoc-gen-go-grpc v1.3.0
    18  // - protoc             v4.24.2
    19  // source: echo.proto
    20  
    21  package echo
    22  
    23  import (
    24  	context "context"
    25  
    26  	grpc "google.golang.org/grpc"
    27  	codes "google.golang.org/grpc/codes"
    28  	status "google.golang.org/grpc/status"
    29  )
    30  
    31  // This is a compile-time assertion to ensure that this generated file
    32  // is compatible with the grpc package it is being compiled against.
    33  // Requires gRPC-Go v1.32.0 or later.
    34  const _ = grpc.SupportPackageIsVersion7
    35  
    36  const (
    37  	Echoer_Echo_FullMethodName = "/echo.Echoer/Echo"
    38  )
    39  
    40  // EchoerClient is the client API for Echoer 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 EchoerClient interface {
    44  	Echo(ctx context.Context, in *EchoRequest, opts ...grpc.CallOption) (*EchoReply, error)
    45  }
    46  
    47  type echoerClient struct {
    48  	cc grpc.ClientConnInterface
    49  }
    50  
    51  func NewEchoerClient(cc grpc.ClientConnInterface) EchoerClient {
    52  	return &echoerClient{cc}
    53  }
    54  
    55  func (c *echoerClient) Echo(ctx context.Context, in *EchoRequest, opts ...grpc.CallOption) (*EchoReply, error) {
    56  	out := new(EchoReply)
    57  	err := c.cc.Invoke(ctx, Echoer_Echo_FullMethodName, in, out, opts...)
    58  	if err != nil {
    59  		return nil, err
    60  	}
    61  	return out, nil
    62  }
    63  
    64  // EchoerServer is the server API for Echoer service.
    65  // All implementations must embed UnimplementedEchoerServer
    66  // for forward compatibility
    67  type EchoerServer interface {
    68  	Echo(context.Context, *EchoRequest) (*EchoReply, error)
    69  	mustEmbedUnimplementedEchoerServer()
    70  }
    71  
    72  // UnimplementedEchoerServer must be embedded to have forward compatible implementations.
    73  type UnimplementedEchoerServer struct {
    74  }
    75  
    76  func (UnimplementedEchoerServer) Echo(context.Context, *EchoRequest) (*EchoReply, error) {
    77  	return nil, status.Errorf(codes.Unimplemented, "method Echo not implemented")
    78  }
    79  func (UnimplementedEchoerServer) mustEmbedUnimplementedEchoerServer() {}
    80  
    81  // UnsafeEchoerServer may be embedded to opt out of forward compatibility for this service.
    82  // Use of this interface is not recommended, as added methods to EchoerServer will
    83  // result in compilation errors.
    84  type UnsafeEchoerServer interface {
    85  	mustEmbedUnimplementedEchoerServer()
    86  }
    87  
    88  func RegisterEchoerServer(s grpc.ServiceRegistrar, srv EchoerServer) {
    89  	s.RegisterService(&Echoer_ServiceDesc, srv)
    90  }
    91  
    92  func _Echoer_Echo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
    93  	in := new(EchoRequest)
    94  	if err := dec(in); err != nil {
    95  		return nil, err
    96  	}
    97  	if interceptor == nil {
    98  		return srv.(EchoerServer).Echo(ctx, in)
    99  	}
   100  	info := &grpc.UnaryServerInfo{
   101  		Server:     srv,
   102  		FullMethod: Echoer_Echo_FullMethodName,
   103  	}
   104  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   105  		return srv.(EchoerServer).Echo(ctx, req.(*EchoRequest))
   106  	}
   107  	return interceptor(ctx, in, info, handler)
   108  }
   109  
   110  // Echoer_ServiceDesc is the grpc.ServiceDesc for Echoer service.
   111  // It's only intended for direct use with grpc.RegisterService,
   112  // and not to be introspected or modified (even as a copy)
   113  var Echoer_ServiceDesc = grpc.ServiceDesc{
   114  	ServiceName: "echo.Echoer",
   115  	HandlerType: (*EchoerServer)(nil),
   116  	Methods: []grpc.MethodDesc{
   117  		{
   118  			MethodName: "Echo",
   119  			Handler:    _Echoer_Echo_Handler,
   120  		},
   121  	},
   122  	Streams:  []grpc.StreamDesc{},
   123  	Metadata: "echo.proto",
   124  }
   125  

View as plain text