validators

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Capability

func Capability() validator.String

Capability validates the string value is a valid role capability.

func IfParentDefined

func IfParentDefined(validators ...validator.String) validator.String

IfParentDefined executes the given set of validators only if the parent of the attribute this validator is defined for is itself defined. This is useful for validating attributes within a block that is mutually exclusive with other blocks.

func IsURL

func IsURL(requireHTTPS bool) validator.String

IsURL validates the given attribute is a valid URL of the form http[s]://host.tld If requiresHTTPS is true, the scheme must be https.

func Name

func Name() validator.String

Name validates the string value is a valid Chainguard name.

func UIDP

func UIDP(allowRootSentinel bool) validator.String

UIDP validates the string value is a valid Chainguard UIDP. allowRootSentinel allows "/" as a valid UIDP, which for some endpoints signals root.

func ValidRegExp

func ValidRegExp() validator.String

ValidRegExp validates the string value is a compilable regular expression.

func ValidateStringFuncs

func ValidateStringFuncs(fns ...ValidateStringFunc) validator.String

ValidateStringFuncs executes the given set of ValidateStringFunc. Useful for one-off string validation functions that can accept a string and return an error.

Types

type ValidateStringFunc

type ValidateStringFunc func(string) error

Jump to

Keyboard shortcuts

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