example

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2022 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package example is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var ExampleAPIExtension_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "example.ExampleAPIExtension",
	HandlerType: (*ExampleAPIExtensionServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Echo",
			Handler:    _ExampleAPIExtension_Echo_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "plugins/example/pkg/example/example.proto",
}

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

View Source
var File_plugins_example_pkg_example_example_proto protoreflect.FileDescriptor

Functions

func RegisterExampleAPIExtensionHandler

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

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

func RegisterExampleAPIExtensionHandlerClient

func RegisterExampleAPIExtensionHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ExampleAPIExtensionClient) error

RegisterExampleAPIExtensionHandlerClient registers the http handlers for service ExampleAPIExtension to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ExampleAPIExtensionClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ExampleAPIExtensionClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "ExampleAPIExtensionClient" to call the correct interceptors.

func RegisterExampleAPIExtensionHandlerFromEndpoint

func RegisterExampleAPIExtensionHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterExampleAPIExtensionHandlerFromEndpoint is same as RegisterExampleAPIExtensionHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterExampleAPIExtensionHandlerServer

func RegisterExampleAPIExtensionHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ExampleAPIExtensionServer) error

RegisterExampleAPIExtensionHandlerServer registers the http handlers for service ExampleAPIExtension to "mux". UnaryRPC :call ExampleAPIExtensionServer 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 RegisterExampleAPIExtensionHandlerFromEndpoint instead.

func RegisterExampleAPIExtensionServer

func RegisterExampleAPIExtensionServer(s grpc.ServiceRegistrar, srv ExampleAPIExtensionServer)

Types

type EchoRequest

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

func (*EchoRequest) Descriptor deprecated

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

Deprecated: Use EchoRequest.ProtoReflect.Descriptor instead.

func (*EchoRequest) GetMessage

func (x *EchoRequest) GetMessage() string

func (*EchoRequest) ProtoMessage

func (*EchoRequest) ProtoMessage()

func (*EchoRequest) ProtoReflect

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

func (*EchoRequest) Reset

func (x *EchoRequest) Reset()

func (*EchoRequest) String

func (x *EchoRequest) String() string

type EchoResponse

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

func (*EchoResponse) Descriptor deprecated

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

Deprecated: Use EchoResponse.ProtoReflect.Descriptor instead.

func (*EchoResponse) GetMessage

func (x *EchoResponse) GetMessage() string

func (*EchoResponse) ProtoMessage

func (*EchoResponse) ProtoMessage()

func (*EchoResponse) ProtoReflect

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

func (*EchoResponse) Reset

func (x *EchoResponse) Reset()

func (*EchoResponse) String

func (x *EchoResponse) String() string

type ExampleAPIExtensionClient

type ExampleAPIExtensionClient interface {
	Echo(ctx context.Context, in *EchoRequest, opts ...grpc.CallOption) (*EchoResponse, error)
}

ExampleAPIExtensionClient is the client API for ExampleAPIExtension 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 ExampleAPIExtensionServer

type ExampleAPIExtensionServer interface {
	Echo(context.Context, *EchoRequest) (*EchoResponse, error)
	// contains filtered or unexported methods
}

ExampleAPIExtensionServer is the server API for ExampleAPIExtension service. All implementations must embed UnimplementedExampleAPIExtensionServer for forward compatibility

type ExamplePlugin

type ExamplePlugin struct {
	UnimplementedExampleAPIExtensionServer
	Logger hclog.Logger
}

func (*ExamplePlugin) ConfigureRoutes

func (s *ExamplePlugin) ConfigureRoutes(app *fiber.App)

func (*ExamplePlugin) Echo

func (*ExamplePlugin) UseKeyValueStore

func (s *ExamplePlugin) UseKeyValueStore(kv system.KVStoreClient)

func (*ExamplePlugin) UseManagementAPI

func (s *ExamplePlugin) UseManagementAPI(api management.ManagementClient)

type UnimplementedExampleAPIExtensionServer

type UnimplementedExampleAPIExtensionServer struct {
}

UnimplementedExampleAPIExtensionServer must be embedded to have forward compatible implementations.

func (UnimplementedExampleAPIExtensionServer) Echo

type UnsafeExampleAPIExtensionServer

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

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

Jump to

Keyboard shortcuts

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