api

package
v0.0.0-...-483b314 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2023 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertBrowserMonitorConfigToGeneric

func ConvertBrowserMonitorConfigToGeneric(config BrowserMonitorConfig) map[string]interface{}

func ConvertHTTPMonitorConfigToGeneric

func ConvertHTTPMonitorConfigToGeneric(config HTTPMonitorConfig) map[string]interface{}

Types

type AlertChannelEmailConfig

type AlertChannelEmailConfig struct {
	To       []string `json:"to"`
	From     string   `json:"from"`
	CC       []string `json:"cc"`
	BCC      []string `json:"bcc"`
	Username string   `json:"username"`
	Password string   `json:"password"`
	Host     string   `json:"host"`
	Port     int      `json:"port"`
}

type AlertChannelModel

type AlertChannelModel struct {
	Name             string                 `json:"name"`
	AlertChannelType string                 `json:"alert_channel_type"`
	Config           map[string]interface{} `json:"config"`
	CreatedAt        time.Time              `json:"created_at"`
	UpdatedAt        time.Time              `json:"updated_at"`
	Monitors         []string               `json:"monitors"`
}

func (*AlertChannelModel) SendDown

func (a *AlertChannelModel) SendDown(monitorName string, message string, dbConn *db.DatabaseConnection) error

func (*AlertChannelModel) SendUp

func (a *AlertChannelModel) SendUp(monitorName string, message string, dbConn *db.DatabaseConnection) error

type AlertChannelPagerDutyConfig

type AlertChannelPagerDutyConfig struct {
	ServiceKey string `json:"service_key"`
}

type AlertChannelSlackConfig

type AlertChannelSlackConfig struct {
	WebhookURL string `json:"webhook_url"`
}

type AlertChannelWebhookConfig

type AlertChannelWebhookConfig struct {
	URL     string            `json:"url"`
	Headers map[string]string `json:"headers"`
}

type BaseSink

type BaseSink struct {
	Name      string                 `json:"name"`
	SinkType  string                 `json:"sink_type"`
	Config    map[string]interface{} `json:"config"`
	CreatedAt time.Time              `json:"created_at"`
	UpdatedAt time.Time              `json:"updated_at"`
}

type BrowserMonitorConfig

type BrowserMonitorConfig struct {
	URL                string `json:"url"`
	TimeoutMS          int    `json:"timeout_ms"`
	BodyContains       string `json:"expected_body_contains"`
	Browser            string `json:"browser"`
	ExpectResponseCode int    `json:"expect_response_code"`
}

type CloudWatchSinkConfig

type CloudWatchSinkConfig struct {
	Region             string `json:"region"`
	AWSAccessKeyID     string `json:"aws_access_key_id"`
	AWSSecretAccessKey string `json:"aws_secret_access_key"`
}

type CreateAlertChannelInput

type CreateAlertChannelInput struct {
	Name             string                 `json:"name"`
	AlertChannelType string                 `json:"alert_channel_type"`
	Config           map[string]interface{} `json:"config"`
}

type CreateMonitorInput

type CreateMonitorInput struct {
	Name             string                 `json:"name"`
	Description      string                 `json:"description"`
	IntervalSeconds  int                    `json:"interval_seconds"`
	MonitorType      string                 `json:"monitor_type"`
	Config           map[string]interface{} `json:"config"`
	SuccessThreshold int                    `json:"success_threshold"`
	FailureThreshold int                    `json:"failure_threshold"`
	Tags             []string               `json:"tags"`
	AlertChannels    []string               `json:"alert_channels"`
	Silenced         bool                   `json:"silenced"`
}

func (*CreateMonitorInput) Validate

func (c *CreateMonitorInput) Validate() error

type CreateSecretInput

type CreateSecretInput struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type CreateSinkInput

type CreateSinkInput struct {
	Name     string                 `json:"name"`
	SinkType string                 `json:"sink_type"`
	Config   map[string]interface{} `json:"config"`
}

func (*CreateSinkInput) Validate

func (c *CreateSinkInput) Validate() error

type CreateUserRequest

type CreateUserRequest struct {
	Username string `json:"username"`
	Role     string `json:"role"`
}

type CreateUserResponse

type CreateUserResponse struct {
	APIKey string `json:"api_key"`
}

type ErrorResponse

type ErrorResponse struct {
	Error string `json:"error"`
}

type HTTPMonitorConfig

type HTTPMonitorConfig struct {
	URL                string            `json:"url"`
	Method             string            `json:"method"`
	BodyContains       string            `json:"expected_body_contains"`
	TimeoutMS          int               `json:"timeout_ms"`
	ExpectResponseCode int               `json:"expect_response_code"`
	SkipTLSValidation  bool              `json:"skip_tls_validation"`
	RequestBody        string            `json:"request_body"`
	Headers            map[string]string `json:"headers"`
}

type InfluxDBV1SinkConfig

type InfluxDBV1SinkConfig struct {
	Host     string `json:"host"`
	Username string `json:"username"`
	Password string `json:"password"`
	Database string `json:"database"`
}

type MonitorModel

type MonitorModel struct {
	Name                      string                 `json:"name"`
	Description               string                 `json:"description"`
	CurrentOutageReason       string                 `json:"current_outage_reason"`
	IntervalSeconds           int                    `json:"interval_seconds"`
	Status                    string                 `json:"status"`
	LastCheckedAt             *time.Time             `json:"last_checked_at"`
	LastCheckedFriendly       string                 `json:"last_checked_friendly"`
	StatusLastChangedAt       time.Time              `json:"status_last_changed_at"`
	StatusLastChangedFriendly string                 `json:"status_last_changed_friendly"`
	CreatedAt                 time.Time              `json:"created_at"`
	UpdatedAt                 time.Time              `json:"updated_at"`
	MonitorType               string                 `json:"monitor_type"`
	Config                    map[string]interface{} `json:"config"`
	Paused                    bool                   `json:"paused"`
	FailureCount              int                    `json:"failure_count"`
	SuccessCount              int                    `json:"success_count"`
	SuccessThreshold          int                    `json:"success_threshold"`
	FailureThreshold          int                    `json:"failure_threshold"`
	Tags                      []string               `json:"tags"`
	AlertChannels             []string               `json:"alert_channels"`
	Silenced                  bool                   `json:"silenced"`
}

type NewServerInput

type NewServerInput struct {
	Port                     int            // Port to listen on
	AutoTLS                  bool           // If true, use Let's Encrypt to automatically get a TLS certificate
	Hostname                 string         // Hostname must be set if using AutoTLS, also used when sending email alerts for callback URLs
	Logger                   *logrus.Logger // Logger to use for logging
	DBConnection             *db.DatabaseConnection
	BrowserMonitoringEnabled bool // If true, browser monitoring will be enabled
}

NewServerInput is the input for creating a Server.

type PingMonitorConfig

type PingMonitorConfig struct {
	Host      string `json:"host"`
	IPFamily  string `json:"ip_family"`
	TimeoutMS int    `json:"timeout_ms"`
}

type SecretModel

type SecretModel struct {
	Name          string    `json:"name"`
	LastUpdatedBy string    `json:"last_updated_by"`
	UpdatedAt     time.Time `json:"last_updated"`
	CreatedAt     time.Time `json:"created_at"`
}

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(input NewServerInput) (*Server, error)

NewServer creates a new api server.

func (*Server) Run

func (s *Server) Run()

Run starts the api server, it will block until the server is stopped.

type TimeStreamSinkConfig

type TimeStreamSinkConfig struct {
	Region             string `json:"region"`
	AWSAccessKeyID     string `json:"aws_access_key_id"`
	AWSSecretAccessKey string `json:"aws_secret_access_key"`
	DBName             string `json:"db_name"`
	TableName          string `json:"table_name"`
}

type UpdateAlertChannelInput

type UpdateAlertChannelInput struct {
	Config map[string]interface{} `json:"config"`
}

type UpdateMonitorInput

type UpdateMonitorInput struct {
	IntervalSeconds  *int                   `json:"interval_seconds"`
	Paused           *bool                  `json:"paused"`
	Config           map[string]interface{} `json:"config"`
	Description      *string                `json:"description"`
	SuccessThreshold *int                   `json:"success_threshold"`
	FailureThreshold *int                   `json:"failure_threshold"`
	Tags             *[]string              `json:"tags"`
	AlertChannels    *[]string              `json:"alert_channels"`
	Silenced         *bool                  `json:"silenced"`
}

func (*UpdateMonitorInput) Validate

func (c *UpdateMonitorInput) Validate() error

type UpdateSecretInput

type UpdateSecretInput struct {
	Value string `json:"value"`
}

type UpdateSinkInput

type UpdateSinkInput struct {
	Config map[string]interface{} `json:"config"`
}

func (*UpdateSinkInput) Validate

func (u *UpdateSinkInput) Validate() error

type UpdateUserRequest

type UpdateUserRequest struct {
	Role      *string `json:"role,omitempty"`
	LockedOut *bool   `json:"locked_out,omitempty"`
}

type UserModel

type UserModel struct {
	Username  string    `json:"username"`
	Role      string    `json:"role"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
	LockedOut bool      `json:"locked_out"`
}

Jump to

Keyboard shortcuts

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