betterstack

package
v1.9.2 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is a Better Stack API client.

func NewClient

func NewClient(apiToken string) *Client

NewClient creates a new Better Stack API client.

func (*Client) FetchHeartbeats

func (c *Client) FetchHeartbeats(ctx context.Context) ([]Heartbeat, error)

FetchHeartbeats retrieves all heartbeats from Better Stack.

func (*Client) FetchMonitors

func (c *Client) FetchMonitors(ctx context.Context) ([]Monitor, error)

FetchMonitors retrieves all monitors from Better Stack.

type Heartbeat

type Heartbeat struct {
	ID         string              `json:"id"`
	Type       string              `json:"type"`
	Attributes HeartbeatAttributes `json:"attributes"`
}

Heartbeat represents a Better Stack heartbeat.

type HeartbeatAttributes

type HeartbeatAttributes struct {
	Name   string `json:"name"`
	Period int    `json:"period"`
	Grace  int    `json:"grace"`
	Paused bool   `json:"paused"`
}

HeartbeatAttributes contains heartbeat configuration.

type HeartbeatsResponse

type HeartbeatsResponse struct {
	Data       []Heartbeat `json:"data"`
	Pagination Pagination  `json:"pagination"`
}

HeartbeatsResponse is the API response for listing heartbeats.

type Monitor

type Monitor struct {
	ID         string            `json:"id"`
	Type       string            `json:"type"`
	Attributes MonitorAttributes `json:"attributes"`
}

Monitor represents a Better Stack monitor.

type MonitorAttributes

type MonitorAttributes struct {
	PronouncableName    string          `json:"pronounceable_name"`
	URL                 string          `json:"url"`
	MonitorType         string          `json:"monitor_type"`
	CheckFrequency      int             `json:"check_frequency"`
	RequestTimeout      int             `json:"request_timeout"`
	RequestMethod       string          `json:"request_method"`
	RequestHeaders      []RequestHeader `json:"request_headers"`
	RequestBody         string          `json:"request_body"`
	ExpectedStatusCodes []int           `json:"expected_status_codes"`
	FollowRedirects     bool            `json:"follow_redirects"`
	Paused              bool            `json:"paused"`
	MonitorGroupID      int             `json:"monitor_group_id"`
	Regions             []string        `json:"regions"`
	Port                int             `json:"port,omitempty"`
}

MonitorAttributes contains monitor configuration.

type MonitorsResponse

type MonitorsResponse struct {
	Data       []Monitor  `json:"data"`
	Pagination Pagination `json:"pagination"`
}

MonitorsResponse is the API response for listing monitors.

type Pagination

type Pagination struct {
	First string `json:"first"`
	Last  string `json:"last"`
	Prev  string `json:"prev"`
	Next  string `json:"next"`
}

Pagination contains pagination metadata.

type RequestHeader

type RequestHeader struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

RequestHeader represents an HTTP request header.

Jump to

Keyboard shortcuts

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