dataplaneapi

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package dataplaneapi provides a client for interacting with the haproxy dataplane api

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrDataPlaneNotReady is returned dataplaneapi fails to return a 200
	ErrDataPlaneNotReady = errors.New("dataplaneapi failed to become ready")

	// ErrDataPlaneHTTPUnauthorized is returned when the request is not authorized
	ErrDataPlaneHTTPUnauthorized = errors.New("dataplaneapi received unauthorized request")

	// ErrDataPlaneHTTPError is returned when the http response is an error
	ErrDataPlaneHTTPError = errors.New("dataplaneapi http error")

	// ErrDataPlaneConfigInvalid is returned when the config is invalid
	ErrDataPlaneConfigInvalid = errors.New("dataplaneapi config is invalid")
)

Functions

This section is empty.

Types

type Client

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

Client is the http client for Data Plane API

func NewClient

func NewClient(url string, options ...Option) *Client

NewClient returns an http client for Data Plane API

func (*Client) APIIsReady

func (c *Client) APIIsReady(ctx context.Context) bool

APIIsReady returns true when a 200 is returned for a GET request to the Data Plane API

func (Client) CheckConfig

func (c Client) CheckConfig(ctx context.Context, config string) error

CheckConfig validates the proposed config without applying it

func (*Client) PostConfig

func (c *Client) PostConfig(ctx context.Context, config string) error

PostConfig pushes a new haproxy config in plain text using basic auth

func (Client) WaitForDataPlaneReady added in v0.0.10

func (c Client) WaitForDataPlaneReady(ctx context.Context, retries int, sleep time.Duration) error

WaitForDataPlaneReady waits for the DataPlane API to be ready

type Option added in v0.0.10

type Option func(c *Client)

Option configures a connection option.

func WithLogger added in v0.0.10

func WithLogger(logger *zap.SugaredLogger) Option

WithLogger sets the logger for the client

Jump to

Keyboard shortcuts

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