model

package
v0.0.0-...-da215d9 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package model contains data structures representing core domain entities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AffectedComponent

type AffectedComponent struct {
	Code      string `json:"code"`
	Name      string `json:"name"`
	OldStatus string `json:"old_status"`
	NewStatus string `json:"new_status"`
}

AffectedComponent represents the structure of an affected component

type Component

type Component struct {
	ID                 string    `json:"id"`
	PageID             string    `json:"page_id"`
	GroupID            string    `json:"group_id"`
	CreatedAt          time.Time `json:"created_at"`
	UpdatedAt          time.Time `json:"updated_at"`
	Group              bool      `json:"group"`
	Name               string    `json:"name"`
	Description        string    `json:"description"`
	Position           int       `json:"position"`
	Status             string    `json:"status"`
	Showcase           bool      `json:"showcase"`
	OnlyShowIfDegraded bool      `json:"only_show_if_degraded"`
	AutomationEmail    string    `json:"automation_email"`
	StartDate          string    `json:"start_date"` // Keeping as string to preserve date format
}

Component represents the structure of a component

type Incident

type Incident struct {
	ID                                        string           `json:"id"`
	Components                                []Component      `json:"components"`
	CreatedAt                                 time.Time        `json:"created_at"`
	Impact                                    string           `json:"impact"`
	ImpactOverride                            string           `json:"impact_override"`
	IncidentUpdates                           []IncidentUpdate `json:"incident_updates"`
	Metadata                                  Metadata         `json:"metadata"`
	MonitoringAt                              time.Time        `json:"monitoring_at"`
	Name                                      string           `json:"name"`
	PageID                                    string           `json:"page_id"`
	PostmortemBody                            string           `json:"postmortem_body"`
	PostmortemBodyLastUpdatedAt               time.Time        `json:"postmortem_body_last_updated_at"`
	PostmortemIgnored                         bool             `json:"postmortem_ignored"`
	PostmortemNotifiedSubscribers             bool             `json:"postmortem_notified_subscribers"`
	PostmortemNotifiedTwitter                 bool             `json:"postmortem_notified_twitter"`
	PostmortemPublishedAt                     time.Time        `json:"postmortem_published_at"`
	ResolvedAt                                time.Time        `json:"resolved_at"`
	ScheduledAutoCompleted                    bool             `json:"scheduled_auto_completed"`
	ScheduledAutoInProgress                   bool             `json:"scheduled_auto_in_progress"`
	ScheduledFor                              time.Time        `json:"scheduled_for"`
	AutoTransitionDeliverNotificationsAtEnd   bool             `json:"auto_transition_deliver_notifications_at_end"`
	AutoTransitionDeliverNotificationsAtStart bool             `json:"auto_transition_deliver_notifications_at_start"`
	AutoTransitionToMaintenanceState          bool             `json:"auto_transition_to_maintenance_state"`
	AutoTransitionToOperationalState          bool             `json:"auto_transition_to_operational_state"`
	ScheduledRemindPrior                      bool             `json:"scheduled_remind_prior"`
	ScheduledRemindedAt                       time.Time        `json:"scheduled_reminded_at"`
	ScheduledUntil                            time.Time        `json:"scheduled_until"`
	Shortlink                                 string           `json:"shortlink"`
	Status                                    string           `json:"status"`
	UpdatedAt                                 time.Time        `json:"updated_at"`
	ReminderIntervals                         string           `json:"reminder_intervals"` // JSON string representation of intervals
}

Incident represents the structure of the provided JSON

func (Incident) Exists

func (i Incident) Exists() (bool, error)

func (Incident) GenerateContainer

func (i Incident) GenerateContainer() component.Component

func (Incident) GenerateUpdateContainer

func (i Incident) GenerateUpdateContainer(u IncidentUpdate) component.Component

func (Incident) Get

func (i Incident) Get() (IncidentInfo, error)

func (Incident) GetColor

func (i Incident) GetColor() int

func (Incident) GetSeverity

func (i Incident) GetSeverity() string

func (*Incident) OrderUpdates

func (i *Incident) OrderUpdates()

type IncidentInfo

type IncidentInfo struct {
	Id            string    `json:"id" db:"id"`
	RoleId        uint64    `json:"role_id" db:"role_id"`
	MessageId     uint64    `json:"message_id" db:"message_id"`
	ThreadId      uint64    `json:"thread_id" db:"thread_id"`
	CreatedAt     time.Time `json:"created_at" db:"created_at"`
	UpdatedAt     time.Time `json:"updated_at" db:"updated_at"`
	CurrentStatus string    `json:"status" db:"status"`
}

IncidentInfo represents the state of a Discord message for an incident

func (IncidentInfo) Save

func (i IncidentInfo) Save() error

type IncidentUpdate

type IncidentUpdate struct {
	ID                   string              `json:"id"`
	IncidentID           string              `json:"incident_id"`
	AffectedComponents   []AffectedComponent `json:"affected_components"`
	Body                 string              `json:"body"`
	CreatedAt            time.Time           `json:"created_at"`
	CustomTweet          string              `json:"custom_tweet"`
	DeliverNotifications bool                `json:"deliver_notifications"`
	DisplayAt            time.Time           `json:"display_at"`
	Status               string              `json:"status"`
	TweetID              string              `json:"tweet_id"`
	TwitterUpdatedAt     time.Time           `json:"twitter_updated_at"`
	UpdatedAt            time.Time           `json:"updated_at"`
	WantsTwitterUpdate   bool                `json:"wants_twitter_update"`
}

IncidentUpdate represents the structure of an incident update

func (IncidentUpdate) AsString

func (iu IncidentUpdate) AsString() string

type JIRAData

type JIRAData struct {
	IssueID string `json:"issue_id"`
}

JIRAData represents the structure of JIRA-related metadata

type Metadata

type Metadata struct {
	JIRA JIRAData `json:"jira"`
}

Metadata represents the structure of metadata in the incident

Jump to

Keyboard shortcuts

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