helpers

package
v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 17, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LowerLetters is the list of lowercase letters.
	LowerLetters = "abcdefghijklmnopqrstuvwxyz"

	// UpperLetters is the list of uppercase letters.
	UpperLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

	// Digits is the list of permitted digits.
	Digits = "0123456789"

	// Symbols is the list of symbols.
	Symbols = "~!@#$%^&*()_+`-={}|[]\\:\"<>?,./"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ControllerHelper

type ControllerHelper struct {
}

func NewControllerHelper

func NewControllerHelper() *ControllerHelper

func (*ControllerHelper) SetReconciledCondition

func (c *ControllerHelper) SetReconciledCondition(
	ctx context.Context,
	statusWriter client.StatusWriter,
	req reconcile.Request,
	resource client.Object,
	conditions *[]metav1.Condition,
	conditionType string,
	reason string,
	message string,
	err error,
	requeueAfter time.Duration,
) (reconcile.Result, error)

SetReconciledCondition is a generic helper to update the reconciled condition for any Kubernetes resource.

type Generator

type Generator struct {
	// contains filtered or unexported fields
}

Generator is the stateful generator which can be used to customize the list of letters, digits, and/or symbols.

func NewGenerator

func NewGenerator(i *GeneratorInput) (*Generator, error)

NewGenerator creates a new Generator from the specified configuration. If no input is given, all the default values are used. This function is safe for concurrent use.

func (*Generator) Generate

func (g *Generator) Generate(
	length int,
	useDigit bool,
	useSymbol bool,
	useUpper bool,
	useLower bool,
	allowRepeat bool,
) (string, error)

Generate generates a password with the given requirements. length is the total number of characters in the password. numDigits is the number of digits to include in the result. numSymbols is the number of symbols to include in the result. noUpper excludes uppercase letters from the results. allowRepeat allows characters to repeat.

The algorithm is fast, but it's not designed to be performant; it favors entropy over speed. This function is safe for concurrent use.

type GeneratorInput

type GeneratorInput struct {
	LowerLetters string
	UpperLetters string
	Digits       string
	Symbols      string
	Reader       io.Reader // rand.Reader by default
}

GeneratorInput is used as input to the NewGenerator function.

type PasswordGenerator

type PasswordGenerator struct {
}

func NewPasswordGenerator

func NewPasswordGenerator() *PasswordGenerator

func (*PasswordGenerator) Generate

func (p *PasswordGenerator) Generate(length int, useLetters bool, useSpecial bool, useNum bool) (string, error)

func GeneratePassword(length int, useLetters bool, useSpecial bool, useNum bool) string {

type S3InstanceHelper

type S3InstanceHelper struct {
}

func NewS3InstanceHelper

func NewS3InstanceHelper() *S3InstanceHelper

func (*S3InstanceHelper) GetS3ClientForRessource

func (s3InstanceHelper *S3InstanceHelper) GetS3ClientForRessource(
	ctx context.Context,
	client client.Client,
	s3factory s3factory.S3Factory,
	ressourceName string,
	ressourceNamespace string,
	ressourceS3InstanceRef string,
) (s3client.S3Client, error)

func (*S3InstanceHelper) GetS3ClientFromS3Instance

func (s3InstanceHelper *S3InstanceHelper) GetS3ClientFromS3Instance(
	ctx context.Context,
	client client.Client,
	s3factory s3factory.S3Factory,
	s3InstanceResource *s3v1alpha1.S3Instance,
) (s3client.S3Client, error)

func (*S3InstanceHelper) GetS3InstanceRefInfo

func (s3InstanceHelper *S3InstanceHelper) GetS3InstanceRefInfo(ressourceS3InstanceRef string, ressourceNamespace string) S3InstanceInfo

func (*S3InstanceHelper) IsAllowedNamespaces

func (s3InstanceHelper *S3InstanceHelper) IsAllowedNamespaces(namespace string, s3Instance *s3v1alpha1.S3Instance) bool

type S3InstanceInfo

type S3InstanceInfo struct {
	// contains filtered or unexported fields
}

func (S3InstanceInfo) Equal

func (s3InstanceInfo S3InstanceInfo) Equal(s3InstanceInfoName string, s3InstanceInfoNamespace string) bool

func (S3InstanceInfo) String

func (s3InstanceInfo S3InstanceInfo) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL