api

package
v3.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2026 License: MIT Imports: 8 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 AddEndpointParams

type AddEndpointParams struct {
	HealthCheckInterval int           `json:"healthcheck_interval"`
	Checks              []HealthCheck `json:"checks"`
	Plugin              string        `json:"plugin"`
	PluginConfig        any           `json:"plugin_config,omitempty"`
}

type Client

type Client interface {
	ListEndpoints(ctx context.Context) ([]Endpoint, error)
	GetEndpoint(ctx context.Context, id string) (Endpoint, error)
	GetEndpointHosts(ctx context.Context, id string) ([]Host, error)
	AddEndpoint(ctx context.Context, params AddEndpointParams) (Endpoint, error)
	UpdateEndpoint(ctx context.Context, id string, params UpdateEndpointParams) (Endpoint, error)
	RemoveEndpoint(ctx context.Context, id string) error
	Failover(ctx context.Context, id string) error
	RotateEncryptionKey(ctx context.Context) error
	Version(ctx 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

func WithUserAgent added in v3.1.0

func WithUserAgent(userAgent string) ClientOpt

type Endpoint

type Endpoint struct {
	ID string `json:"id"`

	Status              string        `json:"status,omitempty"`
	Checks              []HealthCheck `json:"checks,omitempty"`
	HealthCheckInterval int           `json:"healthcheck_interval"`
	Plugin              string        `json:"plugin,omitempty"`
	ElectionKey         string        `json:"election_key,omitempty"`
}

type EndpointGetResponse

type EndpointGetResponse struct {
	Endpoint Endpoint `json:"endpoint"`
}

type EndpointListResponse

type EndpointListResponse struct {
	Endpoints []Endpoint `json:"endpoints"`
}

type ErrNotFound

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

func (ErrNotFound) Error

func (e ErrNotFound) Error() string

type GetEndpointHostsResponse

type GetEndpointHostsResponse struct {
	Hosts []Host `json:"hosts"`
}

type HTTPClient

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

func NewHTTPClient

func NewHTTPClient(opts ...ClientOpt) HTTPClient

func (HTTPClient) AddEndpoint

func (c HTTPClient) AddEndpoint(ctx context.Context, params AddEndpointParams) (Endpoint, error)

func (HTTPClient) Failover

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

func (HTTPClient) GetEndpoint

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

func (HTTPClient) GetEndpointHosts

func (c HTTPClient) GetEndpointHosts(ctx context.Context, id string) ([]Host, error)

func (HTTPClient) ListEndpoints

func (c HTTPClient) ListEndpoints(ctx context.Context) ([]Endpoint, error)

func (HTTPClient) RemoveEndpoint

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

func (HTTPClient) RotateEncryptionKey added in v3.1.0

func (c HTTPClient) RotateEncryptionKey(ctx context.Context) error

func (HTTPClient) UpdateEndpoint

func (c HTTPClient) UpdateEndpoint(ctx context.Context, id string, params UpdateEndpointParams) (Endpoint, error)

func (HTTPClient) Version

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

type HealthCheck

type HealthCheck struct {
	Type HealthCheckType `json:"type"`
	Host string          `json:"host"`
	Port int             `json:"port"`
}

type HealthCheckType

type HealthCheckType string
const (
	TCPHealthCheck HealthCheckType = "TCP"
)

type Host

type Host struct {
	Hostname string `json:"hostname"`
}

type UpdateEndpointParams

type UpdateEndpointParams struct {
	HealthChecks []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