validators

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package validators provides basic validation for splice requests and exposes an interface for additional validators.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Basic

type Basic struct {
}

Basic implements Validator and performs basic checking of a request.

func (Basic) Check

func (d Basic) Check(ctx context.Context, req *models.Request) (server.StatusCode, error)

Check returns StatusSuccess(0) if a request has data in required fields and that data passes basic integrity checks.

type GenericGeneratorChecks added in v1.2.0

type GenericGeneratorChecks struct{}

GenericGeneratorChecks provides general sanity checks for SpliceD generators

func (GenericGeneratorChecks) Check added in v1.2.0

Check returns StatusSuccess if req is valid. It may modify req to sanitize it.

type PrefixGeneratorCheck added in v1.2.0

type PrefixGeneratorCheck struct{}

PrefixGeneratorCheck provides sanity checks for the SpliceD "prefix" Generator. It may modify the request to sanitize certain inputs for compatibility.

func (PrefixGeneratorCheck) Check added in v1.2.0

Check returns StatusSuccess if req is valid. It may modify req to sanitize it.

type Reuse added in v1.2.0

type Reuse struct{}

Reuse implements validators.Validator and checks if the request is permitted to enable name reuse.

func NewReuse added in v1.2.0

func NewReuse() *Reuse

NewReuse returns a reuse validator.

func (Reuse) Check added in v1.2.0

func (r Reuse) Check(ctx context.Context, req *models.Request) (server.StatusCode, error)

type Validator

type Validator interface {
	// Check returns a status code and an error if the check failed. Check
	// should perform its own cleanup (defer or otherwise) prior to returning.
	Check(context.Context, *models.Request) (server.StatusCode, error)
}

Validator performs metadata checking for requests.

func New

func New() ([]Validator, error)

New returns a slice containing all basic validators for interactive requests.

func NewUnattended

func NewUnattended() ([]Validator, error)

NewUnattended returns a slice containing all validators required for unattended requests.

Jump to

Keyboard shortcuts

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