synthetics

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2020 License: Apache-2.0 Imports: 7 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// MonitorTypes specifies the possible types for a Synthetics monitor.
	MonitorTypes = struct {
		Ping            MonitorType
		Browser         MonitorType
		ScriptedBrowser MonitorType
		APITest         MonitorType
	}{
		Ping:            "SIMPLE",
		Browser:         "BROWSER",
		ScriptedBrowser: "SCRIPT_BROWSER",
		APITest:         "SCRIPT_API",
	}

	// MonitorStatus specifies the possible Synthetics monitor status types.
	MonitorStatus = struct {
		Enabled  MonitorStatusType
		Muted    MonitorStatusType
		Disabled MonitorStatusType
	}{
		Enabled:  "ENABLED",
		Muted:    "MUTED",
		Disabled: "DISABLED",
	}
)
View Source
var BaseURLs = map[config.RegionType]string{
	config.Region.US:      "https://synthetics.newrelic.com/synthetics/api/v3",
	config.Region.EU:      "https://synthetics.eu.newrelic.com/synthetics/api/v3",
	config.Region.Staging: "https://staging-synthetics.newrelic.com/synthetics/api/v3",
}

BaseURLs represents the base API URLs for the different environments of the Synthetics API.

Functions

This section is empty.

Types

type ErrorDetail

type ErrorDetail struct {
	Message string `json:"error,omitempty"`
}

ErrorDetail represents an single error from New Relic Synthetics.

type ErrorResponse

type ErrorResponse struct {
	Message            string        `json:"error,omitempty"`
	Messages           []ErrorDetail `json:"errors,omitempty"`
	ServerErrorMessage string        `json:"message,omitempty"`
}

ErrorResponse represents an error response from New Relic Synthetics.

func (*ErrorResponse) Error

func (e *ErrorResponse) Error() string

Error surfaces an error message from the New Relic Synthetics error response.

type Monitor

type Monitor struct {
	ID           string            `json:"id,omitempty"`
	Name         string            `json:"name"`
	Type         MonitorType       `json:"type"`
	Frequency    uint              `json:"frequency"`
	URI          string            `json:"uri"`
	Locations    []string          `json:"locations"`
	Status       MonitorStatusType `json:"status"`
	SLAThreshold float64           `json:"slaThreshold"`
	UserID       uint              `json:"userId,omitempty"`
	APIVersion   string            `json:"apiVersion,omitempty"`
	ModifiedAt   *Time             `json:"modifiedAt,omitempty"`
	CreatedAt    *Time             `json:"createdAt,omitempty"`
	Options      MonitorOptions    `json:"options,omitempty"`
}

Monitor represents a New Relic Synthetics monitor.

type MonitorOptions

type MonitorOptions struct {
	ValidationString       string `json:"validationString,omitempty"`
	VerifySSL              bool   `json:"verifySSL,omitempty"`
	BypassHEADRequest      bool   `json:"bypassHEADRequest,omitempty"`
	TreatRedirectAsFailure bool   `json:"treatRedirectAsFailure,omitempty"`
}

MonitorOptions represents the options for a New Relic Synthetics monitor.

type MonitorScript

type MonitorScript struct {
	Text      string                  `json:"scriptText"`
	Locations []MonitorScriptLocation `json:"scriptLocations"`
}

MonitorScript represents a New Relic Synthetics monitor script.

type MonitorScriptLocation

type MonitorScriptLocation struct {
	Name string `json:"name"`
	HMAC string `json:"hmac"`
}

MonitorScriptLocation represents a New Relic Synthetics monitor script location.

type MonitorStatusType

type MonitorStatusType string

MonitorStatusType represents a Synthetics monitor status type.

type MonitorType

type MonitorType string

MonitorType represents a Synthetics monitor type.

type Synthetics

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

Synthetics is used to communicate with the New Relic Synthetics product.

func New

func New(config config.Config) Synthetics

New is used to create a new Synthetics client instance.

func (*Synthetics) CreateMonitor

func (s *Synthetics) CreateMonitor(monitor Monitor) (string, error)

CreateMonitor is used to create a New Relic Synthetics monitor. If successful it returns the ID of the created resource.

func (*Synthetics) DeleteMonitor

func (s *Synthetics) DeleteMonitor(monitorID string) error

DeleteMonitor is used to create a New Relic Synthetics monitor.

func (*Synthetics) GetMonitor

func (s *Synthetics) GetMonitor(monitorID string) (*Monitor, error)

GetMonitor is used to retrieve a specific New Relic Synthetics monitor.

func (*Synthetics) GetMonitorScript

func (s *Synthetics) GetMonitorScript(monitorID string) (*MonitorScript, error)

GetMonitorScript is used to retrieve the script that belongs to a New Relic Synthetics scripted monitor.

func (*Synthetics) ListMonitors

func (s *Synthetics) ListMonitors() ([]Monitor, error)

ListMonitors is used to retrieve New Relic Synthetics monitors.

func (*Synthetics) UpdateMonitor

func (s *Synthetics) UpdateMonitor(monitor Monitor) error

UpdateMonitor is used to create a New Relic Synthetics monitor.

func (*Synthetics) UpdateMonitorScript

func (s *Synthetics) UpdateMonitorScript(monitorID string, script MonitorScript) error

UpdateMonitorScript is used to add a script to an existing New Relic Synthetics monitor_script.

type Time

type Time time.Time

Time is a type used for unmarshaling timestamps generated by the Synthetics API. Its underlying type is time.Time.

func (Time) Equal

func (t Time) Equal(u Time) bool

Equal provides a comparator for the Time type.

func (Time) MarshalJSON

func (t Time) MarshalJSON() ([]byte, error)

MarshalJSON is responsible for marshaling the Time type.

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(s []byte) (err error)

UnmarshalJSON is responsible for unmarshaling the Time type.

Jump to

Keyboard shortcuts

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