api

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package api defines the interfaces that are implemented by plugins. Some of them are optional - see comments below.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NeedsHostServices

type NeedsHostServices interface {
	// BrokerHostServices is invoked by the plugin loader and provides a broker
	// that can be used by plugins/services to initialize clients to host
	// services. If an error is returned, plugin loading will fail.
	// This gives server implementations control over whether or not the
	// absence of a particular host service is a catastrophic failure.
	BrokerHostServices(ServiceBroker) error
}

NeedsHostServices enables a plugin implementation to receive a service broker from the plugin loader during plugin initialization. The implementation is optional.

type NeedsLogger

type NeedsLogger interface {
	SetLogger(logger hclog.Logger)
}

NeedsLogger enables a plugin implementation to receive a logger from the plugin loader during plugin initialization. The implementation is optional.

type PluginClient

type PluginClient interface {
	ServiceClient

	// Type returns the type of plugin
	Type() string
}

PluginClient defines the server side of a plugin. The necessary code is generated by protoc-gen-go-extension. See proto/plugin/authz/v1 for an example.

type PluginServer

type PluginServer interface {
	ServiceServer

	// Type returns the type of plugin
	Type() string
}

PluginServer defines the server side of a plugin. The necessary code is generated by protoc-gen-go-extension. See proto/plugin/authz/v1 for an example.

type ServiceBroker

type ServiceBroker interface {
	// BrokerClient initializes the passed in host service client. If the
	// host service is not available, the host service client will
	// remain uninitialized and the function will return false.
	BrokerClient(ServiceClient) bool
}

type ServiceClient

type ServiceClient interface {
	// GRPCServiceName returns the full gRPC service name (e.g.
	GRPCServiceName() string

	// InitClient initializes the client using the given gRPC client
	// connection. It returns the client implementation that was initialized.
	InitClient(conn grpc.ClientConnInterface) any
}

ServiceClient defines the client side of a service, which can be embedded by a PluginClient. It is used to define shared functionality in a proto definition, which does not make up a plugin on its own. The necessary code is generated by protoc-gen-go-extension. See proto/service/common/config/v1 for an example.

type ServiceServer

type ServiceServer interface {
	// GRPCServiceName returns the full gRPC service name (e.g.
	GRPCServiceName() string

	// RegisterServer registers the server implementation with the given gRPC server.
	// It returns the implementation that was registered.
	RegisterServer(server *grpc.Server) any
}

ServiceServer defines the server side of a service, which can be embedded by a PluginServer. It is used to define shared functionality in a proto definition, which does not make up a plugin on its own. The necessary code is generated by protoc-gen-go-extension. See proto/service/common/config/v1 for an example.

Jump to

Keyboard shortcuts

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