mirror of
https://github.com/hashicorp/vault.git
synced 2026-06-10 09:22:06 -04:00
Update interface name from Wrapper to a more descriptive RunnerUtil
This commit is contained in:
parent
f3e7ad7669
commit
b87f8a13ed
4 changed files with 7 additions and 7 deletions
|
|
@ -29,7 +29,7 @@ func (dc *DatabasePluginClient) Close() error {
|
|||
// newPluginClient returns a databaseRPCClient with a connection to a running
|
||||
// plugin. The client is wrapped in a DatabasePluginClient object to ensure the
|
||||
// plugin is killed on call of Close().
|
||||
func newPluginClient(sys pluginutil.Wrapper, pluginRunner *pluginutil.PluginRunner) (Database, error) {
|
||||
func newPluginClient(sys pluginutil.RunnerUtil, pluginRunner *pluginutil.PluginRunner) (Database, error) {
|
||||
// pluginMap is the map of plugins we can dispense.
|
||||
var pluginMap = map[string]plugin.Plugin{
|
||||
"database": new(DatabasePlugin),
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ type Statements struct {
|
|||
|
||||
// PluginFactory is used to build plugin database types. It wraps the database
|
||||
// object in a logging and metrics middleware.
|
||||
func PluginFactory(pluginName string, sys pluginutil.LookWrapper, logger log.Logger) (Database, error) {
|
||||
func PluginFactory(pluginName string, sys pluginutil.LookRunnerUtil, logger log.Logger) (Database, error) {
|
||||
// Look for plugin in the plugin catalog
|
||||
pluginRunner, err := sys.LookupPlugin(pluginName)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -19,15 +19,15 @@ type Looker interface {
|
|||
// Wrapper interface defines the functions needed by the runner to wrap the
|
||||
// metadata needed to run a plugin process. This includes looking up Mlock
|
||||
// configuration and wrapping data in a respose wrapped token.
|
||||
type Wrapper interface {
|
||||
type RunnerUtil interface {
|
||||
ResponseWrapData(data map[string]interface{}, ttl time.Duration, jwt bool) (*wrapping.ResponseWrapInfo, error)
|
||||
MlockEnabled() bool
|
||||
}
|
||||
|
||||
// LookWrapper defines the functions for both Looker and Wrapper
|
||||
type LookWrapper interface {
|
||||
type LookRunnerUtil interface {
|
||||
Looker
|
||||
Wrapper
|
||||
RunnerUtil
|
||||
}
|
||||
|
||||
// PluginRunner defines the metadata needed to run a plugin securely with
|
||||
|
|
@ -43,7 +43,7 @@ type PluginRunner struct {
|
|||
|
||||
// Run takes a wrapper instance, and the go-plugin paramaters and executes a
|
||||
// plugin.
|
||||
func (r *PluginRunner) Run(wrapper Wrapper, pluginMap map[string]plugin.Plugin, hs plugin.HandshakeConfig, env []string) (*plugin.Client, error) {
|
||||
func (r *PluginRunner) Run(wrapper RunnerUtil, pluginMap map[string]plugin.Plugin, hs plugin.HandshakeConfig, env []string) (*plugin.Client, error) {
|
||||
// Get a CA TLS Certificate
|
||||
certBytes, key, err := GenerateCert()
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ func CreateClientTLSConfig(certBytes []byte, key *ecdsa.PrivateKey) (*tls.Config
|
|||
|
||||
// WrapServerConfig is used to create a server certificate and private key, then
|
||||
// wrap them in an unwrap token for later retrieval by the plugin.
|
||||
func WrapServerConfig(sys Wrapper, certBytes []byte, key *ecdsa.PrivateKey) (string, error) {
|
||||
func WrapServerConfig(sys RunnerUtil, certBytes []byte, key *ecdsa.PrivateKey) (string, error) {
|
||||
rawKey, err := x509.MarshalECPrivateKey(key)
|
||||
if err != nil {
|
||||
return "", err
|
||||
|
|
|
|||
Loading…
Reference in a new issue