models

package
v1.114.2 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func TextIncidentState

func TextIncidentState(state IncidentState) string

func TextScheduledState added in v1.5.1

func TextScheduledState(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"`
	Persistent     bool           `json:"persistent"`
}

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
	Idle
)

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"`
	Persistent     *bool           `json:"persistent"`
}

type Incidents

type Incidents []Incident

func (Incidents) Filter added in v1.6.1

func (p Incidents) Filter(guid string) Incidents

func (Incidents) Find added in v1.6.1

func (p Incidents) Find(guid string) 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 InputTypeMetadata added in v1.5.0

type InputTypeMetadata int
const (
	Text InputTypeMetadata = iota
	Password
	Checkbox
	Radio
	Select
)

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"`
}

type MetadataField added in v1.3.0

type MetadataField struct {
	Name         string
	Id           string
	Info         string
	InputType    InputTypeMetadata
	ForScheduled bool
	Opts         interface{}
	DefaultOpt   interface{}
}

func (MetadataField) Validate added in v1.3.0

func (m MetadataField) Validate() error

type MetadataFields added in v1.3.0

type MetadataFields []MetadataField

func (MetadataFields) LenIncident added in v1.3.0

func (mf MetadataFields) LenIncident() int

func (MetadataFields) LenScheduled added in v1.3.0

func (mf MetadataFields) LenScheduled() int

type NotifyRequest added in v1.6.1

type NotifyRequest struct {
	Incident      Incident
	TriggerByUser bool
	Subscribers   []string
}

func NewNotifyRequest added in v1.6.1

func NewNotifyRequest(incident Incident, triggerByUser bool) *NotifyRequest

Jump to

Keyboard shortcuts

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