Documentation ¶
Overview ¶
Package grpc_mock_api is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterMockHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterMockHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MockClient) error
- func RegisterMockHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterMockHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MockServer) error
- func RegisterMockServer(s *grpc.Server, srv MockServer)
- type AddStubsRequest
- type AddStubsResponse
- type DeleteStubsRequest
- func (*DeleteStubsRequest) Descriptor() ([]byte, []int)deprecated
- func (x *DeleteStubsRequest) GetMethod() string
- func (x *DeleteStubsRequest) GetService() string
- func (*DeleteStubsRequest) ProtoMessage()
- func (x *DeleteStubsRequest) ProtoReflect() protoreflect.Message
- func (x *DeleteStubsRequest) Reset()
- func (x *DeleteStubsRequest) String() string
- type DeleteStubsResponse
- type FindStubsRequest
- func (*FindStubsRequest) Descriptor() ([]byte, []int)deprecated
- func (x *FindStubsRequest) GetIn() *structpb.Struct
- func (x *FindStubsRequest) GetMethod() string
- func (x *FindStubsRequest) GetService() string
- func (*FindStubsRequest) ProtoMessage()
- func (x *FindStubsRequest) ProtoReflect() protoreflect.Message
- func (x *FindStubsRequest) Reset()
- func (x *FindStubsRequest) String() string
- type FindStubsResponse
- type Input
- func (*Input) Descriptor() ([]byte, []int)deprecated
- func (x *Input) GetContains() *structpb.Struct
- func (x *Input) GetEquals() *structpb.Struct
- func (x *Input) GetMatches() *structpb.Struct
- func (m *Input) GetRule() isInput_Rule
- func (*Input) ProtoMessage()
- func (x *Input) ProtoReflect() protoreflect.Message
- func (x *Input) Reset()
- func (x *Input) String() string
- type Input_Contains
- type Input_Equals
- type Input_Matches
- type MockClient
- type MockServer
- type Output
- func (*Output) Descriptor() ([]byte, []int)deprecated
- func (x *Output) GetCode() int32
- func (x *Output) GetData() *structpb.Struct
- func (x *Output) GetError() string
- func (*Output) ProtoMessage()
- func (x *Output) ProtoReflect() protoreflect.Message
- func (x *Output) Reset()
- func (x *Output) String() string
- type Stub
- func (*Stub) Descriptor() ([]byte, []int)deprecated
- func (x *Stub) GetIn() *Input
- func (x *Stub) GetMethod() string
- func (x *Stub) GetOut() *Output
- func (x *Stub) GetService() string
- func (*Stub) ProtoMessage()
- func (x *Stub) ProtoReflect() protoreflect.Message
- func (x *Stub) Reset()
- func (x *Stub) String() string
- type UnimplementedMockServer
- func (*UnimplementedMockServer) AddStubs(context.Context, *AddStubsRequest) (*AddStubsResponse, error)
- func (*UnimplementedMockServer) DeleteStubs(context.Context, *DeleteStubsRequest) (*DeleteStubsResponse, error)
- func (*UnimplementedMockServer) FindStubs(context.Context, *FindStubsRequest) (*FindStubsResponse, error)
Constants ¶
This section is empty.
Variables ¶
var File_mock_proto protoreflect.FileDescriptor
Functions ¶
func RegisterMockHandler ¶
RegisterMockHandler registers the http handlers for service Mock to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterMockHandlerClient ¶
RegisterMockHandlerClient registers the http handlers for service Mock to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "MockClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "MockClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "MockClient" to call the correct interceptors.
func RegisterMockHandlerFromEndpoint ¶
func RegisterMockHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterMockHandlerFromEndpoint is same as RegisterMockHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterMockHandlerServer ¶
RegisterMockHandlerServer registers the http handlers for service Mock to "mux". UnaryRPC :call MockServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterMockHandlerFromEndpoint instead.
func RegisterMockServer ¶
func RegisterMockServer(s *grpc.Server, srv MockServer)
Types ¶
type AddStubsRequest ¶
type AddStubsRequest struct { Stubs []*Stub `protobuf:"bytes,1,rep,name=stubs,proto3" json:"stubs,omitempty"` // contains filtered or unexported fields }
func (*AddStubsRequest) Descriptor
deprecated
func (*AddStubsRequest) Descriptor() ([]byte, []int)
Deprecated: Use AddStubsRequest.ProtoReflect.Descriptor instead.
func (*AddStubsRequest) GetStubs ¶
func (x *AddStubsRequest) GetStubs() []*Stub
func (*AddStubsRequest) ProtoMessage ¶
func (*AddStubsRequest) ProtoMessage()
func (*AddStubsRequest) ProtoReflect ¶
func (x *AddStubsRequest) ProtoReflect() protoreflect.Message
func (*AddStubsRequest) Reset ¶
func (x *AddStubsRequest) Reset()
func (*AddStubsRequest) String ¶
func (x *AddStubsRequest) String() string
type AddStubsResponse ¶
type AddStubsResponse struct {
// contains filtered or unexported fields
}
func (*AddStubsResponse) Descriptor
deprecated
func (*AddStubsResponse) Descriptor() ([]byte, []int)
Deprecated: Use AddStubsResponse.ProtoReflect.Descriptor instead.
func (*AddStubsResponse) ProtoMessage ¶
func (*AddStubsResponse) ProtoMessage()
func (*AddStubsResponse) ProtoReflect ¶
func (x *AddStubsResponse) ProtoReflect() protoreflect.Message
func (*AddStubsResponse) Reset ¶
func (x *AddStubsResponse) Reset()
func (*AddStubsResponse) String ¶
func (x *AddStubsResponse) String() string
type DeleteStubsRequest ¶
type DeleteStubsRequest struct { Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"` Method string `protobuf:"bytes,2,opt,name=method,proto3" json:"method,omitempty"` // contains filtered or unexported fields }
func (*DeleteStubsRequest) Descriptor
deprecated
func (*DeleteStubsRequest) Descriptor() ([]byte, []int)
Deprecated: Use DeleteStubsRequest.ProtoReflect.Descriptor instead.
func (*DeleteStubsRequest) GetMethod ¶
func (x *DeleteStubsRequest) GetMethod() string
func (*DeleteStubsRequest) GetService ¶
func (x *DeleteStubsRequest) GetService() string
func (*DeleteStubsRequest) ProtoMessage ¶
func (*DeleteStubsRequest) ProtoMessage()
func (*DeleteStubsRequest) ProtoReflect ¶
func (x *DeleteStubsRequest) ProtoReflect() protoreflect.Message
func (*DeleteStubsRequest) Reset ¶
func (x *DeleteStubsRequest) Reset()
func (*DeleteStubsRequest) String ¶
func (x *DeleteStubsRequest) String() string
type DeleteStubsResponse ¶
type DeleteStubsResponse struct {
// contains filtered or unexported fields
}
func (*DeleteStubsResponse) Descriptor
deprecated
func (*DeleteStubsResponse) Descriptor() ([]byte, []int)
Deprecated: Use DeleteStubsResponse.ProtoReflect.Descriptor instead.
func (*DeleteStubsResponse) ProtoMessage ¶
func (*DeleteStubsResponse) ProtoMessage()
func (*DeleteStubsResponse) ProtoReflect ¶
func (x *DeleteStubsResponse) ProtoReflect() protoreflect.Message
func (*DeleteStubsResponse) Reset ¶
func (x *DeleteStubsResponse) Reset()
func (*DeleteStubsResponse) String ¶
func (x *DeleteStubsResponse) String() string
type FindStubsRequest ¶
type FindStubsRequest struct { Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"` Method string `protobuf:"bytes,2,opt,name=method,proto3" json:"method,omitempty"` In *structpb.Struct `protobuf:"bytes,3,opt,name=in,proto3" json:"in,omitempty"` // contains filtered or unexported fields }
func (*FindStubsRequest) Descriptor
deprecated
func (*FindStubsRequest) Descriptor() ([]byte, []int)
Deprecated: Use FindStubsRequest.ProtoReflect.Descriptor instead.
func (*FindStubsRequest) GetIn ¶
func (x *FindStubsRequest) GetIn() *structpb.Struct
func (*FindStubsRequest) GetMethod ¶
func (x *FindStubsRequest) GetMethod() string
func (*FindStubsRequest) GetService ¶
func (x *FindStubsRequest) GetService() string
func (*FindStubsRequest) ProtoMessage ¶
func (*FindStubsRequest) ProtoMessage()
func (*FindStubsRequest) ProtoReflect ¶
func (x *FindStubsRequest) ProtoReflect() protoreflect.Message
func (*FindStubsRequest) Reset ¶
func (x *FindStubsRequest) Reset()
func (*FindStubsRequest) String ¶
func (x *FindStubsRequest) String() string
type FindStubsResponse ¶
type FindStubsResponse struct { Stubs []*Stub `protobuf:"bytes,1,rep,name=stubs,proto3" json:"stubs,omitempty"` // contains filtered or unexported fields }
func (*FindStubsResponse) Descriptor
deprecated
func (*FindStubsResponse) Descriptor() ([]byte, []int)
Deprecated: Use FindStubsResponse.ProtoReflect.Descriptor instead.
func (*FindStubsResponse) GetStubs ¶
func (x *FindStubsResponse) GetStubs() []*Stub
func (*FindStubsResponse) ProtoMessage ¶
func (*FindStubsResponse) ProtoMessage()
func (*FindStubsResponse) ProtoReflect ¶
func (x *FindStubsResponse) ProtoReflect() protoreflect.Message
func (*FindStubsResponse) Reset ¶
func (x *FindStubsResponse) Reset()
func (*FindStubsResponse) String ¶
func (x *FindStubsResponse) String() string
type Input ¶
type Input struct { // Types that are assignable to Rule: // *Input_Equals // *Input_Contains // *Input_Matches Rule isInput_Rule `protobuf_oneof:"rule"` // contains filtered or unexported fields }
func (*Input) Descriptor
deprecated
func (*Input) GetContains ¶
func (*Input) GetMatches ¶
func (*Input) ProtoMessage ¶
func (*Input) ProtoMessage()
func (*Input) ProtoReflect ¶
func (x *Input) ProtoReflect() protoreflect.Message
type Input_Contains ¶
type Input_Equals ¶
type Input_Matches ¶
type MockClient ¶
type MockClient interface { AddStubs(ctx context.Context, in *AddStubsRequest, opts ...grpc.CallOption) (*AddStubsResponse, error) FindStubs(ctx context.Context, in *FindStubsRequest, opts ...grpc.CallOption) (*FindStubsResponse, error) DeleteStubs(ctx context.Context, in *DeleteStubsRequest, opts ...grpc.CallOption) (*DeleteStubsResponse, error) }
MockClient is the client API for Mock service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewMockClient ¶
func NewMockClient(cc grpc.ClientConnInterface) MockClient
type MockServer ¶
type MockServer interface { AddStubs(context.Context, *AddStubsRequest) (*AddStubsResponse, error) FindStubs(context.Context, *FindStubsRequest) (*FindStubsResponse, error) DeleteStubs(context.Context, *DeleteStubsRequest) (*DeleteStubsResponse, error) }
MockServer is the server API for Mock service.
type Output ¶
type Output struct { Data *structpb.Struct `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` Code int32 `protobuf:"varint,2,opt,name=code,proto3" json:"code,omitempty"` Error string `protobuf:"bytes,3,opt,name=error,proto3" json:"error,omitempty"` // contains filtered or unexported fields }
func (*Output) Descriptor
deprecated
func (*Output) ProtoMessage ¶
func (*Output) ProtoMessage()
func (*Output) ProtoReflect ¶
func (x *Output) ProtoReflect() protoreflect.Message
type Stub ¶
type Stub struct { Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"` Method string `protobuf:"bytes,2,opt,name=method,proto3" json:"method,omitempty"` In *Input `protobuf:"bytes,3,opt,name=in,proto3" json:"in,omitempty"` Out *Output `protobuf:"bytes,4,opt,name=out,proto3" json:"out,omitempty"` // contains filtered or unexported fields }
func (*Stub) Descriptor
deprecated
func (*Stub) GetService ¶
func (*Stub) ProtoMessage ¶
func (*Stub) ProtoMessage()
func (*Stub) ProtoReflect ¶
func (x *Stub) ProtoReflect() protoreflect.Message
type UnimplementedMockServer ¶
type UnimplementedMockServer struct { }
UnimplementedMockServer can be embedded to have forward compatible implementations.
func (*UnimplementedMockServer) AddStubs ¶
func (*UnimplementedMockServer) AddStubs(context.Context, *AddStubsRequest) (*AddStubsResponse, error)
func (*UnimplementedMockServer) DeleteStubs ¶
func (*UnimplementedMockServer) DeleteStubs(context.Context, *DeleteStubsRequest) (*DeleteStubsResponse, error)
func (*UnimplementedMockServer) FindStubs ¶
func (*UnimplementedMockServer) FindStubs(context.Context, *FindStubsRequest) (*FindStubsResponse, error)