validators

package
v0.10.5 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package validators provides an entrypoint for the cloudprober's validators framework.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunValidators added in v0.10.3

func RunValidators(vs []*ValidatorWithName, resp interface{}, respBody []byte, validationFailure *metrics.Map, l *logger.Logger) []string

RunValidators runs the list of validators on the given response and responseBody, updates the given validationFailure map and returns the list of failures.

func ValidationFailureMap added in v0.10.3

func ValidationFailureMap(vs []*ValidatorWithName) *metrics.Map

ValidationFailureMap returns an initialized validation failures map.

Types

type Validator

type Validator interface {
	Init(config interface{}, l *logger.Logger) error
	Validate(responseObject interface{}, responseBody []byte) (bool, error)
}

Validator interface represents a validator.

A validator runs a test on the provided input, usually the probe response, and returns the test result. If test cannot be run successfully for some reason (e.g. for malformed input), an error is returned.

type ValidatorWithName added in v0.10.2

type ValidatorWithName struct {
	Name      string
	Validator Validator
}

ValidatorWithName encapsulate a Validator and its name.

func Init

func Init(validatorConfs []*configpb.Validator, l *logger.Logger) ([]*ValidatorWithName, error)

Init initializes the validators defined in the config.

func (*ValidatorWithName) Validate added in v0.10.2

func (vwn *ValidatorWithName) Validate(responseObject interface{}, responseBody []byte) (bool, error)

Validate is simply a wrapper around the encapsulated Validator's Validate method.

Directories

Path Synopsis
Package http provides an HTTP validator for the Cloudprober's validator framework.
Package http provides an HTTP validator for the Cloudprober's validator framework.
Package integrity provides data integrity validator for the Cloudprober's validator framework.
Package integrity provides data integrity validator for the Cloudprober's validator framework.
Package regex provides regex validator for the Cloudprober's validator framework.
Package regex provides regex validator for the Cloudprober's validator framework.

Jump to

Keyboard shortcuts

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