Documentation ¶
Overview ¶
Package validation defines apimachinery user-defined validations.
Index ¶
- Constants
- func EmptyError() string
- func InclusiveRangeError(lo, hi int) string
- func IsDNS1123Label(value string) []string
- func IsDNS1123Subdomain(value string) []string
- func IsInRange(value int, min int, max int) []string
- func IsQualifiedName(value string) []string
- func IsValidIP(value string) []string
- func IsValidIPv4Address(fldPath *field.Path, value string) field.ErrorList
- func IsValidIPv6Address(fldPath *field.Path, value string) field.ErrorList
- func IsValidLabelValue(value string) []string
- func IsValidPassword(password string) error
- func IsValidPercent(percent string) []string
- func IsValidPortNum(port int) []string
- func MaxLenError(length int) string
- func RegexError(msg string, fmt string, examples ...string) string
- type Validator
Constants ¶
const DNS1123LabelMaxLength int = 63
DNS1123LabelMaxLength is a label's max length in DNS (RFC 1123).
const DNS1123SubdomainMaxLength int = 253
DNS1123SubdomainMaxLength is a subdomain's max length in DNS (RFC 1123).
const LabelValueMaxLength int = 63
LabelValueMaxLength is a label's max length.
Variables ¶
This section is empty.
Functions ¶
func EmptyError ¶
func EmptyError() string
EmptyError returns a string explanation of a "must not be empty" validation failure.
func InclusiveRangeError ¶
InclusiveRangeError returns a string explanation of a numeric "must be between" validation failure.
func IsDNS1123Label ¶
IsDNS1123Label tests for a string that conforms to the definition of a label in DNS (RFC 1123).
func IsDNS1123Subdomain ¶
IsDNS1123Subdomain tests for a string that conforms to the definition of a subdomain in DNS (RFC 1123).
func IsQualifiedName ¶
IsQualifiedName tests whether the value passed is what IAM calls a "qualified name". This is a format used in various places throughout the system. If the value is not valid, a list of error strings is returned. Otherwise an empty list (or nil) is returned.
func IsValidIPv4Address ¶
IsValidIPv4Address tests that the argument is a valid IPv4 address.
func IsValidIPv6Address ¶
IsValidIPv6Address tests that the argument is a valid IPv6 address.
func IsValidLabelValue ¶
IsValidLabelValue tests whether the value passed is a valid label value. If the value is not valid, a list of error strings is returned. Otherwise an empty list (or nil) is returned.
func IsValidPassword ¶
IsValidPassword validate password.
func IsValidPercent ¶
IsValidPercent checks that string is in the form of a percentage.
func IsValidPortNum ¶
IsValidPortNum tests that the argument is a valid, non-zero port number.
func MaxLenError ¶
MaxLenError returns a string explanation of a "string too long" validation failure.
Types ¶
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}
Validator is a custom validator for configs.
func NewValidator ¶
func NewValidator(data interface{}) *Validator
NewValidator creates a new Validator.