Rename gRPC request forwarding method

This commit is contained in:
Jeff Mitchell 2017-01-06 17:08:43 -05:00
parent 681e36c4af
commit 336dfed5c3
3 changed files with 18 additions and 18 deletions

View File

@ -307,7 +307,7 @@ func (c *Core) ForwardRequest(req *http.Request) (int, http.Header, []byte, erro
c.logger.Error("core/ForwardRequest: got nil forwarding RPC request")
return 0, nil, nil, fmt.Errorf("got nil forwarding RPC request")
}
resp, err := c.rpcForwardingClient.HandleRequest(context.Background(), freq, grpc.FailFast(true))
resp, err := c.rpcForwardingClient.ForwardRequest(context.Background(), freq, grpc.FailFast(true))
if err != nil {
c.logger.Error("core/ForwardRequest: error during forwarded RPC request", "error", err)
return 0, nil, nil, fmt.Errorf("error during forwarding RPC request")
@ -354,7 +354,7 @@ type forwardedRequestRPCServer struct {
handler http.Handler
}
func (s *forwardedRequestRPCServer) HandleRequest(ctx context.Context, freq *forwarding.Request) (*forwarding.Response, error) {
func (s *forwardedRequestRPCServer) ForwardRequest(ctx context.Context, freq *forwarding.Request) (*forwarding.Response, error) {
// Parse an http.Request out of it
req, err := forwarding.ParseForwardedRequest(freq)
if err != nil {

View File

@ -44,7 +44,7 @@ const _ = grpc.SupportPackageIsVersion4
// Client API for RequestForwarding service
type RequestForwardingClient interface {
HandleRequest(ctx context.Context, in *forwarding.Request, opts ...grpc.CallOption) (*forwarding.Response, error)
ForwardRequest(ctx context.Context, in *forwarding.Request, opts ...grpc.CallOption) (*forwarding.Response, error)
}
type requestForwardingClient struct {
@ -55,9 +55,9 @@ func NewRequestForwardingClient(cc *grpc.ClientConn) RequestForwardingClient {
return &requestForwardingClient{cc}
}
func (c *requestForwardingClient) HandleRequest(ctx context.Context, in *forwarding.Request, opts ...grpc.CallOption) (*forwarding.Response, error) {
func (c *requestForwardingClient) ForwardRequest(ctx context.Context, in *forwarding.Request, opts ...grpc.CallOption) (*forwarding.Response, error) {
out := new(forwarding.Response)
err := grpc.Invoke(ctx, "/vault.RequestForwarding/HandleRequest", in, out, c.cc, opts...)
err := grpc.Invoke(ctx, "/vault.RequestForwarding/ForwardRequest", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
@ -67,27 +67,27 @@ func (c *requestForwardingClient) HandleRequest(ctx context.Context, in *forward
// Server API for RequestForwarding service
type RequestForwardingServer interface {
HandleRequest(context.Context, *forwarding.Request) (*forwarding.Response, error)
ForwardRequest(context.Context, *forwarding.Request) (*forwarding.Response, error)
}
func RegisterRequestForwardingServer(s *grpc.Server, srv RequestForwardingServer) {
s.RegisterService(&_RequestForwarding_serviceDesc, srv)
}
func _RequestForwarding_HandleRequest_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
func _RequestForwarding_ForwardRequest_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(forwarding.Request)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(RequestForwardingServer).HandleRequest(ctx, in)
return srv.(RequestForwardingServer).ForwardRequest(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/vault.RequestForwarding/HandleRequest",
FullMethod: "/vault.RequestForwarding/ForwardRequest",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(RequestForwardingServer).HandleRequest(ctx, req.(*forwarding.Request))
return srv.(RequestForwardingServer).ForwardRequest(ctx, req.(*forwarding.Request))
}
return interceptor(ctx, in, info, handler)
}
@ -97,8 +97,8 @@ var _RequestForwarding_serviceDesc = grpc.ServiceDesc{
HandlerType: (*RequestForwardingServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "HandleRequest",
Handler: _RequestForwarding_HandleRequest_Handler,
MethodName: "ForwardRequest",
Handler: _RequestForwarding_ForwardRequest_Handler,
},
},
Streams: []grpc.StreamDesc{},
@ -108,15 +108,15 @@ var _RequestForwarding_serviceDesc = grpc.ServiceDesc{
func init() { proto.RegisterFile("request_forwarding_service.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{
// 155 bytes of a gzipped FileDescriptorProto
// 151 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x52, 0x28, 0x4a, 0x2d, 0x2c,
0x4d, 0x2d, 0x2e, 0x89, 0x4f, 0xcb, 0x2f, 0x2a, 0x4f, 0x2c, 0x4a, 0xc9, 0xcc, 0x4b, 0x8f, 0x2f,
0x4e, 0x2d, 0x2a, 0xcb, 0x4c, 0x4e, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x2d, 0x4b,
0x2c, 0xcd, 0x29, 0x91, 0xb2, 0x48, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5,
0xcf, 0x48, 0x2c, 0xce, 0xc8, 0x4c, 0xce, 0x2f, 0x2a, 0xd0, 0x07, 0xcb, 0xe9, 0x67, 0xa4, 0xe6,
0x14, 0xa4, 0x16, 0xe9, 0x23, 0x8c, 0xd0, 0x2f, 0xa9, 0x2c, 0x48, 0x2d, 0x86, 0x18, 0x60, 0x14,
0xc8, 0x25, 0x18, 0x04, 0xb1, 0xc4, 0x0d, 0xae, 0x40, 0xc8, 0x86, 0x8b, 0xd7, 0x23, 0x31, 0x2f,
0x25, 0x27, 0x15, 0x2a, 0x25, 0x24, 0xac, 0x87, 0xd0, 0xae, 0x07, 0x15, 0x94, 0x12, 0x41, 0x15,
0x2c, 0x2e, 0xc8, 0xcf, 0x2b, 0x4e, 0x55, 0x62, 0x48, 0x62, 0x03, 0x9b, 0x6c, 0x0c, 0x08, 0x00,
0x00, 0xff, 0xff, 0xc9, 0x1b, 0xdb, 0x52, 0xbe, 0x00, 0x00, 0x00,
0xc4, 0x25, 0x18, 0x04, 0xb1, 0xc4, 0x0d, 0xae, 0x40, 0xc8, 0x96, 0x8b, 0x0f, 0xca, 0x83, 0xca,
0x09, 0x09, 0xeb, 0x21, 0xf4, 0xeb, 0x41, 0x05, 0xa5, 0x44, 0x50, 0x05, 0x8b, 0x0b, 0xf2, 0xf3,
0x8a, 0x53, 0x95, 0x18, 0x92, 0xd8, 0xc0, 0x46, 0x1b, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0x81,
0xce, 0x3f, 0x7f, 0xbf, 0x00, 0x00, 0x00,
}

View File

@ -5,5 +5,5 @@ import "github.com/hashicorp/vault/helper/forwarding/types.proto";
package vault;
service RequestForwarding {
rpc HandleRequest(forwarding.Request) returns (forwarding.Response) {}
rpc ForwardRequest(forwarding.Request) returns (forwarding.Response) {}
}