statping/types/incidents/samples.go

54 lines
1.1 KiB
Go
Raw Normal View History

2020-03-04 10:29:00 +00:00
package incidents
2020-03-09 15:15:15 +00:00
func Samples() error {
2020-03-04 10:29:00 +00:00
incident1 := &Incident{
Title: "Github Downtime",
Description: "This is an example of a incident for a service.",
ServiceId: 2,
}
2020-03-09 15:15:15 +00:00
if err := incident1.Create(); err != nil {
return err
}
2020-03-04 10:29:00 +00:00
i1 := &IncidentUpdate{
IncidentId: incident1.Id,
Message: "Github's page for Statping seems to be sending a 501 error.",
Type: "Investigating",
}
2020-03-09 15:15:15 +00:00
if err := i1.Create(); err != nil {
return err
}
2020-03-04 10:29:00 +00:00
i2 := &IncidentUpdate{
IncidentId: incident1.Id,
Message: "Problem is continuing and we are looking at the issues.",
Type: "Update",
}
2020-03-09 15:15:15 +00:00
if err := i2.Create(); err != nil {
return err
}
2020-03-04 10:29:00 +00:00
i3 := &IncidentUpdate{
IncidentId: incident1.Id,
Message: "Github is now back online and everything is working.",
Type: "Resolved",
}
2020-03-09 15:15:15 +00:00
if err := i3.Create(); err != nil {
return err
}
return nil
2020-03-04 10:29:00 +00:00
}
2020-03-09 15:15:15 +00:00
func SamplesUpdates() error {
2020-03-04 14:20:47 +00:00
u1 := &IncidentUpdate{
IncidentId: 1,
Message: "Github is now back online and everything is working.",
Type: "Resolved",
}
2020-03-09 15:15:15 +00:00
if err := u1.Create(); err != nil {
return err
}
return nil
2020-03-04 10:29:00 +00:00
}