Documentation ¶
Index ¶
- func IsUnsupportedInputRawVersionError(err error) bool
- func ManifestFrom(toolName string, checks map[string]string) model.Manifest
- func ManifestFromWithFlavor(toolName string, flavor string, checks map[string]string) model.Manifest
- func NewUnsupportedInputRawVersionError(msg string) error
- type CheckVersionRequest
- type CheckVersionResult
- type ExactMatchFieldVersionValidator
- type FieldSpec
- type FieldValidationResult
- type FieldVersionValidator
- type FieldVersionValidatorManager
- type FlavorSpec
- type RegexpVersionParser
- type SemverFieldVersionValidator
- type SystemAdapter
- type TestSystemAdapter
- func (t TestSystemAdapter) CheckCommandAvailable(command string) (bool, error)
- func (t *TestSystemAdapter) CheckDirExist(path string) (bool, error)
- func (t *TestSystemAdapter) ClearOutput()
- func (t *TestSystemAdapter) ExecuteCommand(commandName string, params []string) (string, error)
- func (t *TestSystemAdapter) NextOutput(outputFilePath string)
- type ToolSpec
- type ToolValidationResult
- func (result *ToolValidationResult) InvalidField(field string, valueFound string, resultDescription string) *ToolValidationResult
- func (result *ToolValidationResult) IsValid() bool
- func (result *ToolValidationResult) NotParseableVersionOutputCommand(msg string) *ToolValidationResult
- func (result *ToolValidationResult) ToolNotAvailable() *ToolValidationResult
- func (result *ToolValidationResult) ValidField(field string, valueFound string) *ToolValidationResult
- func (result *ToolValidationResult) WithToolAvailable(available bool) *ToolValidationResult
- type ToolsManager
- func (tm ToolsManager) IsManifestCompliant(manifest model.Manifest) (bool, error)
- func (tm ToolsManager) ValidateManifest(manifest model.Manifest) ([]ToolValidationResult, error)
- func (tm ToolsManager) ValidateManifestAndNotify(manifest model.Manifest, ...) ([]ToolValidationResult, error)
- func (tm ToolsManager) ValidateTool(manifestTool model.ManifestTool) ([]ToolValidationResult, error)
- type ToolsStorageAdapter
- type VersionCheckerManager
- type VersionCheckerSpec
- type VersionParser
- type VersionParserSpec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsUnsupportedInputRawVersionError ¶
IsUnsupportedInputRawVersionError checks if the given error is of type UnsupportedInputRawVersionError
func ManifestFromWithFlavor ¶
func NewUnsupportedInputRawVersionError ¶
NewUnsupportedInputRawVersionError creates a new UnsupportedInputRawVersionError
Types ¶
type CheckVersionRequest ¶
type CheckVersionRequest struct { VersionCheckerSpec VersionCheckerSpec VersionCommandOutput string ManifestTool model.ManifestTool }
type CheckVersionResult ¶
type ExactMatchFieldVersionValidator ¶
type ExactMatchFieldVersionValidator struct { }
type FieldValidationResult ¶
type FieldVersionValidator ¶
type FieldVersionValidatorManager ¶
type FieldVersionValidatorManager struct {
// contains filtered or unexported fields
}
func NewFieldVersionValidatorManager ¶
func NewFieldVersionValidatorManager(versionValidators map[string]FieldVersionValidator) FieldVersionValidatorManager
func (FieldVersionValidatorManager) FieldVersionValidator ¶
func (versionValidatorManager FieldVersionValidatorManager) FieldVersionValidator(fieldSpec FieldSpec) (FieldVersionValidator, bool)
type FlavorSpec ¶
type FlavorSpec struct { Name string `yaml:"name"` VersionCommandArgs []string `yaml:"version_command_args"` VersionChecker *VersionCheckerSpec `yaml:"version_checker"` }
type RegexpVersionParser ¶
type RegexpVersionParser struct {
// contains filtered or unexported fields
}
func NewRegexVersionParser ¶
func NewRegexVersionParser(regexpPattern string, keys []string) *RegexpVersionParser
type SemverFieldVersionValidator ¶
type SemverFieldVersionValidator struct { }
type SystemAdapter ¶
type TestSystemAdapter ¶
type TestSystemAdapter struct {
// contains filtered or unexported fields
}
func (TestSystemAdapter) CheckCommandAvailable ¶
func (t TestSystemAdapter) CheckCommandAvailable(command string) (bool, error)
func (*TestSystemAdapter) CheckDirExist ¶
func (t *TestSystemAdapter) CheckDirExist(path string) (bool, error)
func (*TestSystemAdapter) ClearOutput ¶
func (t *TestSystemAdapter) ClearOutput()
func (*TestSystemAdapter) ExecuteCommand ¶
func (t *TestSystemAdapter) ExecuteCommand(commandName string, params []string) (string, error)
func (*TestSystemAdapter) NextOutput ¶
func (t *TestSystemAdapter) NextOutput(outputFilePath string)
type ToolSpec ¶
type ToolSpec struct { Name string `yaml:"name"` Description string `yaml:"description"` Command string `yaml:"command"` VersionCommandArgs []string `yaml:"version_command_args"` VersionChecker *VersionCheckerSpec `yaml:"version_checker"` Flavors []FlavorSpec `yaml:"flavors"` }
func (ToolSpec) HasFlavors ¶
type ToolValidationResult ¶
type ToolValidationResult struct { Tool model.ManifestTool IsToolAvailable bool FieldValidations map[string]FieldValidationResult IsVersionValid bool IsCommandVersionOutputParseable bool ResultDescription string }
func ToolValidationResultFor ¶
func ToolValidationResultFor(tool model.ManifestTool) *ToolValidationResult
func (*ToolValidationResult) InvalidField ¶
func (result *ToolValidationResult) InvalidField(field string, valueFound string, resultDescription string) *ToolValidationResult
func (*ToolValidationResult) IsValid ¶
func (result *ToolValidationResult) IsValid() bool
func (*ToolValidationResult) NotParseableVersionOutputCommand ¶
func (result *ToolValidationResult) NotParseableVersionOutputCommand(msg string) *ToolValidationResult
func (*ToolValidationResult) ToolNotAvailable ¶
func (result *ToolValidationResult) ToolNotAvailable() *ToolValidationResult
func (*ToolValidationResult) ValidField ¶
func (result *ToolValidationResult) ValidField(field string, valueFound string) *ToolValidationResult
func (*ToolValidationResult) WithToolAvailable ¶
func (result *ToolValidationResult) WithToolAvailable(available bool) *ToolValidationResult
type ToolsManager ¶
type ToolsManager struct {
// contains filtered or unexported fields
}
func NewToolsManager ¶
func NewToolsManager(toolsStorageAdapter ToolsStorageAdapter, systemAdapter SystemAdapter, versionCheckerManager VersionCheckerManager) ToolsManager
func (ToolsManager) IsManifestCompliant ¶
func (tm ToolsManager) IsManifestCompliant(manifest model.Manifest) (bool, error)
func (ToolsManager) ValidateManifest ¶
func (tm ToolsManager) ValidateManifest(manifest model.Manifest) ([]ToolValidationResult, error)
func (ToolsManager) ValidateManifestAndNotify ¶
func (tm ToolsManager) ValidateManifestAndNotify(manifest model.Manifest, notifyFunc func(toolValidationResult []ToolValidationResult)) ([]ToolValidationResult, error)
func (ToolsManager) ValidateTool ¶
func (tm ToolsManager) ValidateTool(manifestTool model.ManifestTool) ([]ToolValidationResult, error)
* Manifest has flavor configured ** Tool has flavor configured? *** yes: Check version *** no: Error not configured error * Manifest DOESN'T have flavor configured ** Has the tool flavors *** no: use main tool version checker to Check version *** yes: Iterate all flavors **** if flavor Version Checker match return **** Version checker that matches not found: Return not match result with all the checks done
type ToolsStorageAdapter ¶
type VersionCheckerManager ¶
type VersionCheckerManager struct {
// contains filtered or unexported fields
}
func NewVersionCheckerManager ¶
func NewVersionCheckerManager(fieldVersionValidatorManager FieldVersionValidatorManager) VersionCheckerManager
func (VersionCheckerManager) CheckVersion ¶
func (versionCheckerManager VersionCheckerManager) CheckVersion(checkVersionRequest CheckVersionRequest) (*ToolValidationResult, error)
type VersionCheckerSpec ¶
type VersionCheckerSpec struct { VersionParserArr []VersionParserSpec `yaml:"parsers"` Fields []FieldSpec `yaml:"fields"` }
func (VersionCheckerSpec) FieldNames ¶
func (v VersionCheckerSpec) FieldNames() []string
func (VersionCheckerSpec) GetFieldSpecBy ¶
func (v VersionCheckerSpec) GetFieldSpecBy(name string) (FieldSpec, bool)
type VersionParser ¶
VersionParser interface wraps the Parse method
Parse parses the rawVersion string typically obtained by executing the version flag of a command and returns a map of key values obtained as result of parsing the input or error When the parser does not match the input a UnsupportedInputRawVersionError error must be returned