Documentation ¶
Overview ¶
Package neustar is a SDK that provides access into the Neustar API.
Almost all documentation is taken directly from the Neustar documentation.
Index ¶
- Constants
- Variables
- func ValidAggregateSampleDataFrequency(frequency string) bool
- func ValidAggregateSampleGroupBy(groupBy string) bool
- func ValidBrowserType(browserType string) bool
- func ValidLocation(location string) bool
- func ValidMonitorType(monitorType string) bool
- func ValidStrikes(strike int) bool
- func ValidUpdateInterval(interval int) bool
- type AggregateSampleDataResponse
- type AggregateSampleParameters
- type AggregateSampleResponse
- type AlertPolicy
- type Alerting
- type CreateMonitorParameters
- type CreateMonitorResponse
- type DNSSettings
- type InstanceTestingResponse
- type InstantTesting
- type InstantTestingByLocationResponse
- type InstantTestingCreateResponse
- type InstantTestingData
- type ListAlertPoliciesResponse
- type Monitor
- type Monitoring
- func (m *Monitoring) AggregateSampleData(monitorID string, asp *AggregateSampleParameters) ([]AggregateSampleResponse, error)
- func (m *Monitoring) Create(cmp *CreateMonitorParameters) (CreateMonitorResponse, error)
- func (m *Monitoring) Delete(id string) (int, error)
- func (m *Monitoring) Get(id string) ([]Monitor, error)
- func (m *Monitoring) List() ([]Monitor, error)
- func (m *Monitoring) Locations() ([]string, error)
- func (m *Monitoring) RawSampleData(monitorID, sampleID string) (RawSampleDataResponse, error)
- func (m *Monitoring) Samples(monitorID string, srp *SampleRequestParameters) (SamplesDataResponse, error)
- func (m *Monitoring) Summary(monitorID string) ([]SummaryDataResponse, error)
- func (m *Monitoring) Update()
- type Neustar
- type NewAlertPolicyParameters
- type NewAlertPolicyResponse
- type PingSettings
- type PopSettings
- type PortSettings
- type RawSampleDataResponse
- type ReturnedAPIError
- type SLASettings
- type SMTPSettings
- type SampleRequestParameters
- type SamplesDataResponse
- type Script
- type ScriptCreateParameters
- type ScriptDataResponse
- type Scripting
- type ScriptingListResponse
- type SummaryDataResponse
- type UpdateMonitorParameters
Constants ¶
const ( // AlertURI is the endpoint for calls to the scripting API AlertURI = "alert/1.0" // PolicyURI is the endpoint for policy calls PolicyURI = "/policy" )
const ( // MonitorURI is the endpoint for calls to the monitoring API MonitorURI = "monitor/1.0" // LocationsURI is the endpoint for locations calls LocationsURI = "/locations" // SummaryURI is the endpoint for summary calls SummaryURI = "/summary" // AggregateURI is the endpoint for aggregate calls AggregateURI = "/aggregate" // SamplesURI is the endpoint for sample calls SamplesURI = "/sample" )
const ( // BaseURL is the base URL endpoint BaseURL = "http://api.neustar.biz/performance/" // Version is the current version of this library Version = "0.1" )
const ( // ScriptURI is the endpoint for calls to the scripting API ScriptURI = "script/1.0" // PolicyURI is the endpoint for policy calls CreateURI = "/url" // AllScripts is the endpoint for AllScripts calls AllScriptsURI = "/AllScripts" // ValidSciptsURI is the endpiont for ValidScripts calls ValidSciptsURI = "/ValidScripts" // InvalidScriptsURI is the endpiont for ValidScripts calls InvalidScriptsURI = "/InvalidScripts" // UploadBodyURI is the endpiont for ValidScripts calls UploadBodyURI = "/upload/body" )
const (
// ToolsURI is the endpoint for instant test queries
ToolsURI = "tools/instanttest/1.0"
)
Variables ¶
var APIError map[string]ReturnedAPIError
APIError represents what the API returns on error
var AggregateSampleDataFrequency = []string{"day", "hour"}
AggregateSampleDataFrequency is a slice of valid frequencies
var AggregateSampleGroupBy = []string{"location", "step"}
AggregateSampleGroupBy is a slice of valid groupBy parameters
var BrowserTypes = []string{"FF", "CHROME", "IE"}
BrowserTypes is a slice of valid browser types
var Locations = []string{
"houston",
"brisbane",
"washingtondc",
"birmingham",
"milwaukee",
"siouxfalls",
"mumbai",
"paris",
"shanghai",
"denver",
"sydney",
"portoalegre",
"telaviv",
"rotterdam",
"delhi",
"budapest",
"munich",
"akron",
"dubai",
"miami",
"missoula",
"detroit",
"saopaulo",
"stockholm",
"manchester",
"bucharest",
"zurich",
"madrid",
"prague",
"milan",
"cleveland",
"halifax",
"portland",
"chicago",
"kualalumpur",
"buenosaires",
"newark",
"newyork",
"columbus",
"losangeles",
"stlouis",
"capetown",
"paloalto",
"guangzhou",
"albuquerque",
"boise",
"bangalore",
"sanfrancisco",
"auckland",
"dublin",
"melbourne",
"raleigh",
"austin",
"taipei",
"neworleans",
"beijing",
"philadelphia",
"sanjose",
"amsterdam",
"kansascity",
"nagoya",
"cairo",
"calgary",
"lasvegas",
"pittsburgh",
"berlin",
"hartford",
"honolulu",
"hamburg",
"saltlakecity",
"atlanta",
"tampa",
"toronto",
"bedford",
"sandiego",
"tokyo",
"london",
"charlotte",
"boston",
"lisbon",
"minneapolis",
"seattle",
"copenhagen",
"warsaw",
"istanbul",
"dallas",
"hongkong",
"annapolis",
"vancouver",
"edinburgh",
"phoenix",
"singapore",
"brussels",
"omaha",
"helsinki",
"scranton",
"barcelona",
"montreal",
"oslo",
"frankfurt",
}
ValidLocations is a slice containing all valid locations for scripts and monitors to run from
var MonitorTypes = []string{"RealBrowserUser", "VirtualUser", "dns"}
MonitorTypes is a slice of valid monitor types
var MonitoringErrorCodes = map[string]string{
"MON_0000": "Resource :resource not available",
"MON_0001": "Item with Id :itemid not found",
"MON_0002": "Duplicate name :name found.",
"MON_0003": ":missingfield is/are required fields",
"MON_0004": ":value is an invalid value.",
"MON_0005": ":value is an invalid value type. Type :valuetype expected",
"MON_0006": ":field is an invalid field",
"MON_0007": "Valid :field id not supplied",
"MON_0008": "Empty body received in POST",
"MON_0009": "Empty body received in PUT",
"MON_0010": "System cannot complete the request",
"MON_0011": "User does not have permission to perform the action",
"MON_9999": "An internal error has occured",
}
MonitoringErrorCodes holds API returned error codes
var RealUserMeasurementsErrorCodes = map[string]string{
"RUM_000": "Request has been throttled",
"RUM_001": "Database internal error",
"RUM_002": "Generic internal error",
"RUM_003": "Database found data inconsistencies",
"RUM_004": "Generic Forbidden error",
"RUM_005": "Mandatory parameter is missing",
"RUM_006": "Parameter is not valid",
}
RealUserMeasurementsErrorCodes holds API returned error codes
var Strikes = []int{1, 2, 3}
Strikes is a slice of valid strikes
var UpdateIntervals = []int{1, 2, 3, 4, 5, 10, 15, 20, 30, 60}
UpdateIntervals is a slice of valid intervals
Functions ¶
func ValidAggregateSampleDataFrequency ¶
ValidAggregateSampleDataFrequency validates the given frequency is valid
func ValidAggregateSampleGroupBy ¶
ValidAggregateSampleGroupBy validates the given groupBy is valid
func ValidBrowserType ¶
ValidBrowserType validates the given browser type is valid
func ValidLocation ¶
ValidLocation verifies the given location is valid
func ValidMonitorType ¶
ValidMonitorType validates the given monitor type is valid
func ValidStrikes ¶
ValidStrikes makes sure that the given strike is valid
func ValidUpdateInterval ¶
ValidUpdateInterval validates the given interval is valid
Types ¶
type AggregateSampleDataResponse ¶
type AggregateSampleDataResponse struct { Data struct { Count int `json:"count"` Items []AggregateSampleResponse `json:"items"` } `json:"data"` }
AggregateSampleDataResponse holds the return from the API list call
type AggregateSampleParameters ¶
type AggregateSampleParameters struct { // An ISO 8601 formatted date string or datetime string representing the // start date from which you wish to collect samples. Examples: 2012-03-02 or 2012-03-01T12:00 StartDate string `url:"startDate"` // An ISO 8601 formatted date string or datetime string representing the // end date from which you wish to collect samples. Examples: 2012-03-02 or 2012-03-01T12:00 EndDate string `url:"endDate"` // From which position in the return list you wish to start. At most, 2000 records will be returned. Offset int `url:"offset"` // Aggregation period ('day', 'hour') Frequency string `url:"frequency"` // When selected, the data will be aggregated by the selected 'groupBy' GroupBy string `url:"groupBy"` }
AggregateSampleParameters holds the allowed options for getting aggregate sample data
type AggregateSampleResponse ¶
type AggregateSampleResponse struct { Count int `json:"count"` Uptime string `json:"uptime"` Min int `json:"min"` Max int `json:"max"` Date string `json:"date"` Avg string `json:"avg"` STDDev string `json:"stdDev"` Location string `json:"location"` StepName string `json:"stepName"` StepNumber int `json:"stepNumber"` TP50 int `json:"tp50"` TP90 int `json:"tp90"` }
AggregateSampleResponse holds the returned data from the call
type AlertPolicy ¶
AlertPolicy holds the alert policy data
type Alerting ¶
type Alerting struct {
// contains filtered or unexported fields
}
Alerting holds alerting config
func (*Alerting) ListAlertPolicies ¶
func (a *Alerting) ListAlertPolicies() (ListAlertPoliciesResponse, error)
ListAlertPolicies retrieves a list of policies ordered by date in descending order.
func (*Alerting) NewAlertPolicy ¶
func (a *Alerting) NewAlertPolicy(napp *NewAlertPolicyParameters) (NewAlertPolicyResponse, error)
NewAlertPolicy creates a new Alert policy
type CreateMonitorParameters ¶
type CreateMonitorParameters struct { // The name of the monitor Name string `json:"name"` // A description of what this monitor is for Description string `json:"description"` // How often the monitoring script will run for each of the locations Interval int `json:"interval"` // The id of the test script that this monitor should run TestScript string `json:"testScript"` // A CSV list of locations that this monitor should run from Locations string `json:"Locations"` // The id of the alert policy that this monitor should run AlertPolicy string `json:"alertPolicy"` // Specifies the browser type that this monitor should use. Note: IE is // available for Enterprise customers only Browser string `json:"browser"` // Enables or disables this monitor from taking samples Active string `json:"active"` // Set to network monitor type such as 'dns'. See related settings below. // Leave this blank for script-based monitors. Note: this interface will // not allow you to test network monitor creation. Please use your API client. Type string `json:"type"` DNSSettings DNSSettings `json:"dnsSettings"` PingSettings PingSettings `json:"pingSettings"` PopSettings PopSettings `json:"popSettings"` PortSettings PortSettings `json:"portSettings"` SMTPSettings SMTPSettings `json:"smtpSettings"` }
CreateMonitorParameters holds the parameters needed by the create monitor endpoint
type CreateMonitorResponse ¶
CreateMonitorResponse contains the response from a call to create a new monitor
type DNSSettings ¶
type DNSSettings struct { LookupType string `json:"lookupType"` Authoritative bool `json:"authoritative"` Hostname string `json:"hostname"` DNSServer string `json:"dnsServer"` ExpectedIPs string `json:"expectedIps"` }
DNSSettings is a an object containing all DNS-related settings: {"timeout": int, "lookups": array}. The "lookups" array contains JSON objects with this format: {"lookupType": string ("A" or "AAAA"), "authoritative": boolean, "hostname": string, "dnsServer": string, "expectedIps": string of comma-separated IP addresses}
type InstanceTestingResponse ¶
type InstanceTestingResponse struct { Data struct { // A list of instant test job locations, their status and the specific location Items []InstantTestingData `json:"items"` // The ID of the instant test job ID string `json:"id"` } `json:"data"` }
InstanceTestingResponse
type InstantTesting ¶
type InstantTesting struct {
// contains filtered or unexported fields
}
InstantTesting
func NewInstantTest ¶
func NewInstantTest(neustar *Neustar) *InstantTesting
NewInstantTest returns a new InstantTesting object
func (*InstantTesting) Create ¶
func (i *InstantTesting) Create(url, callback string) (InstantTestingCreateResponse, error)
Create creates a new instant test job and return the job id of the new instant test job. Url is required. You may optionally supply a callback URL. For every stage of the instant test process, we will POST the current status of your instant test job
func (*InstantTesting) GetJob ¶
func (i *InstantTesting) GetJob(instantTestID string) (InstanceTestingResponse, error)
GetJob retrieves information for a specific instant test job, along with information from each location being tested.
func (*InstantTesting) GetJobByLocations ¶
func (i *InstantTesting) GetJobByLocations(instantTestID, instantTestLocationID string)
GetJobByLocations retrieves information for a specific instant test job by location.
type InstantTestingByLocationResponse ¶
type InstantTestingByLocationResponse struct { // The ID of the instant test job ID string `json:"id"` // The current status of the instant test job Status string `json:"status"` // Available on completion, the resultant har file for this instant // test job. HARFile string `json:"harFile"` // Available on completion, the base64 encoded screenshot for this // instant test job. Screenshot string `json:"screenshot"` }
InstantTestingByLocationResponse
type InstantTestingCreateResponse ¶
type InstantTestingCreateResponse struct { Data struct { Items struct { ID string `json:"id"` Loctions []struct { ID string `json:"id"` Location string `json:"location"` } `json:"locations"` Created string `json:"created"` } `json:"items"` } `json:"data"` }
InstantTestingCreateResponse holds the response from the API on Instant Test creation
type InstantTestingData ¶
type InstantTestingData struct { Status string `json:""` Location string `json:"location"` ResponseTime int `json:"responseTime"` ID string `json:"id"` }
InstantTestingJobReponse contains the response from the API
type ListAlertPoliciesResponse ¶
type ListAlertPoliciesResponse struct { // ID of the alert policy ID string // Name of the alert policy Name string // EmailAddresses is a slice of strings containing email addresses associated // with the alert policy EmailAddresses []string // The description of the alert policy Description string // Strikes before triggering an alert. Strikes int // AdvancedEdit holds a flag that will return true if the policy is an Advanced // Alert Policy AdvancedEdit bool }
ListAlertPoliciesResponse holds the response from the ListAlertPolicies call
type Monitor ¶
type Monitor struct { // The ID of the monitor ID string `json:"id"` // The ID of the alerting policy associated with this monitor //AlertPolicy interface{} `json:"alertPolicy"` AlertPolicy AlertPolicy // A list of monitoring locations that this monitor is run from Locations []string `json:"locations"` // The version, id and name of the script associated with this monitor Script Script `json:"script"` // The description of the monitor Description string `json:"description"` // How often this monitor runs Interval int `json:"interval"` // The name of this monitor Name string `json:"name"` // The time of the last monitoring sample for this monitor LastSampleAt string `json:"lastSampleAt"` // Describes whether this monitor is actively monitoring or not Active bool `json:"active"` // Whether this monitor is in a maintenance window or not InMaintenanceWindow bool `json:"inMaintenanceWindow"` // Describes the type of browser that monitor is using, 'FF' for // Firefox or 'CHROME' for Chrome, or 'IE' for Internet Explorer Browser string `json:"browser"` // The type of monitor ('RealBrowserUser', 'VirtualUser', 'dns') Type string `json:"type"` SMTPSettings SMTPSettings `json:"smtpSettings"` SLASettings SLASettings `json:"slaSettings,omitempty"` DNSSettings DNSSettings `json:"dnsSettings,omitempty"` PopSettings PopSettings `json:"popSettings,omitempty"` PortSettings PortSettings `json:"portSettings,omitempty"` PingSettings PingSettings `json:"pingSettings"` }
Monitor hold monitoring data
type Monitoring ¶
type Monitoring struct {
// contains filtered or unexported fields
}
Monitoring holds monitoring config
func NewMonitor ¶
func NewMonitor(neustar *Neustar) *Monitoring
NewMonitor creates a new Monitoring object
func (*Monitoring) AggregateSampleData ¶
func (m *Monitoring) AggregateSampleData(monitorID string, asp *AggregateSampleParameters) ([]AggregateSampleResponse, error)
AggregateSampleData retrieves the aggregated sample information for a given period of time. You can choose to aggregate the data for each hour or each day. This is more effecient than getting all the individual samples for a period of time and performing the aggregation yourself.
func (*Monitoring) Create ¶
func (m *Monitoring) Create(cmp *CreateMonitorParameters) (CreateMonitorResponse, error)
Create creates a new monitor and returns the monitor id of the newly created monitor. Name, interval, testScript and locations are required. Use the Get Monitoring Locations api to retrieve a list of monitoring locations.
func (*Monitoring) Delete ¶
func (m *Monitoring) Delete(id string) (int, error)
Delete deletes the given monitor, stopping it from monitoring and removing all its monitoring data.
func (*Monitoring) Get ¶
func (m *Monitoring) Get(id string) ([]Monitor, error)
Get retrieves information for a specific monitor associated with your account. The monitor id that is returned is used to make other api calls.
func (*Monitoring) List ¶
func (m *Monitoring) List() ([]Monitor, error)
List retrieves a list of all monitors associated with your account, along with information about each. The monitor id that is returned is used to make other api calls.
func (*Monitoring) Locations ¶
func (m *Monitoring) Locations() ([]string, error)
Locations gets a list of all monitoring locations available
func (*Monitoring) RawSampleData ¶
func (m *Monitoring) RawSampleData(monitorID, sampleID string) (RawSampleDataResponse, error)
RawSampleData retrieves the raw, HTTP Archive (HAR) data for a particular sample
func (*Monitoring) Samples ¶
func (m *Monitoring) Samples(monitorID string, srp *SampleRequestParameters) (SamplesDataResponse, error)
Samples returns all samples associated to this monitor for a given time period. This data is returned at a high level, which timing for the overall sample. To get the details for the specific sample, call the get raw sample data api. At a maximum, this api will return 2000 samples. If there are more than 2000 results returned, the 'more' field will be set to true and you can make another api call specifying an offset which would be equal to the number of results returned in the first api call plus the offset of that call.
func (*Monitoring) Summary ¶
func (m *Monitoring) Summary(monitorID string) ([]SummaryDataResponse, error)
Summary provides the monitor summary api returns all of the data that is found when looking at your list of monitors in the web portal. This includes things such as the average load time, sample count and uptime for the day, week, month or year, the last time an error occurred, and the last error message.
func (*Monitoring) Update ¶
func (m *Monitoring) Update()
Update changes some or all of the parameters of an existing monitor. Requires the monitor ID retrieved from the List Monitors api.
type Neustar ¶
Neustar holds the provided access keys
func NewNeustar ¶
NewNeustar creates a new Neustar object
func (*Neustar) DigitalSignature ¶
DigitalSignature creates an MD5 hash of the key, the secret and a timestamp
type NewAlertPolicyParameters ¶
type NewAlertPolicyParameters struct { // Name of the alert policy Name string // EmailAddresses is a string slice of comma-separated email addresses associated with // the alert policy (e.g. ["alert@mycompany.com","myemail@gmail.com"]. EmailAddresses []string // Strikes before triggering an alert. Strikes int // Description for the alert policy Description string }
NewAlertPolicyParameters holds the parameters needed to pass to the NewAlertPolicy method
type NewAlertPolicyResponse ¶
type NewAlertPolicyResponse struct { // Name of the alert policy Name string // EmailAddresses associated with the alert policy EmailAddresses []string // Description of the alert policy Description string // Strikes for the alert policy Strikes int }
NewAlertPolicyResponse
type PingSettings ¶
PingSettings is an object containing all PING-related settings: {"timeout": int, "host": string}.
type PopSettings ¶
type PopSettings struct { Timeout int `json:"timeout"` Server string `json:"server"` Username string `json:"username"` Password string `json:"password"` }
PopSettings holds port settings
type PortSettings ¶
type PortSettings struct { Timeout int `json:"timeout"` Server string `json:"server"` Port int `json:"port"` Protocol string `json:"protocol"` Command string `json:"command"` ExpectedResponse string `json:"expected_response"` DataFormat string `json:"data_format"` }
PortSettings holds port settings
type RawSampleDataResponse ¶
type RawSampleDataResponse struct { Data struct { AgentIPAddr string `json:"agentIpAddr"` Browser string `json:"browser"` BytesReceived int `json:"bytesReceived"` Data struct { Har struct { Log struct { Steps []struct { Duration int `json:"duration"` Label string `json:"label"` NameValuePairs []interface{} `json:"nameValuePairs"` StartTime string `json:"startTime"` Step int `json:"step"` TimePaused int `json:"timePaused"` } `json:"_steps"` Browser struct { Name string `json:"name"` Version string `json:"version"` } `json:"browser"` Creator struct { Name string `json:"name"` Version string `json:"version"` } `json:"creator"` Entries []struct { WSID int `json:"_wsid"` Cache struct{} `json:"cache"` Pageref string `json:"pageref"` Request struct { BodySize int `json:"bodySize"` Cookies []interface{} `json:"cookies"` Headers []struct { Name string `json:"name"` Value string `json:"value"` } `json:"headers"` HeadersSize int `json:"headersSize"` HTTPVersion string `json:"httpVersion"` Method string `json:"method"` QueryString []interface{} `json:"queryString"` URL string `json:"url"` } `json:"request"` Response struct { BodySize int `json:"bodySize"` Content struct { MimeType string `json:"mimeType"` Size int `json:"size"` } `json:"content"` Cookies []struct { Expires string `json:"expires"` Name string `json:"name"` Path string `json:"path"` Value string `json:"value"` } `json:"cookies"` Headers []struct { Name string `json:"name"` Value string `json:"value"` } `json:"headers"` HeadersSize int `json:"headersSize"` HTTPVersion string `json:"httpVersion"` RedirectURL string `json:"redirectURL"` Status int `json:"status"` StatusText string `json:"statusText"` } `json:"response"` ServerIPAddress string `json:"serverIPAddress"` StartedDateTime string `json:"startedDateTime"` Time int `json:"time"` Timings struct { Blocked int `json:"blocked"` Connect int `json:"connect"` DNS int `json:"dns"` Receive int `json:"receive"` Send int `json:"send"` Ssl int `json:"ssl"` Wait int `json:"wait"` } `json:"timings"` } `json:"entries"` Location string `json:"location"` Pages []struct { ID string `json:"id"` PageTimings struct { DOMComplete int `json:"_domComplete"` DOMContentLoadedEventEnd int `json:"_domContentLoadedEventEnd"` DOMContentLoadedEventStart int `json:"_domContentLoadedEventStart"` DOMInteractive int `json:"_domInteractive"` DOMLoading int `json:"_domLoading"` LoadEventEnd int `json:"_loadEventEnd"` LoadEventStart int `json:"_loadEventStart"` OnContentLoad int `json:"onContentLoad"` OnLoad int `json:"onLoad"` } `json:"pageTimings"` StartedDateTime string `json:"startedDateTime"` Title string `json:"title"` } `json:"pages"` Version string `json:"version"` } `json:"log"` } `json:"har"` MonitorID string `json:"monitorId"` Screenshot string `json:"screenshot"` } `json:"data"` Duration string `json:"duration"` Items []interface{} `json:"items"` Location string `json:"location"` Offset int `json:"offset"` ScriptInfo struct { LineNumber interface{} `json:"lineNumber"` ScriptBody string `json:"scriptBody"` ScriptLink string `json:"scriptLink"` ScriptName string `json:"scriptName"` ScriptVersion string `json:"scriptVersion"` } `json:"scriptInfo"` ScriptName string `json:"scriptName"` StartTime string `json:"startTime"` Status string `json:"status"` StatusCode int `json:"statusCode"` Total int `json:"total"` } `json:"data"` }
RawSampleDataResponse holds the response given when the RawSampleData function is called
type ReturnedAPIError ¶
type ReturnedAPIError struct { Message string `json:"message"` Code string `json:"code"` Param string `json:"param"` }
ReturnedAPIError represents what the API returns on error
type SLASettings ¶
type SLASettings struct { RunningAvgDuration int `json:"runningAvgDuration"` Uptime float64 `json:"uptime"` LoadTime float64 `json:"loadtime"` }
SLASettings hols SLA settings
type SMTPSettings ¶
type SMTPSettings struct { Timeout int `json:"timeout"` Server string `json:"server"` Email string `json:"email"` }
SMTPSettings holds SMTP setttings
type SampleRequestParameters ¶
type SampleRequestParameters struct { // An ISO 8601 formatted date string or datetime string representing the start date from which you wish to collect samples. // Examples: 2012-03-02 or 2012-03-01T12:00 StartDate string `url:"startDate"` // An ISO 8601 formatted date string or datetime string representing the end date from which you wish to collect samples. // Examples: 2012-03-02 or 2012-03-01T12:00 EndDate string `url:"endDate"` // From which position in the return list you wish to start. At most, 2000 records will be returned. Offset int `url:"offset"` }
SampleRequestParameters holds the required options to pass to the Sample function
type SamplesDataResponse ¶
type SamplesDataResponse struct { Data struct { Count int `json:"count"` Items []struct { Status string `json:"status"` BytesReceived int `json:"bytesReceived"` ErrorLineNumber int `json:"errorLineNumber"` Location string `json:"location"` StartTime string `json:"startTime"` Duration int `json:"duration"` ID string `json:"id"` } `json:"items"` } `json:"data"` }
SamplesDataResponse holds a response from a call to the Samples endpoint
type Script ¶
type Script struct { ID string `json:"id"` Version string `json:"version"` Name string `json:"name"` }
Script holds a representation of a script
type ScriptCreateParameters ¶
type ScriptCreateParameters struct { // The name of the alert policy Name string `json:"name"` // An array of comma-separated email addresses // associated with the alert policy e.g. ["alert@mycompany.com","myemail@gmail.com"]. EmailAddresses []string `json:"emailAddresses"` // The number of strikes before triggering an alert. Strikes int `json:"strikes"` // A description for the alert policy Description string `json:"description"` }
ScriptCreateParameters holds the parameters passed in to create a new script
type ScriptDataResponse ¶
type ScriptDataResponse struct { Data struct { Total int `json:"total"` Offset int `json:"offset"` More bool `json:"more"` Items []ScriptingListResponse `json:"items"` } `json:"data"` }
ScriptDataResponse holds the return from the API list call
type Scripting ¶
type Scripting struct {
// contains filtered or unexported fields
}
Scripting holds scripting config
func (*Scripting) CloneTestScriptFile ¶
func (s *Scripting) CloneTestScriptFile()
CloneTestScriptFile
func (*Scripting) List ¶
func (s *Scripting) List() ([]ScriptingListResponse, int, error)
List retrieves a list of policies ordered by date in descending order.
func (*Scripting) ListInvalidTestScripts ¶
func (s *Scripting) ListInvalidTestScripts()
ListInvalidTestScripts retrieves a list of invalid test scripts
func (*Scripting) ListValidTestScripts ¶
func (s *Scripting) ListValidTestScripts()
ListValidTestScripts retrieves a list of valid test scripts
func (*Scripting) UploadTestScriptFile ¶
func (s *Scripting) UploadTestScriptFile()
UploadTestScriptFile
type ScriptingListResponse ¶
type ScriptingListResponse struct { // The name of the alert policy Name string `json:"name"` // The ID of the alert policy ID string `json:"id"` // The description of the alert policy Description string `json:"description"` // This flag will return true if the policy is an Advanced Alert Policy AdvancedEdit bool `json:"advancedEdit"` // The email addresses associated with the alert policy EmailAddress []string `json:"emailAddresses"` // The number of strikes before triggering an alert. Strikes int `json:"strikes"` ScriptInput interface{} `json:"scriptInput"` EscalationPolicy interface{} `json:"escalationPolicy"` FeedIDs interface{} `json:"feedIds"` PagerDutyServiceKey interface{} `json:"pagerDutyServiceKey"` PagerDutyConnectName interface{} `json:"pagerDutyConnectionName"` PagerDutyAccount interface{} `json:"pagerDutyAccount"` SMS interface{} `json:"sms"` PolicyGroup interface{} `json:"policyGroup"` History interface{} `json:"history"` AccountID string `json:"accountId"` AlertType interface{} `json:"alertType"` ScriptBody string `json:"scriptBody"` LastUser string `json:"lastUser"` Created string `json:"created"` InUse bool `json:"inUse"` Modified string `json:"modified"` LatestVersion string `json:"latestVersion"` }
ScriptingListResponse holds the response from the list endpoint
type SummaryDataResponse ¶
type SummaryDataResponse struct { // The general status of the monitor, is the monitor erroing or in success state GeneralStatus string `json:"generalStatus"` // The average uptime for the current week, as a percentage AvgUptimeWeek float64 `json:"avgUptimeWeek"` // The ID for the last sample taken. This ID can be used with the sample or aggregate APIs LastSampleID string `json:"lastSampleId"` // The average uptime for the current quarter, as a percentage AvgUptimeQuarter float64 `json:"avgUptimeQuarter"` // The average uptime for the current year, as a percentage AvgUptimeYear float64 `json:"avgUptimeYear"` // The number of samples this month SampleCountMonth int `json:"sampleCountMonth"` // The average uptime this quarter, as a percentage AvgLoadtimeQuarter int `json:"avgLoadtimeQuarter"` // The average load time this day, in milliseconds AvgLoadtimeDay int `json:"avgLoadtimeDay"` // The number of samples this day SampleCountDay int `json:"sampleCountDay"` // The number of samples this year SampleCountYear int `json:"sampleCountYear"` // The last sampe time data LastSampleTimePaused int `json:"lastSampleTimePaused"` // When the last sample was taken LastSampleAt string `json:"lastSampleAt"` // The average load time this month, in milliseconds AvgLoadtimeMonth int `json:"avgLoadtimeMonth"` // The average load time this quarter, in milliseconds SampleCountQuarter int `json:"sampleCountQuarter"` // The monitor status: either 'Alerting', 'Warning', 'Scheduled', 'Active', 'Maintenance', 'Off' Status string `json:"status"` // The average load time this week, in milliseconds AvgLoadtimeWeek int `json:"avgLoadtimeWeek"` // Load time 90th percentile for the previous UTC day, in milliseconds TP90 int `json:"tp90"` // The last sample status of the monitor LastSampleStatus string `json:"lastSampleStatus"` // The average uptime this day, as a percentage AvgUptimeDay float64 `json:"avgUptimeDay"` // The average load time this year, in milliseconds AvgLoadtimeYear int `json:"avgLoadtimeYear"` // The duration of the last sample, in milliseconds LastSampleDuration int `json:"lastSampleDuration"` // Load time 50th percentile for the previous UTC day, in milliseconds TP50 int `json:"tp50"` // The number of samples this week SampleCountWeek int `json:"sampleCountWeek"` // The average uptime this month, as a percentage AvgUptimeMonth float64 `json:"avgUptimeMonth"` // When the last error occured LastErrorAt string `json:"lastErrorAt"` LastErrorID string `json:"lastErrorId"` LastErrorType string `json:"lastErrorType"` LastErrorMessage string `json:"lastErrorMessage"` }
SummaryDataResponse holds the response from the Summary endpoint
type UpdateMonitorParameters ¶
type UpdateMonitorParameters struct { Name string `json:"name"` Description string `json:"name"` Interval int `json:"interval"` TestScript string `json:"testScript"` Locations string `json:"locations"` AlertPolicy string `json:"alertPolicy"` Browser string `json:"browser"` Active string `json:"Active"` }
UpdateMonitorParameters holds the allowed options for updating a monitor