v1alpha1

package
Version: v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package v1alpha1 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

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. 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 DeleteMockAPIRequest

type DeleteMockAPIRequest struct {
	UniqueKey string `protobuf:"bytes,1,opt,name=uniqueKey,proto3" json:"uniqueKey,omitempty"`
	// contains filtered or unexported fields
}

func (*DeleteMockAPIRequest) Descriptor deprecated

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

Deprecated: Use DeleteMockAPIRequest.ProtoReflect.Descriptor instead.

func (*DeleteMockAPIRequest) GetUniqueKey

func (x *DeleteMockAPIRequest) GetUniqueKey() string

func (*DeleteMockAPIRequest) ProtoMessage

func (*DeleteMockAPIRequest) ProtoMessage()

func (*DeleteMockAPIRequest) ProtoReflect

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

func (*DeleteMockAPIRequest) Reset

func (x *DeleteMockAPIRequest) Reset()

func (*DeleteMockAPIRequest) String

func (x *DeleteMockAPIRequest) String() string

type DeleteMockAPIResponse

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

func (*DeleteMockAPIResponse) Descriptor deprecated

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

Deprecated: Use DeleteMockAPIResponse.ProtoReflect.Descriptor instead.

func (*DeleteMockAPIResponse) ProtoMessage

func (*DeleteMockAPIResponse) ProtoMessage()

func (*DeleteMockAPIResponse) ProtoReflect

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

func (*DeleteMockAPIResponse) Reset

func (x *DeleteMockAPIResponse) Reset()

func (*DeleteMockAPIResponse) String

func (x *DeleteMockAPIResponse) String() string

type ListMockAPIRequest

type ListMockAPIRequest struct {
	Keywords   string       `protobuf:"bytes,1,opt,name=keywords,proto3" json:"keywords,omitempty"`
	Pagination *ListOptions `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
	// contains filtered or unexported fields
}

func (*ListMockAPIRequest) Descriptor deprecated

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

Deprecated: Use ListMockAPIRequest.ProtoReflect.Descriptor instead.

func (*ListMockAPIRequest) GetKeywords

func (x *ListMockAPIRequest) GetKeywords() string

func (*ListMockAPIRequest) GetPagination

func (x *ListMockAPIRequest) GetPagination() *ListOptions

func (*ListMockAPIRequest) ProtoMessage

func (*ListMockAPIRequest) ProtoMessage()

func (*ListMockAPIRequest) ProtoReflect

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

func (*ListMockAPIRequest) Reset

func (x *ListMockAPIRequest) Reset()

func (*ListMockAPIRequest) String

func (x *ListMockAPIRequest) String() string

type ListMockAPIResponse

type ListMockAPIResponse struct {
	Data       []*MockAPI    `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty"`
	Pagination *ListResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"`
	// contains filtered or unexported fields
}

func (*ListMockAPIResponse) Descriptor deprecated

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

Deprecated: Use ListMockAPIResponse.ProtoReflect.Descriptor instead.

func (*ListMockAPIResponse) GetData

func (x *ListMockAPIResponse) GetData() []*MockAPI

func (*ListMockAPIResponse) GetPagination

func (x *ListMockAPIResponse) GetPagination() *ListResponse

func (*ListMockAPIResponse) ProtoMessage

func (*ListMockAPIResponse) ProtoMessage()

func (*ListMockAPIResponse) ProtoReflect

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

func (*ListMockAPIResponse) Reset

func (x *ListMockAPIResponse) Reset()

func (*ListMockAPIResponse) String

func (x *ListMockAPIResponse) String() string

type ListOptions

type ListOptions struct {
	Page  uint64 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"`
	Limit uint64 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"`
	// contains filtered or unexported fields
}

func (*ListOptions) Descriptor deprecated

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

Deprecated: Use ListOptions.ProtoReflect.Descriptor instead.

func (*ListOptions) GetLimit

func (x *ListOptions) GetLimit() uint64

func (*ListOptions) GetPage

func (x *ListOptions) GetPage() uint64

func (*ListOptions) ProtoMessage

func (*ListOptions) ProtoMessage()

func (*ListOptions) ProtoReflect

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

func (*ListOptions) Reset

func (x *ListOptions) Reset()

func (*ListOptions) String

func (x *ListOptions) String() string

type ListResponse

type ListResponse struct {
	Total uint64 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"`
	// contains filtered or unexported fields
}

func (*ListResponse) Descriptor deprecated

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

Deprecated: Use ListResponse.ProtoReflect.Descriptor instead.

func (*ListResponse) GetTotal

func (x *ListResponse) GetTotal() uint64

func (*ListResponse) ProtoMessage

func (*ListResponse) ProtoMessage()

func (*ListResponse) ProtoReflect

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

func (*ListResponse) Reset

func (x *ListResponse) Reset()

func (*ListResponse) String

func (x *ListResponse) String() string

type MockAPI

type MockAPI struct {
	UniqueKey string          `protobuf:"bytes,1,opt,name=uniqueKey,proto3" json:"uniqueKey,omitempty"`
	Path      string          `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"`
	Method    string          `protobuf:"bytes,3,opt,name=method,proto3" json:"method,omitempty"`
	Host      string          `protobuf:"bytes,4,opt,name=host,proto3" json:"host,omitempty"`
	Cases     []*MockAPI_Case `protobuf:"bytes,5,rep,name=cases,proto3" json:"cases,omitempty"`
	// contains filtered or unexported fields
}

* * [ Conditions ] ** Javascript: function (request: Request): bool {} ** Target: Header, Body, Query, Param ** Operator(WithNot): Exists, Contains, Equal, MatchRegexp, ><=, Match xxx|xxx|xxx|xxx --- * [ Placeholder ] {{ $request.header.userAgent }} {{ $request.body.xxxxx }} {{ $request.ip }} {{ $fake.nickname }} {{ $fake.phoneNumber }} lk {{ $fake.address }} {{ $fake.imageUrl }} Go Template ? ...

--- * [ Response ] Header Body Grpc Code Latency --- * //

func (*MockAPI) Descriptor deprecated

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

Deprecated: Use MockAPI.ProtoReflect.Descriptor instead.

func (*MockAPI) GetCases

func (x *MockAPI) GetCases() []*MockAPI_Case

func (*MockAPI) GetHost

func (x *MockAPI) GetHost() string

func (*MockAPI) GetMethod

func (x *MockAPI) GetMethod() string

func (*MockAPI) GetPath

func (x *MockAPI) GetPath() string

func (*MockAPI) GetUniqueKey

func (x *MockAPI) GetUniqueKey() string

func (*MockAPI) ProtoMessage

func (*MockAPI) ProtoMessage()

func (*MockAPI) ProtoReflect

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

func (*MockAPI) Reset

func (x *MockAPI) Reset()

func (*MockAPI) String

func (x *MockAPI) String() string

type MockAPI_Case

type MockAPI_Case struct {
	Condition *MockAPI_Condition `protobuf:"bytes,1,opt,name=condition,proto3" json:"condition,omitempty"`
	Response  *MockAPI_Response  `protobuf:"bytes,2,opt,name=response,proto3" json:"response,omitempty"`
	// contains filtered or unexported fields
}

func (*MockAPI_Case) Descriptor deprecated

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

Deprecated: Use MockAPI_Case.ProtoReflect.Descriptor instead.

func (*MockAPI_Case) GetCondition

func (x *MockAPI_Case) GetCondition() *MockAPI_Condition

func (*MockAPI_Case) GetResponse

func (x *MockAPI_Case) GetResponse() *MockAPI_Response

func (*MockAPI_Case) ProtoMessage

func (*MockAPI_Case) ProtoMessage()

func (*MockAPI_Case) ProtoReflect

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

func (*MockAPI_Case) Reset

func (x *MockAPI_Case) Reset()

func (*MockAPI_Case) String

func (x *MockAPI_Case) String() string

type MockAPI_Condition

type MockAPI_Condition struct {

	// Types that are assignable to Condition:
	//	*MockAPI_Condition_Simple
	//	*MockAPI_Condition_Script
	Condition isMockAPI_Condition_Condition `protobuf_oneof:"Condition"`
	// contains filtered or unexported fields
}

func (*MockAPI_Condition) Descriptor deprecated

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

Deprecated: Use MockAPI_Condition.ProtoReflect.Descriptor instead.

func (*MockAPI_Condition) GetCondition

func (m *MockAPI_Condition) GetCondition() isMockAPI_Condition_Condition

func (*MockAPI_Condition) GetScript

func (*MockAPI_Condition) GetSimple

func (*MockAPI_Condition) ProtoMessage

func (*MockAPI_Condition) ProtoMessage()

func (*MockAPI_Condition) ProtoReflect

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

func (*MockAPI_Condition) Reset

func (x *MockAPI_Condition) Reset()

func (*MockAPI_Condition) String

func (x *MockAPI_Condition) String() string

type MockAPI_Condition_Script

type MockAPI_Condition_Script struct {
	Script *MockAPI_Condition_ScriptCondition `protobuf:"bytes,2,opt,name=script,proto3,oneof"`
}

type MockAPI_Condition_ScriptCondition

type MockAPI_Condition_ScriptCondition struct {
	Lang    string `protobuf:"bytes,1,opt,name=lang,proto3" json:"lang,omitempty"`
	Content string `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"`
	// contains filtered or unexported fields
}

func (*MockAPI_Condition_ScriptCondition) Descriptor deprecated

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

Deprecated: Use MockAPI_Condition_ScriptCondition.ProtoReflect.Descriptor instead.

func (*MockAPI_Condition_ScriptCondition) GetContent

func (x *MockAPI_Condition_ScriptCondition) GetContent() string

func (*MockAPI_Condition_ScriptCondition) GetLang

func (*MockAPI_Condition_ScriptCondition) ProtoMessage

func (*MockAPI_Condition_ScriptCondition) ProtoMessage()

func (*MockAPI_Condition_ScriptCondition) ProtoReflect

func (*MockAPI_Condition_ScriptCondition) Reset

func (*MockAPI_Condition_ScriptCondition) String

type MockAPI_Condition_Simple

type MockAPI_Condition_Simple struct {
	Simple *MockAPI_Condition_SimpleCondition `protobuf:"bytes,1,opt,name=simple,proto3,oneof"`
}

type MockAPI_Condition_SimpleCondition

type MockAPI_Condition_SimpleCondition struct {
	Items           []*MockAPI_Condition_SimpleCondition_Item `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"`
	UseOrAmongItems bool                                      `protobuf:"varint,2,opt,name=useOrAmongItems,proto3" json:"useOrAmongItems,omitempty"`
	// contains filtered or unexported fields
}

func (*MockAPI_Condition_SimpleCondition) Descriptor deprecated

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

Deprecated: Use MockAPI_Condition_SimpleCondition.ProtoReflect.Descriptor instead.

func (*MockAPI_Condition_SimpleCondition) GetItems

func (*MockAPI_Condition_SimpleCondition) GetUseOrAmongItems

func (x *MockAPI_Condition_SimpleCondition) GetUseOrAmongItems() bool

func (*MockAPI_Condition_SimpleCondition) ProtoMessage

func (*MockAPI_Condition_SimpleCondition) ProtoMessage()

func (*MockAPI_Condition_SimpleCondition) ProtoReflect

func (*MockAPI_Condition_SimpleCondition) Reset

func (*MockAPI_Condition_SimpleCondition) String

type MockAPI_Condition_SimpleCondition_Item

type MockAPI_Condition_SimpleCondition_Item struct {
	OperandX string `protobuf:"bytes,1,opt,name=operandX,proto3" json:"operandX,omitempty"`
	Operator string `protobuf:"bytes,2,opt,name=operator,proto3" json:"operator,omitempty"`
	OperandY string `protobuf:"bytes,3,opt,name=operandY,proto3" json:"operandY,omitempty"`
	Opposite bool   `protobuf:"varint,4,opt,name=opposite,proto3" json:"opposite,omitempty"`
	// contains filtered or unexported fields
}

func (*MockAPI_Condition_SimpleCondition_Item) Descriptor deprecated

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

Deprecated: Use MockAPI_Condition_SimpleCondition_Item.ProtoReflect.Descriptor instead.

func (*MockAPI_Condition_SimpleCondition_Item) GetOperandX

func (*MockAPI_Condition_SimpleCondition_Item) GetOperandY

func (*MockAPI_Condition_SimpleCondition_Item) GetOperator

func (*MockAPI_Condition_SimpleCondition_Item) GetOpposite

func (*MockAPI_Condition_SimpleCondition_Item) ProtoMessage

func (*MockAPI_Condition_SimpleCondition_Item) ProtoReflect

func (*MockAPI_Condition_SimpleCondition_Item) Reset

func (*MockAPI_Condition_SimpleCondition_Item) String

type MockAPI_Response

type MockAPI_Response struct {

	// Types that are assignable to Response:
	//	*MockAPI_Response_Simple
	//	*MockAPI_Response_Script
	Response isMockAPI_Response_Response `protobuf_oneof:"Response"`
	// contains filtered or unexported fields
}

func (*MockAPI_Response) Descriptor deprecated

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

Deprecated: Use MockAPI_Response.ProtoReflect.Descriptor instead.

func (*MockAPI_Response) GetResponse

func (m *MockAPI_Response) GetResponse() isMockAPI_Response_Response

func (*MockAPI_Response) GetScript

func (*MockAPI_Response) GetSimple

func (*MockAPI_Response) ProtoMessage

func (*MockAPI_Response) ProtoMessage()

func (*MockAPI_Response) ProtoReflect

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

func (*MockAPI_Response) Reset

func (x *MockAPI_Response) Reset()

func (*MockAPI_Response) String

func (x *MockAPI_Response) String() string

type MockAPI_Response_Script

type MockAPI_Response_Script struct {
	Script *MockAPI_Response_ScriptResponse `protobuf:"bytes,2,opt,name=script,proto3,oneof"`
}

type MockAPI_Response_ScriptResponse

type MockAPI_Response_ScriptResponse struct {
	Lang    string               `protobuf:"bytes,1,opt,name=lang,proto3" json:"lang,omitempty"`
	Content string               `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"`
	Timeout *durationpb.Duration `protobuf:"bytes,3,opt,name=timeout,proto3" json:"timeout,omitempty"`
	// contains filtered or unexported fields
}

func (*MockAPI_Response_ScriptResponse) Descriptor deprecated

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

Deprecated: Use MockAPI_Response_ScriptResponse.ProtoReflect.Descriptor instead.

func (*MockAPI_Response_ScriptResponse) GetContent

func (x *MockAPI_Response_ScriptResponse) GetContent() string

func (*MockAPI_Response_ScriptResponse) GetLang

func (*MockAPI_Response_ScriptResponse) GetTimeout

func (*MockAPI_Response_ScriptResponse) ProtoMessage

func (*MockAPI_Response_ScriptResponse) ProtoMessage()

func (*MockAPI_Response_ScriptResponse) ProtoReflect

func (*MockAPI_Response_ScriptResponse) Reset

func (*MockAPI_Response_ScriptResponse) String

type MockAPI_Response_Simple

type MockAPI_Response_Simple struct {
	Simple *MockAPI_Response_SimpleResponse `protobuf:"bytes,1,opt,name=simple,proto3,oneof"`
}

type MockAPI_Response_SimpleResponse

type MockAPI_Response_SimpleResponse struct {
	Code    uint32            `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
	Header  map[string]string `` /* 153-byte string literal not displayed */
	Trailer map[string]string `` /* 155-byte string literal not displayed */
	Body    string            `protobuf:"bytes,4,opt,name=body,proto3" json:"body,omitempty"`
	// contains filtered or unexported fields
}

func (*MockAPI_Response_SimpleResponse) Descriptor deprecated

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

Deprecated: Use MockAPI_Response_SimpleResponse.ProtoReflect.Descriptor instead.

func (*MockAPI_Response_SimpleResponse) GetBody

func (*MockAPI_Response_SimpleResponse) GetCode

func (*MockAPI_Response_SimpleResponse) GetHeader

func (x *MockAPI_Response_SimpleResponse) GetHeader() map[string]string

func (*MockAPI_Response_SimpleResponse) GetTrailer

func (x *MockAPI_Response_SimpleResponse) GetTrailer() map[string]string

func (*MockAPI_Response_SimpleResponse) ProtoMessage

func (*MockAPI_Response_SimpleResponse) ProtoMessage()

func (*MockAPI_Response_SimpleResponse) ProtoReflect

func (*MockAPI_Response_SimpleResponse) Reset

func (*MockAPI_Response_SimpleResponse) String

type MockClient

type MockClient interface {
	SaveMockAPI(ctx context.Context, in *SaveMockAPIRequest, opts ...grpc.CallOption) (*SaveMockAPIResponse, error)
	DeleteMockAPI(ctx context.Context, in *DeleteMockAPIRequest, opts ...grpc.CallOption) (*DeleteMockAPIResponse, error)
	ListMockAPI(ctx context.Context, in *ListMockAPIRequest, opts ...grpc.CallOption) (*ListMockAPIResponse, error)
}

MockClient is the client API for Mock 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.

func NewMockClient

func NewMockClient(cc grpc.ClientConnInterface) MockClient

type MockServer

type MockServer interface {
	SaveMockAPI(context.Context, *SaveMockAPIRequest) (*SaveMockAPIResponse, error)
	DeleteMockAPI(context.Context, *DeleteMockAPIRequest) (*DeleteMockAPIResponse, error)
	ListMockAPI(context.Context, *ListMockAPIRequest) (*ListMockAPIResponse, error)
	// contains filtered or unexported methods
}

MockServer is the server API for Mock service. All implementations must embed UnimplementedMockServer for forward compatibility

type SaveMockAPIRequest

type SaveMockAPIRequest struct {
	Data *MockAPI `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
	// contains filtered or unexported fields
}

func (*SaveMockAPIRequest) Descriptor deprecated

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

Deprecated: Use SaveMockAPIRequest.ProtoReflect.Descriptor instead.

func (*SaveMockAPIRequest) GetData

func (x *SaveMockAPIRequest) GetData() *MockAPI

func (*SaveMockAPIRequest) ProtoMessage

func (*SaveMockAPIRequest) ProtoMessage()

func (*SaveMockAPIRequest) ProtoReflect

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

func (*SaveMockAPIRequest) Reset

func (x *SaveMockAPIRequest) Reset()

func (*SaveMockAPIRequest) String

func (x *SaveMockAPIRequest) String() string

type SaveMockAPIResponse

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

func (*SaveMockAPIResponse) Descriptor deprecated

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

Deprecated: Use SaveMockAPIResponse.ProtoReflect.Descriptor instead.

func (*SaveMockAPIResponse) ProtoMessage

func (*SaveMockAPIResponse) ProtoMessage()

func (*SaveMockAPIResponse) ProtoReflect

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

func (*SaveMockAPIResponse) Reset

func (x *SaveMockAPIResponse) Reset()

func (*SaveMockAPIResponse) String

func (x *SaveMockAPIResponse) String() string

type UnimplementedMockServer

type UnimplementedMockServer struct {
}

UnimplementedMockServer must be embedded to have forward compatible implementations.

func (*UnimplementedMockServer) DeleteMockAPI

func (*UnimplementedMockServer) ListMockAPI

func (*UnimplementedMockServer) SaveMockAPI

Directories

Path Synopsis
apis
v1alpha1
Package v1alpha1 is a reverse proxy.
Package v1alpha1 is a reverse proxy.

Jump to

Keyboard shortcuts

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