syntheticsclient

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2022 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JsonPrint

func JsonPrint(data interface{})

Helper for tests and output

Types

type BlackoutPeriods

type BlackoutPeriods []struct {
	StartDate         string `json:"start_date,omitempty"`
	EndDate           string `json:"end_date,omitempty"`
	Timezone          string `json:"timezone,omitempty"`
	StartTime         string `json:"start_time,omitempty"`
	EndTime           string `json:"end_time,omitempty"`
	RepeatType        string `json:"repeat_type,omitempty"`
	DurationInMinutes int    `json:"duration_in_minutes,omitempty"`
	IsRepeat          bool   `json:"is_repeat,omitempty"`
	MonthlyRepeatType string `json:"monthly_repeat_type,omitempty"`
	CreatedAt         string `json:"created_at,omitempty"`
	UpdatedAt         string `json:"updated_at,omitempty"`
}

type Browser

type Browser struct {
	Label string `json:"label,omitempty"`
	Code  string `json:"code,omitempty"`
}

type BrowserCheckInput

type BrowserCheckInput struct {
	ID                   int                 `json:"id,omitempty"`
	Name                 string              `json:"name,omitempty"`
	Type                 string              `json:"type,omitempty"`
	Frequency            int                 `json:"frequency,omitempty"`
	Paused               bool                `json:"paused,omitempty"`
	Muted                bool                `json:"muted,omitempty"`
	CreatedAt            string              `json:"created_at,omitempty"`
	UpdatedAt            string              `json:"updated_at,omitempty"`
	Links                Links               `json:"links,omitempty"`
	Tags                 []string            `json:"tags"`
	Status               Status              `json:"status,omitempty"`
	RoundRobin           bool                `json:"round_robin,omitempty"`
	AutoRetry            bool                `json:"auto_retry,omitempty"`
	Enabled              bool                `json:"enabled,omitempty"`
	BlackoutPeriods      BlackoutPeriods     `json:"blackout_periods,omitempty"`
	Locations            []int               `json:"locations,omitempty"`
	Integrations         []int               `json:"integrations,omitempty"`
	HTTPRequestHeaders   HTTPRequestHeaders  `json:"http_request_headers,omitempty"`
	HTTPRequestBody      string              `json:"http_request_body,omitempty"`
	HTTPMethod           string              `json:"http_method,omitempty"`
	Notifications        Notifications       `json:"notifications,omitempty"`
	URL                  string              `json:"url,omitempty"`
	UserAgent            string              `json:"user_agent,omitempty"`
	AutoUpdateUserAgent  bool                `json:"auto_update_user_agent,omitempty"`
	Browser              Browser             `json:"browser,omitempty"`
	Steps                []Steps             `json:"steps,omitempty"`
	Cookies              []Cookies           `json:"cookies,omitempty"`
	JavascriptFiles      []JavascriptFiles   `json:"javascript_files,omitempty"`
	ExcludedFiles        []ExcludedFiles     `json:"excluded_files,omitempty"`
	Viewport             Viewport            `json:"viewport,omitempty"`
	EnforceSslValidation bool                `json:"enforce_ssl_validation,omitempty"`
	ThresholdMonitors    []ThresholdMonitors `json:"threshold_monitors,omitempty"`
	DNSOverrides         DNSOverrides        `json:"dns_overrides,omitempty"`
	Connection           Connection          `json:"connection,omitempty"`
	WaitForFullMetrics   bool                `json:"wait_for_full_metrics,omitempty"`
}

type BrowserCheckResponse

type BrowserCheckResponse struct {
	ID                   int                 `json:"id,omitempty"`
	Name                 string              `json:"name,omitempty"`
	Type                 string              `json:"type,omitempty"`
	Frequency            int                 `json:"frequency,omitempty"`
	Paused               bool                `json:"paused,omitempty"`
	Muted                bool                `json:"muted,omitempty"`
	CreatedAt            string              `json:"created_at,omitempty"`
	UpdatedAt            string              `json:"updated_at,omitempty"`
	Links                Links               `json:"links,omitempty"`
	Tags                 Tags                `json:"tags,omitempty"`
	Status               Status              `json:"status,omitempty"`
	RoundRobin           bool                `json:"round_robin,omitempty"`
	AutoRetry            bool                `json:"auto_retry,omitempty"`
	Enabled              bool                `json:"enabled,omitempty"`
	BlackoutPeriods      BlackoutPeriods     `json:"blackout_periods,omitempty"`
	Locations            Locations           `json:"locations,omitempty"`
	Integrations         Integrations        `json:"integrations,omitempty"`
	HTTPRequestHeaders   HTTPRequestHeaders  `json:"http_request_headers,omitempty"`
	HTTPRequestBody      string              `json:"http_request_body,omitempty"`
	HTTPMethod           string              `json:"http_method,omitempty"`
	Notifications        Notifications       `json:"notifications,omitempty"`
	URL                  string              `json:"url,omitempty"`
	UserAgent            string              `json:"user_agent,omitempty"`
	AutoUpdateUserAgent  bool                `json:"auto_update_user_agent,omitempty"`
	Browser              Browser             `json:"browser,omitempty"`
	Steps                []Steps             `json:"steps,omitempty"`
	Cookies              []Cookies           `json:"cookies,omitempty"`
	JavascriptFiles      []JavascriptFiles   `json:"javascript_files,omitempty"`
	ExcludedFiles        []ExcludedFiles     `json:"excluded_files,omitempty"`
	Viewport             Viewport            `json:"viewport,omitempty"`
	EnforceSslValidation bool                `json:"enforce_ssl_validation,omitempty"`
	ThresholdMonitors    []ThresholdMonitors `json:"threshold_monitors,omitempty"`
	DNSOverrides         DNSOverrides        `json:"dns_overrides,omitempty"`
	Connection           Connection          `json:"connection,omitempty"`
	WaitForFullMetrics   bool                `json:"wait_for_full_metrics,omitempty"`
}

type Checks

type Checks []struct {
	ID        int    `json:"id"`
	Name      string `json:"name"`
	Type      string `json:"type"`
	Frequency int    `json:"frequency"`
	Paused    bool   `json:"paused"`
	Muted     bool   `json:"muted"`
	CreatedAt string `json:"created_at"`
	UpdatedAt string `json:"updated_at"`
	Links     Links  `json:"links"`
	Status    Status `json:"status"`
	Tags      Tags   `json:"tags"`
}

type Client

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

func NewClient

func NewClient(apiKey string) *Client

func NewConfigurableClient

func NewConfigurableClient(apiKey string, args ClientArgs) *Client

func (Client) CreateBrowserCheck

func (c Client) CreateBrowserCheck(browserCheckDetails *BrowserCheckInput) (*BrowserCheckResponse, *RequestDetails, error)

func (Client) CreateHttpCheck

func (c Client) CreateHttpCheck(httpCheckDetails *HttpCheckInput) (*HttpCheckResponse, *RequestDetails, error)

func (Client) DeleteBrowserCheck

func (c Client) DeleteBrowserCheck(id int) (*DeleteCheck, error)

func (Client) DeleteHttpCheck

func (c Client) DeleteHttpCheck(id int) (*DeleteCheck, error)

func (Client) GetCheck

func (c Client) GetCheck(id int) (*GetCheck, *RequestDetails, error)

func (Client) GetChecks

func (c Client) GetChecks(params *GetChecksOptions) (*GetChecks, *RequestDetails, error)

GetChecks returns all checks

func (Client) GetHTTPClient

func (c Client) GetHTTPClient() *http.Client

GetHTTPClient returns http client for the purpose of test

func (Client) GetHttpCheck

func (c Client) GetHttpCheck(id int) (*GetHttpCheck, *RequestDetails, error)

func (Client) String

func (c Client) String() string

func (Client) UpdateBrowserCheck

func (c Client) UpdateBrowserCheck(id int, browserCheckDetails *BrowserCheckInput) (*BrowserCheckResponse, *RequestDetails, error)

func (Client) UpdateHttpCheck

func (c Client) UpdateHttpCheck(id int, httpCheckDetails *HttpCheckInput) (*HttpCheckResponse, *RequestDetails, error)

CreateContact creates a new contact for a user

type ClientArgs

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

type Connection

type Connection struct {
	UploadBandwidth   int     `json:"upload_bandwidth,omitempty"`
	DownloadBandwidth int     `json:"download_bandwidth,omitempty"`
	Latency           int     `json:"latency,omitempty"`
	PacketLoss        float64 `json:"packet_loss,omitempty"`
}

type Cookies

type Cookies struct {
	Key    string `json:"key,omitempty"`
	Value  string `json:"value,omitempty"`
	Domain string `json:"domain,omitempty"`
	Path   string `json:"path,omitempty"`
}

type DNSOverrides

type DNSOverrides struct {
	OriginalDomainCom string `json:"original.domain.com,omitempty"`
	OriginalHostCom   string `json:"original.host.com,omitempty"`
}

type DeleteCheck

type DeleteCheck struct {
	Result  string `json:"result"`
	Message string `json:"message"`
	Errors  Errors `json:"errors"`
}

type Errors

type Errors []struct {
	Title       string `json:"title,omitempty"`
	Description string `json:"description,omitempty"`
}

type Escalations

type Escalations struct {
	Sms                bool               `json:"sms,omitempty"`
	Email              bool               `json:"email,omitempty"`
	Call               bool               `json:"call,omitempty"`
	AfterMinutes       int                `json:"after_minutes,omitempty"`
	NotifyWho          []NotifyWho        `json:"notify_who,omitempty"`
	IsRepeat           bool               `json:"is_repeat,omitempty"`
	NotificationWindow NotificationWindow `json:"notification_window,omitempty"`
}

type ExcludedFiles

type ExcludedFiles struct {
	ExclusionType string `json:"exclusion_type,omitempty"`
	PresetName    string `json:"preset_name,omitempty"`
	URL           string `json:"url,omitempty"`
	CreatedAt     string `json:"created_at,omitempty"`
	UpdatedAt     string `json:"updated_at,omitempty"`
}

type GetCheck

type GetCheck struct {
	ID                              int
	Name                            string              `json:"name"`
	Type                            string              `json:"type"`
	Frequency                       int                 `json:"frequency,omitempty"`
	Paused                          bool                `json:"paused,omitempty"`
	Muted                           bool                `json:"muted,omitempty"`
	CreatedAt                       string              `json:"created_at,omitempty"`
	UpdatedAt                       string              `json:"updated_at,omitempty"`
	Links                           Links               `json:"links,omitempty"`
	Status                          Status              `json:"status,omitempty"`
	Notifications                   Notifications       `json:"notifications,omitempty"`
	ResponseTimeMonitorMilliseconds int                 `json:"response_time_monitor_milliseconds,omitempty"`
	HTTPRequestHeaders              HTTPRequestHeaders  `json:"http_request_headers,omitempty"`
	HTTPRequestBody                 string              `json:"http_request_body,omitempty"`
	HTTPMethod                      string              `json:"http_method,omitempty"`
	RoundRobin                      bool                `json:"round_robin,omitempty"`
	AutoRetry                       bool                `json:"auto_retry,omitempty"`
	Enabled                         bool                `json:"enabled,omitempty"`
	Integrations                    Integrations        `json:"integrations,omitempty"`
	URL                             string              `json:"url,omitempty"`
	UserAgent                       string              `json:"user_agent,omitempty"`
	AutoUpdateUserAgent             bool                `json:"auto_update_user_agent,omitempty"`
	Viewport                        Viewport            `json:"viewport,omitempty"`
	EnforceSslValidation            bool                `json:"enforce_ssl_validation,omitempty"`
	Browser                         Browser             `json:"browser,omitempty"`
	DNSOverrides                    DNSOverrides        `json:"dns_overrides,omitempty"`
	WaitForFullMetrics              bool                `json:"wait_for_full_metrics,omitempty"`
	Tags                            Tags                `json:"tags,omitempty"`
	BlackoutPeriods                 BlackoutPeriods     `json:"blackout_periods,omitempty"`
	Locations                       Locations           `json:"locations,omitempty"`
	Steps                           []Steps             `json:"steps,omitempty"`
	JavascriptFiles                 []JavascriptFiles   `json:"javascript_files,omitempty"`
	ThresholdMonitors               []ThresholdMonitors `json:"threshold_monitors,omitempty"`
	ExcludedFiles                   []ExcludedFiles     `json:"excluded_files,omitempty"`
	Cookies                         []Cookies           `json:"cookies,omitempty"`
	Connection                      Connection          `json:"connection,omitempty"`
	SuccessCriteria                 []SuccessCriteria   `json:"success_criteria,omitempty"`
}

type GetChecks

type GetChecks struct {
	CurrentPage  int    `json:"current_page"`
	PerPage      int    `json:"per_page"`
	NextPage     int    `json:"next_page"`
	PreviousPage int    `json:"previous_page"`
	TotalPages   int    `json:"total_pages"`
	TotalCount   int    `json:"total_count"`
	Checks       Checks `json:"checks"`
}

type GetChecksOptions

type GetChecksOptions struct {
	Type    string `json:"type"`
	PerPage int    `json:"per_page"`
	Page    int    `json:"page"`
	Muted   bool   `json:"muted"`
}

Leaving off "Enabled" filter setting. Can be added later if required.

type GetHttpCheck

type GetHttpCheck struct {
	ID                              int
	Name                            string             `json:"name"`
	Type                            string             `json:"type"`
	Frequency                       int                `json:"frequency,omitempty"`
	Paused                          bool               `json:"paused,omitempty"`
	Muted                           bool               `json:"muted,omitempty"`
	CreatedAt                       string             `json:"created_at,omitempty"`
	UpdatedAt                       string             `json:"updated_at,omitempty"`
	Links                           Links              `json:"links,omitempty"`
	Status                          Status             `json:"status,omitempty"`
	Notifications                   Notifications      `json:"notifications,omitempty"`
	ResponseTimeMonitorMilliseconds int                `json:"response_time_monitor_milliseconds,omitempty"`
	HTTPRequestHeaders              HTTPRequestHeaders `json:"http_request_headers,omitempty"`
	HTTPRequestBody                 string             `json:"http_request_body,omitempty"`
	HTTPMethod                      string             `json:"http_method,omitempty"`
	RoundRobin                      bool               `json:"round_robin,omitempty"`
	AutoRetry                       bool               `json:"auto_retry,omitempty"`
	Enabled                         bool               `json:"enabled,omitempty"`
	Integrations                    Integrations       `json:"integrations,omitempty"`
	URL                             string             `json:"url,omitempty"`
	UserAgent                       string             `json:"user_agent,omitempty"`
	Tags                            Tags               `json:"tags,omitempty"`
	BlackoutPeriods                 BlackoutPeriods    `json:"blackout_periods,omitempty"`
	Locations                       Locations          `json:"locations,omitempty"`
	Connection                      Connection         `json:"connection"`
	SuccessCriteria                 []SuccessCriteria  `json:"success_criteria,omitempty"`
}

type HTTPRequestHeaders

type HTTPRequestHeaders struct {
	UserAgent string `json:"User-Agent,omitempty"`
}

type HttpCheckInput

type HttpCheckInput struct {
	ID                 int                `json:"id,omitempty"`
	Name               string             `json:"name,omitempty"`
	Type               string             `json:"type,omitempty"`
	Frequency          int                `json:"frequency,omitempty"`
	Paused             bool               `json:"paused,omitempty"`
	Muted              bool               `json:"muted,omitempty"`
	CreatedAt          string             `json:"created_at,omitempty"`
	UpdatedAt          string             `json:"updated_at,omitempty"`
	Links              Links              `json:"links,omitempty"`
	Tags               []string           `json:"tags"`
	Status             Status             `json:"status,omitempty"`
	RoundRobin         bool               `json:"round_robin,omitempty"`
	AutoRetry          bool               `json:"auto_retry,omitempty"`
	Enabled            bool               `json:"enabled,omitempty"`
	BlackoutPeriods    BlackoutPeriods    `json:"blackout_periods,omitempty"`
	Locations          []int              `json:"locations,omitempty"`
	Integrations       []int              `json:"integrations,omitempty"`
	HTTPRequestHeaders HTTPRequestHeaders `json:"http_request_headers,omitempty"`
	HTTPRequestBody    string             `json:"http_request_body,omitempty"`
	Notifications      Notifications      `json:"notifications,omitempty"`
	URL                string             `json:"url,omitempty"`
	HTTPMethod         string             `json:"http_method,omitempty"`
	SuccessCriteria    []SuccessCriteria  `json:"success_criteria,omitempty"`
	Connection         Connection         `json:"connection,omitempty"`
}

type HttpCheckResponse

type HttpCheckResponse struct {
	ID                 int                `json:"id,omitempty"`
	Name               string             `json:"name,omitempty"`
	Type               string             `json:"type,omitempty"`
	Frequency          int                `json:"frequency,omitempty"`
	Paused             bool               `json:"paused,omitempty"`
	Muted              bool               `json:"muted,omitempty"`
	CreatedAt          string             `json:"created_at,omitempty"`
	UpdatedAt          string             `json:"updated_at,omitempty"`
	Links              Links              `json:"links,omitempty"`
	Tags               Tags               `json:"tags,omitempty"`
	Status             Status             `json:"status,omitempty"`
	RoundRobin         bool               `json:"round_robin,omitempty"`
	AutoRetry          bool               `json:"auto_retry,omitempty"`
	Enabled            bool               `json:"enabled,omitempty"`
	BlackoutPeriods    BlackoutPeriods    `json:"blackout_periods,omitempty"`
	Locations          Locations          `json:"locations,omitempty"`
	Integrations       Integrations       `json:"integrations,omitempty"`
	HTTPRequestHeaders HTTPRequestHeaders `json:"http_request_headers,omitempty"`
	HTTPRequestBody    string             `json:"http_request_body,omitempty"`
	Notifications      Notifications      `json:"notifications,omitempty"`
	URL                string             `json:"url,omitempty"`
	HTTPMethod         string             `json:"http_method,omitempty"`
	SuccessCriteria    []SuccessCriteria  `json:"success_criteria,omitempty"`
	Connection         Connection         `json:"connection,omitempty"`
}

type Integrations

type Integrations []struct {
	ID   int    `json:"id,omitempty"`
	Name string `json:"name,omitempty"`
}

type JavascriptFiles

type JavascriptFiles struct {
	ID        int    `json:"id,omitempty"`
	Name      string `json:"name,omitempty"`
	CreatedAt string `json:"created_at,omitempty"`
	UpdatedAt string `json:"updated_at,omitempty"`
	Links     Links  `json:"links,omitempty"`
}
type Links struct {
	Self     string `json:"self,omitempty"`
	SelfHTML string `json:"self_html,omitempty"`
	Metrics  string `json:"metrics,omitempty"`
	LastRun  string `json:"last_run,omitempty"`
}

Common and shared struct models used for more complex requests

type Locations

type Locations []struct {
	ID          int    `json:"id,omitempty"`
	Name        string `json:"name,omitempty"`
	WorldRegion string `json:"world_region,omitempty"`
	RegionCode  string `json:"region_code,omitempty"`
}

type NotificationWindow

type NotificationWindow struct {
	StartTime         string `json:"start_time,omitempty"`
	EndTime           string `json:"end_time,omitempty"`
	DurationInMinutes int    `json:"duration_in_minutes,omitempty"`
	TimeZone          string `json:"time_zone,omitempty"`
}

type NotificationWindows

type NotificationWindows []struct {
	StartTime         string `json:"start_time,omitempty"`
	EndTime           string `json:"end_time,omitempty"`
	DurationInMinutes int    `json:"duration_in_minutes,omitempty"`
	TimeZone          string `json:"time_zone,omitempty"`
}

type Notifications

type Notifications struct {
	Sms                     bool                `json:"sms,omitempty"`
	Email                   bool                `json:"email,omitempty"`
	Call                    bool                `json:"call,omitempty"`
	NotifyWho               []NotifyWho         `json:"notify_who,omitempty"`
	NotifyAfterFailureCount int                 `json:"notify_after_failure_count,omitempty"`
	NotifyOnLocationFailure bool                `json:"notify_on_location_failure,omitempty"`
	NotificationWindows     NotificationWindows `json:"notification_windows,omitempty"`
	Escalations             []Escalations       `json:"escalations,omitempty"`
	Muted                   bool                `json:"muted,omitempty"`
}

type NotifyWho

type NotifyWho struct {
	Sms             bool   `json:"sms,omitempty"`
	Call            bool   `json:"call,omitempty"`
	Email           bool   `json:"email,omitempty"`
	CustomUserEmail string `json:"custom_email"`
	Type            string `json:"type,omitempty"`
	Links           Links  `json:"links,omitempty"`
	ID              int    `json:"id,omitempty"`
}

type RequestDetails

type RequestDetails struct {
	StatusCode   int
	ResponseBody string
	RequestBody  string
	RawResponse  *http.Response
	RawRequest   *http.Request
}

type Status

type Status struct {
	LastCode           int    `json:"last_code,omitempty"`
	LastMessage        string `json:"last_message,omitempty"`
	LastResponseTime   int    `json:"last_response_time,omitempty"`
	LastRunAt          string `json:"last_run_at,omitempty"`
	LastFailureAt      string `json:"last_failure_at,omitempty"`
	LastAlertAt        string `json:"last_alert_at,omitempty"`
	HasFailure         bool   `json:"has_failure,omitempty"`
	HasLocationFailure bool   `json:"has_location_failure,omitempty"`
}

type Steps

type Steps struct {
	ItemMethod   string `json:"item_method,omitempty"`
	Value        string `json:"value,omitempty"`
	How          string `json:"how,omitempty"`
	What         string `json:"what,omitempty"`
	UpdatedAt    string `json:"updated_at,omitempty"`
	CreatedAt    string `json:"created_at,omitempty"`
	VariableName string `json:"variable_name,omitempty"`
	Name         string `json:"name,omitempty"`
	Position     int    `json:"position,omitempty"`
}

type SuccessCriteria

type SuccessCriteria struct {
	ActionType       string `json:"action_type,omitempty"`
	ComparisonString string `json:"comparison_string,omitempty"`
	CreatedAt        string `json:"created_at,omitempty"`
	UpdatedAt        string `json:"updated_at,omitempty"`
}

type Tags

type Tags []struct {
	ID   int    `json:"id,omitempty"`
	Name string `json:"name,omitempty"`
}

type ThresholdMonitors

type ThresholdMonitors struct {
	Matcher        string `json:"matcher,omitempty"`
	MetricName     string `json:"metric_name,omitempty"`
	ComparisonType string `json:"comparison_type,omitempty"`
	Value          int    `json:"value,omitempty"`
	CreatedAt      string `json:"created_at,omitempty"`
	UpdatedAt      string `json:"updated_at,omitempty"`
}

type Viewport

type Viewport struct {
	Height int `json:"height,omitempty"`
	Width  int `json:"width,omitempty"`
}

Jump to

Keyboard shortcuts

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