uptimerobot

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2024 License: Apache-2.0 Imports: 12 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 uptimerobotv1.MonitorValues, contacts uptimerobotv1.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 uptimerobotv1.MonitorValues, contacts uptimerobotv1.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 uptimerobotv1.MonitorValues, form url.Values, contacts uptimerobotv1.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 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 uptimerobotv1.MonitorValues) FindOpt

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