import "github.com/hashicorp/vault/sdk/plugin"
backend.go grpc_backend.go grpc_backend_client.go grpc_backend_server.go grpc_storage.go grpc_system.go logger.go middleware.go plugin.go serve.go
const BackendPluginName = "backend"
BackendPluginName is the name of the plugin that can be dispensed from the plugin server.
var ErrClientInMetadataMode = errors.New("plugin client can not perform action while in metadata mode")
var ErrServerInMetadataMode = errors.New("plugin server can not perform action while in metadata mode")
func NewBackend(ctx context.Context, pluginName string, pluginType consts.PluginType, sys pluginutil.LookRunnerUtil, conf *logical.BackendConfig, isMetadataMode bool) (logical.Backend, error)
NewBackend will return an instance of an RPC-based client implementation of the backend for external plugins, or a concrete implementation of the backend if it is a builtin backend. The backend is returned as a logical.Backend interface. The isMetadataMode param determines whether the plugin should run in metadata mode.
func NewPluginClient(ctx context.Context, sys pluginutil.RunnerUtil, pluginRunner *pluginutil.PluginRunner, logger log.Logger, isMetadataMode bool) (logical.Backend, error)
Serve is a helper function used to serve a backend plugin. This should be ran on the plugin's main process.
type BackendPluginClient struct { sync.Mutex logical.Backend // contains filtered or unexported fields }
BackendPluginClient is a wrapper around backendPluginClient that also contains its plugin.Client instance. It's primarily used to cleanly kill the client on Cleanup()
func (b *BackendPluginClient) Cleanup(ctx context.Context)
Cleanup calls the RPC client's Cleanup() func and also calls the go-plugin's client Kill() func
type GRPCBackendPlugin struct { Factory logical.Factory MetadataMode bool Logger log.Logger // Embeding this will disable the netRPC protocol plugin.NetRPCUnsupportedPlugin }
GRPCBackendPlugin is the plugin.Plugin implementation that only supports GRPC transport
func (b *GRPCBackendPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)
func (b GRPCBackendPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error
type GRPCStorageClient struct {
// contains filtered or unexported fields
}
GRPCStorageClient is an implementation of logical.Storage that communicates over RPC.
func (s *GRPCStorageClient) Get(ctx context.Context, key string) (*logical.StorageEntry, error)
func (s *GRPCStorageClient) Put(ctx context.Context, entry *logical.StorageEntry) error
type GRPCStorageServer struct {
// contains filtered or unexported fields
}
StorageServer is a net/rpc compatible structure for serving
func (s *GRPCStorageServer) Delete(ctx context.Context, args *pb.StorageDeleteArgs) (*pb.StorageDeleteReply, error)
func (s *GRPCStorageServer) Get(ctx context.Context, args *pb.StorageGetArgs) (*pb.StorageGetReply, error)
func (s *GRPCStorageServer) List(ctx context.Context, args *pb.StorageListArgs) (*pb.StorageListReply, error)
func (s *GRPCStorageServer) Put(ctx context.Context, args *pb.StoragePutArgs) (*pb.StoragePutReply, error)
LoggerReply contains the RPC reply. Not all fields may be used for a particular RPC call.
type LoggerServer struct {
// contains filtered or unexported fields
}
func (l *LoggerServer) Debug(args *LoggerArgs, _ *struct{}) error
func (l *LoggerServer) Error(args *LoggerArgs, reply *LoggerReply) error
func (l *LoggerServer) Info(args *LoggerArgs, _ *struct{}) error
func (l *LoggerServer) IsDebug(args interface{}, reply *LoggerReply) error
func (l *LoggerServer) IsInfo(args interface{}, reply *LoggerReply) error
func (l *LoggerServer) IsTrace(args interface{}, reply *LoggerReply) error
func (l *LoggerServer) IsWarn(args interface{}, reply *LoggerReply) error
func (l *LoggerServer) Log(args *LoggerArgs, _ *struct{}) error
func (l *LoggerServer) SetLevel(args int, _ *struct{}) error
func (l *LoggerServer) Trace(args *LoggerArgs, _ *struct{}) error
func (l *LoggerServer) Warn(args *LoggerArgs, reply *LoggerReply) error
type NOOPStorage struct{}
NOOPStorage is used to deny access to the storage interface while running a backend plugin in metadata mode.
func (s *NOOPStorage) Get(_ context.Context, key string) (*logical.StorageEntry, error)
func (s *NOOPStorage) Put(_ context.Context, entry *logical.StorageEntry) error
type ServeOpts struct { BackendFactoryFunc logical.Factory TLSProviderFunc TLSProviderFunc Logger log.Logger }
Path | Synopsis |
---|---|
mock | |
pb |
Package plugin imports 22 packages (graph) and is imported by 11 packages. Updated 2019-08-26. Refresh now. Tools for package owners.