diagnosis

package
v0.0.0-...-cbcc489 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: Apache-2.0 Imports: 3 Imported by: 14

Documentation

Overview

Package diagnosis contains types used by the "agent diagnose" command.

Index

Constants

View Source
const (
	DiagnosisSuccess         Result = 0
	DiagnosisFail            Result = 1
	DiagnosisWarning         Result = 2
	DiagnosisUnexpectedError        = 3
	DiagnosisResultMIN              = DiagnosisSuccess
	DiagnosisResultMAX              = DiagnosisUnexpectedError
)

Diagnosis results

Variables

View Source
var MetadataAvailCatalog = make(MetadataAvailDiagnoseCatalog)

MetadataAvailCatalog is a set of MetadataAvailDiagnose functions

Functions

func RegisterMetadataAvail

func RegisterMetadataAvail(name string, d MetadataAvailDiagnose)

RegisterMetadataAvail adds a MetadataAvailDiagnose

Types

type Catalog

type Catalog struct {
	// contains filtered or unexported fields
}

Catalog stores the list of registered Diagnose functions

func NewCatalog

func NewCatalog() *Catalog

NewCatalog returns a new Catalog instance

func (*Catalog) GetSuites

func (c *Catalog) GetSuites() []Suite

GetSuites returns the list of registered Diagnose functions

func (*Catalog) Register

func (c *Catalog) Register(suiteName string, diagnose Diagnose)

Register registers the given Diagnose function

type Config

type Config struct {
	Verbose    bool
	RunLocal   bool
	JSONOutput bool
	Include    []string
	Exclude    []string
}

Config contains the Diagnose configuration

type Counters

type Counters struct {
	Total         int `json:"total,omitempty"`
	Success       int `json:"success,omitempty"`
	Fail          int `json:"fail,omitempty"`
	Warnings      int `json:"warnings,omitempty"`
	UnexpectedErr int `json:"unexpected_error,omitempty"`
}

Counters contains the count of the diagnosis results

func (*Counters) Increment

func (c *Counters) Increment(r Result)

Increment increments the count of the diagnosis results

type Diagnose

type Diagnose func() []Diagnosis

Diagnose interface function

type DiagnoseResult

type DiagnoseResult struct {
	Diagnoses []Diagnoses `json:"runs"`
	Summary   Counters    `json:"summary"`
}

DiagnoseResult contains the results of the diagnose command

type Diagnoses

type Diagnoses struct {
	SuiteName      string      `json:"suite_name"`
	SuiteDiagnoses []Diagnosis `json:"diagnoses"`
}

Diagnoses is a collection of Diagnosis

type Diagnosis

type Diagnosis struct {

	// run-time (pass, fail etc)
	Result Result `json:"result"`
	// static-time (meta typically)
	Name string `json:"name"`
	// run-time (actual diagnosis consumable by a user)
	Diagnosis string `json:"diagnosis"`

	// static-time (meta typically)
	Category string `json:"category,omitempty"`
	// static-time (meta typically, description of what being tested)
	Description string `json:"description,omitempty"`
	// run-time (what can be done of what docs need to be consulted to address the issue)
	Remediation string `json:"remediation,omitempty"`
	// run-time
	RawError string `json:"rawerror,omitempty"`
}

Diagnosis contains the results of the diagnosis

func (Diagnosis) MarshalJSON

func (d Diagnosis) MarshalJSON() ([]byte, error)

MarshalJSON marshals the Diagnose struct to JSON

type MetadataAvailDiagnose

type MetadataAvailDiagnose func() error

MetadataAvailDiagnose represents a function to fetch the metadata availability

type MetadataAvailDiagnoseCatalog

type MetadataAvailDiagnoseCatalog map[string]MetadataAvailDiagnose

MetadataAvailDiagnoseCatalog is a set of MetadataAvailDiagnose functions

type Result

type Result int

Result contains the result of the diagnosis

func (Result) ToString

func (r Result) ToString(colors bool) string

ToString returns the string representation of the Result

type Suite

type Suite struct {
	SuitName string
	Diagnose Diagnose
}

Suite contains the Diagnose suite information

Jump to

Keyboard shortcuts

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