models

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func TextIncidentState

func TextIncidentState(state IncidentState) string

func TextState

func TextState(state ComponentState) string

Types

type Component

type Component struct {
	Name  string
	Group string
}

func (*Component) MarshalJSON

func (c *Component) MarshalJSON() ([]byte, error)

func (Component) String

func (c Component) String() string

func (*Component) UnmarshalJSON

func (c *Component) UnmarshalJSON(bytes []byte) error

type ComponentState

type ComponentState int
const (
	Operational ComponentState = iota
	UnderMaintenance
	DegradedPerformance
	PartialOutage
	MajorOutage
)

type Components

type Components []Component

func (*Components) Inline

func (c *Components) Inline() []string

func (*Components) Scan

func (c *Components) Scan(src interface{}) error

func (Components) String

func (c Components) String() string

func (Components) Value

func (c Components) Value() (driver.Value, error)

type Incident

type Incident struct {
	GUID           string         `json:"guid" gorm:"primary_key"`
	CreatedAt      time.Time      `json:"created_at"`
	UpdatedAt      time.Time      `json:"updated_at"`
	State          IncidentState  `json:"state"`
	ComponentState ComponentState `json:"component_state"`
	Components     *Components    `json:"components" gorm:"type:varchar(300)"`
	Messages       []Message      `json:"messages" gorm:"ForeignKey:IncidentGUID;"`
	Metadata       []Metadata     `json:"metadata" gorm:"ForeignKey:IncidentGUID;"`
	IsScheduled    bool           `json:"is_scheduled"`
	ScheduledEnd   time.Time      `json:"scheduled_end"`
	Origin         string         `json:"origin"`
}

func (Incident) IsNew added in v1.1.0

func (i Incident) IsNew() bool

func (Incident) LastMessage

func (i Incident) LastMessage() Message

func (Incident) MainMessage

func (i Incident) MainMessage() Message

func (Incident) UpdateMessages

func (i Incident) UpdateMessages() []Message

func (Incident) UpdateMessagesReverse added in v1.1.2

func (i Incident) UpdateMessagesReverse() []Message

type IncidentState

type IncidentState int
const (
	Unresolved IncidentState = iota
	Resolved
	Monitoring
)

type IncidentUpdateRequest

type IncidentUpdateRequest struct {
	GUID           *string         `json:"guid"`
	CreatedAt      time.Time       `json:"created_at"`
	State          *IncidentState  `json:"state"`
	ComponentState *ComponentState `json:"component_state"`
	Components     *Components     `json:"components"`
	Messages       *[]Message      `json:"messages"`
	Metadata       *[]Metadata     `json:"metadata"`
	IsScheduled    *bool           `json:"is_scheduled"`
	ScheduledEnd   time.Time       `json:"scheduled_end"`
	Origin         *string         `json:"origin"`
	NoNotify       bool            `json:"no_notify"`
}

type Incidents

type Incidents []Incident

func (Incidents) Len

func (p Incidents) Len() int

func (Incidents) Less

func (p Incidents) Less(i, j int) bool

func (Incidents) Swap

func (p Incidents) Swap(i, j int)

type Message

type Message struct {
	GUID         string    `json:"guid" gorm:"primary_key"`
	IncidentGUID string    `json:"incident_guid"`
	CreatedAt    time.Time `json:"created_at"`
	Title        string    `json:"title"`
	Content      string    `json:"content" gorm:"type:text"`
}

type Messages

type Messages []Message

func (Messages) Len

func (p Messages) Len() int

func (Messages) Less

func (p Messages) Less(i, j int) bool

func (Messages) Swap

func (p Messages) Swap(i, j int)

type Metadata

type Metadata struct {
	IncidentGUID string `json:"incident_guid"`
	Key          string `json:"key"`
	Value        string `json:"value"`
}

Jump to

Keyboard shortcuts

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