Documentation
¶
Index ¶
- Constants
- type APIError
- type APIResponse
- type Account
- type AccountResp
- type AccountService
- type AlertContact
- type AlertContactEditResp
- type AlertContactMonitor
- type AlertContactResp
- type AlertContactService
- func (ac *AlertContactService) DeleteAlertContact(id int) (*AlertContactEditResp, error)
- func (ac *AlertContactService) EditAlertContact(params EditAlertContactParams) (*AlertContactEditResp, error)
- func (ac *AlertContactService) GetAlertContacts(params GetAlertContactsParams) (*AlertContactResp, error)
- func (ac *AlertContactService) NewAlertContact(params NewAlertContactParams) (*AlertContactSingleResp, error)
- type AlertContactSingle
- type AlertContactSingleResp
- type Client
- type ClientConfig
- type DeleteAlertContactWrapper
- type DeleteMWindowWrapper
- type DeleteOrResetMonitorsWrappers
- type EditAlertContactParams
- type EditMWindowParams
- type EditMonitorsParams
- type EditMonitorsWrappers
- type ErrorResponse
- type GetAlertContactsParams
- type GetMWindowParams
- type GetMonitorsParams
- type MWindow
- type MWindowResp
- type MWindowService
- func (ms *MWindowService) DeleteMWindow(id int) (*MWindowResp, error)
- func (ms *MWindowService) EditMWindow(params EditMWindowParams) (*MWindowResp, error)
- func (ms *MWindowService) GetMWindows(params GetMWindowParams) (*MWindowsResp, error)
- func (ms *MWindowService) NewMWindow(params NewMWindowParams) (*MWindowsResp, error)
- type MWindowsResp
- type Monitor
- type MonitorLog
- type MonitorSSL
- type MonitorService
- func (ms *MonitorService) DeleteMonitor(id int) (*MonitorsSingResp, error)
- func (ms *MonitorService) EditMonitor(id int, request EditMonitorsParams) (*MonitorsSingResp, error)
- func (ms *MonitorService) GetMonitors(params GetMonitorsParams) (*MonitorsResp, error)
- func (ms *MonitorService) NewMonitor(params NewMonitorsParams) (*MonitorsSingResp, error)
- func (ms *MonitorService) ResetMonitor(id int) (*MonitorsSingResp, error)
- type MonitorSingle
- type MonitorsResp
- type MonitorsSingResp
- type NewAlertContactParams
- type NewMWindowParams
- type NewMonitorsParams
- type Object
- type Pagination
Constants ¶
const ( StatFail = "fail" StatOk = "ok" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIError ¶
type APIError struct {
// StatusCode is the HTTP response status code
StatusCode int `json:"-"`
Message string `json:"message,omitempty"`
}
APIError represents the error response received when an API call fails. The HTTP response code is set inside of the StatusCode field, with the Message
func (APIError) RateLimited ¶
RateLimited returns whether the response had a status of 429, and as such the client is rate limited. The PagerDuty rate limits should reset once per minute, and for the API they are an account-wide rate limit (not per API key or IP).
type APIResponse ¶
type APIResponse struct {
Stat string `json:"stat"`
}
APIResponse is a response from the Uptime robot API
type Account ¶
type Account struct {
Email string `json:"email"`
UserId int `json:"user_id"`
FirstName string `json:"firstname"`
SmsCredits int `json:"sms_credits"`
MonitorLimit int `json:"monitor_limit"`
MonitorInterval int `json:"monitor_interval"`
UpMonitors int `json:"up_monitors"`
DownMonitors int `json:"down_monitors"`
PausedMonitors int `json:"paused_monitors"`
TotalMonitorsCount int `json:"total_monitors_count"`
}
Account returns basic information for the account making the API request,
type AccountResp ¶
type AccountService ¶
type AccountService struct {
// contains filtered or unexported fields
}
func (*AccountService) GetAccountDetails ¶
func (ac *AccountService) GetAccountDetails() (*AccountResp, error)
GetAccountDetails Get https://uptimerobot.com/#getAccountDetailsWrap
type AlertContact ¶
type AlertContactEditResp ¶
type AlertContactEditResp struct {
Stat string `json:"stat"`
AlertContact AlertContactSingle `json:"alertcontact"`
}
type AlertContactMonitor ¶
type AlertContactResp ¶
type AlertContactResp struct {
Stat string `json:"stat"`
Limit int `json:"limit"`
Offset int `json:"offset"`
Total int `json:"total"`
AlertContacts []AlertContact `json:"alert_contacts"`
}
type AlertContactService ¶
type AlertContactService struct {
// contains filtered or unexported fields
}
func (*AlertContactService) DeleteAlertContact ¶
func (ac *AlertContactService) DeleteAlertContact(id int) (*AlertContactEditResp, error)
DeleteAlertContact Get https://uptimerobot.com/#deleteAlertContactWrap
func (*AlertContactService) EditAlertContact ¶
func (ac *AlertContactService) EditAlertContact(params EditAlertContactParams) (*AlertContactEditResp, error)
EditAlertContact Get https://uptimerobot.com/#editAlertContactWrap
func (*AlertContactService) GetAlertContacts ¶
func (ac *AlertContactService) GetAlertContacts(params GetAlertContactsParams) (*AlertContactResp, error)
GetAlertContacts Get https://uptimerobot.com/#getAccountDetailsWrap The list of alert contacts
func (*AlertContactService) NewAlertContact ¶
func (ac *AlertContactService) NewAlertContact(params NewAlertContactParams) (*AlertContactSingleResp, error)
NewAlertContact Get https://uptimerobot.com/#newAlertContactWrap
type AlertContactSingle ¶
type AlertContactSingle struct {
Id int `json:"id"`
}
type AlertContactSingleResp ¶
type AlertContactSingleResp struct {
Stat string `json:"stat"`
AlertContact AlertContactSingle `json:"alertcontact"`
}
type Client ¶
type Client struct {
// Token used to make authenticated API calls.
Token string
// Services used for talking to different parts of the UptimeRobot API.
Account AccountService
AlertContact AlertContactService
Monitor MonitorService
MWindow MWindowService
// contains filtered or unexported fields
}
A Client manages communication with the UptimeRobot API.
func NewClientWithConfig ¶
func NewClientWithConfig(config *ClientConfig) *Client
NewClientWithConfig returns a new UptimeRobot API client.
type ClientConfig ¶
type ClientConfig struct {
// APIToken is the UptimeRobot API token to use for authentication.
APIToken string
// HTTPClient is your own HTTP client. The library will otherwise use a
// parameter-less `&http.Client{}`, resulting in default everything.
HTTPClient *http.Client
// UserAgent User agent used when communicating with the UptimeRobot API.
UserAgent *string
}
ClientConfig specifies configuration with which to initialize a UptimeRobot API client.
type DeleteAlertContactWrapper ¶
type DeleteAlertContactWrapper struct {
Id int `url:"id"`
}
DeleteAlertContactWrapper are wrapper for DeleteAlertContact.
type DeleteMWindowWrapper ¶
type DeleteMWindowWrapper struct {
Id int `url:"id"`
}
type DeleteOrResetMonitorsWrappers ¶
type DeleteOrResetMonitorsWrappers struct {
Id int `url:"id"`
}
type EditAlertContactParams ¶
type EditAlertContactParams struct {
Id int `url:"id"`
Value *string `url:"value,omitempty"`
FriendlyName *string `url:"friendly_name,omitempty"`
}
EditAlertContactParams are parameters for EditAlertContact.
type EditMWindowParams ¶
type EditMWindowParams struct {
FriendlyName string `url:"friendly_name"`
Url string `url:"url"`
SubType *int `url:"sub_type,omitempty"`
Port *int `url:"port,omitempty"`
KeywordType *int `url:"keyword_type,omitempty"`
KeywordCaseType *int `json:"keyword_case_type,omitempty"`
KeywordValue *string `url:"keyword_value,omitempty"`
Interval *int `url:"interval,omitempty"`
Timeout *int `url:"timeout,omitempty"`
HttpUsername *string `url:"http_username,omitempty"`
HttpPassword *string `url:"http_username,omitempty"`
HttpAuthType *int `url:"http_username,omitempty"`
HttpMethod *int `url:"http_method,omitempty"`
AlertContacts *string `url:"alert_contacts,omitempty"`
MWindows *string `url:"mwindows,omitempty"`
//CustomHttpHeaders *string `url:"custom_http_headers,omitempty"`
//CustomHttpStatuses *string `url:"custom_http_statuses,omitempty"`
IgnoreSSLErrors *bool `url:"ignore_ssl_errors,omitempty"`
}
type EditMonitorsParams ¶
type EditMonitorsParams struct {
FriendlyName string `url:"friendly_name"`
Url string `url:"url"`
SubType *int `url:"sub_type,omitempty"`
Port *int `url:"port,omitempty"`
KeywordType *int `url:"keyword_type,omitempty"`
KeywordCaseType *int `json:"keyword_case_type,omitempty"`
KeywordValue *string `url:"keyword_value,omitempty"`
Interval *int `url:"interval,omitempty"`
Timeout *int `url:"timeout,omitempty"`
HttpUsername *string `url:"http_username,omitempty"`
HttpPassword *string `url:"http_username,omitempty"`
HttpAuthType *int `url:"http_username,omitempty"`
HttpMethod *int `url:"http_method,omitempty"`
AlertContacts *string `url:"alert_contacts,omitempty"`
MWindows *string `url:"mwindows,omitempty"`
CustomHttpHeaders *string `url:"custom_http_headers,omitempty"`
CustomHttpStatuses *string `url:"custom_http_statuses,omitempty"`
IgnoreSSLErrors *bool `url:"ignore_ssl_errors,omitempty"`
}
type EditMonitorsWrappers ¶
type EditMonitorsWrappers struct {
Id int `url:"id"`
EditMonitorsParams
}
type ErrorResponse ¶
type GetAlertContactsParams ¶
type GetAlertContactsParams struct {
Offset *int `url:"offset,omitempty"`
Limit *int `url:"limit,omitempty"`
AlertContacts *string `url:"alert_contacts,omitempty"`
}
GetAlertContactsParams are parameters for GetAlertContacts.
type GetMWindowParams ¶
type GetMonitorsParams ¶
type GetMonitorsParams struct {
Monitors *string `url:"monitors,omitempty"`
Types *string `url:"types,omitempty"`
Statuses *string `url:"statuses,omitempty"`
CustomUptimeRatios *string `url:"custom_uptime_ratios,omitempty"`
CustomUptimeDurations int `url:"custom_down_durations,omitempty"`
AllTimeUptimeRation int `url:"all_time_uptime_ratio,omitempty"`
AllTimeUptimeDurations int `url:"all_time_uptime_durations,omitempty"`
Logs int `url:"logs,omitempty"`
AlertContacts int `url:"alert_contacts,omitempty"`
MWindows int `url:"mwindows,omitempty"`
SSL int `url:"ssl,omitempty"`
CustomHttpHeaders int `url:"custom_http_headers,omitempty"`
CustomHttpStatuses int `url:"custom_http_statuses,omitempty"`
Timezone int `url:"timezone,omitempty"`
Offset int `url:"offset,omitempty"`
Limit *int `url:"limit,omitempty"`
Search *string `url:"search,omitempty"`
}
type MWindow ¶
type MWindow struct {
Id int `json:"id"`
User int `json:"user"`
Type int `json:"type"`
FriendlyName string `json:"friendly_name"`
// StartTime comes from API as a string value with a format like “18:20.”
StartTime string `json:"start_time"`
Duration int `json:"duration"`
Value string `json:"value"`
Status int `json:"status"`
}
type MWindowResp ¶
type MWindowService ¶
type MWindowService struct {
// contains filtered or unexported fields
}
func (*MWindowService) DeleteMWindow ¶
func (ms *MWindowService) DeleteMWindow(id int) (*MWindowResp, error)
DeleteMWindow Get https://uptimerobot.com/#deleteMwindowWrap
func (*MWindowService) EditMWindow ¶
func (ms *MWindowService) EditMWindow(params EditMWindowParams) (*MWindowResp, error)
EditMWindow Get https://uptimerobot.com/#editMWindow
func (*MWindowService) GetMWindows ¶
func (ms *MWindowService) GetMWindows(params GetMWindowParams) (*MWindowsResp, error)
GetMWindows Get https://uptimerobot.com/#getMWindows
func (*MWindowService) NewMWindow ¶
func (ms *MWindowService) NewMWindow(params NewMWindowParams) (*MWindowsResp, error)
NewMWindow Get https://uptimerobot.com/#newMWindow
type MWindowsResp ¶
type MWindowsResp struct {
Stat string `json:"stat"`
Pagination Pagination `json:"pagination"`
MWindows []MWindow `json:"mwindows"`
}
type Monitor ¶
type Monitor struct {
Id int `json:"id"`
FriendlyName string `json:"friendly_name"`
Url string `json:"url"`
Type int `json:"type"`
// sub_type, port and keyword_type are returned as either an integer or an empty string,
// which Go doesn't allow: https://github.com/golang/go/issues/22182
SubType interface{} `json:"sub_type"`
Port interface{} `json:"port"`
KeywordType interface{} `json:"keyword_type"`
KeywordCaseType *int `json:"keyword_case_type"`
KeywordValue string `json:"keyword_value"`
HttpUsername string `json:"http_username"`
HttpPassword string `json:"http_password"`
Interval int `json:"interval"`
Timeout int `json:"timeout"`
Status int `json:"status"`
CreateDatetime int `json:"create_datetime"`
MonitorGroup int `json:"monitor_group"`
IsGroupMain int `json:"is_group_main"`
Logs []MonitorLog `json:"logs"`
AlertContacts *[]AlertContactMonitor `json:"alert_contacts"`
SSL *MonitorSSL `json:"ssl"`
}
type MonitorLog ¶
type MonitorSSL ¶
type MonitorService ¶
type MonitorService struct {
// contains filtered or unexported fields
}
func (*MonitorService) DeleteMonitor ¶
func (ms *MonitorService) DeleteMonitor(id int) (*MonitorsSingResp, error)
DeleteMonitor Get https://uptimerobot.com/#deleteMonitorWrap
func (*MonitorService) EditMonitor ¶
func (ms *MonitorService) EditMonitor(id int, request EditMonitorsParams) (*MonitorsSingResp, error)
EditMonitor Get https://uptimerobot.com/#editMonitorWrap
func (*MonitorService) GetMonitors ¶
func (ms *MonitorService) GetMonitors(params GetMonitorsParams) (*MonitorsResp, error)
GetMonitors Get https://uptimerobot.com/#getMonitorsWrap
func (*MonitorService) NewMonitor ¶
func (ms *MonitorService) NewMonitor(params NewMonitorsParams) (*MonitorsSingResp, error)
NewMonitor Get https://uptimerobot.com/#newMonitorWrap
func (*MonitorService) ResetMonitor ¶
func (ms *MonitorService) ResetMonitor(id int) (*MonitorsSingResp, error)
ResetMonitor Get https://uptimerobot.com/#resetMonitorWrap
type MonitorSingle ¶
type MonitorsResp ¶
type MonitorsResp struct {
Stat string `json:"stat"`
Pagination Pagination `json:"pagination"`
Monitors []Monitor `json:"monitors"`
}
type MonitorsSingResp ¶
type MonitorsSingResp struct {
Stat string `json:"stat"`
Monitor MonitorSingle `json:"monitor"`
}
type NewAlertContactParams ¶
type NewAlertContactParams struct {
TypeContact string `url:"type"`
Value string `url:"value"`
FriendlyName string `url:"friendly_name"`
}
NewAlertContactParams are parameters for NewAlertContact.
type NewMWindowParams ¶
type NewMonitorsParams ¶
type NewMonitorsParams struct {
Type int `url:"type"`
FriendlyName string `url:"friendly_name"`
Url string `url:"url"`
SubType *int `url:"sub_type,omitempty"`
Port *int `url:"port,omitempty"`
KeywordType *int `url:"keyword_type,omitempty"`
KeywordCaseType *int `json:"keyword_case_type,omitempty"`
KeywordValue *string `url:"keyword_value,omitempty"`
Interval *int `url:"interval,omitempty"`
Timeout *int `url:"timeout,omitempty"`
HttpUsername *string `url:"http_username,omitempty"`
HttpPassword *string `url:"http_username,omitempty"`
HttpAuthType *int `url:"http_username,omitempty"`
HttpMethod *int `url:"http_method,omitempty"`
AlertContacts *string `url:"alert_contacts,omitempty"`
MWindows *string `url:"mwindows,omitempty"`
CustomHttpHeaders *string `url:"custom_http_headers,omitempty"`
CustomHttpStatuses *string `url:"custom_http_statuses,omitempty"`
IgnoreSSLErrors *bool `url:"ignore_ssl_errors,omitempty"`
}
type Object ¶
type Object struct {
Stat string `json:"stat"`
}
Object contains the common fields of every resource in the UptimeRobot API.