Skip to content

Open-source status page, incident response and uptime monitoring

1.8 KB
Raw Blame
package database

import "database/sql"

// JobType represents the type of job for a monitor.
type JobType string

const (
	JobTypeTCP  JobType = "tcp"
	JobTypeUDP  JobType = "udp"
	JobTypeHTTP JobType = "http"
	JobTypeDNS  JobType = "dns"
	JobTypeICMP JobType = "icmp"
	JobTypeGRPC JobType = "grpc"
)

type Monitor struct {
	ID              int            `db:"id"`
	Active          bool           `db:"active"`
	WorkspaceID     int            `db:"workspace_id"`
	JobType         JobType        `db:"job_type"`
	Periodicity     string         `db:"periodicity"`
	URL             string         `db:"url"`
	Headers         string         `db:"headers"`
	Body            string         `db:"body"`
	Method          string         `db:"method"`
	Timeout         int64          `db:"timeout"`
	DegradedAfter   sql.NullInt64  `db:"degraded_after"`
	Assertions      sql.NullString `db:"assertions"`
	Retry           int            `db:"retry"`
	FollowRedirects bool           `db:"follow_redirects"`
	OtelEndpoint    sql.NullString `db:"otel_endpoint" json:"-"`
	OtelHeaders     sql.NullString `db:"otel_headers" json:"-"`
	Name            string         `db:"name" json:"-"`
	ExternalName    sql.NullString `db:"external_name" json:"-"`
	Description     string         `db:"description" json:"-"`
	CreatedAt       int            `db:"created_at" json:"-"`
	UpdatedAt       int            `db:"updated_at" json:"-"`
	DeletedAt       sql.NullInt64  `db:"deleted_at" json:"-"`
	Regions         string         `db:"regions" json:"-"`
	Status          string         `db:"status" json:"-"`
	Public          bool           `db:"public" json:"-"`
	GrpcService     sql.NullString `db:"grpc_service" json:"-"`
	GrpcTls         sql.NullString `db:"grpc_tls" json:"-"`
}

type PrivateLocation struct {
	ID   int    `db:"id"`
	Name string `db:"name"`
}