client

package
v0.0.0-...-29e7bc9 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2023 License: AGPL-3.0 Imports: 8 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 {
	BaseURL *url.URL
	// contains filtered or unexported fields
}

Client is a simple HTTP client for the REST API.

func New

func New(base string, options ...Option) (*Client, error)

New returns a newly configured REST API Client.

func (*Client) CallAPI

func (c *Client) CallAPI(ctx context.Context, method string, rel *url.URL, body, out interface{}) (err error)

CallAPI executes the desired REST API request. it's expected that the body and out are the structs that follows the JSON:API

func (*Client) Metrics

func (c *Client) Metrics(ctx context.Context) (ret []v1.Metric, err error)

Metrics returns the current metrics summary.

func (*Client) SetStatus

func (c *Client) SetStatus(ctx context.Context, patch v1.Status) (ret v1.Status, err error)

SetStatus tries to change the current status and returns the new one if it was successful.

func (*Client) Status

func (c *Client) Status(ctx context.Context) (ret v1.Status, err error)

Status returns the current k6 status.

type Option

type Option func(*Client)

Option function are helpers that enable the flexible configuration of the REST API client.

func WithHTTPClient

func WithHTTPClient(httpClient *http.Client) Option

WithHTTPClient configures the supplied HTTP client to be used when making REST API requests.

func WithLogger

func WithLogger(logger *logrus.Entry) Option

WithLogger sets the specified logger to the client.

Jump to

Keyboard shortcuts

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