heartbeat

package module
v0.0.0-...-68a1e1b Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2018 License: MIT Imports: 7 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

opsgenie-heartbeat

A super simple client to send ping requests to the Opsgenie Heartbeat API.

While the SDK supports heartbeat requests, it's more involved to use & I wanted the underlying HTTP GET requests to be more robust to failure.

Usage

hb := heartbeat.New("api-key")
hb.Ping(context.Background(), "name-of-the-heartbeat")

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnauthorised signafies an invalid api key
	ErrUnauthorised = errors.New("invalid api key")
	// ErrNonOkStatusCode a non 2XX status code was returned
	ErrNonOkStatusCode = errors.New("non 200 status code")
)

Functions

This section is empty.

Types

type HTTPClient

type HTTPClient interface {
	Do(*http.Request) (*http.Response, error)
}

HTTPClient represents an HTTP client that can make a request

type PingRequest

type PingRequest struct {
	// APIKey used to talk to the API
	APIKey string

	Endpoint string
	Client   HTTPClient
}

PingRequest handles talking to the Opsgenie Heartbeat API

func New

func New(key string) PingRequest

New creates a PingRequest with a default HTTP client and API key from env variable

func (PingRequest) Ping

func (r PingRequest) Ping(ctx context.Context, heartbeat string) error

Ping performs a HTTP request to the Opsgenie Heartbeat Ping endpoint

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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