Documentation
¶
Index ¶
- Constants
- Variables
- func CompleteDockerComposeYaml(maintainer, appName, filePath, host string) error
- func ReadBody[T any](w http.ResponseWriter, r *http.Request) (*T, bool)
- func Validate(validationTag, fieldValue string) error
- func ValidateStruct(inputStructure any) error
- type FileSystemOperator
- type FileSystemOperatorImpl
- type FileValidator
- type FileValidatorImpl
- type GenericRegex
- type Regex
- type ServiceValidator
- type ServiceValidatorImpl
- func (s *ServiceValidatorImpl) ValidateContainerName(serviceName string, serviceMap map[string]any, maintainerName, appName string) error
- func (f *ServiceValidatorImpl) ValidateDeploySection(serviceName string, serviceMap map[string]any) error
- func (s *ServiceValidatorImpl) ValidateImage(serviceName string, serviceMap map[string]any) error
- func (s *ServiceValidatorImpl) ValidatePorts(serviceName string, serviceMap map[string]any) error
- func (s *ServiceValidatorImpl) ValidateServiceKeys(serviceName string, serviceMap map[string]any) error
- func (s *ServiceValidatorImpl) ValidateServiceVolumes(maintainerName, appName, serviceName string, serviceMap map[string]any) error
- type SimpleFile
- type SimpleRegex
- type VersionValidator
- type VersionValidatorImpl
Constants ¶
View Source
const ( ServiceField = "service" KeyField = "key" ImageField = "image" ExpectedContainerName = "expected_container_name" PortField = "port" ExpectedPrefixField = "expected_prefix" )
View Source
const ( FieldUserName = "user_name" FieldAppName = "app_name" FieldVersionName = "version_name" FieldSearchTerm = "search_term" FieldPassword = "password" FieldEmail = "email" FieldNumber = "number" FieldHost = "host" FieldKnownHosts = "known_hosts" FieldResticBackupID = "restic_backup_id" FieldRemoteHost = "remote_host" FieldEmailOrEmpty = "email_or_empty" FieldSecret = "secret" FieldType = "type" )
Variables ¶
View Source
var (
InvalidInputError = "invalid input, regex does not match"
)
View Source
var ValidationMap = map[string]Regex{ FieldUserName: NewSimpleRegex("a-z0-9", 3, 20), FieldAppName: NewSimpleRegex("a-z0-9", 3, 20), FieldVersionName: NewSimpleRegex("a-z0-9.", 3, 20), FieldSearchTerm: NewSimpleRegex("a-z0-9", 0, 20), FieldPassword: NewSimpleRegex("a-zA-Z0-9._-", 8, 30), FieldEmail: NewGenericRegex(emailRegex), FieldNumber: NewSimpleRegex("0-9", 1, 20), FieldHost: NewSimpleRegex("a-zA-Z0-9:._-", 0, 64), FieldKnownHosts: NewGenericRegex(`^[A-Za-z0-9.:,/_+=#@\[\]| \r\n-]{0,}$`), FieldResticBackupID: NewSimpleRegex("a-f0-9", 64, 64), FieldRemoteHost: NewSimpleRegex("a-zA-Z0-9._-", 0, 64), FieldEmailOrEmpty: NewGenericRegex(`^$|^` + emailRegexSuffix), FieldSecret: simpleSecretRegex, }
Functions ¶
func ValidateStruct ¶ added in v0.0.78
Types ¶
type FileSystemOperator ¶ added in v0.0.160
type FileSystemOperatorImpl ¶ added in v0.0.160
type FileSystemOperatorImpl struct{}
func (*FileSystemOperatorImpl) CheckDockerComposeSyntax ¶ added in v0.0.160
func (f *FileSystemOperatorImpl) CheckDockerComposeSyntax(composePath string) error
func (*FileSystemOperatorImpl) ListFiles ¶ added in v0.0.161
func (f *FileSystemOperatorImpl) ListFiles(dir string) ([]SimpleFile, error)
func (*FileSystemOperatorImpl) ReadYamlFile ¶ added in v0.0.161
func (f *FileSystemOperatorImpl) ReadYamlFile(path string) (map[string]any, error)
type FileValidator ¶ added in v0.0.160
type FileValidatorImpl ¶ added in v0.0.160
type FileValidatorImpl struct {
ServiceValidator ServiceValidator
FileSystemOperator FileSystemOperator
}
func (*FileValidatorImpl) CheckAppYamlCorrectness ¶ added in v0.0.160
func (f *FileValidatorImpl) CheckAppYamlCorrectness(appConfig map[string]any) error
func (*FileValidatorImpl) CheckFilePresence ¶ added in v0.0.161
func (f *FileValidatorImpl) CheckFilePresence(appDir string) error
func (*FileValidatorImpl) ValidateComposeFile ¶ added in v0.0.160
func (f *FileValidatorImpl) ValidateComposeFile(compose map[string]any, maintainerName, appName string) error
type GenericRegex ¶ added in v0.0.151
func NewGenericRegex ¶ added in v0.0.151
func NewGenericRegex(regexString string) *GenericRegex
func (*GenericRegex) MatchString ¶ added in v0.0.151
func (r *GenericRegex) MatchString(fieldName, input string) error
type ServiceValidator ¶ added in v0.0.160
type ServiceValidator interface {
ValidateServiceKeys(serviceName string, serviceMap map[string]any) error
ValidateImage(serviceName string, serviceMap map[string]any) error
ValidateContainerName(serviceName string, serviceMap map[string]any, maintainerName, appName string) error
ValidatePorts(serviceName string, serviceMap map[string]any) error
ValidateServiceVolumes(maintainerName, appName, serviceName string, serviceMap map[string]any) error
ValidateDeploySection(serviceName string, serviceMap map[string]any) error
}
type ServiceValidatorImpl ¶ added in v0.0.160
type ServiceValidatorImpl struct{}
func (*ServiceValidatorImpl) ValidateContainerName ¶ added in v0.0.160
func (*ServiceValidatorImpl) ValidateDeploySection ¶ added in v0.0.160
func (f *ServiceValidatorImpl) ValidateDeploySection(serviceName string, serviceMap map[string]any) error
func (*ServiceValidatorImpl) ValidateImage ¶ added in v0.0.160
func (s *ServiceValidatorImpl) ValidateImage(serviceName string, serviceMap map[string]any) error
func (*ServiceValidatorImpl) ValidatePorts ¶ added in v0.0.160
func (s *ServiceValidatorImpl) ValidatePorts(serviceName string, serviceMap map[string]any) error
func (*ServiceValidatorImpl) ValidateServiceKeys ¶ added in v0.0.160
func (s *ServiceValidatorImpl) ValidateServiceKeys(serviceName string, serviceMap map[string]any) error
func (*ServiceValidatorImpl) ValidateServiceVolumes ¶ added in v0.0.160
func (s *ServiceValidatorImpl) ValidateServiceVolumes(maintainerName, appName, serviceName string, serviceMap map[string]any) error
type SimpleFile ¶ added in v0.0.161
type SimpleRegex ¶ added in v0.0.151
func NewSimpleRegex ¶ added in v0.0.151
func NewSimpleRegex(allowedSymbols string, minLength, maxLength int) *SimpleRegex
func (*SimpleRegex) MatchString ¶ added in v0.0.151
func (r *SimpleRegex) MatchString(fieldName, input string) error
type VersionValidator ¶ added in v0.0.160
func NewVersionValidator ¶ added in v0.0.160
func NewVersionValidator() VersionValidator
type VersionValidatorImpl ¶ added in v0.0.160
type VersionValidatorImpl struct {
Zipper u.Zipper
FileSystemService FileSystemOperator
FileValidator FileValidator
}
Click to show internal directories.
Click to hide internal directories.