Documentation
¶
Index ¶
- Variables
- func AffectsFromImpactComponentList(componentImpacts *apiServerDefinition.ImpactComponentList) (*[]Impact, error)
- func GetCurrentPhaseGeneration(dbCon *gorm.DB) (int, error)
- func GetHighestIncidentUpdateOrder(dbCon *gorm.DB, incidentID uuid.UUID) (int, error)
- type Component
- type ID
- type Impact
- type ImpactType
- type Incident
- type IncidentUpdate
- type Labels
- type Model
- type Phase
- type Severity
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidLabelData Data is of invalid type. ErrInvalidLabelData = errors.New("label data is invalid") // ErrEmptyValue Value is empty. ErrEmptyValue = errors.New("value is empty") // ErrSeverityValueOutOfRange Severity value is out of range. ErrSeverityValueOutOfRange = errors.New("severity value out of range") // ErrMaintenanceNeedsEnd ... ErrMaintenanceNeedsEnd = errors.New("maintenance event needs a end") // ErrEndsBeforeStart An incident ends before it has started. ErrEndsBeforeStart = errors.New("incidents end before it starts") )
Functions ¶
func AffectsFromImpactComponentList ¶
func AffectsFromImpactComponentList(componentImpacts *apiServerDefinition.ImpactComponentList) (*[]Impact, error)
AffectsFromImpactComponentList parses a apiServerDefinition.ImpactComponentList to an Impact list.
func GetCurrentPhaseGeneration ¶
GetCurrentPhaseGeneration retrieves the currently highest generation.
Types ¶
type Component ¶
type Component struct {
DisplayName *apiServerDefinition.DisplayName `yaml:"displayname"`
Labels *Labels `gorm:"type:jsonb" yaml:"labels"`
ActivelyAffectedBy *[]Impact `gorm:"foreignKey:ComponentID"`
Model `gorm:"embedded"`
}
Component represents a single component that could be affected by many Incident.
func ComponentFromAPI ¶
func ComponentFromAPI(componentRequest *apiServerDefinition.Component) (*Component, error)
ComponentFromAPI creates a Component from an API request.
func (*Component) GetImpactIncidentList ¶
func (c *Component) GetImpactIncidentList() *apiServerDefinition.ImpactIncidentList
GetImpactIncidentList converts the impact list.
func (*Component) ToAPIResponse ¶
func (c *Component) ToAPIResponse() apiServerDefinition.ComponentResponseData
ToAPIResponse converts to API response.
type Impact ¶
type Impact struct {
Incident *Incident `gorm:"foreignKey:IncidentID"`
Component *Component `gorm:"foreignKey:ComponentID"`
ImpactType *ImpactType `gorm:"foreignKey:ImpactTypeID"`
IncidentID *ID `gorm:"primaryKey"`
ComponentID *ID `gorm:"primaryKey"`
ImpactTypeID *ID `gorm:"primaryKey"`
Severity *apiServerDefinition.SeverityValue `gorm:"type:smallint"`
}
Impact connect a Incident with a Component and ImpactType.
type ImpactType ¶
type ImpactType struct {
DisplayName *apiServerDefinition.DisplayName `gorm:"not null" yaml:"displayname"`
Description *apiServerDefinition.Description `yaml:"description"`
Model `gorm:"embedded"`
}
ImpactType represents the type of impact.
func ImpactTypeFromAPI ¶
func ImpactTypeFromAPI(impactTypeRequest *apiServerDefinition.ImpactType) (*ImpactType, error)
ImpactTypeFromAPI creates an ImpactType from an API request.
func (*ImpactType) ToAPIResponse ¶
func (it *ImpactType) ToAPIResponse() apiServerDefinition.ImpactTypeResponseData
ToAPIResponse converts to API response.
type Incident ¶
type Incident struct {
DisplayName *apiServerDefinition.DisplayName
Description *apiServerDefinition.Description
Affects *[]Impact `gorm:"foreignKey:IncidentID;constraint:OnDelete:CASCADE"`
BeganAt *apiServerDefinition.Date
EndedAt *apiServerDefinition.Date
PhaseGeneration *apiServerDefinition.Incremental
PhaseOrder *apiServerDefinition.Incremental
Phase *Phase `gorm:"foreignKey:PhaseGeneration,PhaseOrder;References:Generation,Order"`
Updates *[]IncidentUpdate `gorm:"foreignKey:IncidentID;constraint:OnDelete:CASCADE"`
Model `gorm:"embedded"`
}
Incident represents an incident happening to one or more Component.
func IncidentFromAPI ¶
func IncidentFromAPI(incidentRequest *apiServerDefinition.Incident) (*Incident, error)
IncidentFromAPI creates an Incident from an API request.
func (*Incident) GetImpactComponentList ¶
func (i *Incident) GetImpactComponentList() *apiServerDefinition.ImpactComponentList
GetImpactComponentList converts the Affects list to an apiServerDefinition.ImpactComponentList.
func (*Incident) GetIncidentUpdates ¶
func (i *Incident) GetIncidentUpdates() *apiServerDefinition.IncrementalList
GetIncidentUpdates converts the Updates list to an apiServerDefinition.IncrementalList.
func (*Incident) ToAPIResponse ¶
func (i *Incident) ToAPIResponse() apiServerDefinition.IncidentResponseData
ToAPIResponse converts to API response.
type IncidentUpdate ¶
type IncidentUpdate struct {
IncidentID *ID `gorm:"primaryKey"`
Order *apiServerDefinition.Incremental `gorm:"primaryKey"`
DisplayName *apiServerDefinition.DisplayName
Description *apiServerDefinition.Description
CreatedAt *apiServerDefinition.Date
}
IncidentUpdate describes a action that changes the incident.
func IncidentUpdateFromAPI ¶
func IncidentUpdateFromAPI( incidentUpdateRequest *apiServerDefinition.IncidentUpdate, incidentID uuid.UUID, order int, ) (*IncidentUpdate, error)
IncidentUpdateFromAPI creates an IncidentUpdate from an API request.
func (*IncidentUpdate) ToAPIResponse ¶
func (iu *IncidentUpdate) ToAPIResponse() apiServerDefinition.IncidentUpdateResponseData
ToAPIResponse converts to API response.
type Labels ¶
type Labels apiServerDefinition.Labels
Labels are metadata for components.
func (*Labels) Scan ¶
Scan implements the database/sql.Scanner interface to correctly read data.
type Model ¶
type Model struct {
ID ID `gorm:"primaryKey;type:uuid;"`
}
Model sets the basic Data for all true database resources.
type Phase ¶
type Phase struct {
Name *apiServerDefinition.Phase `gorm:"not null" yaml:"name"`
Generation *apiServerDefinition.Incremental `gorm:"primaryKey"`
Order *apiServerDefinition.Incremental `gorm:"primaryKey"`
}
Phase represents a state of an incident on a moving scale to resolution of the incident.
func PhaseReferenceFromAPI ¶
func PhaseReferenceFromAPI(phase *apiServerDefinition.PhaseReference) (*Phase, error)
PhaseReferenceFromAPI creates a Phase from an API request.
type Severity ¶
type Severity struct {
DisplayName *apiServerDefinition.DisplayName `yaml:"name"`
Value *apiServerDefinition.SeverityValue `gorm:"type:smallint;unique" yaml:"value"`
}
Severity represents a severity of a incident affecting a component.
func NewSeverity ¶
func NewSeverity( displayName apiServerDefinition.DisplayName, value apiServerDefinition.SeverityValue, ) (*Severity, error)
NewSeverity checks the value and creates a new severity.
func SeverityFromAPI ¶
func SeverityFromAPI(severityRequest *apiServerDefinition.SeverityRequest) (*Severity, error)
SeverityFromAPI creates a Severity from an API request.
func (*Severity) ToAPIResponse ¶
func (s *Severity) ToAPIResponse() apiServerDefinition.Severity
ToAPIResponse converts to API response.