uptimerobot

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrStatus   = errors.New("error code from Uptime Robot API")
	ErrResponse = errors.New("received fail from Uptime Robot API")
)
View Source
var ErrContactNotFound = errors.New("contact not found")
View Source
var ErrMonitorNotFound = errors.New("monitor not found")

Functions

This section is empty.

Types

type Account

type Account struct {
	Email string `json:"email"`
}

type AccountDetailsResponse

type AccountDetailsResponse struct {
	Status  urtypes.Status `json:"stat"`
	Account Account        `json:"account"`
}

type Client

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

func NewClient

func NewClient(apiKey string) Client

func (Client) CreateMonitor

func (c Client) CreateMonitor(ctx context.Context, monitor Monitor, contacts MonitorContacts) (string, error)

func (Client) DeleteMonitor

func (c Client) DeleteMonitor(ctx context.Context, id string) error

func (Client) Do

func (c Client) Do(ctx context.Context, endpoint string, form url.Values) (*http.Response, error)

func (Client) EditMonitor

func (c Client) EditMonitor(ctx context.Context, id string, monitor Monitor, contacts MonitorContacts) (string, error)

func (Client) FindContactID

func (c Client) FindContactID(ctx context.Context, friendlyName string) (string, error)

func (Client) FindMonitorID

func (c Client) FindMonitorID(ctx context.Context, opts ...FindOpt) (string, error)

func (Client) GetAccountDetails

func (c Client) GetAccountDetails(ctx context.Context) (string, error)

func (Client) MonitorValues

func (c Client) MonitorValues(monitor Monitor, form url.Values, contacts MonitorContacts) url.Values

func (Client) NewRequest

func (c Client) NewRequest(ctx context.Context, endpoint string, form url.Values) (*http.Request, error)

func (Client) NewValues

func (c Client) NewValues() url.Values

type Contact

type Contact struct {
	// FriendlyName sets the name that is shown in Uptime Robot.
	FriendlyName string `json:"friendlyName"`
}

type FindContactResponse

type FindContactResponse struct {
	Status   urtypes.Status    `json:"stat"`
	Contacts []ResponseContact `json:"alert_contacts"`
}

type FindMonitorResponse

type FindMonitorResponse struct {
	Status   urtypes.Status    `json:"stat"`
	Monitors []ResponseMonitor `json:"monitors"`
}

type FindOpt

type FindOpt func(form url.Values)

func FindByID

func FindByID(id ...string) FindOpt

func FindBySearch

func FindBySearch(val string) FindOpt

func FindByURL

func FindByURL(monitor Monitor) FindOpt

type Monitor

type Monitor struct {
	// FriendlyName sets the name that is shown in Uptime Robot.
	FriendlyName string `json:"friendlyName"`

	// URL is the URL or IP to monitor, including the scheme.
	URL string `json:"url"`

	// Type chooses the monitor type.
	//+kubebuilder:default:=HTTPS
	Type urtypes.MonitorType `json:"type,omitempty"`

	// Interval is the monitoring interval.
	//+kubebuilder:default:="60s"
	Interval metav1.Duration `json:"interval,omitempty"`

	// Status toggles pause status for the monitor. 0 is paused, 1 is running.
	//+kubebuilder:default:=1
	Status uint8 `json:"status,omitempty"`

	// Timeout is the monitor timeout.
	//+kubebuilder:default:="30s"
	Timeout metav1.Duration `json:"timeout,omitempty"`

	// HTTPMethod defines the HTTP verb to use.
	//+kubebuilder:default:="HEAD"
	HTTPMethod urtypes.HTTPMethod `json:"httpMethod,omitempty"`

	// Keyword provides configuration for the Keyword monitor type.
	Keyword *MonitorKeyword `json:"keyword,omitempty"`

	// Port provides configuration for the Port monitor type.
	Port *MonitorPort `json:"port,omitempty"`

	// Auth enables monitor auth.
	Auth *MonitorAuth `json:"auth,omitempty"`
}

func (*Monitor) DeepCopy

func (in *Monitor) DeepCopy() *Monitor

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Monitor.

func (*Monitor) DeepCopyInto

func (in *Monitor) DeepCopyInto(out *Monitor)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type MonitorAuth

type MonitorAuth struct {
	//+kubebuilder:default:="Basic"
	Type urtypes.MonitorAuthType `json:"type"`

	Username string `json:"username,omitempty"`
	Password string `json:"password,omitempty"`

	SecretName  string `json:"secretName,omitempty"`
	UsernameKey string `json:"usernameKey,omitempty"`
	PasswordKey string `json:"passwordKey,omitempty"`
}

type MonitorContact

type MonitorContact struct {
	ID string `json:"id"`

	MonitorContactCommon `json:",inline"`
}

func (MonitorContact) String

func (m MonitorContact) String() string

type MonitorContactCommon

type MonitorContactCommon struct {
	// Threshold defines the number of minutes to wait to notify.
	// +kubebuilder:default:="1m"
	Threshold metav1.Duration `json:"threshold,omitempty"`

	// Recurrence defines the number of minutes between a repeat notification.
	// A value of 0, disables repeat notifications.
	Recurrence metav1.Duration `json:"recurrence,omitempty"`
}

type MonitorContacts

type MonitorContacts []MonitorContact

func (MonitorContacts) String

func (m MonitorContacts) String() string

type MonitorKeyword

type MonitorKeyword struct {
	Type urtypes.KeywordType `json:"type"`

	//+kubebuilder:default:=false
	CaseSensitive bool `json:"caseSensitive,omitempty"`

	Value string `json:"value"`
}

type MonitorPort

type MonitorPort struct {
	Type urtypes.PortType `json:"type"`

	Number uint16 `json:"number,omitempty"`
}

type Response

type Response struct {
	Status  urtypes.Status  `json:"stat"`
	Monitor ResponseMonitor `json:"monitor"`
}

type ResponseContact

type ResponseContact struct {
	ID           string `json:"id"`
	FriendlyName string `json:"friendly_name"`
}

type ResponseMonitor

type ResponseMonitor struct {
	ID json.Number `json:"id"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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