Documentation
¶
Index ¶
- func EncodeCursor(c Cursor) (string, error)
- func Routes(h *Handler) chi.Router
- type Cache
- type CreateMonitor
- type CreateMonitorRequest
- type CreateMonitorResponse
- type Cursor
- type GetMonitorResponse
- type Handler
- func (h *Handler) CreateMonitor(w http.ResponseWriter, r *http.Request)
- func (h *Handler) DeleteMonitor(w http.ResponseWriter, r *http.Request)
- func (h *Handler) GetAllMonitors(w http.ResponseWriter, r *http.Request)
- func (h *Handler) GetMonitor(w http.ResponseWriter, r *http.Request)
- func (h *Handler) UpdateMonitorStatus(w http.ResponseWriter, r *http.Request)
- type ListMonitorsOptions
- type ListMonitorsPage
- type ListMonitorsResponse
- type Monitor
- type MonitorRecord
- type Repository
- func (r *Repository) CloseOpenIncident(ctx context.Context, monitorID uuid.UUID) error
- func (r *Repository) Create(ctx context.Context, monitor CreateMonitor) (uuid.UUID, error)
- func (r *Repository) Delete(ctx context.Context, teamID, monitorID uuid.UUID) error
- func (r *Repository) Get(ctx context.Context, teamID, monitorID uuid.UUID) (Monitor, error)
- func (r *Repository) GetAll(ctx context.Context, teamID uuid.UUID, opts ListMonitorsOptions) ([]Monitor, bool, error)
- func (r *Repository) GetByID(ctx context.Context, monitorID uuid.UUID) (Monitor, error)
- func (r *Repository) SetEnabled(ctx context.Context, teamID, monitorID uuid.UUID, enabled bool) error
- type Service
- func (s *Service) CreateMonitor(ctx context.Context, data CreateMonitor) (uuid.UUID, error)
- func (s *Service) DeleteMonitor(ctx context.Context, teamID, monitorID uuid.UUID) error
- func (s *Service) GetAllMonitors(ctx context.Context, teamID uuid.UUID, opts ListMonitorsOptions) (ListMonitorsPage, error)
- func (s *Service) GetMonitor(ctx context.Context, teamID uuid.UUID, monitorID uuid.UUID) (Monitor, error)
- func (s *Service) LoadMonitor(ctx context.Context, monitorID uuid.UUID) (Monitor, error)
- func (s *Service) ScheduleMonitor(ctx context.Context, mID uuid.UUID, intervalSec int32, op string)
- func (s *Service) UpdateMonitorStatus(ctx context.Context, teamID, monitorID uuid.UUID, enable bool) (bool, error)
- type UpdateMonitorStatusRequest
- type UserService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodeCursor ¶ added in v0.1.9
Types ¶
type Cache ¶
type Cache interface {
GetMonitor(ctx context.Context, id uuid.UUID) (Monitor, bool)
SetMonitor(ctx context.Context, m Monitor) error
Schedule(ctx context.Context, monitorID string, runAt time.Time) error
ClearIncident(ctx context.Context, monitorID uuid.UUID) error
DelMonitor(ctx context.Context, id uuid.UUID) error
DelStatus(ctx context.Context, monitorID uuid.UUID) error
DelSchedule(ctx context.Context, monitorID string) error
}
type CreateMonitor ¶
type CreateMonitorRequest ¶
type CreateMonitorRequest struct {
Url string `json:"url" validate:"required,url"`
IntervalSec int32 `json:"interval_sec" validate:"required,gte=60"`
TimeoutSec int32 `json:"timeout_sec" validate:"required,gte=120"`
LatencyThresholdMs *int32 `json:"latency_threshold_ms"`
ExpectedStatus *int32 `json:"expected_status"`
NotificationChannels []string `json:"notification_channels"`
}
type CreateMonitorResponse ¶
type CreateMonitorResponse struct {
MonitorID string `json:"monitor_id"`
}
type Cursor ¶ added in v0.1.9
func DecodeCursor ¶ added in v0.1.9
type GetMonitorResponse ¶
type GetMonitorResponse struct {
ID string `json:"id"`
Url string `json:"url"`
IntervalSec int32 `json:"interval_sec"`
TimeoutSec int32 `json:"timeout_sec"`
LatencyThresholdMs *int32 `json:"latency_threshold_ms"`
ExpectedStatus *int32 `json:"expected_status"`
Enabled bool `json:"enabled"`
IsDown bool `json:"is_down"`
NotificationChannels []string `json:"notification_channels"`
}
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func NewHandler ¶
func (*Handler) CreateMonitor ¶
func (h *Handler) CreateMonitor(w http.ResponseWriter, r *http.Request)
func (*Handler) DeleteMonitor ¶ added in v0.1.2
func (h *Handler) DeleteMonitor(w http.ResponseWriter, r *http.Request)
func (*Handler) GetAllMonitors ¶
func (h *Handler) GetAllMonitors(w http.ResponseWriter, r *http.Request)
func (*Handler) GetMonitor ¶
func (h *Handler) GetMonitor(w http.ResponseWriter, r *http.Request)
func (*Handler) UpdateMonitorStatus ¶
func (h *Handler) UpdateMonitorStatus(w http.ResponseWriter, r *http.Request)
type ListMonitorsOptions ¶ added in v0.1.9
type ListMonitorsPage ¶ added in v0.1.9
type ListMonitorsResponse ¶ added in v0.1.9
type ListMonitorsResponse struct {
Limit int32 `json:"limit"`
HasMore bool `json:"has_more"`
NextCursor *string `json:"next_cursor,omitempty"`
Monitors []GetMonitorResponse `json:"monitors"`
}
type MonitorRecord ¶
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
func NewRepository ¶
func NewRepository(dbExecutor db.DBTX, logger *zerolog.Logger) *Repository
func (*Repository) CloseOpenIncident ¶ added in v0.1.9
func (*Repository) Create ¶
func (r *Repository) Create(ctx context.Context, monitor CreateMonitor) (uuid.UUID, error)
func (*Repository) GetAll ¶
func (r *Repository) GetAll(ctx context.Context, teamID uuid.UUID, opts ListMonitorsOptions) ([]Monitor, bool, error)
func (*Repository) SetEnabled ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(monitorRepo *Repository, cache Cache, userSvc UserService, logger *zerolog.Logger) *Service
func (*Service) CreateMonitor ¶
func (*Service) DeleteMonitor ¶ added in v0.1.2
func (*Service) GetAllMonitors ¶
func (s *Service) GetAllMonitors(ctx context.Context, teamID uuid.UUID, opts ListMonitorsOptions) (ListMonitorsPage, error)
func (*Service) GetMonitor ¶
func (*Service) LoadMonitor ¶
func (*Service) ScheduleMonitor ¶
type UpdateMonitorStatusRequest ¶
type UpdateMonitorStatusRequest struct {
Enable *bool `json:"enable" validate:"required"`
}
Click to show internal directories.
Click to hide internal directories.