2017-04-05 23:20:31 +00:00
|
|
|
package builtinplugins
|
|
|
|
|
2017-04-06 00:19:29 +00:00
|
|
|
import (
|
2017-04-26 17:34:45 +00:00
|
|
|
"github.com/hashicorp/vault/plugins/database/mssql"
|
2017-04-13 20:48:32 +00:00
|
|
|
"github.com/hashicorp/vault/plugins/database/mysql"
|
|
|
|
"github.com/hashicorp/vault/plugins/database/postgresql"
|
2017-04-06 00:19:29 +00:00
|
|
|
)
|
2017-04-05 23:20:31 +00:00
|
|
|
|
2017-04-21 01:46:41 +00:00
|
|
|
type BuiltinFactory func() (interface{}, error)
|
|
|
|
|
2017-04-24 17:30:33 +00:00
|
|
|
var plugins map[string]BuiltinFactory = map[string]BuiltinFactory{
|
|
|
|
"mysql-database-plugin": mysql.New,
|
|
|
|
"postgresql-database-plugin": postgresql.New,
|
2017-04-26 17:34:45 +00:00
|
|
|
"mssql-database-plugin": mssql.New,
|
2017-04-07 22:50:03 +00:00
|
|
|
}
|
|
|
|
|
2017-04-24 17:30:33 +00:00
|
|
|
func Get(name string) (BuiltinFactory, bool) {
|
|
|
|
f, ok := plugins[name]
|
2017-04-07 22:50:03 +00:00
|
|
|
return f, ok
|
2017-04-05 23:20:31 +00:00
|
|
|
}
|
2017-04-12 16:40:54 +00:00
|
|
|
|
2017-04-24 17:30:33 +00:00
|
|
|
func Keys() []string {
|
|
|
|
keys := make([]string, len(plugins))
|
2017-04-12 16:40:54 +00:00
|
|
|
|
|
|
|
i := 0
|
2017-04-24 17:30:33 +00:00
|
|
|
for k := range plugins {
|
2017-04-12 16:40:54 +00:00
|
|
|
keys[i] = k
|
|
|
|
i++
|
|
|
|
}
|
|
|
|
|
|
|
|
return keys
|
|
|
|
}
|