Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsAuthenticationError ¶
IsAuthenticationError checks if given error is know auth error.
func NewAuthRefreshDriver ¶
func NewAuthRefreshDriver(d driver.Driver, a AuthProvider) driver.Driver
NewAuthRefreshDriver wraps given sql.Driver and uses AuthLoader to fetch new DNS in case of auth error.
Types ¶
type AuthProvider ¶
AuthProvider is used for refreshing DB credentials.
type AuthRefreshDriver ¶
type AuthRefreshDriver struct {
// contains filtered or unexported fields
}
AuthRefreshDriver wraps a sql.Driver with automatic credentials reloading.
func (*AuthRefreshDriver) Connect ¶
Connect call's driver.Open which automatically refreshes credentials on Auth error.
func (*AuthRefreshDriver) Driver ¶
func (d *AuthRefreshDriver) Driver() driver.Driver
Driver return pointer to itself.
func (*AuthRefreshDriver) Open ¶
func (d *AuthRefreshDriver) Open(_ string) (conn driver.Conn, err error)
Open tries opening new connection and automatically refreshes credentials on Auth error.
func (*AuthRefreshDriver) OpenConnector ¶
func (d *AuthRefreshDriver) OpenConnector(_ string) (driver.Connector, error)
OpenConnector return pointer to driver itself which implements also driver.Connector.
type BuildAuthTokenFn ¶
type BuildAuthTokenFn func(ctx context.Context, endpoint, region, dbUser string, creds aws.CredentialsProvider, optFns ...func(options *auth.BuildAuthTokenOptions)) (string, error)
type IAMAuth ¶
type IAMAuth struct {
Host, DBUser, DBPassword, DBRegion, SSLMode, DBName string
Port int
BuildAuthToken BuildAuthTokenFn
}
IAMAuth implements AuthProvider and generates IAM DB credentials.