Chore: Use SigV4 middleware from aws-sdk (#84462)

This commit is contained in:
Andres Martinez Gotor
2024-03-18 09:33:22 +01:00
committed by GitHub
parent 39b32524e2
commit 6204f1e847
10 changed files with 27 additions and 174 deletions
@@ -75,6 +75,9 @@ type PluginInstanceCfg struct {
SQLDatasourceMaxOpenConnsDefault int
SQLDatasourceMaxIdleConnsDefault int
SQLDatasourceMaxConnLifetimeDefault int
SigV4AuthEnabled bool
SigV4VerboseLogging bool
}
// ProvidePluginInstanceConfig returns a new PluginInstanceCfg.
@@ -120,6 +123,8 @@ func ProvidePluginInstanceConfig(cfg *setting.Cfg, settingProvider setting.Provi
SQLDatasourceMaxIdleConnsDefault: cfg.SqlDatasourceMaxIdleConnsDefault,
SQLDatasourceMaxConnLifetimeDefault: cfg.SqlDatasourceMaxConnLifetimeDefault,
ResponseLimit: cfg.ResponseLimit,
SigV4AuthEnabled: cfg.SigV4AuthEnabled,
SigV4VerboseLogging: cfg.SigV4VerboseLogging,
}, nil
}
@@ -151,5 +151,10 @@ func (s *RequestConfigProvider) PluginRequestConfig(ctx context.Context, pluginI
m[backend.ResponseLimit] = strconv.FormatInt(s.cfg.ResponseLimit, 10)
}
if s.cfg.SigV4AuthEnabled {
m[awsds.SigV4AuthEnabledEnvVarKeyName] = "true"
m[awsds.SigV4VerboseLoggingEnvVarKeyName] = strconv.FormatBool(s.cfg.SigV4VerboseLogging)
}
return m
}