Add DB type consts (#31295)

* add necessary consts

* add other db plugins

* correct ES

* Fix consts in test
This commit is contained in:
Ellie 2025-07-17 12:08:27 -05:00 committed by GitHub
parent 6981f475c6
commit 1e7f22aeec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 24 additions and 13 deletions

View File

@ -1665,8 +1665,8 @@ func TestBackend_GetConnectionMetrics(t *testing.T) {
cassandraConfig,
},
expectedCounts: map[string]int{
pluginconsts.DbPostgresqlPlugin: 1,
pluginconsts.DbCassandraPlugin: 1,
pluginconsts.DbPostgresqlPluginType: 1,
pluginconsts.DbCassandraPluginType: 1,
},
},
{
@ -1675,7 +1675,7 @@ func TestBackend_GetConnectionMetrics(t *testing.T) {
postgresConfig,
},
expectedCounts: map[string]int{
pluginconsts.DbPostgresqlPlugin: 1,
pluginconsts.DbPostgresqlPluginType: 1,
},
},
{
@ -1692,8 +1692,8 @@ func TestBackend_GetConnectionMetrics(t *testing.T) {
cassandraConfigV2,
},
expectedCounts: map[string]int{
pluginconsts.DbPostgresqlPlugin: 2,
pluginconsts.DbCassandraPlugin: 2,
pluginconsts.DbPostgresqlPluginType: 2,
pluginconsts.DbCassandraPluginType: 2,
},
},
}

View File

@ -26,14 +26,6 @@ const (
AuthTypeSAML = "saml"
AuthTypeApprole = "approle"
AuthTypeJWT = "jwt"
DbCassandraPlugin = "cassandra"
DbHanaPlugin = "hdb"
DbInfluxDBPlugin = "influxdb"
DbMongoDBPlugin = "mongodb"
DbMsSQLPlugin = "mssql"
DbMySQLPlugin = "mysql"
DbRedshiftPlugin = "redshift"
DbPostgresqlPlugin = "pgx"
SecretEngineAD = "ad"
SecretEngineAlicloud = "alicloud"
SecretEngineAWS = "aws"
@ -71,3 +63,21 @@ const (
// database type for every database.
SecretEngineDatabase = "database"
)
// These DB consts match the type returned from database plugin's Type() method.
const (
DbCassandraPluginType = "cassandra"
DbCouchbasePluginType = "couchbase"
DbElasticSearchPluginType = "elasticsearch"
DbHanaPluginType = "hdb"
DbInfluxDBPluginType = "influxdb"
DbMongoDBPluginType = "mongodb"
DbMongoAtlasPluginType = "mongodbatlas"
DbMsSQLPluginType = "mssql"
DbMySQLPluginType = "mysql"
DbPostgresqlPluginType = "pgx"
DbRedshiftPluginType = "redshift"
DbRedisPluginType = "redis"
DbRedisElasticachePluginType = "redisElastiCache"
DbSnowflakePluginType = "snowflake"
)

View File

@ -83,6 +83,7 @@ const (
mountTypeNSCubbyhole = "ns_cubbyhole"
mountTypeToken = "token"
mountTypeNSToken = "ns_token"
mountTypeDatabase = "database"
MountTableUpdateStorage = true
MountTableNoUpdateStorage = false