validation

package
v1.3.0-beta.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2016 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const CIdentifierFmt string = "[A-Za-z_][A-Za-z0-9_]*"
View Source
const DNS1123LabelFmt string = "[a-z0-9]([-a-z0-9]*[a-z0-9])?"
View Source
const DNS1123LabelMaxLength int = 63
View Source
const DNS1123SubdomainFmt string = DNS1123LabelFmt + "(\\." + DNS1123LabelFmt + ")*"
View Source
const DNS1123SubdomainMaxLength int = 253
View Source
const DNS952LabelFmt string = "[a-z]([-a-z0-9]*[a-z0-9])?"
View Source
const DNS952LabelMaxLength int = 24
View Source
const HTTPHeaderNameFmt string = "[-A-Za-z0-9]+"
View Source
const IdentifierNoHyphensBeginEndFmt string = "[a-z0-9]([a-z0-9-]*[a-z0-9])*"
View Source
const LabelValueMaxLength int = 63

Variables

This section is empty.

Functions

func EmptyError added in v1.3.0

func EmptyError() string

EmptyError returns a string explanation of a "must not be empty" validation failure.

func IsCIdentifier

func IsCIdentifier(value string) bool

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

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 IsDNS952Label

func IsDNS952Label(value string) []string

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

func IsHTTPHeaderName added in v1.2.0

func IsHTTPHeaderName(value string) bool

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 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 added in v1.2.0

func IsValidGroupId(gid int64) bool

IsValidGroupId tests that the argument is a valid gids.

func IsValidIP added in v1.3.0

func IsValidIP(value string) bool

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) bool

func IsValidPortName

func IsValidPortName(port string) bool

IsValidPortName check that the argument is valid syntax. It must be non empty and no more than 15 characters long It must contains at least one letter [a-z] and it must contains only [a-z0-9-]. Hypens ('-') cannot be leading or trailing character of the string and cannot be adjacent to other hyphens. Although RFC 6335 allows upper and lower case characters but case is ignored for comparison purposes: (HTTP and http denote the same service).

func IsValidPortNum

func IsValidPortNum(port int) bool

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

func IsValidUserId added in v1.2.0

func IsValidUserId(uid int64) bool

IsValidUserId tests that the argument is a valid uids.

func MaxLenError added in v1.3.0

func MaxLenError(length int) string

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

func RegexError added in v1.3.0

func RegexError(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