upapi

package
v2.0.0-...-5aa12ad Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DecodeError = errors.New("error response decode error")

Functions

func ErrorFromResponse

func ErrorFromResponse(r *http.Response) error

Types

type API

type API interface {
	Checks() ChecksEndpoint
	Contacts() ContactsEndpoint
	Dashboards() DashboardsEndpoint
	Integrations() IntegrationsEndpoint
	Tags() TagsEndpoint
	Outages() OutagesEndpoint
	ProbeServers() ProbeServersEndpoint
	StatusPages() StatusPagesEndpoint
	SLAReports() SLAReportsEndpoint
	ScheduledReports() ScheduledReportsEndpoint
}

API manages communication with the Uptime.com API.

func New

func New(opts ...Option) (api API, err error)

New returns a new API client instance.

type Alert

type Alert struct {
	PK                   int64      `json:"pk,omitempty"`
	URL                  string     `json:"url,omitempty"`
	CreatedAt            *time.Time `json:"created_at,omitempty"`
	MonitoringServerName string     `json:"monitoring_server_name,omitempty"`
	MonitoringServerIPv4 *net.IP    `json:"monitoring_server_ipv4,omitempty"`
	MonitoringServerIPv6 *net.IP    `json:"monitoring_server_ipv6,omitempty"`
	Location             string     `json:"location,omitempty"`
	Output               string     `json:"output,omitempty"`
}

Alert represents an alert generated during an outage.

type CBD

type CBD interface {
	Doer
	RequestBuilder
	ResponseDecoder
}

CBD is http Client, request Build and response Decoder bundle.

type Check

type Check struct {
	PK                     int64           `json:"pk,omitempty"`
	URL                    string          `json:"url,omitempty"`
	StatsURL               string          `json:"stats_url,omitempty"`
	AlertsURL              string          `json:"alerts_url,omitempty"`
	Name                   string          `json:"name,omitempty"`
	CachedResponseTime     float64         `json:"cached_response_time,omitempty"`
	ContactGroups          []string        `json:"contact_groups"`
	CreatedAt              time.Time       `json:"created_at,omitempty"`
	ModifiedAt             time.Time       `json:"modified_at,omitempty"`
	Locations              []string        `json:"locations,omitempty"`
	Tags                   []string        `json:"tags,omitempty"`
	CheckType              string          `json:"check_type,omitempty"`
	Escalations            string          `json:"-,omitempty"` // TODO
	MonitoringServiceType  string          `json:"monitoring_service_type,omitempty"`
	IsPaused               bool            `json:"is_paused,omitempty"`
	IsUnderMaintenance     bool            `json:"is_under_maintenance,omitempty"`
	StateIsUp              bool            `json:"state_is_up,omitempty"`
	StateChangedAt         time.Time       `json:"state_changed_at,omitempty"`
	HeartbeatURL           string          `json:"heartbeat_url,omitempty"`
	WebhookURL             string          `json:"webhook_url,omitempty"`
	Protocol               string          `json:"msp_protocol,omitempty"`
	Interval               int64           `json:"msp_interval,omitempty"`
	Address                string          `json:"msp_address"`
	Port                   int64           `json:"msp_port,omitempty"`
	Username               string          `json:"msp_username,omitempty"`
	Password               string          `json:"msp_password,omitempty"`
	Proxy                  string          `json:"msp_proxy,omitempty"`
	DNSServer              string          `json:"msp_dns_server,omitempty"`
	DNSRecordType          string          `json:"msp_dns_record_type,omitempty"`
	StatusCode             string          `json:"msp_status_code,omitempty"`
	SendString             string          `json:"msp_send_string,omitempty"`
	ExpectString           string          `json:"msp_expect_string,omitempty"`
	ExpectStringType       string          `json:"msp_expect_string_type,omitempty"`
	Encryption             string          `json:"msp_encryption,omitempty"`
	Threshold              int64           `json:"msp_threshold,omitempty"`
	Headers                string          `json:"msp_headers,omitempty"`
	Script                 string          `json:"msp_script,omitempty"`
	Version                int64           `json:"msp_version,omitempty"`
	Sensitivity            int64           `json:"msp_sensitivity,omitempty"`
	NumRetries             int64           `json:"msp_num_retries,omitempty"`
	UseIPVersion           string          `json:"msp_use_ip_version,omitempty"`
	UptimeSLA              decimal.Decimal `json:"msp_uptime_sla,omitempty"`
	ResponseTimeSLA        decimal.Decimal `json:"msp_response_time_sla,omitempty"`
	Notes                  string          `json:"msp_notes,omitempty"`
	IncludeInGlobalMetrics bool            `json:"msp_include_in_global_metrics,omitempty"`

	Maintenance *CheckMaintenance `json:"maintenance,omitempty"`

	SSLConfig       *CheckSSLCertConfig   `json:"sslconfig,omitempty"`
	PageSpeedConfig *CheckPageSpeedConfig `json:"pagespeedconfig,omitempty"`
	GroupConfig     *CheckGroupConfig     `json:"groupcheckconfig,omitempty"`
}

Check represents a check in Uptime.com.

func (Check) PrimaryKey

func (c Check) PrimaryKey() PrimaryKey

type CheckAPI

type CheckAPI struct {
	Name                   string          `json:"name,omitempty"`
	ContactGroups          []string        `json:"contact_groups,omitempty"`
	Locations              []string        `json:"locations,omitempty"`
	Tags                   []string        `json:"tags,omitempty"`
	IsPaused               bool            `json:"is_paused"`
	Interval               int64           `json:"msp_interval,omitempty"`
	Threshold              int64           `json:"msp_threshold,omitempty"`
	Script                 string          `json:"msp_script,omitempty"`
	Sensitivity            int64           `json:"msp_sensitivity,omitempty"`
	NumRetries             int64           `json:"msp_num_retries,omitempty"`
	UseIPVersion           string          `json:"msp_use_ip_version,omitempty"`
	UptimeSLA              decimal.Decimal `json:"msp_uptime_sla,omitempty"`
	ResponseTimeSLA        decimal.Decimal `json:"msp_response_time_sla,omitempty"`
	Notes                  string          `json:"msp_notes,omitempty"`
	IncludeInGlobalMetrics bool            `json:"msp_include_in_global_metrics"`
}

type CheckBlacklist

type CheckBlacklist struct {
	Name          string          `json:"name,omitempty"`
	ContactGroups []string        `json:"contact_groups,omitempty"`
	Locations     []string        `json:"locations,omitempty"`
	Tags          []string        `json:"tags,omitempty"`
	IsPaused      bool            `json:"is_paused"`
	Address       string          `json:"msp_address"`
	NumRetries    int64           `json:"msp_num_retries,omitempty"`
	UptimeSLA     decimal.Decimal `json:"msp_uptime_sla,omitempty"`
	Notes         string          `json:"msp_notes,omitempty"`
}

type CheckCreateUpdateResponse

type CheckCreateUpdateResponse struct {
	Messages map[string]interface{} `json:"messages,omitempty"`
	Results  Check                  `json:"results,omitempty"`
}

func (CheckCreateUpdateResponse) Item

type CheckDNS

type CheckDNS struct {
	Name                   string          `json:"name,omitempty"`
	ContactGroups          []string        `json:"contact_groups,omitempty"`
	Locations              []string        `json:"locations,omitempty"`
	Tags                   []string        `json:"tags,omitempty"`
	IsPaused               bool            `json:"is_paused"`
	Interval               int64           `json:"msp_interval,omitempty"`
	Address                string          `json:"msp_address"`
	DNSServer              string          `json:"msp_dns_server,omitempty"`
	DNSRecordType          string          `json:"msp_dns_record_type,omitempty"`
	ExpectString           string          `json:"msp_expect_string,omitempty"`
	Threshold              int64           `json:"msp_threshold,omitempty"`
	Sensitivity            int64           `json:"msp_sensitivity,omitempty"`
	NumRetries             int64           `json:"msp_num_retries,omitempty"`
	UptimeSLA              decimal.Decimal `json:"msp_uptime_sla,omitempty"`
	ResponseTimeSLA        decimal.Decimal `json:"msp_response_time_sla,omitempty"`
	Notes                  string          `json:"msp_notes,omitempty"`
	IncludeInGlobalMetrics bool            `json:"msp_include_in_global_metrics"`
}

type CheckGetResponse

type CheckGetResponse Check

func (CheckGetResponse) Item

func (c CheckGetResponse) Item() Check

type CheckGroup

type CheckGroup struct {
	Name                   string           `json:"name,omitempty"`
	ContactGroups          []string         `json:"contact_groups"`
	Locations              []string         `json:"locations,omitempty"`
	Tags                   []string         `json:"tags,omitempty"`
	IsPaused               bool             `json:"is_paused"`
	UptimeSLA              decimal.Decimal  `json:"msp_uptime_sla,omitempty"`
	ResponseTimeSLA        decimal.Decimal  `json:"msp_response_time_sla,omitempty"`
	Notes                  string           `json:"msp_notes,omitempty"`
	IncludeInGlobalMetrics bool             `json:"msp_include_in_global_metrics"`
	Config                 CheckGroupConfig `json:"groupcheckconfig,omitempty"`
}

type CheckGroupConfig

type CheckGroupConfig struct {
	CheckServices               []string `json:"group_check_services,omitempty"`
	CheckTags                   []string `json:"group_check_tags,omitempty"`
	CheckDownCondition          string   `json:"group_check_down_condition,omitempty"`
	UptimePercentCalculation    string   `json:"group_uptime_percent_calculation,omitempty"`
	ResponseTimeCalculationMode string   `json:"group_response_time_calculation_mode,omitempty"`
	ResponseTimeCheckType       string   `json:"group_response_time_check_type,omitempty"`
	ResponseTimeSingleCheck     string   `json:"group_response_time_single_check,omitempty"`
}

type CheckHTTP

type CheckHTTP struct {
	Name                   string          `json:"name,omitempty"`
	ContactGroups          []string        `json:"contact_groups,omitempty"`
	Locations              []string        `json:"locations,omitempty"`
	Tags                   []string        `json:"tags,omitempty"`
	IsPaused               bool            `json:"is_paused"`
	Interval               int64           `json:"msp_interval,omitempty"`
	Address                string          `json:"msp_address"`
	Port                   int64           `json:"msp_port,omitempty"`
	Username               string          `json:"msp_username,omitempty"`
	Password               string          `json:"msp_password,omitempty"`
	Proxy                  string          `json:"msp_proxy,omitempty"`
	StatusCode             string          `json:"msp_status_code"`
	SendString             string          `json:"msp_send_string,omitempty"`
	ExpectString           string          `json:"msp_expect_string,omitempty"`
	ExpectStringType       string          `json:"msp_expect_string_type,omitempty"`
	Encryption             string          `json:"msp_encryption,omitempty"`
	Threshold              int64           `json:"msp_threshold,omitempty"`
	Headers                string          `json:"msp_headers,omitempty"`
	Version                int64           `json:"msp_version,omitempty"`
	Sensitivity            int64           `json:"msp_sensitivity,omitempty"`
	NumRetries             int64           `json:"msp_num_retries,omitempty"`
	UseIPVersion           string          `json:"msp_use_ip_version,omitempty"`
	UptimeSLA              decimal.Decimal `json:"msp_uptime_sla,omitempty"`
	ResponseTimeSLA        decimal.Decimal `json:"msp_response_time_sla,omitempty"`
	Notes                  string          `json:"msp_notes,omitempty"`
	IncludeInGlobalMetrics bool            `json:"msp_include_in_global_metrics"`
}

type CheckHeartbeat

type CheckHeartbeat struct {
	Name                   string          `json:"name,omitempty"`
	ContactGroups          []string        `json:"contact_groups,omitempty"`
	Tags                   []string        `json:"tags,omitempty"`
	IsPaused               bool            `json:"is_paused"`
	Interval               int64           `json:"msp_interval,omitempty"`
	UptimeSLA              decimal.Decimal `json:"msp_uptime_sla,omitempty"`
	ResponseTimeSLA        decimal.Decimal `json:"msp_response_time_sla,omitempty"`
	Notes                  string          `json:"msp_notes,omitempty"`
	IncludeInGlobalMetrics bool            `json:"msp_include_in_global_metrics"`
	HeartbeatURL           string          `json:"heartbeat_url,omitempty"`
}

type CheckICMP

type CheckICMP struct {
	Name                   string          `json:"name,omitempty"`
	ContactGroups          []string        `json:"contact_groups,omitempty"`
	Locations              []string        `json:"locations,omitempty"`
	Tags                   []string        `json:"tags,omitempty"`
	IsPaused               bool            `json:"is_paused"`
	Interval               int64           `json:"msp_interval,omitempty"`
	Address                string          `json:"msp_address"`
	Sensitivity            int64           `json:"msp_sensitivity,omitempty"`
	NumRetries             int64           `json:"msp_num_retries,omitempty"`
	UseIPVersion           string          `json:"msp_use_ip_version,omitempty"`
	UptimeSLA              decimal.Decimal `json:"msp_uptime_sla,omitempty"`
	ResponseTimeSLA        decimal.Decimal `json:"msp_response_time_sla,omitempty"`
	Notes                  string          `json:"msp_notes,omitempty"`
	IncludeInGlobalMetrics bool            `json:"msp_include_in_global_metrics"`
}

type CheckIMAP

type CheckIMAP struct {
	Name                   string          `json:"name,omitempty"`
	ContactGroups          []string        `json:"contact_groups,omitempty"`
	Locations              []string        `json:"locations,omitempty"`
	Tags                   []string        `json:"tags,omitempty"`
	IsPaused               bool            `json:"is_paused"`
	Interval               int64           `json:"msp_interval,omitempty"`
	Address                string          `json:"msp_address"`
	Port                   int64           `json:"msp_port,omitempty"`
	ExpectString           string          `json:"msp_expect_string,omitempty"`
	Encryption             string          `json:"msp_encryption,omitempty"`
	Sensitivity            int64           `json:"msp_sensitivity,omitempty"`
	NumRetries             int64           `json:"msp_num_retries,omitempty"`
	UseIPVersion           string          `json:"msp_use_ip_version,omitempty"`
	UptimeSLA              decimal.Decimal `json:"msp_uptime_sla,omitempty"`
	ResponseTimeSLA        decimal.Decimal `json:"msp_response_time_sla,omitempty"`
	Notes                  string          `json:"msp_notes,omitempty"`
	IncludeInGlobalMetrics bool            `json:"msp_include_in_global_metrics"`
}

type CheckListOptions

type CheckListOptions struct {
	Page                  int64    `url:"page,omitempty"`
	PageSize              int64    `url:"page_size,omitempty"`
	Search                string   `url:"search,omitempty"`
	Ordering              string   `url:"ordering,omitempty"`
	MonitoringServiceType string   `url:"monitoring_service_type,omitempty"`
	IsPaused              bool     `url:"is_paused"`
	StateIsUp             bool     `url:"state_is_up,omitempty"`
	Tag                   []string `url:"tag,omitempty"`
}

CheckListOptions specifies the optional parameters to the CheckService.List method.

type CheckListResponse

type CheckListResponse struct {
	Count   int64   `json:"count,omitempty"`
	Results []Check `json:"results,omitempty"`
}

func (CheckListResponse) List

func (r CheckListResponse) List() []Check

type CheckMaintenance

type CheckMaintenance struct {
	State    string                     `json:"state,omitempty"`
	Schedule []CheckMaintenanceSchedule `json:"schedule,omitempty"`
}

type CheckMaintenanceSchedule

type CheckMaintenanceSchedule struct {
	Type          string `json:"type"`
	FromTime      string `json:"from_time,omitempty"`
	ToTime        string `json:"to_time,omitempty"`
	Monthday      int    `json:"monthday,omitempty"`
	MonthdayFrom  int    `json:"monthday_from,omitempty"`
	MonthdayTo    int    `json:"monthday_to,omitempty"`
	OnceStartDate string `json:"once_start_date,omitempty"`
	OnceEndDate   string `json:"once_end_date,omitempty"`
	Weekdays      []int  `json:"weekdays,omitempty"`
}

type CheckMalware

type CheckMalware struct {
	Name          string          `json:"name,omitempty"`
	ContactGroups []string        `json:"contact_groups,omitempty"`
	Locations     []string        `json:"locations,omitempty"`
	Tags          []string        `json:"tags,omitempty"`
	IsPaused      bool            `json:"is_paused"`
	Address       string          `json:"msp_address"`
	NumRetries    int64           `json:"msp_num_retries,omitempty"`
	UptimeSLA     decimal.Decimal `json:"msp_uptime_sla,omitempty"`
	Notes         string          `json:"msp_notes,omitempty"`
}

type CheckNTP

type CheckNTP struct {
	Name                   string          `json:"name,omitempty"`
	ContactGroups          []string        `json:"contact_groups,omitempty"`
	Locations              []string        `json:"locations,omitempty"`
	Tags                   []string        `json:"tags,omitempty"`
	IsPaused               bool            `json:"is_paused"`
	Interval               int64           `json:"msp_interval"`
	Address                string          `json:"msp_address"`
	Port                   int64           `json:"msp_port,omitempty"`
	Threshold              int64           `json:"msp_threshold,omitempty"`
	Sensitivity            int64           `json:"msp_sensitivity,omitempty"`
	NumRetries             int64           `json:"msp_num_retries,omitempty"`
	UseIPVersion           string          `json:"msp_use_ip_version,omitempty"`
	UptimeSLA              decimal.Decimal `json:"msp_uptime_sla,omitempty"`
	ResponseTimeSLA        decimal.Decimal `json:"msp_response_time_sla,omitempty"`
	Notes                  string          `json:"msp_notes,omitempty"`
	IncludeInGlobalMetrics bool            `json:"msp_include_in_global_metrics"`
}

type CheckPOP

type CheckPOP struct {
	Name                   string          `json:"name,omitempty"`
	ContactGroups          []string        `json:"contact_groups,omitempty"`
	Locations              []string        `json:"locations,omitempty"`
	Tags                   []string        `json:"tags,omitempty"`
	IsPaused               bool            `json:"is_paused"`
	Interval               int64           `json:"msp_interval,omitempty"`
	Address                string          `json:"msp_address"`
	Port                   int64           `json:"msp_port,omitempty"`
	ExpectString           string          `json:"msp_expect_string,omitempty"`
	Encryption             string          `json:"msp_encryption,omitempty"`
	Sensitivity            int64           `json:"msp_sensitivity,omitempty"`
	NumRetries             int64           `json:"msp_num_retries,omitempty"`
	UseIPVersion           string          `json:"msp_use_ip_version,omitempty"`
	UptimeSLA              decimal.Decimal `json:"msp_uptime_sla,omitempty"`
	ResponseTimeSLA        decimal.Decimal `json:"msp_response_time_sla,omitempty"`
	Notes                  string          `json:"msp_notes,omitempty"`
	IncludeInGlobalMetrics bool            `json:"msp_include_in_global_metrics"`
}

type CheckPageSpeed

type CheckPageSpeed struct {
	Name          string               `json:"name,omitempty"`
	ContactGroups []string             `json:"contact_groups,omitempty"`
	Locations     []string             `json:"locations,omitempty"`
	Tags          []string             `json:"tags,omitempty"`
	IsPaused      bool                 `json:"is_paused"`
	Address       string               `json:"msp_address"`
	Interval      int64                `json:"msp_interval,omitempty"`
	Username      string               `json:"msp_username,omitempty"`
	Password      string               `json:"msp_password,omitempty"`
	Headers       string               `json:"msp_headers,omitempty"`
	Script        string               `json:"msp_script,omitempty"`
	NumRetries    int64                `json:"msp_num_retries,omitempty"`
	Notes         string               `json:"msp_notes,omitempty"`
	Config        CheckPageSpeedConfig `json:"pagespeedconfig,omitempty"`
}

type CheckPageSpeedConfig

type CheckPageSpeedConfig struct {
	EmulatedDevice       string `json:"emulated_device,omitempty"`
	ConnectionThrottling string `json:"connection_throttling,omitempty"`
	ExcludeURLs          string `json:"exclude_urls,omitempty"`
	UptimeGradeThreshold string `json:"uptime_grade_threshold,omitempty"`
}

type CheckRUM

type CheckRUM struct {
	Name                   string          `json:"name,omitempty"`
	ContactGroups          []string        `json:"contact_groups,omitempty"`
	Locations              []string        `json:"locations,omitempty"`
	Tags                   []string        `json:"tags,omitempty"`
	IsPaused               bool            `json:"is_paused"`
	Address                string          `json:"msp_address"`
	Threshold              int64           `json:"msp_threshold,omitempty"`
	UptimeSLA              decimal.Decimal `json:"msp_uptime_sla,omitempty"`
	Notes                  string          `json:"msp_notes,omitempty"`
	IncludeInGlobalMetrics bool            `json:"msp_include_in_global_metrics"`
}

type CheckRUM2

type CheckRUM2 struct {
	Name                   string          `json:"name,omitempty"`
	ContactGroups          []string        `json:"contact_groups,omitempty"`
	Locations              []string        `json:"locations,omitempty"`
	Tags                   []string        `json:"tags,omitempty"`
	IsPaused               bool            `json:"is_paused"`
	Address                string          `json:"msp_address"`
	Threshold              int64           `json:"msp_threshold,omitempty"`
	UptimeSLA              decimal.Decimal `json:"msp_uptime_sla,omitempty"`
	Notes                  string          `json:"msp_notes,omitempty"`
	IncludeInGlobalMetrics bool            `json:"msp_include_in_global_metrics"`
}

type CheckSMTP

type CheckSMTP struct {
	Name                   string          `json:"name,omitempty"`
	ContactGroups          []string        `json:"contact_groups,omitempty"`
	Locations              []string        `json:"locations,omitempty"`
	Tags                   []string        `json:"tags,omitempty"`
	IsPaused               bool            `json:"is_paused"`
	Interval               int64           `json:"msp_interval"`
	Address                string          `json:"msp_address"`
	Port                   int64           `json:"msp_port,omitempty"`
	Username               string          `json:"msp_username,omitempty"`
	Password               string          `json:"msp_password,omitempty"`
	ExpectString           string          `json:"msp_expect_string,omitempty"`
	Encryption             string          `json:"msp_encryption,omitempty"`
	Sensitivity            int64           `json:"msp_sensitivity,omitempty"`
	NumRetries             int64           `json:"msp_num_retries,omitempty"`
	UseIpVersion           string          `json:"msp_use_ip_version,omitempty"`
	UptimeSLA              decimal.Decimal `json:"msp_uptime_sla,omitempty"`
	ResponseTimeSLA        decimal.Decimal `json:"msp_response_time_sla,omitempty"`
	Notes                  string          `json:"msp_notes,omitempty"`
	IncludeInGlobalMetrics bool            `json:"msp_include_in_global_metrics"`
}

type CheckSSH

type CheckSSH struct {
	Name                   string          `json:"name,omitempty"`
	ContactGroups          []string        `json:"contact_groups,omitempty"`
	Locations              []string        `json:"locations,omitempty"`
	Tags                   []string        `json:"tags,omitempty"`
	IsPaused               bool            `json:"is_paused"`
	Interval               int64           `json:"msp_interval,omitempty"`
	Address                string          `json:"msp_address"`
	Port                   int64           `json:"msp_port,omitempty"`
	Sensitivity            int64           `json:"msp_sensitivity,omitempty"`
	NumRetries             int64           `json:"msp_num_retries,omitempty"`
	UseIpVersion           string          `json:"msp_use_ip_version,omitempty"`
	UptimeSLA              decimal.Decimal `json:"msp_uptime_sla,omitempty"`
	ResponseTimeSLA        decimal.Decimal `json:"msp_response_time_sla,omitempty"`
	Notes                  string          `json:"msp_notes,omitempty"`
	IncludeInGlobalMetrics bool            `json:"msp_include_in_global_metrics"`
}

type CheckSSLCert

type CheckSSLCert struct {
	Name          string             `json:"name,omitempty"`
	ContactGroups []string           `json:"contact_groups,omitempty"`
	Locations     []string           `json:"locations,omitempty"`
	Tags          []string           `json:"tags,omitempty"`
	IsPaused      bool               `json:"is_paused"`
	Protocol      string             `json:"msp_protocol,omitempty"`
	Address       string             `json:"msp_address"`
	Port          int64              `json:"msp_port,omitempty"`
	Threshold     int64              `json:"msp_threshold"`
	NumRetries    int64              `json:"msp_num_retries,omitempty"`
	UptimeSLA     decimal.Decimal    `json:"msp_uptime_sla,omitempty"`
	Notes         string             `json:"msp_notes,omitempty"`
	SSLConfig     CheckSSLCertConfig `json:"sslconfig,omitempty"`
}

type CheckSSLCertConfig

type CheckSSLCertConfig struct {
	Protocol         string `json:"ssl_cert_protocol,omitempty" flag:"sslcert.protocol"`
	CRL              bool   `json:"ssl_cert_crl" flag:"sslcert.crl"`
	FirstElementOnly bool   `json:"ssl_cert_first_element_only" flag:"sslcert.first-element-only"`
	Match            string `json:"ssl_cert_match,omitempty" flag:"sslcert.match"`
	Issuer           string `json:"ssl_cert_issuer,omitempty" flag:"sslcert.issuer"`
	MinVersion       string `json:"ssl_cert_minimum_ssl_tls_version,omitempty" flag:"sslcert.min-version"`
	Fingerprint      string `json:"ssl_cert_fingerprint,omitempty" flag:"sslcert.fingerprint"`
	SelfSigned       bool   `json:"ssl_cert_selfsigned,omitempty" flag:"sslcert.self-signed"`
	URL              string `json:"ssl_cert_file,omitempty" flag:"sslcert.url"`
}

type CheckStats

type CheckStats struct {
	Date                   string   `json:"date"`
	Outages                int64    `json:"outages"`
	DowntimeSecs           int64    `json:"downtime_secs"`
	Uptime                 *float64 `json:"uptime,omitempty"`
	ResponseTime           *float64 `json:"response_time,omitempty"`
	ResponseTimeDatapoints [][]any  `json:"response_time_datapoints,omitempty"`
}

type CheckStatsOptions

type CheckStatsOptions struct {
	StartDate              string `url:"start_date,omitempty"`
	EndDate                string `url:"end_date,omitempty"`
	Location               string `url:"location,omitempty"`
	LocationsResponseTimes bool   `url:"locations_response_times,omitempty"`
	IncludeAlerts          bool   `url:"include_alerts,omitempty"`
	Download               bool   `url:"download,omitempty"`
	PDF                    bool   `url:"pdf,omitempty"`
}

CheckStatsOptions specifies the parameters to /api/v1/checks/{pk}/stats/ endpoint

type CheckStatsResponse

type CheckStatsResponse struct {
	StartDate string `json:"start_date"`
	EndDate   string `json:"end_date"`
	Totals    struct {
		Outages      int64 `json:"outages,omitempty"`
		DowntimeSecs int64 `json:"downtime_secs,omitempty"`
	} `json:"totals"`
	Statistics []CheckStats `json:"statistics"`
}

CheckStatsResponse represents the API response to a Stats query

func (CheckStatsResponse) List

func (c CheckStatsResponse) List() []CheckStats

type CheckTCP

type CheckTCP struct {
	Name                   string          `json:"name,omitempty"`
	ContactGroups          []string        `json:"contact_groups,omitempty"`
	Locations              []string        `json:"locations,omitempty"`
	Tags                   []string        `json:"tags,omitempty"`
	IsPaused               bool            `json:"is_paused"`
	Interval               int64           `json:"msp_interval,omitempty"`
	Address                string          `json:"msp_address"`
	Port                   int64           `json:"msp_port,omitempty"`
	SendString             string          `json:"msp_send_string,omitempty"`
	ExpectString           string          `json:"msp_expect_string,omitempty"`
	Sensitivity            int64           `json:"msp_sensitivity,omitempty"`
	NumRetries             int64           `json:"msp_num_retries,omitempty"`
	UseIpVersion           string          `json:"msp_use_ip_version,omitempty"`
	UptimeSLA              decimal.Decimal `json:"msp_uptime_sla,omitempty"`
	ResponseTimeSLA        decimal.Decimal `json:"msp_response_time_sla,omitempty"`
	Notes                  string          `json:"msp_notes,omitempty"`
	IncludeInGlobalMetrics bool            `json:"msp_include_in_global_metrics"`
	Encryption             string          `json:"msp_encryption"`
}

type CheckTransaction

type CheckTransaction struct {
	Name                   string          `json:"name,omitempty"`
	ContactGroups          []string        `json:"contact_groups,omitempty"`
	Locations              []string        `json:"locations,omitempty"`
	Tags                   []string        `json:"tags,omitempty"`
	IsPaused               bool            `json:"is_paused"`
	Interval               int64           `json:"msp_interval,omitempty"`
	Threshold              int64           `json:"msp_threshold,omitempty"`
	Script                 string          `json:"msp_script,omitempty"`
	Sensitivity            int64           `json:"msp_sensitivity,omitempty"`
	NumRetries             int64           `json:"msp_num_retries,omitempty"`
	UptimeSLA              decimal.Decimal `json:"msp_uptime_sla,omitempty"`
	ResponseTimeSLA        decimal.Decimal `json:"msp_response_time_sla,omitempty"`
	Notes                  string          `json:"msp_notes,omitempty"`
	IncludeInGlobalMetrics bool            `json:"msp_include_in_global_metrics"`
}

type CheckUDP

type CheckUDP struct {
	Name                   string          `json:"name,omitempty"`
	ContactGroups          []string        `json:"contact_groups,omitempty"`
	Locations              []string        `json:"locations,omitempty"`
	Tags                   []string        `json:"tags,omitempty"`
	IsPaused               bool            `json:"is_paused"`
	Interval               int64           `json:"msp_interval,omitempty"`
	Address                string          `json:"msp_address"`
	Port                   int64           `json:"msp_port,omitempty"`
	SendString             string          `json:"msp_send_string,omitempty"`
	ExpectString           string          `json:"msp_expect_string,omitempty"`
	Sensitivity            int64           `json:"msp_sensitivity,omitempty"`
	NumRetries             int64           `json:"msp_num_retries,omitempty"`
	UseIpVersion           string          `json:"msp_use_ip_version,omitempty"`
	UptimeSLA              decimal.Decimal `json:"msp_uptime_sla,omitempty"`
	ResponseTimeSLA        decimal.Decimal `json:"msp_response_time_sla,omitempty"`
	Notes                  string          `json:"msp_notes,omitempty"`
	IncludeInGlobalMetrics bool            `json:"msp_include_in_global_metrics"`
}

type CheckWHOIS

type CheckWHOIS struct {
	Name          string          `json:"name,omitempty"`
	ContactGroups []string        `json:"contact_groups,omitempty"`
	Locations     []string        `json:"locations,omitempty"`
	Tags          []string        `json:"tags,omitempty"`
	IsPaused      bool            `json:"is_paused"`
	Address       string          `json:"msp_address"`
	ExpectString  string          `json:"msp_expect_string,omitempty"`
	Threshold     int64           `json:"msp_threshold,omitempty"`
	NumRetries    int64           `json:"msp_num_retries,omitempty"`
	UptimeSLA     decimal.Decimal `json:"msp_uptime_sla,omitempty"`
	Notes         string          `json:"msp_notes,omitempty"`
}

type CheckWebhook

type CheckWebhook struct {
	Name                   string          `json:"name,omitempty"`
	ContactGroups          []string        `json:"contact_groups,omitempty"`
	Locations              []string        `json:"locations,omitempty"`
	Tags                   []string        `json:"tags,omitempty"`
	IsPaused               bool            `json:"is_paused"`
	UptimeSLA              decimal.Decimal `json:"msp_uptime_sla,omitempty"`
	ResponseTimeSLA        decimal.Decimal `json:"msp_response_time_sla,omitempty"`
	Notes                  string          `json:"msp_notes,omitempty"`
	IncludeInGlobalMetrics bool            `json:"msp_include_in_global_metrics"`
	WebhookUrl             string          `json:"webhook_url,omitempty"`
}

type ChecksEndpoint

type ChecksEndpoint interface {
	List(context.Context, CheckListOptions) ([]Check, error)
	Get(context.Context, PrimaryKeyable) (*Check, error)
	Delete(context.Context, PrimaryKeyable) error
	Stats(context.Context, PrimaryKeyable, CheckStatsOptions) ([]CheckStats, error)

	CreateAPI(context.Context, CheckAPI) (*Check, error)
	UpdateAPI(context.Context, PrimaryKeyable, CheckAPI) (*Check, error)

	CreateBlacklist(context.Context, CheckBlacklist) (*Check, error)
	UpdateBlacklist(context.Context, PrimaryKeyable, CheckBlacklist) (*Check, error)

	CreateDNS(context.Context, CheckDNS) (*Check, error)
	UpdateDNS(context.Context, PrimaryKeyable, CheckDNS) (*Check, error)

	CreateGroup(context.Context, CheckGroup) (*Check, error)
	UpdateGroup(context.Context, PrimaryKeyable, CheckGroup) (*Check, error)

	CreateHeartbeat(context.Context, CheckHeartbeat) (*Check, error)
	UpdateHeartbeat(context.Context, PrimaryKeyable, CheckHeartbeat) (*Check, error)

	CreateHTTP(context.Context, CheckHTTP) (*Check, error)
	UpdateHTTP(context.Context, PrimaryKeyable, CheckHTTP) (*Check, error)

	CreateICMP(context.Context, CheckICMP) (*Check, error)
	UpdateICMP(context.Context, PrimaryKeyable, CheckICMP) (*Check, error)

	CreateIMAP(context.Context, CheckIMAP) (*Check, error)
	UpdateIMAP(context.Context, PrimaryKeyable, CheckIMAP) (*Check, error)

	CreateMalware(context.Context, CheckMalware) (*Check, error)
	UpdateMalware(context.Context, PrimaryKeyable, CheckMalware) (*Check, error)

	CreateNTP(context.Context, CheckNTP) (*Check, error)
	UpdateNTP(context.Context, PrimaryKeyable, CheckNTP) (*Check, error)

	CreatePOP(context.Context, CheckPOP) (*Check, error)
	UpdatePOP(context.Context, PrimaryKeyable, CheckPOP) (*Check, error)

	CreateRUM(context.Context, CheckRUM) (*Check, error)
	UpdateRUM(context.Context, PrimaryKeyable, CheckRUM) (*Check, error)

	CreateRUM2(context.Context, CheckRUM2) (*Check, error)
	UpdateRUM2(context.Context, PrimaryKeyable, CheckRUM2) (*Check, error)

	CreateSMTP(context.Context, CheckSMTP) (*Check, error)
	UpdateSMTP(context.Context, PrimaryKeyable, CheckSMTP) (*Check, error)

	CreateSSH(context.Context, CheckSSH) (*Check, error)
	UpdateSSH(context.Context, PrimaryKeyable, CheckSSH) (*Check, error)

	CreateSSLCert(context.Context, CheckSSLCert) (*Check, error)
	UpdateSSLCert(context.Context, PrimaryKeyable, CheckSSLCert) (*Check, error)

	CreateTCP(context.Context, CheckTCP) (*Check, error)
	UpdateTCP(context.Context, PrimaryKeyable, CheckTCP) (*Check, error)

	CreateTransaction(context.Context, CheckTransaction) (*Check, error)
	UpdateTransaction(context.Context, PrimaryKeyable, CheckTransaction) (*Check, error)

	CreateUDP(context.Context, CheckUDP) (*Check, error)
	UpdateUDP(context.Context, PrimaryKeyable, CheckUDP) (*Check, error)

	CreateWebhook(context.Context, CheckWebhook) (*Check, error)
	UpdateWebhook(context.Context, PrimaryKeyable, CheckWebhook) (*Check, error)

	CreateWHOIS(context.Context, CheckWHOIS) (*Check, error)
	UpdateWHOIS(context.Context, PrimaryKeyable, CheckWHOIS) (*Check, error)

	CreatePageSpeed(context.Context, CheckPageSpeed) (*Check, error)
	UpdatePageSpeed(context.Context, PrimaryKeyable, CheckPageSpeed) (*Check, error)

	UpdateMaintenance(context.Context, PrimaryKeyable, CheckMaintenance) (*Check, error)
}

func NewChecksEndpoint

func NewChecksEndpoint(cbd CBD) ChecksEndpoint

type Contact

type Contact struct {
	PK                       int64    `json:"pk,omitempty"`
	URL                      string   `json:"url,omitempty"`
	Name                     string   `json:"name,omitempty"`
	SmsList                  []string `json:"sms_list,omitempty"`
	EmailList                []string `json:"email_list,omitempty"`
	PhonecallList            []string `json:"phonecall_list,omitempty"`
	Integrations             []string `json:"integrations,omitempty"`
	PushNotificationProfiles []string `json:"push_notification_profiles,omitempty"`
}

func (Contact) PrimaryKey

func (c Contact) PrimaryKey() PrimaryKey

type ContactCreateUpdateResponse

type ContactCreateUpdateResponse struct {
	Results Contact `json:"results,omitempty"`
}

func (ContactCreateUpdateResponse) Item

type ContactListOptions

type ContactListOptions struct {
	Page              int64  `url:"page,omitempty"`
	PageSize          int64  `url:"page_size,omitempty"`
	Search            string `url:"search,omitempty"`
	Ordering          string `url:"ordering,omitempty"`
	HasOnCallSchedule bool   `url:"has_on_call_schedule,omitempty"`
}

type ContactListResponse

type ContactListResponse struct {
	Count   int64     `json:"count,omitempty"`
	Results []Contact `json:"results,omitempty"`
}

func (ContactListResponse) List

func (r ContactListResponse) List() []Contact

type ContactResponse

type ContactResponse Contact

func (ContactResponse) Item

func (r ContactResponse) Item() Contact

type Dashboard

type Dashboard struct {
	PK                         int64    `json:"pk"`
	ServicesSelected           []string `json:"services_selected"`
	ServicesTags               []string `json:"services_tags"`
	Ordering                   int64    `json:"ordering"`
	Name                       string   `json:"name"`
	IsPinned                   bool     `json:"is_pinned"`
	MetricsShowSection         bool     `json:"metrics_show_section"`
	MetricsForAllChecks        bool     `json:"metrics_for_all_checks"`
	ServicesShowSection        bool     `json:"services_show_section"`
	ServicesNumToShow          int64    `json:"services_num_to_show"`
	ServicesIncludeUp          bool     `json:"services_include_up"`
	ServicesIncludeDown        bool     `json:"services_include_down"`
	ServicesIncludePaused      bool     `json:"services_include_paused"`
	ServicesIncludeMaintenance bool     `json:"services_include_maintenance"`
	ServicesPrimarySort        string   `json:"services_primary_sort"`
	ServicesSecondarySort      string   `json:"services_secondary_sort"`
	ServicesShowUptime         bool     `json:"services_show_uptime"`
	ServicesShowResponseTime   bool     `json:"services_show_response_time"`
	AlertsShowSection          bool     `json:"alerts_show_section"`
	AlertsForAllChecks         bool     `json:"alerts_for_all_checks"`
	AlertsIncludeIgnored       bool     `json:"alerts_include_ignored"`
	AlertsincludeResolved      bool     `json:"alerts_include_resolved"`
	AlertsnumToShow            int64    `json:"alerts_num_to_show"`
}

func (Dashboard) PrimaryKey

func (d Dashboard) PrimaryKey() PrimaryKey

type DashboardCreateUpdateResponse

type DashboardCreateUpdateResponse struct {
	Results Dashboard `json:"results,omitempty"`
}

func (DashboardCreateUpdateResponse) Item

type DashboardListOptions

type DashboardListOptions struct {
	Page     int64  `url:"page,omitempty"`
	PageSize int64  `url:"page_size,omitempty"`
	Search   string `url:"search,omitempty"`
	Ordering string `url:"ordering,omitempty"`
}

type DashboardListResponse

type DashboardListResponse struct {
	Count   int64       `json:"count,omitempty"`
	Results []Dashboard `json:"results,omitempty"`
}

func (DashboardListResponse) List

func (r DashboardListResponse) List() []Dashboard

type DashboardResponse

type DashboardResponse Dashboard

func (DashboardResponse) Item

func (d DashboardResponse) Item() Dashboard

type Doer

type Doer interface {
	Do(rq *http.Request) (*http.Response, error)
}

type EndpointCreator

type EndpointCreator[RequestType any, ResponseType Itemable[ItemType], ItemType any] interface {
	Create(ctx context.Context, arg RequestType) (*ItemType, error)
}

EndpointCreator is a generic interface for creating an item from an endpoint.

func NewEndpointCreator

func NewEndpointCreator[RequestType any, ResponseType Itemable[ItemType], ItemType any](cbd CBD, endpoint string) EndpointCreator[RequestType, ResponseType, ItemType]

type EndpointDeleter

type EndpointDeleter interface {
	Delete(ctx context.Context, pk PrimaryKeyable) error
}

EndpointDeleter is a generic interface for deleting an item from an endpoint.

func NewEndpointDeleter

func NewEndpointDeleter(cbd CBD, endpoint string) EndpointDeleter

type EndpointGetter

type EndpointGetter[ResponseType Itemable[ItemType], ItemType any] interface {
	Get(ctx context.Context, pk PrimaryKeyable) (*ItemType, error)
}

EndpointGetter is a generic interface for getting a single item from an endpoint.

func NewEndpointGetter

func NewEndpointGetter[ResponseType Itemable[ItemType], ItemType any](cbd CBD, endpoint string) EndpointGetter[ResponseType, ItemType]

type EndpointLister

type EndpointLister[ResponseType Listable[ItemType], ItemType any, OptionsType any] interface {
	List(ctx context.Context, opts OptionsType) ([]ItemType, error)
}

EndpointLister is a generic interface for listing items from an endpoint.

func NewEndpointLister

func NewEndpointLister[ResponseType Listable[ItemType], ItemType any, OptionsType any](cbd CBD, endpoint string) EndpointLister[Listable[ItemType], ItemType, OptionsType]

type EndpointUpdater

type EndpointUpdater[ArgumentType any, ResultType Itemable[ItemType], ItemType any] interface {
	Update(ctx context.Context, pk PrimaryKeyable, arg ArgumentType) (*ItemType, error)
}

EndpointUpdater is a generic interface for updating an item from an endpoint.

func NewEndpointUpdater

func NewEndpointUpdater[RequestType any, ResponseType Itemable[ItemType], ItemType any](cbd CBD, endpoint string) EndpointUpdater[RequestType, ResponseType, ItemType]

type Error

type Error struct {
	Response *http.Response
	Code     string              `json:"error_code"`
	Message  string              `json:"error_message"`
	Fields   map[string][]string `json:"error_fields,omitempty"`
}

func NewError

func NewError() *Error

func (Error) Error

func (e Error) Error() string

type Integration

type Integration struct {
	PK            int64    `json:"pk,omitempty"`
	URL           string   `json:"url,omitempty"`
	Name          string   `json:"name,omitempty"`
	Module        string   `json:"module,omitempty"`
	ContactGroups []string `json:"contact_groups,omitempty"`
	IsErrored     bool     `json:"is_errored,omitempty"`
	LastError     string   `json:"last_error,omitempty"`
}

Integration represents an integration in Uptime.com.

func (Integration) PrimaryKey

func (i Integration) PrimaryKey() PrimaryKey

type IntegrationCachet

type IntegrationCachet struct {
	PK            int64    `json:"pk,omitempty"`
	CachetURL     string   `json:"url,omitempty"`
	Name          string   `json:"name,omitempty"`
	ContactGroups []string `json:"contact_groups,omitempty"`
	Token         string   `json:"token,omitempty"`
	Component     string   `json:"component,omitempty"`
	Metric        string   `json:"metric,omitempty"`
}

func (IntegrationCachet) PrimaryKey

func (i IntegrationCachet) PrimaryKey() PrimaryKey

type IntegrationDatadog

type IntegrationDatadog struct {
	Name          string   `json:"name,omitempty"`
	ContactGroups []string `json:"contact_groups,omitempty"`
	APIKey        string   `json:"api_key,omitempty"`
	APPKey        string   `json:"app_key,omitempty"`
	Region        string   `json:"region,omitempty"`
}

type IntegrationGeckoboard

type IntegrationGeckoboard struct {
	Name          string   `json:"name,omitempty"`
	ContactGroups []string `json:"contact_groups,omitempty"`
	APIKey        string   `json:"api_key,omitempty"`
	DatasetName   string   `json:"dataset_name,omitempty"`
}

type IntegrationJiraServicedesk

type IntegrationJiraServicedesk struct {
	Name                     string   `json:"name,omitempty"`
	ContactGroups            []string `json:"contact_groups,omitempty"`
	APIEmail                 string   `json:"api_email,omitempty"`
	APIToken                 string   `json:"api_token,omitempty"`
	JiraSubdomain            string   `json:"jira_subdomain,omitempty"`
	ProjectKey               string   `json:"project_key,omitempty"`
	Labels                   string   `json:"labels,omitempty"`
	CustomFieldIdAccountName int64    `json:"custom_field_id_account_name,omitempty"`
	CustomFieldIdCheckName   int64    `json:"custom_field_id_check_name,omitempty"`
	CustomFieldIdCheckUrl    int64    `json:"custom_field_id_check_url,omitempty"`
	CustomFieldsJson         string   `json:"custom_fields_json,omitempty"`
}

type IntegrationKlipfolio

type IntegrationKlipfolio struct {
	Name           string   `json:"name,omitempty"`
	ContactGroups  []string `json:"contact_groups,omitempty"`
	APIKey         string   `json:"api_key,omitempty"`
	DataSourceName string   `json:"data_source_name,omitempty"`
}

type IntegrationLibrato

type IntegrationLibrato struct {
	Name          string   `json:"name,omitempty"`
	ContactGroups []string `json:"contact_groups,omitempty"`
	Email         string   `json:"email,omitempty"`
	APIToken      string   `json:"api_token,omitempty"`
	MetricName    string   `json:"metric_name,omitempty"`
}

type IntegrationListOptions

type IntegrationListOptions struct {
	Page     int64  `url:"page,omitempty"`
	PageSize int64  `url:"page_size,omitempty"`
	Search   string `url:"search,omitempty"`
	Ordering string `url:"ordering,omitempty"`
	Module   string `url:"module,omitempty"`
}

type IntegrationListResponse

type IntegrationListResponse struct {
	Count    int64         `json:"count,omitempty"`
	Next     string        `json:"next,omitempty"`
	Previous string        `json:"previous,omitempty"`
	Results  []Integration `json:"results,omitempty"`
}

func (IntegrationListResponse) List

type IntegrationMicrosoftTeams

type IntegrationMicrosoftTeams struct {
	Name          string   `json:"name,omitempty"`
	ContactGroups []string `json:"contact_groups,omitempty"`
	WebhookUrl    string   `json:"webhook_url,omitempty"`
}

type IntegrationOpsgenie

type IntegrationOpsgenie struct {
	Name          string   `json:"name,omitempty"`
	ContactGroups []string `json:"contact_groups,omitempty"`
	APIEndpoint   string   `json:"api_endpoint,omitempty"`
	APIKey        string   `json:"api_key,omitempty"`
	Teams         string   `json:"teams,omitempty"`
	Tags          string   `json:"tags,omitempty"`
	Autoresolve   bool     `json:"autoresolve"`
}

type IntegrationPagerduty

type IntegrationPagerduty struct {
	Name          string   `json:"name,omitempty"`
	ContactGroups []string `json:"contact_groups,omitempty"`
	ServiceKey    string   `json:"service_key,omitempty"`
	Autoresolve   bool     `json:"autoresolve"`
}

type IntegrationPushbullet

type IntegrationPushbullet struct {
	Name          string   `json:"name,omitempty"`
	ContactGroups []string `json:"contact_groups,omitempty"`
	Email         string   `json:"email,omitempty"`
}

type IntegrationPushover

type IntegrationPushover struct {
	Name          string   `json:"name,omitempty"`
	ContactGroups []string `json:"contact_groups,omitempty"`
	User          string   `json:"user,omitempty"`
	Priority      int64    `json:"priority,omitempty"`
}

type IntegrationResponse

type IntegrationResponse struct {
	Results Integration `json:"results,omitempty"`
}

func (IntegrationResponse) Item

type IntegrationSlack

type IntegrationSlack struct {
	Name          string   `json:"name,omitempty"`
	ContactGroups []string `json:"contact_groups,omitempty"`
	WebhookURL    string   `json:"webhook_url,omitempty"`
	Channel       string   `json:"channel,omitempty"`
}

type IntegrationStatus

type IntegrationStatus struct {
	Name          string   `json:"name,omitempty"`
	ContactGroups []string `json:"contact_groups,omitempty"`
	StatuspageID  string   `json:"statuspage_id,omitempty"`
	APIID         string   `json:"api_id,omitempty"`
	APIKey        string   `json:"api_key,omitempty"`
	Component     string   `json:"component,omitempty"`
	Container     string   `json:"container,omitempty"`
	Metric        string   `json:"metric,omitempty"`
}

type IntegrationStatuspage

type IntegrationStatuspage struct {
	Name          string   `json:"name,omitempty"`
	ContactGroups []string `json:"contact_groups,omitempty"`
	APIKey        string   `json:"api_key,omitempty"`
	Page          string   `json:"page,omitempty"`
	Component     string   `json:"component,omitempty"`
	Metric        string   `json:"metric,omitempty"`
}

type IntegrationTwitter

type IntegrationTwitter struct {
	Name             string   `json:"name,omitempty"`
	ContactGroups    []string `json:"contact_groups,omitempty"`
	OauthToken       string   `json:"oauth_token,omitempty"`
	OauthTokenSecret string   `json:"oauth_token_secret,omitempty"`
}

type IntegrationVictorops

type IntegrationVictorops struct {
	Name          string   `json:"name,omitempty"`
	ContactGroups []string `json:"contact_groups,omitempty"`
	ServiceKey    string   `json:"service_key,omitempty"`
	RoutingKey    string   `json:"routing_key,omitempty"`
}

type IntegrationWavefront

type IntegrationWavefront struct {
	Name          string   `json:"name,omitempty"`
	ContactGroups []string `json:"contact_groups,omitempty"`
	WavefrontUrl  string   `json:"wavefront_url,omitempty"`
	APIToken      string   `json:"api_token,omitempty"`
}

type IntegrationWebhook

type IntegrationWebhook struct {
	Name             string   `json:"name,omitempty"`
	ContactGroups    []string `json:"contact_groups,omitempty"`
	PostbackUrl      string   `json:"postback_url,omitempty"`
	Headers          string   `json:"headers,omitempty"`
	UseLegacyPayload bool     `json:"use_legacy_payload"`
}

type IntegrationZapier

type IntegrationZapier struct {
	Name          string   `json:"name,omitempty"`
	ContactGroups []string `json:"contact_groups,omitempty"`
	WebhookUrl    string   `json:"webhook_url,omitempty"`
}

type IntegrationsEndpoint

type IntegrationsEndpoint interface {
	List(context.Context, IntegrationListOptions) ([]Integration, error)
	Get(context.Context, PrimaryKeyable) (*Integration, error)
	Delete(context.Context, PrimaryKeyable) error
	CreateCachet(context.Context, IntegrationCachet) (*Integration, error)
	UpdateCachet(context.Context, PrimaryKeyable, IntegrationCachet) (*Integration, error)
	CreateDatadog(context.Context, IntegrationDatadog) (*Integration, error)
	UpdateDatadog(context.Context, PrimaryKeyable, IntegrationDatadog) (*Integration, error)
	CreateGeckoboard(context.Context, IntegrationGeckoboard) (*Integration, error)
	UpdateGeckoboard(context.Context, PrimaryKeyable, IntegrationGeckoboard) (*Integration, error)
	CreateJiraServicedesk(context.Context, IntegrationJiraServicedesk) (*Integration, error)
	UpdateJiraServiceDesk(context.Context, PrimaryKeyable, IntegrationJiraServicedesk) (*Integration, error)
	CreateKlipfolio(context.Context, IntegrationKlipfolio) (*Integration, error)
	UpdateKlipfolio(context.Context, PrimaryKeyable, IntegrationKlipfolio) (*Integration, error)
	CreateLibrato(context.Context, IntegrationLibrato) (*Integration, error)
	UpdateLibrato(context.Context, PrimaryKeyable, IntegrationLibrato) (*Integration, error)
	CreateMicrosoftTeams(context.Context, IntegrationMicrosoftTeams) (*Integration, error)
	UpdateMicrosoftTeams(context.Context, PrimaryKeyable, IntegrationMicrosoftTeams) (*Integration, error)
	CreateOpsgenie(context.Context, IntegrationOpsgenie) (*Integration, error)
	UpdateOpsgenie(context.Context, PrimaryKeyable, IntegrationOpsgenie) (*Integration, error)
	CreatePagerduty(context.Context, IntegrationPagerduty) (*Integration, error)
	UpdatePagerduty(context.Context, PrimaryKeyable, IntegrationPagerduty) (*Integration, error)
	CreatePushbullet(context.Context, IntegrationPushbullet) (*Integration, error)
	UpdatePushbullet(context.Context, PrimaryKeyable, IntegrationPushbullet) (*Integration, error)
	CreatePushover(context.Context, IntegrationPushover) (*Integration, error)
	UpdatePushover(context.Context, PrimaryKeyable, IntegrationPushover) (*Integration, error)
	CreateSlack(context.Context, IntegrationSlack) (*Integration, error)
	UpdateSlack(context.Context, PrimaryKeyable, IntegrationSlack) (*Integration, error)
	CreateStatus(context.Context, IntegrationStatus) (*Integration, error)
	UpdateStatus(context.Context, PrimaryKeyable, IntegrationStatus) (*Integration, error)
	CreateStatuspage(context.Context, IntegrationStatuspage) (*Integration, error)
	UpdateStatuspage(context.Context, PrimaryKeyable, IntegrationStatuspage) (*Integration, error)
	CreateTwitter(context.Context, IntegrationTwitter) (*Integration, error)
	UpdateTwitter(context.Context, PrimaryKeyable, IntegrationTwitter) (*Integration, error)
	CreateVictorops(context.Context, IntegrationVictorops) (*Integration, error)
	UpdateVictorops(context.Context, PrimaryKeyable, IntegrationVictorops) (*Integration, error)
	CreateWavefront(context.Context, IntegrationWavefront) (*Integration, error)
	UpdateWavefront(context.Context, PrimaryKeyable, IntegrationWavefront) (*Integration, error)
	CreateWebhook(context.Context, IntegrationWebhook) (*Integration, error)
	UpdateWebhook(context.Context, PrimaryKeyable, IntegrationWebhook) (*Integration, error)
	CreateZapier(context.Context, IntegrationZapier) (*Integration, error)
	UpdateZapier(context.Context, PrimaryKeyable, IntegrationZapier) (*Integration, error)
}

func NewIntegrationsEndpoint

func NewIntegrationsEndpoint(cbd CBD) IntegrationsEndpoint

type Itemable

type Itemable[Item any] interface {
	Item() Item
}

type Listable

type Listable[Item any] interface {
	List() []Item
}

type Option

type Option func(cbd CBD) (CBD, error)

func WithBaseURL

func WithBaseURL(baseurl string) Option

func WithRateLimit

func WithRateLimit(rateLimit float64) Option

func WithRateLimitEvery

func WithRateLimitEvery(every time.Duration) Option

func WithRetry

func WithRetry(limit int, maxDelay time.Duration, w io.Writer) Option

func WithToken

func WithToken(token string) Option

func WithTrace

func WithTrace(w io.Writer) Option

func WithUserAgent

func WithUserAgent(ua string) Option

type Outage

type Outage struct {
	PK                         int64     `json:"pk,omitempty"`
	URL                        string    `json:"url,omitempty"`
	CreatedAt                  time.Time `json:"created_at,omitempty"`
	ResolvedAt                 time.Time `json:"resolved_at,omitempty"`
	DurationSecs               int64     `json:"duration_secs,omitempty"`
	IgnoreAlertURL             string    `json:"ignore_alert_url,omitempty"`
	CheckPK                    int64     `json:"check_pk,omitempty"`
	CheckURL                   string    `json:"check_url,omitempty"`
	CheckAddresss              string    `json:"check_address,omitempty"`
	CheckName                  string    `json:"check_name,omitempty"`
	CheckMonitoringServiceType string    `json:"check_monitoring_service_type,omitempty"`
	StateIsUp                  bool      `json:"state_is_up,omitempty"`
	Ignored                    bool      `json:"ignored,omitempty"`
	NumLocationsDown           int64     `json:"num_locations_down,omitempty"`
	AllAlerts                  *[]Alert  `json:"all_alerts,omitempty"`
}

Outage represents an outage reported by Uptime.com.

type OutageListOptions

type OutageListOptions struct {
	Page                       int64  `url:"page,omitempty"`
	PageSize                   int64  `url:"page_size,omitempty"`
	Search                     string `url:"search,omitempty"`
	Ordering                   string `url:"ordering,omitempty"`
	CheckMonitoringServiceType string `url:"check_monitoring_service_type,omitempty"`
}

OutageListOptions specifies the optional parameters to the OutagesService.List and OutagesService.ListByServiceType methods.

type OutageListResponse

type OutageListResponse struct {
	Count    int64    `json:"count,omitempty"`
	Next     string   `json:"next,omitempty"`
	Previous string   `json:"previous,omitempty"`
	Results  []Outage `json:"results,omitempty"`
}

OutageListResponse represents a page of Outage results returned by the Uptime.com API.

func (OutageListResponse) List

func (o OutageListResponse) List() []Outage

type OutageResponse

type OutageResponse Outage

func (OutageResponse) Item

func (o OutageResponse) Item() Outage

type OutagesEndpoint

type OutagesEndpoint interface {
	List(context.Context, OutageListOptions) ([]Outage, error)
	Get(context.Context, PrimaryKeyable) (*Outage, error)
}

func NewOutagesEndpoint

func NewOutagesEndpoint(cbd CBD) OutagesEndpoint

type PrimaryKey

type PrimaryKey int

func (PrimaryKey) PrimaryKey

func (p PrimaryKey) PrimaryKey() PrimaryKey

type PrimaryKeyable

type PrimaryKeyable interface {
	PrimaryKey() PrimaryKey
}

type ProbeServer

type ProbeServer struct {
	Location  string `json:"location"`
	ProbeName string `json:"probe_name"`
	IPAddress string `json:"ip_address"`
}

type ProbeServerListOptions

type ProbeServerListOptions struct{}

type ProbeServerListResponse

type ProbeServerListResponse []ProbeServer

func (ProbeServerListResponse) List

type ProbeServersEndpoint

type ProbeServersEndpoint interface {
	List(ctx context.Context) ([]ProbeServer, error)
}

func NewProbeServersEndpoint

func NewProbeServersEndpoint(cbd CBD) ProbeServersEndpoint

type RequestBuilder

type RequestBuilder interface {
	BuildRequest(ctx context.Context, method string, endpoint string, args any, data any) (*http.Request, error)
}

type ResponseDecoder

type ResponseDecoder interface {
	DecodeResponse(rs *http.Response, data any) error
}

type SLAReport

type SLAReport struct {
	PK                              int64               `json:"pk,omitempty"`
	URL                             string              `json:"url,omitempty"`
	StatsURL                        string              `json:"stats_url,omitempty"`
	Name                            string              `json:"name"`
	ServicesTags                    []string            `json:"services_tags,omitempty"`
	ServicesSelected                *[]SLAReportService `json:"services_selected,omitempty"`
	ReportingGroups                 *[]SLAReportGroup   `json:"reporting_groups,omitempty"`
	DefaultDateRange                string              `json:"default_date_range,omitempty"`
	FilterWithDowntime              bool                `json:"filter_with_downtime,omitempty"`
	FilterUptimeSLAViolations       bool                `json:"filter_uptime_sla_violations,omitempty"`
	FilterSlowest                   bool                `json:"filter_slowest,omitempty"`
	FilterResponseTimeSLAViolations bool                `json:"filter_response_time_sla_violations,omitempty"`
	ShowUptimeSection               bool                `json:"show_uptime_section,omitempty"`
	ShowUptimeSLA                   bool                `json:"show_uptime_sla,omitempty"`
	ShowResponseTimeSection         bool                `json:"show_response_time_section,omitempty"`
	ShowResponseTimeSLA             bool                `json:"show_response_time_sla,omitempty"`
	UptimeSectionSort               string              `json:"uptime_section_sort,omitempty"`
	ResponseTimeSectionSort         string              `json:"response_time_section_sort,omitempty"`
}

func (SLAReport) PrimaryKey

func (s SLAReport) PrimaryKey() PrimaryKey

type SLAReportCreateUpdateResponse

type SLAReportCreateUpdateResponse struct {
	Results SLAReport `json:"results,omitempty"`
}

func (SLAReportCreateUpdateResponse) Item

type SLAReportGroup

type SLAReportGroup struct {
	ID            int      `json:"id,omitempty"`
	Name          string   `json:"name,omitempty"`
	GroupServices []string `json:"group_services,omitempty"`
}

func (SLAReportGroup) PrimaryKey

func (s SLAReportGroup) PrimaryKey() PrimaryKey

type SLAReportGroupCreateResponse

type SLAReportGroupCreateResponse struct {
	Results SLAReportGroup `json:"results,omitempty"`
}

func (SLAReportGroupCreateResponse) Item

type SLAReportGroupCreateUpdateResponse

type SLAReportGroupCreateUpdateResponse struct {
	Results SLAReportGroup `json:"results,omitempty"`
}

func (SLAReportGroupCreateUpdateResponse) Item

type SLAReportGroupListOptions

type SLAReportGroupListOptions struct {
	Page     int64  `url:"page,omitempty"`
	PageSize int64  `url:"page_size,omitempty"`
	Search   string `url:"search,omitempty"`
	Ordering string `url:"ordering,omitempty"`
}

type SLAReportGroupListResponse

type SLAReportGroupListResponse struct {
	Count   int64            `json:"count,omitempty"`
	Results []SLAReportGroup `json:"results,omitempty"`
}

func (SLAReportGroupListResponse) List

type SLAReportGroupResponse

type SLAReportGroupResponse SLAReportGroup

func (SLAReportGroupResponse) Item

type SLAReportListOptions

type SLAReportListOptions struct {
	Page     int64  `url:"page,omitempty"`
	PageSize int64  `url:"page_size,omitempty"`
	Search   string `url:"search,omitempty"`
	Ordering string `url:"ordering,omitempty"`
}

type SLAReportListResponse

type SLAReportListResponse struct {
	Count   int64       `json:"count,omitempty"`
	Results []SLAReport `json:"results,omitempty"`
}

func (SLAReportListResponse) List

func (r SLAReportListResponse) List() []SLAReport

type SLAReportResponse

type SLAReportResponse SLAReport

func (SLAReportResponse) Item

func (r SLAReportResponse) Item() SLAReport

type SLAReportService

type SLAReportService struct {
	PK   int    `json:"pk,omitempty"`
	Name string `json:"name,omitempty"`
}

func (SLAReportService) MarshalJSON

func (s SLAReportService) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

This is workaround for the fact that the API can accept either a string (name) or an int for the PK field.

func (*SLAReportService) UnmarshalJSON

func (s *SLAReportService) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON implements the json.Unmarshaler interface.

This is workaround for the fact that the API can return either a string (name) or an int for the PK field.

type ScheduledReport

type ScheduledReport struct {
	PK              int64    `json:"pk,omitempty"`
	URL             string   `json:"url,omitempty"`
	Name            string   `json:"name"`
	ScheduledReport string   `json:"sla_report,omitempty"`
	RecipientUsers  []string `json:"recipient_users,omitempty"`
	RecipientEmails []string `json:"recipient_emails,omitempty"`
	FileType        string   `json:"file_type,omitempty"`
	Recurrence      string   `json:"recurrence,omitempty"`
	OnWeekday       int32    `json:"on_weekday,omitempty"`
	AtTime          int32    `json:"at_time"`
	IsEnabled       bool     `json:"is_enabled,omitempty"`
}

func (ScheduledReport) PrimaryKey

func (s ScheduledReport) PrimaryKey() PrimaryKey

type ScheduledReportCreateUpdateResponse

type ScheduledReportCreateUpdateResponse struct {
	Results ScheduledReport `json:"results,omitempty"`
}

func (ScheduledReportCreateUpdateResponse) Item

type ScheduledReportListOptions

type ScheduledReportListOptions struct {
	Page     int64  `url:"page,omitempty"`
	PageSize int64  `url:"page_size,omitempty"`
	Search   string `url:"search,omitempty"`
	Ordering string `url:"ordering,omitempty"`
}

type ScheduledReportListResponse

type ScheduledReportListResponse struct {
	Count   int64             `json:"count,omitempty"`
	Results []ScheduledReport `json:"results,omitempty"`
}

func (ScheduledReportListResponse) List

type ScheduledReportResponse

type ScheduledReportResponse ScheduledReport

func (ScheduledReportResponse) Item

type StatusPage

type StatusPage struct {
	PK                        int64  `json:"pk,omitempty"`
	URL                       string `json:"url,omitempty"`
	Name                      string `json:"name"`
	VisibilityLevel           string `json:"visibility_level"`
	Description               string `json:"description"`
	PageType                  string `json:"page_type"`
	Slug                      string `json:"slug"`
	CNAME                     string `json:"cname"`
	AllowSubscriptions        bool   `json:"allow_subscriptions"`
	AllowSearchIndexing       bool   `json:"allow_search_indexing"`
	AllowDrillDown            bool   `json:"allow_drill_down"`
	AuthUsername              string `json:"auth_username"`
	AuthPassword              string `json:"auth_password"`
	ShowStatusTab             bool   `json:"show_status_tab"`
	ShowActiveIncidents       bool   `json:"show_active_incidents"`
	ShowComponentResponseTime bool   `json:"show_component_response_time"`
	ShowHistoryTab            bool   `json:"show_history_tab"`
	DefaultHistoryDateRange   int64  `json:"default_history_date_range"`
	UptimeCalculationType     string `json:"uptime_calculation_type"`
	ShowHistorySnake          bool   `json:"show_history_snake"`
	ShowComponentHistory      bool   `json:"show_component_history"`
	ShowSummaryMetrics        bool   `json:"show_summary_metrics"`
	ShowPastIncidents         bool   `json:"show_past_incidents"`
	AllowPdfReport            bool   `json:"allow_pdf_report"`
	GoogleAnalyticsCode       string `json:"google_analytics_code"`
	ContactEmail              string `json:"contact_email"`
	EmailFrom                 string `json:"email_from"`
	EmailReplyTo              string `json:"email_reply_to"`
	CustomHeaderHtml          string `json:"custom_header_html"`
	CustomFooterHtml          string `json:"custom_footer_html"`
	CustomCss                 string `json:"custom_css"`
	CompanyWebsiteUrl         string `json:"company_website_url"`
	Timezone                  string `json:"timezone"`
}

func (StatusPage) PrimaryKey

func (s StatusPage) PrimaryKey() PrimaryKey

type StatusPageCreateUpdateResponse

type StatusPageCreateUpdateResponse struct {
	Results StatusPage `json:"results,omitempty"`
}

func (StatusPageCreateUpdateResponse) Item

type StatusPageListOptions

type StatusPageListOptions struct {
	Page            int64  `url:"page,omitempty"`
	PageSize        int64  `url:"page_size,omitempty"`
	Search          string `url:"search,omitempty"`
	Ordering        string `url:"ordering,omitempty"`
	VisibilityLevel string `url:"visibility_level,omitempty"`
}

type StatusPageListResponse

type StatusPageListResponse struct {
	Count   int64        `json:"count,omitempty"`
	Results []StatusPage `json:"results,omitempty"`
}

func (StatusPageListResponse) List

type StatusPageResponse

type StatusPageResponse StatusPage

func (StatusPageResponse) Item

func (r StatusPageResponse) Item() StatusPage

type Tag

type Tag struct {
	PK       int64  `json:"pk,omitempty"`
	URL      string `json:"url,omitempty"`
	Tag      string `json:"tag,omitempty"`
	ColorHex string `json:"color_hex,omitempty"`
}

Tag represents a check tag in Uptime.com.

func (Tag) PrimaryKey

func (t Tag) PrimaryKey() PrimaryKey

type TagCreateUpdateResponse

type TagCreateUpdateResponse struct {
	Results Tag `json:"results,omitempty"`
}

TagCreateUpdateResponse represents a response from the tagsImpl

func (TagCreateUpdateResponse) Item

func (t TagCreateUpdateResponse) Item() Tag

type TagItemResponse

type TagItemResponse = Tag

TagItemResponse represents a response from the tagsImpl.

func (TagItemResponse) Item

func (t TagItemResponse) Item() Tag

type TagListOptions

type TagListOptions struct {
	Page     int64  `url:"page,omitempty"`
	PageSize int64  `url:"page_size,omitempty"`
	Search   string `url:"search,omitempty"`
	Ordering string `url:"ordering,omitempty"`
}

TagListOptions specifies the optional parameters to tag listing API call.

type TagListResponse

type TagListResponse struct {
	Count    int64  `json:"count,omitempty"`
	Next     string `json:"next,omitempty"`
	Previous string `json:"previous,omitempty"`
	Results  []Tag  `json:"results,omitempty"`
}

TagListResponse represents a list of check tags.

func (TagListResponse) List

func (r TagListResponse) List() []Tag

type TagsEndpoint

type TagsEndpoint interface {
	List(context.Context, TagListOptions) ([]Tag, error)
	Create(context.Context, Tag) (*Tag, error)
	Get(context.Context, PrimaryKeyable) (*Tag, error)
	Update(context.Context, PrimaryKeyable, Tag) (*Tag, error)
	Delete(context.Context, PrimaryKeyable) error
}

func NewTagsEndpoint

func NewTagsEndpoint(cbd CBD) TagsEndpoint

Jump to

Keyboard shortcuts

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