api

package
v2.0.5 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Activated = "ACTIVATED"
	Standby   = "STANDBY"
	Failing   = "FAILING"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AddIPParams

type AddIPParams struct {
	HealthcheckInterval int                  `json:"healthcheck_interval"`
	Checks              []models.Healthcheck `json:"checks"`
}

type Client

type Client interface {
	ListIPs(context.Context) ([]IP, error)
	GetIP(ctx context.Context, id string) (IP, error)
	AddIP(ctx context.Context, ip string, params AddIPParams) (IP, error)
	UpdateIP(ctx context.Context, id string, params UpdateIPParams) (IP, error)
	RemoveIP(ctx context.Context, id string) error
	Failover(ctx context.Context, id string) error
	Version(context.Context) (string, error)
}

type ClientOpt

type ClientOpt func(HTTPClient) HTTPClient

func WithPassword

func WithPassword(pass string) ClientOpt

func WithTimeout

func WithTimeout(timeout time.Duration) ClientOpt

func WithURL

func WithURL(url string) ClientOpt

func WithUser

func WithUser(user string) ClientOpt

type ErrNotFound

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

func (ErrNotFound) Error

func (e ErrNotFound) Error() string

type HTTPClient

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

func NewHTTPClient

func NewHTTPClient(opts ...ClientOpt) HTTPClient

func (HTTPClient) AddIP

func (c HTTPClient) AddIP(ctx context.Context, ip string, params AddIPParams) (IP, error)

func (HTTPClient) Failover

func (c HTTPClient) Failover(ctx context.Context, id string) error

func (HTTPClient) GetIP

func (c HTTPClient) GetIP(ctx context.Context, id string) (IP, error)

func (HTTPClient) ListIPs

func (c HTTPClient) ListIPs(ctx context.Context) ([]IP, error)

func (HTTPClient) RemoveIP

func (c HTTPClient) RemoveIP(ctx context.Context, id string) error

func (HTTPClient) UpdateIP

func (c HTTPClient) UpdateIP(ctx context.Context, id string, params UpdateIPParams) (IP, error)

func (HTTPClient) Version

func (c HTTPClient) Version(ctx context.Context) (string, error)

type IP

type IP struct {
	models.IP
	Status string `json:"status,omitempty"`
}

type UpdateIPParams

type UpdateIPParams struct {
	Healthchecks []models.Healthcheck `json:"healthchecks"`
}

Directories

Path Synopsis
Package apimock is a generated GoMock package.
Package apimock is a generated GoMock package.

Jump to

Keyboard shortcuts

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