healthchecks

package module
v0.0.0-...-623b9cf Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2019 License: MIT Imports: 4 Imported by: 0

README

go-healthchecks Build Status GoDoc Go Report Card

Simple http client api for healthchecks.io

Installation

go get -u github.com/frozzare/go-healthchecks

Example

package main

import (
	"context"
	"log"

	"github.com/frozzare/go-healthchecks"
)

func main() {
	client := healthchecks.NewClient(nil)

	err := client.Start(context.Background(), "your-uuid-here")
	if err != nil {
		log.Fatal(err)
	}

	err := client.Success(context.Background(), "your-uuid-here")
	if err != nil {
		log.Fatal(err)
	}

	err = client.Fail(context.Background(), "your-uuid-here")
	if err != nil {
		log.Fatal(err)
	}
}

License

MIT © Fredrik Forsmo

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrBadStatusCode is the error returned when a bad status code occurs.
	ErrBadStatusCode = errors.New("Bad status code from healthchecks")

	// DefaultURL is the default url to healthchecks.
	DefaultURL = "https://hc-ping.com/"
)

Functions

This section is empty.

Types

type Client

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

A Client manages communication with Healthchecks.

func NewClient

func NewClient(httpClient *http.Client, args ...string) *Client

NewClient returns a new Healthchecks client. If a nil httpClient is provided, http.DefaultClient will be used.

func (*Client) Fail

func (c *Client) Fail(ctx context.Context, id string) error

Fail sends a fail request to Healthchecks, a error is returned if a error has occurred.

func (*Client) Start

func (c *Client) Start(ctx context.Context, id string) error

Start sends a start request to Healthchecks.io to indicate that the job has started.

func (*Client) Success

func (c *Client) Success(ctx context.Context, id string) error

Success sends a success request to Healthchecks, a error is returned if a error has occurred.

Jump to

Keyboard shortcuts

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