Documentation ¶
Index ¶
- Constants
- func GenerateUsername(opts ...UsernameOpt) (string, error)
- func RandomAlphaNumeric(length int, prependA1a bool) (string, error)
- type CaseOp
- type CredentialsProducer
- type SQLCredentialsProducer
- func (scp *SQLCredentialsProducer) GenerateCredentials(ctx context.Context) (string, error)
- func (scp *SQLCredentialsProducer) GenerateExpiration(ttl time.Time) (string, error)
- func (scp *SQLCredentialsProducer) GeneratePassword() (string, error)
- func (scp *SQLCredentialsProducer) GenerateUsername(config dbplugin.UsernameConfig) (string, error)
- type UsernameOpt
Constants ¶
const (
NoneLength int = -1
)
Variables ¶
This section is empty.
Functions ¶
func GenerateUsername ¶ added in v0.2.0
func GenerateUsername(opts ...UsernameOpt) (string, error)
func RandomAlphaNumeric ¶
RandomAlphaNumeric returns a random string of characters [A-Za-z0-9-] of the provided length. The string generated takes up to 4 characters of space that are predefined and prepended to ensure password character requirements. It also requires a min length of 10 characters.
Types ¶
type CaseOp ¶ added in v0.2.0
type CaseOp int
func CaseOpString ¶ added in v0.13.0
CaseOpString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func CaseOpValues ¶ added in v0.13.0
func CaseOpValues() []CaseOp
CaseOpValues returns all values of the enum
type CredentialsProducer ¶
type CredentialsProducer interface { GenerateCredentials(context.Context) (string, error) GenerateUsername(dbplugin.UsernameConfig) (string, error) GeneratePassword() (string, error) GenerateExpiration(time.Time) (string, error) }
CredentialsProducer can be used as an embedded interface in the Database definition. It implements the methods for generating user information for a particular database type and is used in all the builtin database types.
type SQLCredentialsProducer ¶
type SQLCredentialsProducer struct { DisplayNameLen int RoleNameLen int UsernameLen int Separator string LowercaseUsername bool }
SQLCredentialsProducer implements CredentialsProducer and provides a generic credentials producer for most sql database types.
func (*SQLCredentialsProducer) GenerateCredentials ¶ added in v0.1.12
func (scp *SQLCredentialsProducer) GenerateCredentials(ctx context.Context) (string, error)
func (*SQLCredentialsProducer) GenerateExpiration ¶
func (scp *SQLCredentialsProducer) GenerateExpiration(ttl time.Time) (string, error)
func (*SQLCredentialsProducer) GeneratePassword ¶
func (scp *SQLCredentialsProducer) GeneratePassword() (string, error)
func (*SQLCredentialsProducer) GenerateUsername ¶
func (scp *SQLCredentialsProducer) GenerateUsername(config dbplugin.UsernameConfig) (string, error)
type UsernameOpt ¶ added in v0.2.0
type UsernameOpt func(*usernameBuilder)
func Case ¶ added in v0.2.0
func Case(c CaseOp) UsernameOpt
func DisplayName ¶ added in v0.2.0
func DisplayName(dispName string, maxLength int) UsernameOpt
func MaxLength ¶ added in v0.2.0
func MaxLength(maxLen int) UsernameOpt
func RoleName ¶ added in v0.2.0
func RoleName(roleName string, maxLength int) UsernameOpt
func Separator ¶ added in v0.2.0
func Separator(sep string) UsernameOpt
func ToLower ¶ added in v0.2.0
func ToLower() UsernameOpt
func ToUpper ¶ added in v0.2.0
func ToUpper() UsernameOpt