mirror of
https://github.com/replicatedhq/troubleshoot.git
synced 2026-04-15 07:16:34 +00:00
32 lines
820 B
Go
32 lines
820 B
Go
package analyzer
|
|
|
|
import (
|
|
"errors"
|
|
|
|
troubleshootv1beta1 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta1"
|
|
)
|
|
|
|
type AnalyzeResult struct {
|
|
IsPass bool
|
|
IsFail bool
|
|
IsWarn bool
|
|
|
|
Title string
|
|
Message string
|
|
URI string
|
|
}
|
|
|
|
func Analyze(analyzer *troubleshootv1beta1.Analyze, getCollectedFileContents func(string) ([]byte, error)) (*AnalyzeResult, error) {
|
|
if analyzer.ClusterVersion != nil {
|
|
return analyzeClusterVersion(analyzer.ClusterVersion, getCollectedFileContents)
|
|
}
|
|
if analyzer.StorageClass != nil {
|
|
return analyzeStorageClass(analyzer.StorageClass, getCollectedFileContents)
|
|
}
|
|
if analyzer.CustomResourceDefinition != nil {
|
|
return analyzeCustomResourceDefinition(analyzer.CustomResourceDefinition, getCollectedFileContents)
|
|
}
|
|
|
|
return nil, errors.New("invalid analyzer")
|
|
}
|