logs

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BetterStackError

type BetterStackError struct {
	StatusCode int    // The HTTP status code associated with the error.
	Message    string // The error message.
}

BetterStackError represents an error returned by the BetterStack SDK.

func (*BetterStackError) Error

func (err *BetterStackError) Error() string

type Betterstack

type Betterstack struct {
	Token string
	// contains filtered or unexported fields
}

Betterstack represents the client for interacting with the Betterstack API.

func NewFromENV

func NewFromENV() (*Betterstack, error)

NewFromENV creates a new instance of the betterstack struct using the LOGS_API_TOKEN environment variable. It returns a pointer to the betterstack struct and an error if any.

func (*Betterstack) CreateSource

func (bs *Betterstack) CreateSource(bodyParams models.CreateSourceBodyParams) (*models.Source, error)

CreateSource creates a new source in the Betterstack SDK. It takes a bodyParams parameter of type models.CreateSourceBodyParams, which contains the necessary information to create the source. It returns a *models.Source and an error.

func (*Betterstack) DeleteSource

func (bs *Betterstack) DeleteSource(sourceID string) error

DeleteSource deletes a source with the specified sourceID from the Betterstack SDK. It sends a DELETE request to the "/api/v1/sources/{sourceID}" endpoint. If the request is successful, it returns nil. Otherwise, it returns an error.

func (*Betterstack) FetchLogs

func (bs *Betterstack) FetchLogs(queryParams *models.FetchLogsParams) (*models.Logs, error)

FetchLogs fetches logs from the Betterstack API.

func (*Betterstack) GetSource

func (bs *Betterstack) GetSource(sourceID string) (*models.Source, error)

GetSource retrieves the source data for a given source ID.

func (*Betterstack) ListSources

func (bs *Betterstack) ListSources(page, perPage *int) (*models.Sources, error)

ListSources Returns a list of your team's existing sources.

func (*Betterstack) MakeAPIRequest

func (bs *Betterstack) MakeAPIRequest(req *http.Request) ([]byte, error)

MakeAPIRequest sends an API request using the provided http.Request object and returns the response body as a byte array. If the request fails or the response status code is not 200, an error is returned.

func (*Betterstack) UpdateSource

func (bs *Betterstack) UpdateSource(sourceID string, bodyParams models.UpdateSourceBodyParams) (*models.Source, error)

UpdateSource Updates an existing source. Send only the parameters you wish to change (e.g. name )

Jump to

Keyboard shortcuts

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