open-vault/helper/builtinplugins/builtin.go

45 lines
1.4 KiB
Go
Raw Normal View History

package builtinplugins
2017-04-06 00:19:29 +00:00
import (
"github.com/hashicorp/vault/plugins/database/cassandra"
"github.com/hashicorp/vault/plugins/database/hana"
2017-05-11 23:29:28 +00:00
"github.com/hashicorp/vault/plugins/database/mongodb"
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
)
type BuiltinFactory func() (interface{}, error)
var plugins map[string]BuiltinFactory = map[string]BuiltinFactory{
// These four plugins all use the same mysql implementation but with
// different username settings passed by the constructor.
"mysql-database-plugin": mysql.New(mysql.MetadataLen, mysql.UsernameLen),
"mysql-aurora-database-plugin": mysql.New(mysql.LegacyMetadataLen, mysql.LegacyUsernameLen),
"mysql-rds-database-plugin": mysql.New(mysql.LegacyMetadataLen, mysql.LegacyUsernameLen),
"mysql-legacy-database-plugin": mysql.New(mysql.LegacyMetadataLen, mysql.LegacyUsernameLen),
"postgresql-database-plugin": postgresql.New,
2017-04-26 17:34:45 +00:00
"mssql-database-plugin": mssql.New,
"cassandra-database-plugin": cassandra.New,
2017-05-11 23:29:28 +00:00
"mongodb-database-plugin": mongodb.New,
"hana-database-plugin": hana.New,
2017-04-07 22:50:03 +00:00
}
func Get(name string) (BuiltinFactory, bool) {
f, ok := plugins[name]
2017-04-07 22:50:03 +00:00
return f, ok
}
func Keys() []string {
keys := make([]string, len(plugins))
i := 0
for k := range plugins {
keys[i] = k
i++
}
return keys
}