validation

package
v0.0.0-...-bb2f907 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2023 License: Apache-2.0 Imports: 16 Imported by: 15

Documentation

Index

Constants

View Source
const VALID_ALPHANUM_STR string = "ALPHANUM"
View Source
const VALID_ALPHA_STR string = "ALPHA"
View Source
const VALID_ANY_STR string = "ANY"
View Source
const VALID_BASE64_STR string = "BASE64"

doesn't verify valid base64 length - just checks for proper base64 characters

View Source
const VALID_NAME_STR string = "NAME"

Variables

This section is empty.

Functions

func IsIp

func IsIp(ip string) error

func IsIpv4

func IsIpv4(ip string) error

func IsIpv4Cidr

func IsIpv4Cidr(cidr string) error

func IsMac

func IsMac(mac string) error

func IsTarGz

func IsTarGz(r io.Reader) error

func IsValidLabel

func IsValidLabel(label string) []string

validate that label conforms to kubernetes label conventions

general label format expected is:
"<labelprefix>/<labelname>=<Labelvalue>"
where labelprefix matches DNS1123Subdomain format
      labelname matches DNS1123Label format

Input labels are allowed to match following formats:

"<DNS1123Subdomain>/<DNS1123Label>=<Labelvalue>"
"<DNS1123Label>=<LabelValue>"
"<LabelValue>"

func IsValidName

func IsValidName(name string) []string

default name check - matches valid label value with addtion that length > 0

func IsValidNumber

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

func IsValidNumberStr

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

func IsValidParameterPresent

func IsValidParameterPresent(vars map[string]string, sp []string) error

IsValidParameterPresent method takes in a vars map and a array of string parameters that you expect to be present in the GET request. Returns Nil if all the parameters are present or else shall return error message.

func IsValidString

func IsValidString(str string, min, max int, format string) []string

string check - validates for conformance to provided lengths and specified content min and max - the string if format string provided - check against matching predefined

func ValidateJsonSchemaData

func ValidateJsonSchemaData(jsonSchemaFile string, jsonData interface{}) (error, int)

ValidateJsonSchemaData function validates the document against the Json Schema

Types

This section is empty.

Jump to

Keyboard shortcuts

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