validate

package
v0.1.57 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogInternalError

func LogInternalError(format string, a ...any)

Types

type InRangeIncludingCheck added in v0.1.55

type InRangeIncludingCheck[T constraints.Ordered] struct {
	// contains filtered or unexported fields
}

InRangeIncludingCheck represents <lowerBound, upperBound> range.

func NewPortCheck added in v0.1.55

func NewPortCheck() InRangeIncludingCheck[int32]

NewPortCheck creates InRangeIncludingCheck that can validate port correctness.

func NewPriorityCheck added in v0.1.55

func NewPriorityCheck() InRangeIncludingCheck[int64]

NewPriorityCheck creates InRangeIncludingCheck that can validate priority value.

func (*InRangeIncludingCheck[T]) Check added in v0.1.55

func (i *InRangeIncludingCheck[T]) Check(value T, valueType interface{}) error

type Line

type Line struct {
	LineNumber int
	Content    string
}

func ReadLines

func ReadLines(sourceRange hcl.Range, bytes []byte) ([]Line, error)

func ReadLinesForRange

func ReadLinesForRange(sourceRange hcl.Range) ([]Line, error)

func (Line) String

func (l Line) String() string

type RegexpValidator added in v0.1.55

type RegexpValidator struct {
	// contains filtered or unexported fields
}

func (*RegexpValidator) Check added in v0.1.55

func (r *RegexpValidator) Check(value string, valueType interface{}) error

Check validates provided string with a regexp based on the pattern and returns optional error.

type ResourceValidationInfo

type ResourceValidationInfo struct {
	SourceRanges  map[string]hcl.Range
	BlockDefRange hcl.Range
	ResourceId    string
}

type ValidationError

type ValidationError struct {
	ErrorMessage string
	ResourceId   string
	FieldName    string

	ResourceNotFound   bool
	ResourceNotFoundId string
}

type Validator added in v0.1.55

type Validator interface {
	Check(value string, valueType interface{}) error
}

func NewCIDRIPv4Check added in v0.1.55

func NewCIDRIPv4Check() Validator

NewCIDRIPv4Check creates new RegexpValidator validating CIDR IPv4

func NewDbPasswordValidator added in v0.1.55

func NewDbPasswordValidator(engine resourcespb.DatabaseEngine) Validator

func NewDbUsernameValidator added in v0.1.55

func NewDbUsernameValidator(engine resourcespb.DatabaseEngine, version string) Validator

func NewProtocolCheck added in v0.1.55

func NewProtocolCheck() Validator

NewProtocolCheck checks if provided protocol value is allowed in every deployment environment.

func NewWordWithDotHyphenUnder80Validator added in v0.1.55

func NewWordWithDotHyphenUnder80Validator() Validator

NewWordWithDotHyphenUnder80Validator creates new RegexpValidator validating with wordWithDotHyphenUnder80Pattern.

Jump to

Keyboard shortcuts

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