validators

package
v2.8.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	StorageValidationTimeout = 10 * time.Second
	// StorageCheckCacheTTL is how long a readiness check result is reused before revalidating providers
	StorageCheckCacheTTL = 5 * time.Minute
)

Variables

View Source
var (
	// ErrBucketNotFound is returned when a provider does not contain the expected bucket
	ErrBucketNotFound = errors.New("bucket not found")
	// ErrUnableToCreateBucket is returned when the local bucket could not be created and the directory does not exist
	ErrUnableToCreateBucket = errors.New("unable to create bucket directory")
	// ErrProviderTypeMismatch is returned when provider's reported type doesn't match expected type
	ErrProviderTypeMismatch = errors.New("provider type mismatch")
)
View Source
var (
	// ErrPasswordProtectedNDA is returned when an NDA upload requires a password to open
	ErrPasswordProtectedNDA = errors.New("nda pdf is password protected, remove the password and upload again")
)
View Source
var MimeTypeValidator storage.ValidationFunc = mimeTypeValidator

MimeTypeValidator validates the mime type of the uploaded file

View Source
var NDAValidator storage.ValidationFunc = ndaValidator

NDAValidator requires trust center NDAs to be PDFs that open without a password, since the attestation merge cannot decrypt them

View Source
var UploadValidator = storage.ValidationFunc(pkgobjects.ChainValidators(mimeTypeValidator, ndaValidator))

UploadValidator is the validation chain applied to every upload before it reaches storage

Functions

func StorageAvailabilityCheck

func StorageAvailabilityCheck(cfgProvider func() storage.ProviderConfig) func(ctx context.Context) error

StorageAvailabilityCheck returns a readiness check that validates storage provider availability, caching the result for StorageCheckCacheTTL so readiness probes do not hit provider APIs on every cycle

func ValidateAvailabilityByProvider

func ValidateAvailabilityByProvider(ctx context.Context, cfg storage.ProviderConfig, logSuccess bool) []error

ValidateAvailabilityByProvider validates only providers that have EnsureAvailable enabled. This allows per-provider strict availability enforcement instead of a global setting. logSuccess controls whether successful connectivity is logged; pass true on the startup path and false on recurring paths such as readiness probes

Types

This section is empty.

Jump to

Keyboard shortcuts

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