plugin

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2023 License: Apache-2.0 Imports: 13 Imported by: 10

Documentation

Index

Constants

View Source
const InfoName = "info"

InfoName constant should not be used directly when implementing plugins. It's the registration name for the info plugin, used by the CLI and the cli-plugin-base library (RegisterPlugins function) to register the plugins.

Variables

View Source
var File_util_plugin_info_proto protoreflect.FileDescriptor
View Source
var InfoService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "util.plugin.InfoService",
	HandlerType: (*InfoServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "GetInfo",
			Handler:    _InfoService_GetInfo_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "util/plugin/info.proto",
}

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

Functions

func RegisterInfoServiceServer added in v0.32.0

func RegisterInfoServiceServer(s grpc.ServiceRegistrar, srv InfoServiceServer)

Types

type Info

type Info interface {
	GetInfo(ctx context.Context) (*PluginInfo, error)
}

Info interface needs to be implemented by all plugins to provide basic plugin information.

type InfoPlugin

type InfoPlugin struct {
	plugin.Plugin

	Impl InfoServiceServer
}

InfoPlugin is used on the server (CLI) and client (plugin) side to integrate with the plugin system. A plugin should not be using this directly, but instead depend on the cli-plugin-base library to register the plugins.

func (InfoPlugin) GRPCClient added in v0.32.0

func (InfoPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)

func (*InfoPlugin) GRPCServer added in v0.32.0

func (p *InfoPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error

type InfoServiceClient added in v0.32.0

type InfoServiceClient interface {
	GetInfo(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*PluginInfo, error)
}

InfoServiceClient is the client API for InfoService 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 NewInfoServiceClient added in v0.32.0

func NewInfoServiceClient(cc grpc.ClientConnInterface) InfoServiceClient

type InfoServiceServer added in v0.32.0

type InfoServiceServer interface {
	GetInfo(context.Context, *emptypb.Empty) (*PluginInfo, error)
	// contains filtered or unexported methods
}

InfoServiceServer is the server API for InfoService service. All implementations must embed UnimplementedInfoServiceServer for forward compatibility

type ParameterInfo

type ParameterInfo struct {
	Name        string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
	Mandatory   bool   `protobuf:"varint,3,opt,name=mandatory,proto3" json:"mandatory,omitempty"`
	// contains filtered or unexported fields
}

ParameterInfo contains the information about a parameter. This is used to inform the CLI user what command-line parameters are expected explicitly for this target (plugin).

func (*ParameterInfo) Descriptor deprecated added in v0.32.0

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

Deprecated: Use ParameterInfo.ProtoReflect.Descriptor instead.

func (*ParameterInfo) GetDescription added in v0.32.0

func (x *ParameterInfo) GetDescription() string

func (*ParameterInfo) GetMandatory added in v0.32.0

func (x *ParameterInfo) GetMandatory() bool

func (*ParameterInfo) GetName added in v0.32.0

func (x *ParameterInfo) GetName() string

func (*ParameterInfo) ProtoMessage added in v0.32.0

func (*ParameterInfo) ProtoMessage()

func (*ParameterInfo) ProtoReflect added in v0.32.0

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

func (*ParameterInfo) Reset added in v0.32.0

func (x *ParameterInfo) Reset()

func (*ParameterInfo) String

func (x *ParameterInfo) String() string

type PluginInfo

type PluginInfo struct {
	Name        string           `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Description string           `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"`
	Version     *Version         `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"`
	Parameters  []*ParameterInfo `protobuf:"bytes,4,rep,name=parameters,proto3" json:"parameters,omitempty"`
	// contains filtered or unexported fields
}

PluginInfo represents the information about a plugin.

func (*PluginInfo) Descriptor deprecated added in v0.32.0

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

Deprecated: Use PluginInfo.ProtoReflect.Descriptor instead.

func (*PluginInfo) FullOverview

func (i *PluginInfo) FullOverview() string

func (*PluginInfo) GetDescription added in v0.32.0

func (x *PluginInfo) GetDescription() string

func (*PluginInfo) GetName added in v0.32.0

func (x *PluginInfo) GetName() string

func (*PluginInfo) GetParameters added in v0.32.0

func (x *PluginInfo) GetParameters() []*ParameterInfo

func (*PluginInfo) GetVersion added in v0.32.0

func (x *PluginInfo) GetVersion() *Version

func (*PluginInfo) InfoString added in v0.32.0

func (i *PluginInfo) InfoString() string

func (*PluginInfo) ProtoMessage added in v0.32.0

func (*PluginInfo) ProtoMessage()

func (*PluginInfo) ProtoReflect added in v0.32.0

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

func (*PluginInfo) Reset added in v0.32.0

func (x *PluginInfo) Reset()

func (*PluginInfo) String

func (x *PluginInfo) String() string

type UnimplementedInfoServiceServer added in v0.32.0

type UnimplementedInfoServiceServer struct {
}

UnimplementedInfoServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedInfoServiceServer) GetInfo added in v0.32.0

type UnsafeInfoServiceServer added in v0.32.0

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

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

type Version

type Version struct {
	Major       int32 `protobuf:"varint,1,opt,name=major,proto3" json:"major,omitempty"`
	Minor       int32 `protobuf:"varint,2,opt,name=minor,proto3" json:"minor,omitempty"`
	Maintenance int32 `protobuf:"varint,3,opt,name=maintenance,proto3" json:"maintenance,omitempty"`
	// contains filtered or unexported fields
}

Version contains semantic versioning information of the plugin

func ParseVersion

func ParseVersion(version string) *Version

ParseVersion parses the given string version in the form X.Y.Z and returns a Version struct representing it. If the input string is invalid, a 0.0.0 version will be returned

func (*Version) Descriptor deprecated added in v0.32.0

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

Deprecated: Use Version.ProtoReflect.Descriptor instead.

func (*Version) GetMaintenance added in v0.32.0

func (x *Version) GetMaintenance() int32

func (*Version) GetMajor added in v0.32.0

func (x *Version) GetMajor() int32

func (*Version) GetMinor added in v0.32.0

func (x *Version) GetMinor() int32

func (*Version) ProtoMessage added in v0.32.0

func (*Version) ProtoMessage()

func (*Version) ProtoReflect added in v0.32.0

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

func (*Version) Reset added in v0.32.0

func (x *Version) Reset()

func (*Version) String

func (x *Version) String() string

Jump to

Keyboard shortcuts

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