2017-04-05 23:20:31 +00:00
|
|
|
package builtinplugins
|
|
|
|
|
2017-04-06 00:19:29 +00:00
|
|
|
import (
|
2017-05-03 00:04:49 +00:00
|
|
|
"github.com/hashicorp/vault/plugins/database/cassandra"
|
2017-07-07 20:11:23 +00:00
|
|
|
"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
|
|
|
)
|
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{
|
2017-05-03 20:33:56 +00:00
|
|
|
// These four plugins all use the same mysql implementation but with
|
|
|
|
// different username settings passed by the constructor.
|
2017-06-06 13:49:49 +00:00
|
|
|
"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),
|
2017-05-03 20:33:56 +00:00
|
|
|
|
2017-04-24 17:30:33 +00:00
|
|
|
"postgresql-database-plugin": postgresql.New,
|
2017-04-26 17:34:45 +00:00
|
|
|
"mssql-database-plugin": mssql.New,
|
2017-05-03 00:04:49 +00:00
|
|
|
"cassandra-database-plugin": cassandra.New,
|
2017-05-11 23:29:28 +00:00
|
|
|
"mongodb-database-plugin": mongodb.New,
|
2017-07-07 20:11:23 +00:00
|
|
|
"hana-database-plugin": hana.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
|
|
|
|
}
|