api

package
v3.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Activated = "ACTIVATED"
	Standby   = "STANDBY"
	Failing   = "FAILING"
)
View Source
const (
	PluginARP              = "arp"
	PluginWebhook          = "webhook"
	PluginOutscalePublicIP = "outscale_public_ip"
)
View Source
const (
	HeaderWebhookTimestamp  = "X-Link-Webhook-Timestamp"
	HeaderWebhookSignature  = "X-Link-Webhook-Signature"
	HeaderWebhookResourceID = "X-Link-Webhook-Resource-ID"
)

Variables

View Source
var (
	ErrWebhookRequestNil         = errors.New("webhook request is required")
	ErrWebhookSecretMissing      = errors.New("webhook secret is required")
	ErrWebhookRequestBodyMissing = errors.New("webhook request body is required")
	ErrWebhookTimestampMissing   = errors.New("missing X-Link-Webhook-Timestamp header")
	ErrWebhookSignatureMissing   = errors.New("missing X-Link-Webhook-Signature header")
	ErrWebhookSignatureInvalid   = errors.New("invalid X-Link-Webhook-Signature header")
	ErrWebhookSignatureMismatch  = errors.New("webhook signature does not match")
	ErrWebhookPayloadInvalid     = errors.New("invalid webhook payload")
)

Functions

This section is empty.

Types

type ARPPluginConfig added in v3.3.0

type ARPPluginConfig struct {
	IP string `json:"ip"`
}

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 OutscalePublicIPPluginConfig added in v3.3.0

type OutscalePublicIPPluginConfig struct {
	AccessKey string `json:"access_key"`
	SecretKey string `json:"secret_key"`
	Region    string `json:"region"`

	PublicIPID string `json:"public_ip_id"`
	NICID      string `json:"nic_id"`
}

type UpdateEndpointParams

type UpdateEndpointParams struct {
	HealthChecks []HealthCheck `json:"healthchecks"`
}

type WebhookPluginConfig added in v3.3.0

type WebhookPluginConfig struct {
	URL        string            `json:"url"`
	Headers    map[string]string `json:"headers,omitempty"`
	Secret     string            `json:"secret,omitempty"`
	ResourceID string            `json:"resource_id"`
}

type WebhookPluginStatusChangePayload added in v3.3.0

type WebhookPluginStatusChangePayload struct {
	EndpointID string `json:"endpoint_id"`
	ResourceID string `json:"resource_id"`
	Plugin     string `json:"plugin"`
	Status     string `json:"status"`
}

func ParseAndValidateWebhook added in v3.3.0

func ParseAndValidateWebhook(
	ctx context.Context,
	req *http.Request,
	secret string,
) (WebhookPluginStatusChangePayload, error)

ParseAndValidateWebhook decodes the payload and validates the webhook signature. The request body is restored before returning so callers can read it again if needed.

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