grpc_mock_api

package
v2.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 25, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package grpc_mock_api is a generated protocol buffer package.

It is generated from these files:

mock.proto

It has these top-level messages:

AddStubsRequest
AddStubsResponse
FindStubsRequest
FindStubsResponse
DeleteStubsRequest
DeleteStubsResponse
Stub
Input
Output

Package grpc_mock_api is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterMockHandler

func RegisterMockHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterMockHandler registers the http handlers for service Mock to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterMockHandlerClient

func RegisterMockHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MockClient) error

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

func RegisterMockHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MockServer) error

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.

func RegisterMockServer

func RegisterMockServer(s *grpc.Server, srv MockServer)

Types

type AddStubsRequest

type AddStubsRequest struct {
	Stubs []*Stub `protobuf:"bytes,1,rep,name=stubs" json:"stubs,omitempty"`
}

func (*AddStubsRequest) Descriptor

func (*AddStubsRequest) Descriptor() ([]byte, []int)

func (*AddStubsRequest) GetStubs

func (m *AddStubsRequest) GetStubs() []*Stub

func (*AddStubsRequest) ProtoMessage

func (*AddStubsRequest) ProtoMessage()

func (*AddStubsRequest) Reset

func (m *AddStubsRequest) Reset()

func (*AddStubsRequest) String

func (m *AddStubsRequest) String() string

type AddStubsResponse

type AddStubsResponse struct {
}

func (*AddStubsResponse) Descriptor

func (*AddStubsResponse) Descriptor() ([]byte, []int)

func (*AddStubsResponse) ProtoMessage

func (*AddStubsResponse) ProtoMessage()

func (*AddStubsResponse) Reset

func (m *AddStubsResponse) Reset()

func (*AddStubsResponse) String

func (m *AddStubsResponse) String() string

type DeleteStubsRequest

type DeleteStubsRequest struct {
	Service string `protobuf:"bytes,1,opt,name=service" json:"service,omitempty"`
	Method  string `protobuf:"bytes,2,opt,name=method" json:"method,omitempty"`
}

func (*DeleteStubsRequest) Descriptor

func (*DeleteStubsRequest) Descriptor() ([]byte, []int)

func (*DeleteStubsRequest) GetMethod

func (m *DeleteStubsRequest) GetMethod() string

func (*DeleteStubsRequest) GetService

func (m *DeleteStubsRequest) GetService() string

func (*DeleteStubsRequest) ProtoMessage

func (*DeleteStubsRequest) ProtoMessage()

func (*DeleteStubsRequest) Reset

func (m *DeleteStubsRequest) Reset()

func (*DeleteStubsRequest) String

func (m *DeleteStubsRequest) String() string

type DeleteStubsResponse

type DeleteStubsResponse struct {
}

func (*DeleteStubsResponse) Descriptor

func (*DeleteStubsResponse) Descriptor() ([]byte, []int)

func (*DeleteStubsResponse) ProtoMessage

func (*DeleteStubsResponse) ProtoMessage()

func (*DeleteStubsResponse) Reset

func (m *DeleteStubsResponse) Reset()

func (*DeleteStubsResponse) String

func (m *DeleteStubsResponse) String() string

type FindStubsRequest

type FindStubsRequest struct {
	Service string                   `protobuf:"bytes,1,opt,name=service" json:"service,omitempty"`
	Method  string                   `protobuf:"bytes,2,opt,name=method" json:"method,omitempty"`
	In      *google_protobuf1.Struct `protobuf:"bytes,3,opt,name=in" json:"in,omitempty"`
}

func (*FindStubsRequest) Descriptor

func (*FindStubsRequest) Descriptor() ([]byte, []int)

func (*FindStubsRequest) GetIn

func (*FindStubsRequest) GetMethod

func (m *FindStubsRequest) GetMethod() string

func (*FindStubsRequest) GetService

func (m *FindStubsRequest) GetService() string

func (*FindStubsRequest) ProtoMessage

func (*FindStubsRequest) ProtoMessage()

func (*FindStubsRequest) Reset

func (m *FindStubsRequest) Reset()

func (*FindStubsRequest) String

func (m *FindStubsRequest) String() string

type FindStubsResponse

type FindStubsResponse struct {
	Stubs []*Stub `protobuf:"bytes,1,rep,name=stubs" json:"stubs,omitempty"`
}

func (*FindStubsResponse) Descriptor

func (*FindStubsResponse) Descriptor() ([]byte, []int)

func (*FindStubsResponse) GetStubs

func (m *FindStubsResponse) GetStubs() []*Stub

func (*FindStubsResponse) ProtoMessage

func (*FindStubsResponse) ProtoMessage()

func (*FindStubsResponse) Reset

func (m *FindStubsResponse) Reset()

func (*FindStubsResponse) String

func (m *FindStubsResponse) String() string

type Input

type Input struct {
	// Types that are valid to be assigned to Rule:
	//	*Input_Equals
	//	*Input_Contains
	//	*Input_Matches
	Rule isInput_Rule `protobuf_oneof:"rule"`
}

func (*Input) Descriptor

func (*Input) Descriptor() ([]byte, []int)

func (*Input) GetContains

func (m *Input) GetContains() *google_protobuf1.Struct

func (*Input) GetEquals

func (m *Input) GetEquals() *google_protobuf1.Struct

func (*Input) GetMatches

func (m *Input) GetMatches() *google_protobuf1.Struct

func (*Input) GetRule

func (m *Input) GetRule() isInput_Rule

func (*Input) ProtoMessage

func (*Input) ProtoMessage()

func (*Input) Reset

func (m *Input) Reset()

func (*Input) String

func (m *Input) String() string

func (*Input) XXX_OneofFuncs

func (*Input) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{})

XXX_OneofFuncs is for the internal use of the proto package.

type Input_Contains

type Input_Contains struct {
	Contains *google_protobuf1.Struct `protobuf:"bytes,2,opt,name=contains,oneof"`
}

type Input_Equals

type Input_Equals struct {
	Equals *google_protobuf1.Struct `protobuf:"bytes,1,opt,name=equals,oneof"`
}

type Input_Matches

type Input_Matches struct {
	Matches *google_protobuf1.Struct `protobuf:"bytes,3,opt,name=matches,oneof"`
}

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)
}

func NewMockClient

func NewMockClient(cc *grpc.ClientConn) MockClient

type Output

type Output struct {
	Data  *google_protobuf1.Struct `protobuf:"bytes,1,opt,name=data" json:"data,omitempty"`
	Code  int32                    `protobuf:"varint,2,opt,name=code" json:"code,omitempty"`
	Error string                   `protobuf:"bytes,3,opt,name=error" json:"error,omitempty"`
}

func (*Output) Descriptor

func (*Output) Descriptor() ([]byte, []int)

func (*Output) GetCode

func (m *Output) GetCode() int32

func (*Output) GetData

func (m *Output) GetData() *google_protobuf1.Struct

func (*Output) GetError

func (m *Output) GetError() string

func (*Output) ProtoMessage

func (*Output) ProtoMessage()

func (*Output) Reset

func (m *Output) Reset()

func (*Output) String

func (m *Output) String() string

type Stub

type Stub struct {
	Service string  `protobuf:"bytes,1,opt,name=service" json:"service,omitempty"`
	Method  string  `protobuf:"bytes,2,opt,name=method" json:"method,omitempty"`
	In      *Input  `protobuf:"bytes,3,opt,name=in" json:"in,omitempty"`
	Out     *Output `protobuf:"bytes,4,opt,name=out" json:"out,omitempty"`
}

func (*Stub) Descriptor

func (*Stub) Descriptor() ([]byte, []int)

func (*Stub) GetIn

func (m *Stub) GetIn() *Input

func (*Stub) GetMethod

func (m *Stub) GetMethod() string

func (*Stub) GetOut

func (m *Stub) GetOut() *Output

func (*Stub) GetService

func (m *Stub) GetService() string

func (*Stub) ProtoMessage

func (*Stub) ProtoMessage()

func (*Stub) Reset

func (m *Stub) Reset()

func (*Stub) String

func (m *Stub) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL