Documentation ¶
Overview ¶
Package types contains declaration of various data types (usually structures) used elsewhere in the CCX Notification Service code.
Index ¶
- Constants
- type AccountNumber
- type CliFlags
- type ClusterEntry
- type ClusterName
- type ClusterOrgKey
- type ClusterReport
- type DBDriver
- type Digest
- type ErrorKey
- type EvaluatedReportItem
- type Event
- type EventMetadata
- type EventPayload
- type EventTarget
- type EventType
- type KafkaOffset
- type MissingMandatoryFile
- type ModuleName
- type NotificationContext
- type NotificationMessage
- type NotificationRecord
- type NotificationType
- type NotificationTypeID
- type NotificationTypes
- type NotifiedRecordsPerCluster
- type NotifiedRecordsPerClusterByTarget
- type OrgID
- type ProducerMessage
- type RenderedReport
- type Report
- type ReportContent
- type ReportData
- type ReportItem
- type RuleID
- type RuleName
- type Rules
- type RulesMap
- type ServiceLogEntry
- type State
- type StateID
- type States
- type TagsSet
- type TemplateRendererOutput
- type TemplateRendererRequestBody
- type Timestamp
Constants ¶
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 // NotificationBackendTarget matches the notification backend int code in the database (CCXDEV-8767) NotificationBackendTarget EventTarget = 1 // ServiceLogTarget matches the service log int code in the database (CCXDEV-8767) ServiceLogTarget EventTarget = 2 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountNumber ¶
type AccountNumber uint32
AccountNumber represents account number for a given report.
type CliFlags ¶
type CliFlags struct { InstantReports bool WeeklyReports bool ShowVersion bool ShowAuthors bool ShowConfiguration bool PrintNewReportsForCleanup bool PerformNewReportsCleanup bool PrintOldReportsForCleanup bool PerformOldReportsCleanup bool CleanupOnStartup bool Verbose bool MaxAge string }
CliFlags represents structure holding all command line arguments/flags.
type ClusterEntry ¶
type ClusterEntry struct { OrgID OrgID AccountNumber AccountNumber ClusterName ClusterName KafkaOffset KafkaOffset UpdatedAt Timestamp }
ClusterEntry represents the entries retrieved from the DB
type ClusterName ¶
type ClusterName string
ClusterName data type represents name of cluster in format c8590f31-e97e-4b85-b506-c45ce1911a12 (ie. in UUID format).
type ClusterOrgKey ¶
type ClusterOrgKey struct { OrgID OrgID ClusterName ClusterName }
ClusterOrgKey is a slice with two items: an organization ID and a cluster UUID
type Digest ¶
type Digest struct { ClustersAffected int CriticalNotifications int ImportantNotifications int Recommendations int Incidents int // We don't have this info, AFAIK }
Digest is a structure containing the counters for weekly digest
type EvaluatedReportItem ¶
type EvaluatedReportItem struct { ReportItem TotalRisk int }
EvaluatedReportItem represents a report item with additional information after evaluation
type Event ¶
type Event struct { Metadata EventMetadata `json:"metadata"` Payload EventPayload `json:"payload"` }
Event is a structure containing the payload and its metadata.
type EventMetadata ¶
type EventMetadata map[string]interface{}
EventMetadata represents the metadata of the sent payload. It is expected to be an empty struct as of today
type EventPayload ¶
EventPayload is a JSON string containing all the data required by the app to compose the various messages (Email, webhook, ...).
type EventTarget ¶
type EventTarget int8
EventTarget matches the backend int code in the database where the notifications are sent (CCXDEV-8767)
type EventType ¶
type EventType int
EventType represents the allowed event types in notification messages
type KafkaOffset ¶
type KafkaOffset int64
KafkaOffset is a data type representing offset in Kafka topic.
type MissingMandatoryFile ¶
type MissingMandatoryFile struct {
FileName string
}
MissingMandatoryFile is an error raised while parsing, when a mandatory file is missing
func (MissingMandatoryFile) Error ¶
func (err MissingMandatoryFile) Error() string
type NotificationContext ¶
type NotificationContext map[string]interface{}
NotificationContext represents the extra information that is common to all the events that are sent in this message as a JSON string (escaped)
type NotificationMessage ¶
type NotificationMessage struct { Bundle string `json:"bundle"` Application string `json:"application"` EventType string `json:"event_type"` Timestamp string `json:"timestamp"` AccountID string `json:"account_id"` OrgID string `json:"org_id"` Events []Event `json:"events"` Context NotificationContext `json:"context"` }
NotificationMessage represents content of messages sent to the notification platform topic in Kafka.
type NotificationRecord ¶
type NotificationRecord struct { OrgID OrgID AccountNumber AccountNumber ClusterName ClusterName UpdatedAt Timestamp NotificationTypeID NotificationTypeID StateID StateID Report ClusterReport NotifiedAt Timestamp ErrorLog string EventTarget EventTarget // this is the event_type_id (CCXDEV-8767) }
NotificationRecord structure represents one record stored in `reported` table.
type NotificationType ¶
type NotificationType struct { ID NotificationTypeID Value string Frequency string Comment string }
NotificationType represents one record from `notification_types` table.
type NotificationTypeID ¶
type NotificationTypeID int
NotificationTypeID represents ID value in `notifiation_types` table.
type NotificationTypes ¶
type NotificationTypes struct { Instant NotificationTypeID Weekly NotificationTypeID }
NotificationTypes contains all IDs for all possible notification types
type NotifiedRecordsPerCluster ¶
type NotifiedRecordsPerCluster map[ClusterOrgKey]NotificationRecord
NotifiedRecordsPerCluster maps a string representation of ClusterOrgKey to a NotificationRecord
type NotifiedRecordsPerClusterByTarget ¶
type NotifiedRecordsPerClusterByTarget map[EventTarget]NotifiedRecordsPerCluster
NotifiedRecordsPerClusterByTarget let us split the notified records by their target (CCXDEV-8767)
type ProducerMessage ¶
type ProducerMessage []byte
ProducerMessage is a byte array (typically converted JSON) to be processed by one of the Producer implementations
type RenderedReport ¶
type RenderedReport struct { RuleID RuleID `json:"rule_id"` ErrorKey ErrorKey `json:"error_key"` Resolution string `json:"resolution"` Reason string `json:"reason"` Description string `json:"description"` }
RenderedReport contains all rendered text fields for specific cluster report
type Report ¶
type Report struct {
Reports ReportContent `json:"reports"`
}
Report represents report send in a message consumed from any broker
type ReportContent ¶
type ReportContent []*EvaluatedReportItem
ReportContent represents the array of items expected in a report
type ReportData ¶
type ReportData struct { Clusters []ClusterName `json:"clusters"` Reports map[ClusterName]Report `json:"reports"` }
ReportData is part of the request to content template renderer containing report data
type ReportItem ¶
type ReportItem struct { Type string `json:"type"` Module ModuleName `json:"component"` ErrorKey ErrorKey `json:"key"` Details json.RawMessage `json:"details"` }
ReportItem represents a single (hit) rule of the string encoded report
type RulesMap ¶
type RulesMap map[string]types.RuleContent
RulesMap contains a map of RuleContent objects accesible indexed by rule names
type ServiceLogEntry ¶
type ServiceLogEntry struct { ClusterUUID ClusterName `json:"cluster_uuid"` Description string `json:"description"` ServiceName string `json:"service_name"` Severity string `json:"severity"` Summary string `json:"summary"` CreatedBy string `json:"created_by"` Username string `json:"username"` }
ServiceLogEntry is a structure to be sent to Service Log
type States ¶
type States struct { SameState StateID SentState StateID LowerIssueState StateID ErrorState StateID }
States contains all IDs for all possible states
type TagsSet ¶
type TagsSet map[string]struct{}
TagsSet contains a set of tags
func MakeSetOfTags ¶
MakeSetOfTags helper function makes set of tags from given list of tags
type TemplateRendererOutput ¶
type TemplateRendererOutput struct { Clusters []ClusterName `json:"clusters"` Reports map[ClusterName][]RenderedReport `json:"reports"` }
TemplateRendererOutput is an output structure from content template renderer
type TemplateRendererRequestBody ¶
type TemplateRendererRequestBody struct { Content Rules `json:"content"` ReportData ReportData `json:"report_data"` }
TemplateRendererRequestBody is a structure to be sent in request body to content template renderer