types

package
v0.0.0-...-a7cb739 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package types contains declaration of various data types (usually structures) used elsewhere in the aggregator code.

Generated documentation is available at: https://godoc.org/github.com/RedHatInsights/insights-results-aggregator-mock/types

Documentation in literate-programming-style is available at: https://redhatinsights.github.io/insights-results-aggregator-mock/packages/types/types.html

Index

Constants

This section is empty.

Variables

View Source
var ErrOldReport = errors.New("More recent report already exists in storage")

ErrOldReport is an error returned if a more recent already exists on the storage while attempting to write a report for a cluster.

Functions

This section is empty.

Types

type Acknowledge

type Acknowledge struct {
	Acknowledged  bool   `json:"-"` // let's skip this one in responses
	Rule          string `json:"rule"`
	Justification string `json:"justification"`
	CreatedBy     string `json:"created_by"`
	CreatedAt     string `json:"created_at"`
	UpdatedAt     string `json:"updated_at"`
}

Acknowledge represents user acknowledgement of given rule

type AcknowledgementJustification

type AcknowledgementJustification struct {
	Value string `json:"justification"`
}

AcknowledgementJustification data structure represents body of request with specified justification of given acknowledgement

type AcknowledgementRuleSelectorJustification

type AcknowledgementRuleSelectorJustification struct {
	RuleSelector RuleSelector `json:"rule_id"`
	Value        string       `json:"justification"`
}

AcknowledgementRuleSelectorJustification data structure represents body of request with specified rule selector and justification of given acknowledgement

type AcknowledgementsMetadata

type AcknowledgementsMetadata struct {
	Count int `json:"count"`
}

AcknowledgementsMetadata contains metadata about list of acknowledgements

type AcknowledgementsResponse

type AcknowledgementsResponse struct {
	Metadata AcknowledgementsMetadata `json:"meta"`
	Data     []Acknowledge            `json:"data"`
}

AcknowledgementsResponse is structure returned to client in JSON serialization format

type Alert

type Alert struct {
	Name      string `json:"name"`
	Namespace string `json:"namespace"`
	Severity  string `json:"severity"`
	URL       string `json:"url"`
}

Alert data structure representing a single alert

type ClusterName

type ClusterName string

ClusterName represents name of cluster in format c8590f31-e97e-4b85-b506-c45ce1911a12

type ClusterReport

type ClusterReport string

ClusterReport represents cluster report

type Component

type Component string

Component represent name of component (of rule)

type DBDriver

type DBDriver int

DBDriver type for db driver enum

const (
	// DBDriverSQLite3 shows that db driver is sqlite
	DBDriverSQLite3 DBDriver = iota
	// DBDriverPostgres shows that db driver is postgres
	DBDriverPostgres
	// DBDriverGeneral general sql(used for mock now)
	DBDriverGeneral
)

type DVOWorkload

type DVOWorkload struct {
	Rule             string
	CheckDescription string
	CheckRemediation string
	Kind             string
	UID              string
	NamespaceName    string
	NamespaceUID     string
}

DVOWorkload structure represents one item for DVO recommendation for any cluster

type DisabledRuleResponse

type DisabledRuleResponse struct {
	RuleModule  string `json:"rule_id"`
	Description string `json:"description"`
	Generic     string `json:"details"`
	DisabledAt  string `json:"disabled_at"`
}

DisabledRuleResponse represents a single disabled rule displaying only identifying information

type ErrorKey

type ErrorKey string

ErrorKey represents type for error key

type KafkaOffset

type KafkaOffset int64

KafkaOffset type for kafka offset

type OperatorCondition

type OperatorCondition struct {
	Name      string `json:"name"`
	Condition string `json:"condition"`
	Reason    string `json:"reason"`
	URL       string `json:"url"`
}

OperatorCondition data structure representing a single operator condition

type OrgID

type OrgID uint32

OrgID represents organization ID

type ReportResponse

type ReportResponse struct {
	Meta  ReportResponseMeta    `json:"meta"`
	Rules []RuleContentResponse `json:"data"`
}

ReportResponse represents the response of /report endpoint

type ReportResponseMeta

type ReportResponseMeta struct {
	Count         int       `json:"count"`
	LastCheckedAt Timestamp `json:"last_checked_at"`
}

ReportResponseMeta contains metadata about the report

type ReportRules

type ReportRules struct {
	HitRules     []RuleOnReport `json:"reports"`
	SkippedRules []RuleOnReport `json:"skips"`
	PassedRules  []RuleOnReport `json:"pass"`
	TotalCount   int
}

ReportRules is a helper struct for easy JSON unmarshalling of string encoded report

type RequestID

type RequestID string

RequestID is used to store the request ID supplied in input Kafka records as a unique identifier of payloads. Empty string represents a missing request ID.

type Rule

type Rule struct {
	Module     RuleID `json:"module"`
	Name       string `json:"name"`
	Summary    string `json:"summary"`
	Reason     string `json:"reason"`
	Resolution string `json:"resolution"`
	MoreInfo   string `json:"more_info"`
}

Rule represents the content of rule table

type RuleContentResponse

type RuleContentResponse struct {
	CreatedAt    string      `json:"created_at"`
	Description  string      `json:"description"`
	ErrorKey     string      `json:"-"`
	Generic      interface{} `json:"details"`
	Reason       string      `json:"reason"`
	Resolution   string      `json:"resolution"`
	TotalRisk    int         `json:"total_risk"`
	RiskOfChange int         `json:"risk_of_change"`
	RuleModule   string      `json:"rule_id"`
	TemplateData interface{} `json:"extra_data"`
	Tags         []string    `json:"tags"`
	UserVote     UserVote    `json:"user_vote"`
	Disabled     bool        `json:"disabled"`
}

RuleContentResponse represents a single rule in the response of /report endpoint

type RuleErrorKey

type RuleErrorKey struct {
	ErrorKey    ErrorKey  `json:"error_key"`
	RuleModule  RuleID    `json:"rule_module"`
	Condition   string    `json:"condition"`
	Description string    `json:"description"`
	Impact      int       `json:"impact"`
	Likelihood  int       `json:"likelihood"`
	PublishDate time.Time `json:"publish_date"`
	Active      bool      `json:"active"`
	Generic     string    `json:"generic"`
	Tags        []string  `json:"tags"`
}

RuleErrorKey represents the content of rule_error_key table

type RuleHit

type RuleHit struct {
	Component Component
	ErrorKey  ErrorKey
	Cluster   ClusterName
}

RuleHit represents one rule hit for one defined cluster

type RuleID

type RuleID string

RuleID represents type for rule id

type RuleOnReport

type RuleOnReport struct {
	Module   string      `json:"component"`
	ErrorKey string      `json:"key"`
	Details  interface{} `json:"details"`
}

RuleOnReport represents a single (hit) rule of the string encoded report

type RuleSelector

type RuleSelector string

RuleSelector represents component + error key

type RuleWithContent

type RuleWithContent struct {
	Module      RuleID    `json:"module"`
	Name        string    `json:"name"`
	Summary     string    `json:"summary"`
	Reason      string    `json:"reason"`
	Resolution  string    `json:"resolution"`
	MoreInfo    string    `json:"more_info"`
	ErrorKey    ErrorKey  `json:"error_key"`
	Condition   string    `json:"condition"`
	Description string    `json:"description"`
	TotalRisk   int       `json:"total_risk"`
	PublishDate time.Time `json:"publish_date"`
	Active      bool      `json:"active"`
	Generic     string    `json:"generic"`
	Tags        []string  `json:"tags"`
}

RuleWithContent represents a rule with content, basically the mix of rule and rule_error_key tables' content

type SimplifiedReport

type SimplifiedReport struct {
	Cluster   string              `json:"cluster"`
	RequestID string              `json:"requestID"`
	Status    string              `json:"status"`
	RuleHits  []SimplifiedRuleHit `json:"report"`
}

SimplifiedReport is structure returned by the service to IO to handle On Demand Data Gathering

type SimplifiedRuleHit

type SimplifiedRuleHit struct {
	RuleFQDN    string `json:"rule_fqdn"`
	ErrorKey    string `json:"error_key"`
	Description string `json:"description"`
	TotalRisk   int    `json:"total_risk"`
}

SimplifiedRuleHit structure represents one simplified rule hit for On Demand Data Gathering

type Timestamp

type Timestamp string

Timestamp represents any timestamp in a form gathered from database TODO: need to be improved

type UpgradeRiskPrediction

type UpgradeRiskPrediction struct {
	Recommended bool                   `json:"upgrade_recommended"`
	Predictors  UpgradeRisksPredictors `json:"upgrade_risks_predictors"`
}

UpgradeRiskPrediction data structure represents body of the response for an upgrade-risk-predictions request

type UpgradeRisksPredictors

type UpgradeRisksPredictors struct {
	Alerts             []Alert             `json:"alerts"`
	OperatorConditions []OperatorCondition `json:"operator_conditions"`
}

UpgradeRisksPredictors data structure represents the alerts and conditions that are contained in an upgrade-risk-predictions response

type UserID

type UserID string

UserID represents type for user id

type UserVote

type UserVote int

UserVote is a type for user's vote

const (
	// UserVoteDislike shows user's dislike
	UserVoteDislike UserVote = -1
	// UserVoteNone shows no vote from user
	UserVoteNone UserVote = 0
	// UserVoteLike shows user's like
	UserVoteLike UserVote = 1
)

Jump to

Keyboard shortcuts

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