Documentation ¶
Overview ¶
Package example is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterExampleAPIExtensionHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterExampleAPIExtensionHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ExampleAPIExtensionClient) error
- func RegisterExampleAPIExtensionHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterExampleAPIExtensionHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ExampleAPIExtensionServer) error
- func RegisterExampleAPIExtensionServer(s grpc.ServiceRegistrar, srv ExampleAPIExtensionServer)
- func RegisterExampleUnaryExtensionServer(s grpc.ServiceRegistrar, srv ExampleUnaryExtensionServer)
- func Scheme(_ context.Context) meta.Scheme
- type EchoRequest
- type EchoResponse
- type ExampleAPIExtensionClient
- type ExampleAPIExtensionServer
- type ExamplePlugin
- func (s *ExamplePlugin) CanInstall(context.Context, *emptypb.Empty) (*emptypb.Empty, error)
- func (s *ExamplePlugin) CancelUninstall(context.Context, *corev1.Reference) (*emptypb.Empty, error)
- func (s *ExamplePlugin) ConfigureRoutes(app *gin.Engine)
- func (s *ExamplePlugin) Echo(_ context.Context, req *EchoRequest) (*EchoResponse, error)
- func (s *ExamplePlugin) Hello(context.Context, *emptypb.Empty) (*EchoResponse, error)
- func (s *ExamplePlugin) Info(context.Context, *emptypb.Empty) (*capabilityv1.Details, error)
- func (s *ExamplePlugin) Install(context.Context, *capabilityv1.InstallRequest) (*capabilityv1.InstallResponse, error)
- func (s *ExamplePlugin) InstallerTemplate(context.Context, *emptypb.Empty) (*capabilityv1.InstallerTemplateResponse, error)
- func (s *ExamplePlugin) Status(context.Context, *capabilityv1.StatusRequest) (*capabilityv1.NodeCapabilityStatus, error)
- func (s *ExamplePlugin) Uninstall(context.Context, *capabilityv1.UninstallRequest) (*emptypb.Empty, error)
- func (s *ExamplePlugin) UninstallStatus(context.Context, *corev1.Reference) (*corev1.TaskStatus, error)
- func (s *ExamplePlugin) UseKeyValueStore(client system.KeyValueStoreClient)
- func (s *ExamplePlugin) UseManagementAPI(api managementv1.ManagementClient)
- type ExampleUnaryExtensionClient
- type ExampleUnaryExtensionServer
- type UnimplementedExampleAPIExtensionServer
- type UnimplementedExampleUnaryExtensionServer
- type UnsafeExampleAPIExtensionServer
- type UnsafeExampleUnaryExtensionServer
Constants ¶
This section is empty.
Variables ¶
var ExampleAPIExtension_ServiceDesc = grpc.ServiceDesc{ ServiceName: "example.ExampleAPIExtension", HandlerType: (*ExampleAPIExtensionServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Echo", Handler: _ExampleAPIExtension_Echo_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "github.com/rancher/opni/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)
var ExampleUnaryExtension_ServiceDesc = grpc.ServiceDesc{ ServiceName: "example.ExampleUnaryExtension", HandlerType: (*ExampleUnaryExtensionServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Hello", Handler: _ExampleUnaryExtension_Hello_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "github.com/rancher/opni/plugins/example/pkg/example/example.proto", }
ExampleUnaryExtension_ServiceDesc is the grpc.ServiceDesc for ExampleUnaryExtension service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var File_github_com_rancher_opni_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)
func RegisterExampleUnaryExtensionServer ¶ added in v0.5.4
func RegisterExampleUnaryExtensionServer(s grpc.ServiceRegistrar, srv ExampleUnaryExtensionServer)
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.
func NewExampleAPIExtensionClient ¶
func NewExampleAPIExtensionClient(cc grpc.ClientConnInterface) ExampleAPIExtensionClient
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 { UnsafeExampleAPIExtensionServer UnsafeExampleUnaryExtensionServer capabilityv1.UnsafeBackendServer system.UnimplementedSystemPluginClient Logger hclog.Logger }
func (*ExamplePlugin) CanInstall ¶
func (*ExamplePlugin) CancelUninstall ¶ added in v0.6.0
func (*ExamplePlugin) ConfigureRoutes ¶
func (s *ExamplePlugin) ConfigureRoutes(app *gin.Engine)
func (*ExamplePlugin) Echo ¶
func (s *ExamplePlugin) Echo(_ context.Context, req *EchoRequest) (*EchoResponse, error)
func (*ExamplePlugin) Hello ¶ added in v0.5.4
func (s *ExamplePlugin) Hello(context.Context, *emptypb.Empty) (*EchoResponse, error)
func (*ExamplePlugin) Info ¶ added in v0.6.0
func (s *ExamplePlugin) Info(context.Context, *emptypb.Empty) (*capabilityv1.Details, error)
func (*ExamplePlugin) Install ¶
func (s *ExamplePlugin) Install(context.Context, *capabilityv1.InstallRequest) (*capabilityv1.InstallResponse, error)
func (*ExamplePlugin) InstallerTemplate ¶
func (s *ExamplePlugin) InstallerTemplate(context.Context, *emptypb.Empty) (*capabilityv1.InstallerTemplateResponse, error)
func (*ExamplePlugin) Status ¶ added in v0.6.0
func (s *ExamplePlugin) Status(context.Context, *capabilityv1.StatusRequest) (*capabilityv1.NodeCapabilityStatus, error)
func (*ExamplePlugin) Uninstall ¶ added in v0.4.2
func (s *ExamplePlugin) Uninstall(context.Context, *capabilityv1.UninstallRequest) (*emptypb.Empty, error)
func (*ExamplePlugin) UninstallStatus ¶ added in v0.6.0
func (s *ExamplePlugin) UninstallStatus(context.Context, *corev1.Reference) (*corev1.TaskStatus, error)
func (*ExamplePlugin) UseKeyValueStore ¶
func (s *ExamplePlugin) UseKeyValueStore(client system.KeyValueStoreClient)
func (*ExamplePlugin) UseManagementAPI ¶
func (s *ExamplePlugin) UseManagementAPI(api managementv1.ManagementClient)
type ExampleUnaryExtensionClient ¶ added in v0.5.4
type ExampleUnaryExtensionClient interface {
Hello(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*EchoResponse, error)
}
ExampleUnaryExtensionClient is the client API for ExampleUnaryExtension 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 NewExampleUnaryExtensionClient ¶ added in v0.5.4
func NewExampleUnaryExtensionClient(cc grpc.ClientConnInterface) ExampleUnaryExtensionClient
type ExampleUnaryExtensionServer ¶ added in v0.5.4
type ExampleUnaryExtensionServer interface { Hello(context.Context, *emptypb.Empty) (*EchoResponse, error) // contains filtered or unexported methods }
ExampleUnaryExtensionServer is the server API for ExampleUnaryExtension service. All implementations must embed UnimplementedExampleUnaryExtensionServer for forward compatibility
type UnimplementedExampleAPIExtensionServer ¶
type UnimplementedExampleAPIExtensionServer struct { }
UnimplementedExampleAPIExtensionServer must be embedded to have forward compatible implementations.
func (UnimplementedExampleAPIExtensionServer) Echo ¶
func (UnimplementedExampleAPIExtensionServer) Echo(context.Context, *EchoRequest) (*EchoResponse, error)
type UnimplementedExampleUnaryExtensionServer ¶ added in v0.5.4
type UnimplementedExampleUnaryExtensionServer struct { }
UnimplementedExampleUnaryExtensionServer must be embedded to have forward compatible implementations.
func (UnimplementedExampleUnaryExtensionServer) Hello ¶ added in v0.5.4
func (UnimplementedExampleUnaryExtensionServer) Hello(context.Context, *emptypb.Empty) (*EchoResponse, error)
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.
type UnsafeExampleUnaryExtensionServer ¶ added in v0.5.4
type UnsafeExampleUnaryExtensionServer interface {
// contains filtered or unexported methods
}
UnsafeExampleUnaryExtensionServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ExampleUnaryExtensionServer will result in compilation errors.