package credsutil
import "github.com/hashicorp/vault/sdk/database/helper/credsutil"
Index ¶
- Constants
- func GenerateUsername(opts ...UsernameOpt) (string, error)
- func RandomAlphaNumeric(length int, prependA1a bool) (string, error)
- type CaseOp
- func CaseOpString(s string) (CaseOp, error)
- func CaseOpValues() []CaseOp
- func (i CaseOp) IsACaseOp() bool
- func (i CaseOp) String() string
- 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 )
Functions ¶
func GenerateUsername ¶
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 ¶
type CaseOp int
func CaseOpString ¶
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 ¶
func CaseOpValues() []CaseOp
CaseOpValues returns all values of the enum
func (CaseOp) IsACaseOp ¶
IsACaseOp returns "true" if the value is listed in the enum definition. "false" otherwise
func (CaseOp) String ¶
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 ¶
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 ¶
type UsernameOpt func(*usernameBuilder)
func Case ¶
func Case(c CaseOp) UsernameOpt
func DisplayName ¶
func DisplayName(dispName string, maxLength int) UsernameOpt
func MaxLength ¶
func MaxLength(maxLen int) UsernameOpt
func RoleName ¶
func RoleName(roleName string, maxLength int) UsernameOpt
func Separator ¶
func Separator(sep string) UsernameOpt
func ToLower ¶
func ToLower() UsernameOpt
func ToUpper ¶
func ToUpper() UsernameOpt
Source Files ¶
caseop_enumer.go credsutil.go sql.go usernames.go
- Version
- v0.18.0 (latest)
- Published
- Jun 5, 2025
- Platform
- linux/amd64
- Imports
- 6 packages
- Last checked
- 1 month ago –
Tools for package owners.