types

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Overview

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

Index

Constants

View Source
const (
	// OCPRecommendationsStorage represents OCP recommendations database schema
	OCPRecommendationsStorage = "ocp_recommendations"

	// DVORecommendationsStorage represents DVO recommendations database schema
	DVORecommendationsStorage = "dvo_recommendations"
)
View Source
const (
	// SQLStorage constant is used to specify storage based on any SQL database
	SQLStorage = "sql"
	// RedisStorage constant is used to specify storage based on Redis database
	RedisStorage = "redis"
	// NoopStorage constant is used to specify storage based on No-op database
	NoopStorage = "noop"
)
View Source
const (
	// UserVoteDislike shows user's dislike
	UserVoteDislike = types.UserVoteDislike
	// UserVoteNone shows no vote from user
	UserVoteNone = types.UserVoteNone
	// UserVoteLike shows user's like
	UserVoteLike = types.UserVoteLike
)
View Source
const (
	// DBDriverPostgres shows that db driver is postgres
	DBDriverPostgres = types.DBDriverPostgres
	// DBDriverGeneral general sql(used for mock now)
	DBDriverGeneral = types.DBDriverGeneral
)
View Source
const (
	// ContextKeyUser is a constant for user authentication token in request
	ContextKeyUser = types.ContextKeyUser
)

Variables

View Source
var ErrEmptyReport = errors.New("empty report found in deserialized message")

ErrEmptyReport is an error returned if an empty report or a report with only empty attributes is found in the parsed message

View Source
var ErrOldReport = types.ErrOldReport

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

Functions

func ConvertDBError

func ConvertDBError(err error, itemID interface{}) error

ConvertDBError converts sql errors to those defined in this package

Types

type Account added in v1.3.2

type Account = uint32

Account represent the account number

type AllowedVersions added in v1.4.0

type AllowedVersions = map[SchemaVersion]struct{}

AllowedVersions represents the currently allowed versions of data schema

type ClusterName

type ClusterName = types.ClusterName

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

type ClusterReport

type ClusterReport = types.ClusterReport

ClusterReport represents cluster report

type ClusterReports added in v1.1.2

type ClusterReports = types.ClusterReports

ClusterReports is a data structure containing list of clusters, list of errors and dictionary with results per cluster.

type DBDriver

type DBDriver = types.DBDriver

DBDriver type for db driver enum

type DVOLinks struct {
	Jira                 []string `json:"jira"`
	ProductDocumentation []string `json:"product_documentation"`
}

DVOLinks contains some URLs with relevant information about the recommendation

type DVOMetrics added in v1.4.0

type DVOMetrics struct {
	WorkloadRecommendations []WorkloadRecommendation `json:"workload_recommendations"`
}

DVOMetrics contains all the workload recommendations for a single cluster

type DVOReport added in v1.4.0

type DVOReport struct {
	OrgID           string          `json:"org_id"`
	NamespaceID     string          `json:"namespace_id"`
	NamespaceName   string          `json:"namespace_name"`
	ClusterID       string          `json:"cluster_id"`
	Recommendations uint            `json:"recommendations"`
	Report          string          `json:"report"`
	Objects         uint            `json:"objects"`
	ReportedAt      types.Timestamp `json:"reported_at"`
	LastCheckedAt   types.Timestamp `json:"last_checked_at"`
}

DVOReport represents a single row of the dvo.dvo_report table.

type DVOWorkload added in v1.4.0

type DVOWorkload struct {
	Namespace    string `json:"namespace"`
	NamespaceUID string `json:"namespace_uid"`
	Kind         string `json:"kind"`
	Name         string `json:"name"`
	UID          string `json:"uid"`
}

DVOWorkload contains the main information of the workload recommendation

type DisabledRuleResponse

type DisabledRuleResponse = types.DisabledRuleResponse

DisabledRuleResponse represents a single disabled rule displaying only identifying information

type ErrorKey

type ErrorKey = types.ErrorKey

ErrorKey represents type for error key

type FeedbackRequest

type FeedbackRequest struct {
	Message string `json:"message"`
}

FeedbackRequest contains message of user feedback

type ForeignKeyError

type ForeignKeyError struct {
	TableName      string
	ForeignKeyName string

	// Details can reveal you information about specific item violating fk
	Details string
}

ForeignKeyError something violates foreign key error

func (*ForeignKeyError) Error

func (err *ForeignKeyError) Error() string

Error returns error string

type Identity

type Identity = types.Identity

Identity contains internal user info

type InfoItem added in v1.2.6

type InfoItem struct {
	InfoID  RuleID            `json:"info_id"`
	InfoKey InfoKey           `json:"key"`
	Details map[string]string `json:"details"`
}

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

type InfoKey added in v1.2.6

type InfoKey string

InfoKey represents type for info key

type ItemNotFoundError

type ItemNotFoundError = types.ItemNotFoundError

ItemNotFoundError shows that item with id ItemID wasn't found in the storage

type Metadata added in v1.2.6

type Metadata struct {
	GatheredAt time.Time `json:"gathering_time"`
}

Metadata represents the metadata field in the Kafka topic messages

type OrgID

type OrgID = types.OrgID

OrgID represents organization ID

type ReportItem added in v1.1.0

type ReportItem = types.ReportItem

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

type ReportResponse

type ReportResponse = types.ReportResponse

ReportResponse represents the response of /report endpoint

type ReportResponseMeta

type ReportResponseMeta = types.ReportResponseMeta

ReportResponseMeta contains metadata about the report

type ReportRules

type ReportRules = types.ReportRules

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

type RequestID

type RequestID = types.RequestID

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 = types.Rule

Rule represents the content of rule table

type RuleErrorKey

type RuleErrorKey = types.RuleErrorKey

RuleErrorKey represents the content of rule_error_key table

type RuleFQDN added in v1.3.1

type RuleFQDN = types.RuleFQDN

RuleFQDN is rule module, older notation

type RuleID

type RuleID = types.RuleID

RuleID represents type for rule id

type RuleOnReport

type RuleOnReport = types.RuleOnReport

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

type RuleRating added in v1.1.5

type RuleRating = types.RuleRating

RuleRating represents a rule rating element sent by the user

type RuleSelector added in v1.1.8

type RuleSelector = types.RuleSelector

RuleSelector represents type for rule id + error key in the rule_id|error_key format

type RuleWithContent

type RuleWithContent = types.RuleWithContent

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

type SchemaVersion added in v1.1.3

type SchemaVersion = types.SchemaVersion

SchemaVersion represents the received message's version of data schema

type TableAlreadyExistsError

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

TableAlreadyExistsError represents table already exists error

func (*TableAlreadyExistsError) Error

func (err *TableAlreadyExistsError) Error() string

Error returns error string

type TableNotFoundError

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

TableNotFoundError table not found error

func (*TableNotFoundError) Error

func (err *TableNotFoundError) Error() string

Error returns error string

type Timestamp

type Timestamp = types.Timestamp

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

type Token added in v1.1.0

type Token = types.Token

Token is x-rh-identity struct

type User added in v1.2.7

type User = types.User

User is single-user identifying struct

type UserID

type UserID = types.UserID

UserID represents type for user id

type UserVote

type UserVote = types.UserVote

UserVote is a type for user's vote

type ValidationError

type ValidationError = types.ValidationError

ValidationError validation error, for example when string is longer then expected

type Version added in v1.2.6

type Version = types.Version

Version represents the version of the cluster

type WorkloadRecommendation added in v1.4.0

type WorkloadRecommendation struct {
	ResponseID string                 `json:"response_id"`
	Component  string                 `json:"component"`
	Key        string                 `json:"key"`
	Details    map[string]interface{} `json:"details"`
	Tags       []string               `json:"tags"`
	Links      DVOLinks               `json:"links"`
	Workloads  []DVOWorkload          `json:"workloads"`
}

WorkloadRecommendation contains all the information about the recommendation Details is generic interface{} because it contains template data used to fill rule content, i.e. we don't/should't know the structure

Jump to

Keyboard shortcuts

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