Documentation
¶
Index ¶
- Constants
- Variables
- type AlertCondition
- type Client
- func (c *Client) CreateAlertCondition(policyID uint, args *CreateAlertConditionArgs) (*AlertCondition, error)
- func (c *Client) CreateMonitor(m *CreateMonitorArgs) (*Monitor, error)
- func (c *Client) DeleteAlertCondition(alertConditionID uint) error
- func (c *Client) DeleteMonitor(id string) error
- func (c *Client) GetAlertCondition(policyID, alertConditionID uint) (*AlertCondition, error)
- func (c *Client) GetAllMonitors(offset, limit uint) (*GetAllMonitorsResponse, error)
- func (c *Client) GetMonitor(id string) (*Monitor, error)
- func (c *Client) GetMonitorScript(id string) (string, error)
- func (c *Client) UpdateAlertCondition(alertConditionID uint, args *UpdateAlertConditionArgs) (*AlertCondition, error)
- func (c *Client) UpdateMonitor(id string, args *UpdateMonitorArgs) (*Monitor, error)
- func (c *Client) UpdateMonitorScript(id string, args *UpdateMonitorScriptArgs) error
- type CreateAlertConditionArgs
- type CreateMonitorArgs
- type ExtendedMonitor
- type GetAllMonitorsResponse
- type HTTPClient
- type Monitor
- type RetryableHTTPClient
- type ScriptLocation
- type UpdateAlertConditionArgs
- type UpdateMonitorArgs
- type UpdateMonitorScriptArgs
Constants ¶
const ( // The different monitor types. TypeSimple = "SIMPLE" TypeBrowser = "BROWSER" TypeScriptAPI = "SCRIPT_API" TypeScriptBrowser = "SCRIPT_BROWSER" )
Variables ¶
var ( // ErrMonitorNotFound is returned when a monitor can't be // found. ErrMonitorNotFound = errors.New("error: monitor not found") // ErrMonitorScriptNotFound is returned when a monitor script can't // be found. ErrMonitorScriptNotFound = errors.New("error: monitor script not found") // ErrAlertConditionNotFound is returned when an alert // condition can't be found. ErrAlertConditionNotFound = errors.New("error: alert condition not found") )
Functions ¶
This section is empty.
Types ¶
type AlertCondition ¶
type AlertCondition struct {
ID uint `json:"id"`
Name string `json:"name"`
MonitorID string `json:"monitor_id"`
RunbookURL string `json:"runbook_url,omitempty"`
Enabled bool `json:"enabled"`
}
AlertCondition is the response to CreateAlertCondition.
type Client ¶
type Client struct {
APIKey string
HTTPClient HTTPClient
// contains filtered or unexported fields
}
Client is a client to New Relic Synthetics.
func (*Client) CreateAlertCondition ¶
func (c *Client) CreateAlertCondition(policyID uint, args *CreateAlertConditionArgs) (*AlertCondition, error)
CreateAlertCondition creates a Synthetics alert condition for an existing policy.
func (*Client) CreateMonitor ¶
func (c *Client) CreateMonitor(m *CreateMonitorArgs) (*Monitor, error)
CreateMonitor creates a new Monitor.
func (*Client) DeleteAlertCondition ¶
DeleteAlertCondition deletes a Synthetics alert condition.
func (*Client) DeleteMonitor ¶
DeleteMonitor deletes a Monitor.
func (*Client) GetAlertCondition ¶
func (c *Client) GetAlertCondition(policyID, alertConditionID uint) (*AlertCondition, error)
GetAlertCondition finds a Synthetics alert condition.
func (*Client) GetAllMonitors ¶
func (c *Client) GetAllMonitors(offset, limit uint) (*GetAllMonitorsResponse, error)
GetAllMonitors returns all monitors within a New Relic Synthetics account. Values of -1 indicate to use the defaults.
func (*Client) GetMonitor ¶
GetMonitor returns a specific Monitor.
func (*Client) GetMonitorScript ¶
GetMonitorScript returns the script that backs a monitor.
func (*Client) UpdateAlertCondition ¶
func (c *Client) UpdateAlertCondition(alertConditionID uint, args *UpdateAlertConditionArgs) (*AlertCondition, error)
UpdateAlertCondition updates a Synthetics alert condition. All fields must be specified.
func (*Client) UpdateMonitor ¶
func (c *Client) UpdateMonitor(id string, args *UpdateMonitorArgs) (*Monitor, error)
UpdateMonitor creates a new Monitor.
func (*Client) UpdateMonitorScript ¶
func (c *Client) UpdateMonitorScript(id string, args *UpdateMonitorScriptArgs) error
UpdateMonitorScript updates the script that backs a monitor.
type CreateAlertConditionArgs ¶
type CreateAlertConditionArgs struct {
Name string `json:"name"`
MonitorID string `json:"monitor_id"`
RunbookURL string `json:"runbook_url,omitempty"`
Enabled bool `json:"enabled"`
}
CreateAlertConditionArgs are the arguments to CreateAlertCondition.
type CreateMonitorArgs ¶
type CreateMonitorArgs struct {
Name string `json:"name"`
Type string `json:"type"`
Frequency uint `json:"frequency"`
URI string `json:"uri,omitempty"`
Locations []string `json:"locations"`
Status string `json:"status"`
SLAThreshold float64 `json:"slaThreshold,omitempty"`
ValidationString *string `json:"-"`
VerifySSL *bool `json:"-"`
BypassHEADRequest *bool `json:"-"`
TreatRedirectAsFailure *bool `json:"-"`
}
CreateMonitorArgs are the arguments to CreateMonitor.
type ExtendedMonitor ¶
type ExtendedMonitor struct {
ID string `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
Frequency uint `json:"frequency"`
URI string `json:"uri"`
Locations []string `json:"locations"`
Status string `json:"status"`
SLAThreshold float64 `json:"slaThreshold"`
Options map[string]interface{} `json:"options"`
ModifiedAt time.Time
CreatedAt time.Time
UserID uint `json:"userId"`
APIVersion string `json:"apiVersion"`
// These are only used for parsing.
ModifiedAtRaw string `json:"modifiedAt"`
CreatedAtRaw string `json:"createdAt"`
}
ExtendedMonitor is the monitor format provided by GetAllMonitors.
type GetAllMonitorsResponse ¶
type GetAllMonitorsResponse struct {
Monitors []*ExtendedMonitor `json:"monitors"`
Count uint `json:"count"`
}
GetAllMonitorsResponse is the response by GetAllMonitors.
type HTTPClient ¶
HTTPClient is the interface to an HTTP client.
type Monitor ¶
type Monitor struct {
ID string `json:"id,omitempty"`
Name string `json:"name"`
Type string `json:"type"`
Frequency uint `json:"frequency"`
URI string `json:"uri"`
Locations []string `json:"locations"`
Status string `json:"status"`
SLAThreshold float64 `json:"slaThreshold"`
UserID uint `json:"userId,omitempty"`
APIVersion string `json:"apiVersion,omitempty"`
Options map[string]interface{} `json:"options,omitempty"`
ValidationString *string `json:"-"`
VerifySSL *bool `json:"-"`
BypassHEADRequest *bool `json:"-"`
TreatRedirectAsFailure *bool `json:"-"`
}
Monitor describes a specific Synthetics monitor.
type RetryableHTTPClient ¶
RetryableHTTPClient is the interface to an HTTP client that supports retries.
type ScriptLocation ¶
ScriptLocation corresponds to the different locations a script can be executed from.
type UpdateAlertConditionArgs ¶
type UpdateAlertConditionArgs struct {
Name string `json:"name"`
MonitorID string `json:"monitor_id"`
RunbookURL string `json:"runbook_url,omitempty"`
Enabled bool `json:"enabled"`
}
UpdateAlertConditionArgs are the arguments to UpdateAlertCondition.
type UpdateMonitorArgs ¶
type UpdateMonitorArgs struct {
Name string `json:"name,omitempty"`
Frequency uint `json:"frequency,omitempty"`
URI string `json:"uri,omitempty"`
Locations []string `json:"locations,omitempty"`
Status string `json:"status,omitempty"`
SLAThreshold float64 `json:"slaThreshold,omitempty"`
ValidationString *string `json:"-"`
VerifySSL *bool `json:"-"`
BypassHEADRequest *bool `json:"-"`
TreatRedirectAsFailure *bool `json:"-"`
}
UpdateMonitorArgs are the arguments to UpdateMonitor.
type UpdateMonitorScriptArgs ¶
type UpdateMonitorScriptArgs struct {
ScriptText string `json:"scriptText"`
ScriptLocations []*ScriptLocation `json:"scriptLocations,omitempty"`
}
UpdateMonitorScriptArgs are the arguments to UpdateMonitorScript.