validation

package
v0.3.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: Apache-2.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	OciImageDomainFmt          string = ociDomainCompFmt + `(?:[.]` + ociDomainCompFmt + `)*` + `(?::[0-9]+)?`
	OciImageNameFmt            string = `(?:` + OciImageDomainFmt + `\/)?` + ociNameCompFmt + `(?:\/` + ociNameCompFmt + `)*`
	OciImageTagFmt             string = `[\w][\w.-]{0,127}`
	OciImageDigestFmt          string = `[A-Za-z][A-Za-z0-9]*(?:[-_+.][A-Za-z][A-Za-z0-9]*)*[:][[:xdigit:]]{32,}`
	OciImageReferenceFmt       string = `(` + OciImageNameFmt + `)(?:\:(` + OciImageTagFmt + `))?(?:\@(` + OciImageDigestFmt + `))?`
	OciImageReferenceMaxLength int    = 2048
)
View Source
const (
	// as per https://docs.github.com/en/get-started/using-git/dealing-with-special-characters-in-branch-and-tag-names#naming-branches-and-tags
	GitRevisionFmt string = `[a-zA-Z0-9]([a-zA-Z0-9\.\-\_\/])*`
	// GitHub limits to 255 minus "refs/heads/"
	GitRevisionMaxLength int = 244
)

Variables

View Source
var GenericNameRegexp = regexp.MustCompile("^" + dns1123LabelFmt + "$")
View Source
var GitRevisionRegexp = regexp.MustCompile("^" + GitRevisionFmt + "$")
View Source
var (
	OciImageReferenceRegexp = regexp.MustCompile("^" + OciImageReferenceFmt + "$")
)

Functions

func ValidateAnnotations

func ValidateAnnotations(annotations *map[string]string) []error

ValidateAnnotations validates that a set of annotations are valid K8s annotations.

func ValidateBase64Field

func ValidateBase64Field(s string, path string, maxLen int) []error

func ValidateBearerToken

func ValidateBearerToken(token *string, path string) []error

func ValidateCSR

func ValidateCSR(csr []byte) []error

func ValidateCSRUsages

func ValidateCSRUsages(u *[]string) []error

func ValidateExpirationSeconds

func ValidateExpirationSeconds(e *int32) []error

TODO: this should log a warning if less than minExpirationSeconds using the configured logger

func ValidateFilePath added in v0.3.0

func ValidateFilePath(s *string, path string) []error

func ValidateGenericName

func ValidateGenericName(name *string, path string) []error

func ValidateGitRevision

func ValidateGitRevision(name *string, path string) []error

func ValidateLabels

func ValidateLabels(labels *map[string]string) []error

ValidateLabels validates that a set of labels are valid K8s labels.

func ValidateLabelsWithPath

func ValidateLabelsWithPath(labels *map[string]string, path string) []error

ValidateLabelsWithPath validates that a set of labels are valid K8s labels, with fieldPath being the path to the label field.

func ValidateLinuxFileMode added in v0.3.0

func ValidateLinuxFileMode(m *int, path string) []error

func ValidateLinuxUserGroup added in v0.3.0

func ValidateLinuxUserGroup(s *string, path string) []error

func ValidateOciImageReference

func ValidateOciImageReference(s *string, path string) []error

Validates an OCI image reference.

func ValidateResourceName

func ValidateResourceName(name *string) []error

ValidateResourceName validates that metadata.name is not empty and is a valid name in K8s.

func ValidateResourceNameReference added in v0.2.0

func ValidateResourceNameReference(name *string, path string) []error

ValidateResourceRef validates that metadata.name is not empty and is a valid name in K8s.

func ValidateSignerName

func ValidateSignerName(s string) []error

Currently every request is sent to the only signer, named "ca" and defined in cmd/flightctl-api/main.go

func ValidateString

func ValidateString(s *string, path string, minLen int, maxLen int, patternRegexp *regexp.Regexp, patternFmt string, patternExample ...string) []error

ValidateString validates that a string has a length between minLen and maxLen, and matches the provided pattern.

func ValidateStringMap added in v0.3.0

func ValidateStringMap(m *map[string]string, path string, minLen int, maxLen int, patternRegexp *regexp.Regexp, patternFmt string, patternExample ...string) []error

ValidateStringMap validates that the k,v elements in a map are correctly defined as a string.

Types

This section is empty.

Jump to

Keyboard shortcuts

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