validate

package
v0.0.0-...-3cb0de5 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package validate contains validation for RPC requests and Config entries.

Index

Constants

View Source
const (
	MaxPackagePathLength = 256

	MaxEnvValueLength = 1024
	MaxEnvVarCount    = 64
)

Variables

This section is empty.

Functions

func BotDimensions

func BotDimensions(dims map[string][]string) errors.MultiError

BotDimensions validates dimensions as self-reported by a bot.

Among other checks, verifies the bot reports "id" dimension with a single value that will be used as the bot ID.

func BotPingTolerance

func BotPingTolerance(bpt int64) error

BotPingTolerance checks a bot_ping_tolerance is correct.

func BotRequestUUID

func BotRequestUUID(val string) error

BotRequestUUID checks if `val` is a valid bot request UUID.

An empty string is considered valid as well.

func CIPDPackageName

func CIPDPackageName(pkg string, allowTemplate bool) error

CIPDPackageName checks CIPD package name is correct.

If allowTemplate is true, the package name is allowed to be a template e.g. have "${platform}" and other substitutions inside.

func CIPDPackageVersion

func CIPDPackageVersion(ver string) error

CIPDPackageVersion checks CIPD package version is correct.

func CIPDPackages

func CIPDPackages[P cipdPkg](packages []P, requirePinnedVer bool, doc *directoryocclusion.Checker, pkgSource string) errors.MultiError

CIPDPackages checks a slice of CIPD packages are correct.

func CIPDServer

func CIPDServer(server string) error

CIPDServer checks CIPD server is correct.

func Caches

func Caches[C cacheEntry](caches []C, cacheSource string) (*directoryocclusion.Checker, errors.MultiError)

Caches validates a slice of cacheEntry.

Also returns a directoryoccusion.Checker with all of the cache pathes.

Can be used to validate * []*apipb.CacheEntry * []*configpb.TaskTemplate_CacheEntry

func DimensionKey

func DimensionKey(key string) error

DimensionKey checks if `key` can be a dimension key.

func DimensionValue

func DimensionValue(val string) error

DimensionValue checks if `val` can be a dimension value.

func EnvVar

func EnvVar(ev string) error

EnvVar validates an envvar name.

func Length

func Length(val string, limit int) error

Length checks the value does not exceed the limit.

func Path

func Path(p string, maxLen int, allowWinPath bool) error

Path validates a path.

func Priority

func Priority(p int32) error

Priority checks a priority is correct.

func PubSubTopicName

func PubSubTopicName(topic string) (string, string, error)

PubSubTopicName validates the format of topic, extract the cloud project and topic id, and return them.

func SecureURL

func SecureURL(u string) error

SecureURL checks a URL is valid and secure, except for localhost.

func ServiceAccount

func ServiceAccount(sa string) error

ServiceAccount checks a service account is correct.

func SessionID

func SessionID(val string) error

SessionID checks if `val` is a valid bot session ID.

func Tag

func Tag(tag string) error

Tag checks a "<key>:<value>" tag is correct.

Types

This section is empty.

Jump to

Keyboard shortcuts

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