validation

package
v1.6.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2017 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package validation contains generic api type validation functions.

Index

Constants

View Source
const IsNegativeErrorMsg string = `must be greater than or equal to 0`

Variables

View Source
var ValidateNamespaceName = NameIsDNSLabel

ValidateNamespaceName can be used to check whether the given namespace name is valid. Prefix indicates this name will be used as part of generation, in which case trailing dashes are allowed.

View Source
var ValidateServiceAccountName = NameIsDNSSubdomain

ValidateServiceAccountName can be used to check whether the given service account name is valid. Prefix indicates this name will be used as part of generation, in which case trailing dashes are allowed.

Functions

func NameIsDNS1035Label

func NameIsDNS1035Label(name string, prefix bool) []string

NameIsDNS1035Label is a ValidateNameFunc for names that must be a DNS 952 label.

func NameIsDNSLabel

func NameIsDNSLabel(name string, prefix bool) []string

NameIsDNSLabel is a ValidateNameFunc for names that must be a DNS 1123 label.

func NameIsDNSSubdomain

func NameIsDNSSubdomain(name string, prefix bool) []string

NameIsDNSSubdomain is a ValidateNameFunc for names that must be a DNS subdomain.

func ValidateNonnegativeField

func ValidateNonnegativeField(value int64, fldPath *field.Path) field.ErrorList

Validates that given value is not negative.

Types

type ValidateNameFunc

type ValidateNameFunc func(name string, prefix bool) []string

ValidateNameFunc validates that the provided name is valid for a given resource type. Not all resources have the same validation rules for names. Prefix is true if the name will have a value appended to it. If the name is not valid, this returns a list of descriptions of individual characteristics of the value that were not valid. Otherwise this returns an empty list or nil.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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