validation

package
v0.0.0-...-5010687 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Package validation implements the validation logic in LUCI Config.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExamineResult

type ExamineResult struct {
	// MissingFiles are files that don't have the corresponding GCS objects.
	//
	// Use the attached signed URL to instruct client to upload the config
	// content.
	MissingFiles []struct {
		File      File
		SignedURL string
	}
	// UnvalidatableFiles are files that no service can validate.
	//
	// Those files SHOULD not be included in the validation request.
	UnvalidatableFiles []File
}

ExamineResult is the result of `Examine` method.

func (*ExamineResult) Passed

func (er *ExamineResult) Passed() bool

Passed return True if the config files passed the examination and can proceed to `Validate`.

type File

type File interface {
	// GetPath returns the relative path to the config file from config root.
	GetPath() string
	// GetGSPath returns the GCS path to where the config file is stored.
	//
	// The GCS object that the path points to SHOULD exist before calling
	// `Validate`.
	GetGSPath() gs.Path
	// GetRawContent returns the raw and uncompressed content of this config.
	//
	// This is currently used to validate the configs LUCI Config itself is
	// interested in and validate configs against legacy services.
	GetRawContent(context.Context) ([]byte, error)
}

File defines the interface of a config file in validation.

type Validator

type Validator struct {
	// GsClient is used to talk Google Cloud Storage
	GsClient clients.GsClient
	// Finder is used to find the services that can validate a given config files.
	Finder finder
	// SelfRuleSet is the RuleSet that validates the configs against LUCI Config
	// itself.
	SelfRuleSet *validation.RuleSet
}

Validator validates config files backed Google Cloud Storage.

func (*Validator) Examine

func (v *Validator) Examine(ctx context.Context, cs config.Set, files []File) (*ExamineResult, error)

Examine examines the configs files to ensure successful validation.

func (*Validator) Validate

func (v *Validator) Validate(ctx context.Context, cs config.Set, files []File) (*cfgcommonpb.ValidationResult, error)

Validate validates the provided config files.

Jump to

Keyboard shortcuts

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