Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Clients is an interface for retrieving cloud clients. Clients cloud.Clients // Clock is used to control time. Clock clockwork.Clock // Interval is the interval between user updates. Interval is also used as // the minimum password expiration duration. Interval time.Duration // Log is the logrus field logger. Log logrus.FieldLogger // UpdateMeta is used to update database metadata. UpdateMeta func(context.Context, types.Database) error }
Config is the config for users service.
func (*Config) CheckAndSetDefaults ¶
CheckAndSetDefaults validates the config and set defaults.
type Fetcher ¶
type Fetcher interface { // GetType returns the database type of the fetcher. GetType() string // FetchDatabaseUsers fetches users for provided database. FetchDatabaseUsers(ctx context.Context, database types.Database) ([]User, error) }
Fetcher fetches database users for a particular database type.
type User ¶
type User interface { // GetID returns a globally unique ID for the user. GetID() string // GetDatabaseUsername returns in-database username for the user. GetDatabaseUsername() string // Setup preforms any setup necessary like creating password secret. Setup(ctx context.Context) error // Teardown performs any teardown necessary like deleting password secret. Teardown(ctx context.Context) error // GetPassword returns the password used for database login. GetPassword(ctx context.Context) (string, error) // RotatePassword rotates user's password. RotatePassword(ctx context.Context) error }
User represents a managed cloud database user.
type Users ¶
type Users struct {
// contains filtered or unexported fields
}
Users manages database users for cloud databases.
func (*Users) GetPassword ¶
func (u *Users) GetPassword(ctx context.Context, database types.Database, username string) (string, error)
GetPassword returns the password for database login.
func (*Users) Setup ¶
Setup starts to discover and manage users for provided database.
Setup allows managed database users to become available as soon as new database is registered instead of waiting for the periodic setup goroutine. Note that there is no corresponding "Teardown" as cleanup will eventually happen in the periodic setup.