validate

package
v0.0.0-...-7bf56e6 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: Apache-2.0 Imports: 13 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 BotPingTolerance

func BotPingTolerance(bpt int64) error

BotPingTolerance checks a bot_ping_tolerance is correct.

func CIPDPackages

func CIPDPackages[P cipdPkg](packages []P, requirePinnedVer bool, cachePaths stringset.Set) errors.MultiError

CIPDPackages checks a slice of CIPD packages are correct.

func Caches

func Caches[C cacheEntry](caches []C) (pathSet stringset.Set, merr errors.MultiError)

Caches validates a slice of cacheEntry.

Also returns a set of cache paths.

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

func CipdPackageName

func CipdPackageName(pkg string) error

CipdPackageName checks CIPD package name is correct.

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