api

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_mocking_service_proto protoreflect.FileDescriptor
View Source
var MockingService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "grpcditto.api.MockingService",
	HandlerType: (*MockingServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "AddMock",
			Handler:    _MockingService_AddMock_Handler,
		},
		{
			MethodName: "Clear",
			Handler:    _MockingService_Clear_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "mocking_service.proto",
}

MockingService_ServiceDesc is the grpc.ServiceDesc for MockingService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterMockingServiceServer

func RegisterMockingServiceServer(s grpc.ServiceRegistrar, srv MockingServiceServer)

Types

type AddMockRequest

type AddMockRequest struct {
	Mock *DittoMock `protobuf:"bytes,1,opt,name=mock,proto3" json:"mock,omitempty"`
	// contains filtered or unexported fields
}

func (*AddMockRequest) Descriptor deprecated

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

Deprecated: Use AddMockRequest.ProtoReflect.Descriptor instead.

func (*AddMockRequest) GetMock

func (x *AddMockRequest) GetMock() *DittoMock

func (*AddMockRequest) ProtoMessage

func (*AddMockRequest) ProtoMessage()

func (*AddMockRequest) ProtoReflect

func (x *AddMockRequest) ProtoReflect() protoreflect.Message

func (*AddMockRequest) Reset

func (x *AddMockRequest) Reset()

func (*AddMockRequest) String

func (x *AddMockRequest) String() string

type AddMockResponse

type AddMockResponse struct {
	// contains filtered or unexported fields
}

func (*AddMockResponse) Descriptor deprecated

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

Deprecated: Use AddMockResponse.ProtoReflect.Descriptor instead.

func (*AddMockResponse) ProtoMessage

func (*AddMockResponse) ProtoMessage()

func (*AddMockResponse) ProtoReflect

func (x *AddMockResponse) ProtoReflect() protoreflect.Message

func (*AddMockResponse) Reset

func (x *AddMockResponse) Reset()

func (*AddMockResponse) String

func (x *AddMockResponse) String() string

type ClearRequest

type ClearRequest struct {
	// contains filtered or unexported fields
}

func (*ClearRequest) Descriptor deprecated

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

Deprecated: Use ClearRequest.ProtoReflect.Descriptor instead.

func (*ClearRequest) ProtoMessage

func (*ClearRequest) ProtoMessage()

func (*ClearRequest) ProtoReflect

func (x *ClearRequest) ProtoReflect() protoreflect.Message

func (*ClearRequest) Reset

func (x *ClearRequest) Reset()

func (*ClearRequest) String

func (x *ClearRequest) String() string

type ClearResponse

type ClearResponse struct {
	// contains filtered or unexported fields
}

func (*ClearResponse) Descriptor deprecated

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

Deprecated: Use ClearResponse.ProtoReflect.Descriptor instead.

func (*ClearResponse) ProtoMessage

func (*ClearResponse) ProtoMessage()

func (*ClearResponse) ProtoReflect

func (x *ClearResponse) ProtoReflect() protoreflect.Message

func (*ClearResponse) Reset

func (x *ClearResponse) Reset()

func (*ClearResponse) String

func (x *ClearResponse) String() string

type DittoBodyPattern

type DittoBodyPattern struct {

	// Types that are assignable to Pattern:
	//
	//	*DittoBodyPattern_EqualToJson
	//	*DittoBodyPattern_MatchesJsonpath
	Pattern isDittoBodyPattern_Pattern `protobuf_oneof:"pattern"`
	// contains filtered or unexported fields
}

func (*DittoBodyPattern) Descriptor deprecated

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

Deprecated: Use DittoBodyPattern.ProtoReflect.Descriptor instead.

func (*DittoBodyPattern) GetEqualToJson

func (x *DittoBodyPattern) GetEqualToJson() *structpb.Struct

func (*DittoBodyPattern) GetMatchesJsonpath

func (x *DittoBodyPattern) GetMatchesJsonpath() *JSONPathPattern

func (*DittoBodyPattern) GetPattern

func (m *DittoBodyPattern) GetPattern() isDittoBodyPattern_Pattern

func (*DittoBodyPattern) ProtoMessage

func (*DittoBodyPattern) ProtoMessage()

func (*DittoBodyPattern) ProtoReflect

func (x *DittoBodyPattern) ProtoReflect() protoreflect.Message

func (*DittoBodyPattern) Reset

func (x *DittoBodyPattern) Reset()

func (*DittoBodyPattern) String

func (x *DittoBodyPattern) String() string

type DittoBodyPattern_EqualToJson

type DittoBodyPattern_EqualToJson struct {
	EqualToJson *structpb.Struct `protobuf:"bytes,1,opt,name=equal_to_json,json=equalToJson,proto3,oneof"`
}

type DittoBodyPattern_MatchesJsonpath

type DittoBodyPattern_MatchesJsonpath struct {
	MatchesJsonpath *JSONPathPattern `protobuf:"bytes,2,opt,name=matches_jsonpath,json=matchesJsonpath,proto3,oneof"`
}

type DittoMock

type DittoMock struct {
	Request  *DittoRequest    `protobuf:"bytes,1,opt,name=request,proto3" json:"request,omitempty"`
	Response []*DittoResponse `protobuf:"bytes,2,rep,name=response,proto3" json:"response,omitempty"`
	// contains filtered or unexported fields
}

func (*DittoMock) Descriptor deprecated

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

Deprecated: Use DittoMock.ProtoReflect.Descriptor instead.

func (*DittoMock) GetRequest

func (x *DittoMock) GetRequest() *DittoRequest

func (*DittoMock) GetResponse

func (x *DittoMock) GetResponse() []*DittoResponse

func (*DittoMock) ProtoMessage

func (*DittoMock) ProtoMessage()

func (*DittoMock) ProtoReflect

func (x *DittoMock) ProtoReflect() protoreflect.Message

func (*DittoMock) Reset

func (x *DittoMock) Reset()

func (*DittoMock) String

func (x *DittoMock) String() string

type DittoRequest

type DittoRequest struct {

	// fully qualified grpc method like “/package.full.name.UserService/Update“
	Method       string              `protobuf:"bytes,1,opt,name=method,proto3" json:"method,omitempty"`
	BodyPatterns []*DittoBodyPattern `protobuf:"bytes,2,rep,name=body_patterns,json=bodyPatterns,proto3" json:"body_patterns,omitempty"`
	// contains filtered or unexported fields
}

DittoRequest represents request matching object. It matches requests first by method and then by patterns. All patterns must match in order for a request to match. If no matches are found the service will return “Unimplemented“ grpc error. If there multiple matches are found the first one is what gets returned, the other ones will be ignored.

func (*DittoRequest) Descriptor deprecated

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

Deprecated: Use DittoRequest.ProtoReflect.Descriptor instead.

func (*DittoRequest) GetBodyPatterns

func (x *DittoRequest) GetBodyPatterns() []*DittoBodyPattern

func (*DittoRequest) GetMethod

func (x *DittoRequest) GetMethod() string

func (*DittoRequest) ProtoMessage

func (*DittoRequest) ProtoMessage()

func (*DittoRequest) ProtoReflect

func (x *DittoRequest) ProtoReflect() protoreflect.Message

func (*DittoRequest) Reset

func (x *DittoRequest) Reset()

func (*DittoRequest) String

func (x *DittoRequest) String() string

type DittoResponse

type DittoResponse struct {

	// Types that are assignable to Response:
	//
	//	*DittoResponse_Body
	//	*DittoResponse_Status
	//	*DittoResponse_BodyTemplate
	Response isDittoResponse_Response `protobuf_oneof:"response"`
	// contains filtered or unexported fields
}

func (*DittoResponse) Descriptor deprecated

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

Deprecated: Use DittoResponse.ProtoReflect.Descriptor instead.

func (*DittoResponse) GetBody

func (x *DittoResponse) GetBody() *structpb.Struct

func (*DittoResponse) GetBodyTemplate added in v0.9.0

func (x *DittoResponse) GetBodyTemplate() string

func (*DittoResponse) GetResponse

func (m *DittoResponse) GetResponse() isDittoResponse_Response

func (*DittoResponse) GetStatus

func (x *DittoResponse) GetStatus() *RpcStatus

func (*DittoResponse) ProtoMessage

func (*DittoResponse) ProtoMessage()

func (*DittoResponse) ProtoReflect

func (x *DittoResponse) ProtoReflect() protoreflect.Message

func (*DittoResponse) Reset

func (x *DittoResponse) Reset()

func (*DittoResponse) String

func (x *DittoResponse) String() string

type DittoResponse_Body

type DittoResponse_Body struct {
	// Struct conveniently represents any object that doesn't have a strict schema
	Body *structpb.Struct `protobuf:"bytes,1,opt,name=body,proto3,oneof"`
}

type DittoResponse_BodyTemplate added in v0.9.0

type DittoResponse_BodyTemplate struct {
	// provide a go template to dynamically generate response,
	// yaml and json are supported inside of the template
	BodyTemplate string `protobuf:"bytes,3,opt,name=body_template,json=bodyTemplate,proto3,oneof"`
}

type DittoResponse_Status

type DittoResponse_Status struct {
	Status *RpcStatus `protobuf:"bytes,2,opt,name=status,proto3,oneof"`
}

type JSONPathPattern

type JSONPathPattern struct {
	Expression string `protobuf:"bytes,1,opt,name=expression,proto3" json:"expression,omitempty"`
	// Types that are assignable to Operator:
	//
	//	*JSONPathPattern_Contains
	//	*JSONPathPattern_Eq
	//	*JSONPathPattern_Regexp
	Operator isJSONPathPattern_Operator `protobuf_oneof:"operator"`
	// contains filtered or unexported fields
}

JSONPath pattern supports JSONPath spec

Examples ^^^^^^^^

{ "expression": "$.message_type", "eq": "resource" } { "expression": "$.message_type", "contains": "re" } { "expression": "$.name", "regexp": "^callback[-]svc.*$" }

func (*JSONPathPattern) Descriptor deprecated

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

Deprecated: Use JSONPathPattern.ProtoReflect.Descriptor instead.

func (*JSONPathPattern) GetContains

func (x *JSONPathPattern) GetContains() string

func (*JSONPathPattern) GetEq

func (x *JSONPathPattern) GetEq() string

func (*JSONPathPattern) GetExpression

func (x *JSONPathPattern) GetExpression() string

func (*JSONPathPattern) GetOperator

func (m *JSONPathPattern) GetOperator() isJSONPathPattern_Operator

func (*JSONPathPattern) GetRegexp

func (x *JSONPathPattern) GetRegexp() string

func (*JSONPathPattern) ProtoMessage

func (*JSONPathPattern) ProtoMessage()

func (*JSONPathPattern) ProtoReflect

func (x *JSONPathPattern) ProtoReflect() protoreflect.Message

func (*JSONPathPattern) Reset

func (x *JSONPathPattern) Reset()

func (*JSONPathPattern) String

func (x *JSONPathPattern) String() string

type JSONPathPattern_Contains

type JSONPathPattern_Contains struct {
	Contains string `protobuf:"bytes,2,opt,name=contains,proto3,oneof"`
}

type JSONPathPattern_Eq

type JSONPathPattern_Eq struct {
	Eq string `protobuf:"bytes,3,opt,name=eq,proto3,oneof"`
}

type JSONPathPattern_Regexp

type JSONPathPattern_Regexp struct {
	Regexp string `protobuf:"bytes,4,opt,name=regexp,proto3,oneof"`
}

type MockingServiceClient

type MockingServiceClient interface {
	// AddMock adds new mock to the server
	AddMock(ctx context.Context, in *AddMockRequest, opts ...grpc.CallOption) (*AddMockResponse, error)
	// Delete all mocks
	Clear(ctx context.Context, in *ClearRequest, opts ...grpc.CallOption) (*ClearResponse, error)
}

MockingServiceClient is the client API for MockingService service.

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.

type MockingServiceServer

type MockingServiceServer interface {
	// AddMock adds new mock to the server
	AddMock(context.Context, *AddMockRequest) (*AddMockResponse, error)
	// Delete all mocks
	Clear(context.Context, *ClearRequest) (*ClearResponse, error)
	// contains filtered or unexported methods
}

MockingServiceServer is the server API for MockingService service. All implementations must embed UnimplementedMockingServiceServer for forward compatibility

type RpcStatus

type RpcStatus struct {
	Code    code.Code `protobuf:"varint,1,opt,name=code,proto3,enum=google.rpc.Code" json:"code,omitempty"`
	Message string    `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
	// contains filtered or unexported fields
}

func (*RpcStatus) Descriptor deprecated

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

Deprecated: Use RpcStatus.ProtoReflect.Descriptor instead.

func (*RpcStatus) GetCode

func (x *RpcStatus) GetCode() code.Code

func (*RpcStatus) GetMessage

func (x *RpcStatus) GetMessage() string

func (*RpcStatus) ProtoMessage

func (*RpcStatus) ProtoMessage()

func (*RpcStatus) ProtoReflect

func (x *RpcStatus) ProtoReflect() protoreflect.Message

func (*RpcStatus) Reset

func (x *RpcStatus) Reset()

func (*RpcStatus) String

func (x *RpcStatus) String() string

type UnimplementedMockingServiceServer

type UnimplementedMockingServiceServer struct {
}

UnimplementedMockingServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedMockingServiceServer) AddMock

func (UnimplementedMockingServiceServer) Clear

type UnsafeMockingServiceServer

type UnsafeMockingServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeMockingServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to MockingServiceServer will result in compilation errors.

Jump to

Keyboard shortcuts

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