Documentation ¶
Overview ¶
Package types contains declaration of various data types (usually structures) used elsewhere in the aggregator code.
Index ¶
- Constants
- Variables
- func ConvertDBError(err error, itemID interface{}) error
- type Account
- type AllowedVersions
- type ClusterName
- type ClusterReport
- type ClusterReports
- type DBDriver
- type DVOLinks
- type DVOMetrics
- type DVOReport
- type DVOWorkload
- type DisabledRuleResponse
- type ErrorKey
- type FeedbackRequest
- type ForeignKeyError
- type Identity
- type InfoItem
- type InfoKey
- type ItemNotFoundError
- type Metadata
- type OrgID
- type ReportItem
- type ReportResponse
- type ReportResponseMeta
- type ReportRules
- type RequestID
- type Rule
- type RuleErrorKey
- type RuleFQDN
- type RuleID
- type RuleOnReport
- type RuleRating
- type RuleSelector
- type RuleWithContent
- type SchemaVersion
- type TableAlreadyExistsError
- type TableNotFoundError
- type Timestamp
- type Token
- type User
- type UserID
- type UserVote
- type ValidationError
- type Version
- type WorkloadRecommendation
Constants ¶
const ( // OCPRecommendationsStorage represents OCP recommendations database schema OCPRecommendationsStorage = "ocp_recommendations" // DVORecommendationsStorage represents DVO recommendations database schema DVORecommendationsStorage = "dvo_recommendations" )
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" )
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 )
const ( // DBDriverPostgres shows that db driver is postgres DBDriverPostgres = types.DBDriverPostgres // DBDriverGeneral general sql(used for mock now) DBDriverGeneral = types.DBDriverGeneral )
const ( // ContextKeyUser is a constant for user authentication token in request ContextKeyUser = types.ContextKeyUser )
Variables ¶
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
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 ¶
ConvertDBError converts sql errors to those defined in this package
Types ¶
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 DVOLinks ¶ added in v1.4.0
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 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 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 ItemNotFoundError ¶
type ItemNotFoundError = types.ItemNotFoundError
ItemNotFoundError shows that item with id ItemID wasn't found in the storage
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 ¶
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 RuleErrorKey ¶
type RuleErrorKey = types.RuleErrorKey
RuleErrorKey represents the content of rule_error_key table
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 ¶
Timestamp represents any timestamp in a form gathered from database TODO: need to be improved
type ValidationError ¶
type ValidationError = types.ValidationError
ValidationError validation error, for example when string is longer then expected
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