validation

package
v0.0.0-...-672dd8d Latest Latest
Warning

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

Go to latest
Published: May 28, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const DNS1035LabelMaxLength int = 63
View Source
const DNS1123LabelMaxLength int = 63
View Source
const DNS1123SubdomainMaxLength int = 253
View Source
const LabelValueMaxLength int = 63

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

func InclusiveRangeError(lo, hi int) string

InclusiveRangeError returns a string explanation of a numeric "must be between" validation failure.

func IsCIdentifier

func IsCIdentifier(value string) []string

IsCIdentifier tests for a string that conforms the definition of an identifier in C. This checks the format, but not the length.

func IsConfigMapKey

func IsConfigMapKey(value string) []string

IsConfigMapKey tests for a string that is a valid key for a ConfigMap or Secret

func IsDNS1035Label

func IsDNS1035Label(value string) []string

IsDNS1035Label tests for a string that conforms to the definition of a label in DNS (RFC 1035).

func IsDNS1123Label

func IsDNS1123Label(value string) []string

IsDNS1123Label tests for a string that conforms to the definition of a label in DNS (RFC 1123).

func IsDNS1123Subdomain

func IsDNS1123Subdomain(value string) []string

IsDNS1123Subdomain tests for a string that conforms to the definition of a subdomain in DNS (RFC 1123).

func IsEnvVarName

func IsEnvVarName(value string) []string

IsEnvVarName tests if a string is a valid environment variable name.

func IsFullyQualifiedName

func IsFullyQualifiedName(fldPath *field.Path, name string) field.ErrorList

IsFullyQualifiedName checks if the name is fully qualified.

func IsHTTPHeaderName

func IsHTTPHeaderName(value string) []string

IsHTTPHeaderName checks that a string conforms to the Go HTTP library's definition of a valid header field name (a stricter subset than RFC7230).

func IsInRange

func IsInRange(value int, min int, max int) []string

IsInRange tests that the argument is in an inclusive range.

func IsQualifiedName

func IsQualifiedName(value string) []string

IsQualifiedName tests whether the value passed is what Kubernetes 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 IsValidGroupID

func IsValidGroupID(gid int64) []string

IsValidGroupID tests that the argument is a valid Unix GID.

func IsValidIP

func IsValidIP(value string) []string

IsValidIP tests that the argument is a valid IP address.

func IsValidLabelValue

func IsValidLabelValue(value string) []string

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 IsValidPercent

func IsValidPercent(percent string) []string

func IsValidPortName

func IsValidPortName(port string) []string

IsValidPortName check that the argument is valid syntax. It must be non-empty and no more than 15 characters long. It may contain only [-a-z0-9] and must contain at least one letter [a-z]. It must not start or end with a hyphen, nor contain adjacent hyphens.

Note: We only allow lower-case characters, even though RFC 6335 is case insensitive.

func IsValidPortNum

func IsValidPortNum(port int) []string

IsValidPortNum tests that the argument is a valid, non-zero port number.

func IsValidSocketAddr

func IsValidSocketAddr(value string) []string

IsSocketAddr checks that a string conforms is a valid socket address as defined in RFC 789. (e.g 0.0.0.0:10254 or [::]:10254))

func IsValidUserID

func IsValidUserID(uid int64) []string

IsValidUserID tests that the argument is a valid Unix UID.

func IsWildcardDNS1123Subdomain

func IsWildcardDNS1123Subdomain(value string) []string

IsWildcardDNS1123Subdomain tests for a string that conforms to the definition of a wildcard subdomain in DNS (RFC 1034 section 4.3.3).

func MaxLenError

func MaxLenError(length int) string

MaxLenError returns a string explanation of a "string too long" validation failure.

func RegexError

func RegexError(msg string, fmt string, examples ...string) string

RegexError returns a string explanation of a regex validation failure.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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